[Extra zoom mode] Adopt list view controller UI for select menus
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-03-23  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         [Extra zoom mode] Adopt list view controller UI for select menus
4         https://bugs.webkit.org/show_bug.cgi?id=183944
5         <rdar://problem/38799062>
6
7         Reviewed by Andy Estes.
8
9         Rename WKSelectMenuViewController to WKSelectMenuListViewController, and also rename the relevant
10         WebKitAdditions harness files. See corresponding changes for more details.
11
12         * UIProcess/WKSelectMenuListViewController.h: Renamed from Source/WebKit/UIProcess/ios/forms/WKSelectMenuViewController.h.
13         * UIProcess/WKSelectMenuListViewController.mm: Renamed from Source/WebKit/UIProcess/ios/forms/WKSelectMenuViewController.mm.
14         * UIProcess/ios/WKContentViewInteraction.h:
15         * UIProcess/ios/WKContentViewInteraction.mm:
16         (-[WKContentView presentSelectMenuViewController:]):
17         (-[WKContentView dismissSelectMenuViewController:]):
18         (-[WKContentView selectMenu:didSelectItemAtIndex:]):
19         (-[WKContentView numberOfItemsInSelectMenu:]):
20         (-[WKContentView selectMenu:displayTextForItemAtIndex:]):
21         (-[WKContentView selectMenu:didCheckItemAtIndex:checked:]):
22         (-[WKContentView selectMenuUsesMultipleSelection:]):
23         (-[WKContentView selectMenu:hasSelectedOptionAtIndex:]):
24         (-[WKContentView _wheelChangedWithEvent:]):
25
26         Overriding wheel events and re-dispatching them is no longer needed after r229437, so we can just remove special
27         handling for select menus here.
28
29         (-[WKContentView didCancelSelectionInSelectMenu:]): Deleted.
30         (-[WKContentView selectMenuSupportsMultipleSelection:]): Deleted.
31         (-[WKContentView selectMenu:hasCheckedOptionAtIndex:]): Deleted.
32         (-[WKContentView startingIndexForSelectMenu:]): Deleted.
33
34         The starting index for a select menu is no longer relevant when using list view controllers for input, so we can
35         just remove this delegate hook altogether.
36
37         * WebKit.xcodeproj/project.pbxproj:
38
39 2018-03-23  Youenn Fablet  <youenn@apple.com>
40
41         CacheStorage::Caches should clear m_caches when clearing its representation even though it is not yet initialized
42         https://bugs.webkit.org/show_bug.cgi?id=183945
43
44         Reviewed by Chris Dumez.
45
46         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
47         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
48         In case we clear Caches in the middle of the initialization, m_caches might not be empty
49         but m_isInitialized is not yet set to true since we are computing the Caches size.
50         Update the assertion and clear m_caches in that case.
51
52 2018-03-23  David Kilzer  <ddkilzer@apple.com>
53
54         Stop using dispatch_set_target_queue()
55         <https://webkit.org/b/183908>
56         <rdar://problem/33553533>
57
58         Reviewed by Daniel Bates.
59
60         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
61         (WebKit::NetworkCache::IOChannel::IOChannel): Remove the call to
62         dispatch_set_target_queue() since this is handled in the
63         dispatch_io_create() call above.
64
65 2018-03-23  Youenn Fablet  <youenn@apple.com>
66
67         CacheStorage::Engine should not ref itself when hopping to a background thread
68         https://bugs.webkit.org/show_bug.cgi?id=183925
69         <rdar://problem/38580483>
70
71         Reviewed by Chris Dumez.
72
73         Add support for weak pointers to CacheStorage Engine.
74         Use weak pointer when hopping to background threads.
75         Store callbacks in CacheStorage::Engine maps to keep them being destroyed in the main thread only.
76         Made some callbacks CompletionHandler as a bonus.
77
78         Made sure to use just one Engine for all private sessions.
79
80         * NetworkProcess/cache/CacheStorageEngine.cpp:
81         (WebKit::CacheStorage::Engine::~Engine):
82         (WebKit::CacheStorage::Engine::from):
83         (WebKit::CacheStorage::Engine::initialize):
84         (WebKit::CacheStorage::Engine::writeFile):
85         (WebKit::CacheStorage::Engine::readFile):
86         * NetworkProcess/cache/CacheStorageEngine.h:
87         (WebKit::CacheStorage::Engine::weakPtrFactory):
88
89 2018-03-23  Ryan Haddad  <ryanhaddad@apple.com>
90
91         Unreviewed build fix.
92
93         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
94
95 2018-03-23  Miguel Gomez  <magomez@igalia.com>
96
97         [GTK][WPE] Avoid software color conversion inside BitmapTextureGL
98         https://bugs.webkit.org/show_bug.cgi?id=183892
99
100         Remove the UpdateContentsFlag parameter when calling BitmapTexture::updateContents().
101
102         Reviewed by Žan Doberšek.
103
104         * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
105         (WebKit::CoordinatedBackingStoreTile::swapBuffers):
106
107 2018-03-23  Michael Catanzaro  <mcatanzaro@igalia.com>
108
109         [WPE][GTK] Fix -Wswitch warnings after r229778
110         https://bugs.webkit.org/show_bug.cgi?id=183927
111
112         Reviewed by Carlos Garcia Campos.
113
114         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
115         (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): Log a warning if Suspend is
116         received as a PolicyAction
117         * UIProcess/API/glib/WebKitNavigationClient.cpp: Ignore the ProcessSwap termination reason,
118         which should be invisible to WebKit clients
119
120 2018-03-22  Chris Dumez  <cdumez@apple.com>
121
122         Include security origin in the service worker process name
123         https://bugs.webkit.org/show_bug.cgi?id=183913
124
125         Reviewed by Youenn Fablet.
126
127         Include security origin in the service worker process name to facilitate debugging. This way, we
128         can differentiate which service worker process is used for which origin in activity monitor.
129
130         * Shared/ChildProcess.h:
131         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
132         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
133         * UIProcess/ServiceWorkerProcessProxy.cpp:
134         (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
135         * WebProcess/cocoa/WebProcessCocoa.mm:
136         (WebKit::WebProcess::initializeProcessName):
137
138 2018-03-22  Michael Catanzaro  <mcatanzaro@igalia.com>
139
140         Unreviewed, silence unused variable warning
141
142         * UIProcess/WebPageProxy.cpp:
143         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
144
145 2018-03-22  Dan Bernstein  <mitz@apple.com>
146
147         WKWebView doesn’t expose its spellCheckerDocumentTag
148         https://bugs.webkit.org/show_bug.cgi?id=183797
149         <rdar://problem/38678089>
150
151         Reviewed by Tim Horton.
152
153         * UIProcess/API/Cocoa/WKWebView.mm:
154         (-[WKWebView _spellCheckerDocumentTag]): Added this getter which calls through to the WebViewImpl.
155         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Declared _spellCheckerDocumentTag property.
156
157 2018-03-22  Chris Dumez  <cdumez@apple.com>
158
159         Use the same SWServer for all ephemeral sessions
160         https://bugs.webkit.org/show_bug.cgi?id=183921
161         <rdar://problem/36873075>
162
163         Reviewed by Youenn Fablet.
164
165         Use the same SWServer for all ephemeral sessions. SWServers never go away and we create
166         one per sessionID. When browsing doing private browsing in Safari (and other fetching
167         favorite icons), the sessionID is ephemeral and keeps changing. This means that we kept
168         constructing new SWServers that would never go away. Each SWServer has a thread so we
169         would eventually hit the thread limit for the storage process.
170
171         * StorageProcess/StorageProcess.cpp:
172         (WebKit::StorageProcess::swServerForSession):
173
174 2018-03-22  Michael Catanzaro  <mcatanzaro@igalia.com>
175
176         Unreviewed, fix format string warnings in service worker code
177
178         On Linux x86_64, uint64_t is unsigned long, not unsigned long long.
179
180         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
181         (WebKit::WebSWServerConnection::startFetch):
182         (WebKit::WebSWServerConnection::didFinishFetch):
183         (WebKit::WebSWServerConnection::didFailFetch):
184         (WebKit::WebSWServerConnection::didNotHandleFetch):
185
186 2018-03-22  Daniel Bates  <dabates@apple.com>
187
188         Expose SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest() as WebKit SPI
189         https://bugs.webkit.org/show_bug.cgi?id=183907
190         <rdar://problem/38759127>
191
192         Reviewed by Alex Christensen.
193
194         Adds both modern Objective-C SPI and C SPI to allow an embedding client to register a scheme
195         whose content should be displayed/loaded if and only if it can be requested. Disregarding an
196         app that enables universal access, by using this SPI WebKit will refuse to display cross-origin
197         content for the registered schemes.
198
199         We need to add C SPI for embedding clients that have not transitioned to the modern Objective-
200         C API/SPI.
201
202         * Shared/WebProcessCreationParameters.cpp:
203         (WebKit::WebProcessCreationParameters::encode const):
204         (WebKit::WebProcessCreationParameters::decode):
205         * Shared/WebProcessCreationParameters.h:
206         * UIProcess/API/C/WKContext.cpp:
207         (WKContextRegisterURLSchemeAsCanDisplayOnlyIfCanRequest):
208         * UIProcess/API/C/WKContextPrivate.h:
209         * UIProcess/API/Cocoa/WKProcessPool.mm:
210         (-[WKProcessPool _registerURLSchemeAsCanDisplayOnlyIfCanRequest:]):
211         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
212         * UIProcess/WebProcessPool.cpp:
213         (WebKit::WebProcessPool::initializeNewWebProcess):
214         (WebKit::WebProcessPool::registerURLSchemeAsCanDisplayOnlyIfCanRequest):
215         * UIProcess/WebProcessPool.h:
216         * WebProcess/WebProcess.cpp:
217         (WebKit::WebProcess::initializeWebProcess):
218         (WebKit::WebProcess::registerURLSchemeAsCanDisplayOnlyIfCanRequest const):
219         * WebProcess/WebProcess.h:
220         * WebProcess/WebProcess.messages.in:
221
222 2018-03-22  Tim Horton  <timothy_horton@apple.com>
223
224         Improve readability of WebCore's OTHER_LDFLAGS
225         https://bugs.webkit.org/show_bug.cgi?id=183909
226         <rdar://problem/38760992>
227
228         Reviewed by Dan Bernstein.
229
230         * Configurations/Base.xcconfig:
231         * Configurations/FeatureDefines.xcconfig:
232
233 2018-03-22  Zan Dobersek  <zdobersek@igalia.com>
234
235         [TexMap] Make TextureMapperContextAttributes thread-specific
236         https://bugs.webkit.org/show_bug.cgi?id=183895
237
238         Reviewed by Carlos Garcia Campos.
239
240         CoordinatedGraphicsScene, as an implementor of the
241         TextureMapperPlatformLayerProxy::Compositor interface, doesn't have to
242         implement the texmapGL() method anymore.
243
244         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
245         (WebKit::CoordinatedGraphicsScene::onNewBufferAvailable):
246         (WebKit::CoordinatedGraphicsScene::texmapGL): Deleted.
247         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
248
249 2018-03-21  Frederic Wang  <fwang@igalia.com>
250
251         Unreviewed, update comment added in r229801.
252
253         * WebProcess/WebPage/ios/FindControllerIOS.mm:
254         (WebKit::FindController::didFindString): Remove "On Mobile" and mention bug 183889.
255
256 2018-03-21  Chris Dumez  <cdumez@apple.com>
257
258         Regression(r229831): ProcessSwap.Basic API test is crashing
259         https://bugs.webkit.org/show_bug.cgi?id=183884
260
261         Reviewed by Brady Eidson.
262
263         This code should only be called for navigation policy decisions.
264         It used to work without this check because of an early return, which
265         was dropped in r229831.
266
267         * UIProcess/WebPageProxy.cpp:
268         (WebKit::WebPageProxy::receivedPolicyDecision):
269
270 2018-03-21  Wenson Hsieh  <wenson_hsieh@apple.com>
271
272         [Extra zoom mode] Add new SPI hooks for clients to vend an input session context view
273         https://bugs.webkit.org/show_bug.cgi?id=183866
274         <rdar://problem/38692256>
275
276         Reviewed by Tim Horton.
277
278         Add new SPI hooks to _WKInputDelegate allowing internal clients to provide a view that gives additional context
279         when editing form controls, on top of the default label or placeholder text displayed by WebKit. The height
280         delegate is invoked first, giving the client an opportunity to lay out the context view to fit the given size;
281         the actual view is then queried.
282
283         If the view changes, clients may tell WebKit to reload the context view via SPI on WKFormInputSession; this call
284         to reload is plumbed through to the currently presented list view controller (at the moment, this is only the
285         text input list view controller).
286
287         * UIProcess/API/Cocoa/_WKFormInputSession.h:
288         * UIProcess/API/Cocoa/_WKInputDelegate.h:
289
290         Add the new SPI hooks, described above.
291
292         * UIProcess/ios/WKContentViewInteraction.h:
293         * UIProcess/ios/WKContentViewInteraction.mm:
294         (-[WKFormInputSession reloadFocusedElementContextView]):
295
296         Plumb the context view reload hook through WKContentView to WKTextInputListViewController.
297
298         (-[WKContentView setupInteraction]):
299         (-[WKContentView _stopAssistingNode]):
300         (-[WKContentView reloadContextViewForPresentedListViewController]):
301         (-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
302
303         Slight tweak to only reload text suggestions if we are not blurring the focused element. Without this extra
304         condition, the list view controller's inner table view would get reloaded when the form input session's text
305         suggestions are set to nil when the list view controller is dismissed, causing a visible stutter in the
306         dismissal animation of view controller.
307
308 2018-03-21  Chris Dumez  <cdumez@apple.com>
309
310         WebKitTestRunner crashed in com.apple.WebKit: WebKit::WebProcessPool::terminateServiceWorkerProcesses
311         https://bugs.webkit.org/show_bug.cgi?id=183875
312
313         Reviewed by Brent Fulgham.
314
315         Protect |this| while we're iterating over m_serviceWorkerProcesses and terminating
316         each service worker process. It is possible for the WebProcess pool to get destroyed
317         as a result of terminating a service worker process.
318
319         This change is covered by layout tests that are currently crashing on the ASAN bots.
320
321         * UIProcess/WebProcessPool.cpp:
322         (WebKit::WebProcessPool::terminateServiceWorkerProcesses):
323
324 2018-03-21  Eric Carlson  <eric.carlson@apple.com>
325
326         Fix typo in inactive media stream timeout default value
327         https://bugs.webkit.org/show_bug.cgi?id=183872
328         <rdar://problem/38723903>
329
330         Reviewed by Jer Noble.
331
332         * Shared/WebPreferences.yaml: Fix typo.
333         * Shared/WebPreferencesDefaultValues.h: Ditto.
334
335 2018-03-21  Chris Dumez  <cdumez@apple.com>
336
337         Make policy decisions asynchronous
338         https://bugs.webkit.org/show_bug.cgi?id=180568
339         <rdar://problem/37131297>
340
341         Reviewed by Alex Christensen.
342
343         Get rid of synchronous IPC and synchronous code paths for policy delegates.
344         Policy decisions are now all made asynchronously and rely on asynchronous
345         IPC.
346
347         This code change is based on work by Alex Christensen.
348
349         * UIProcess/WebPageProxy.cpp:
350         (WebKit::WebPageProxy::receivedPolicyDecision):
351         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
352         (WebKit::WebPageProxy::decidePolicyForResponse):
353         * UIProcess/WebPageProxy.h:
354         * UIProcess/WebPageProxy.messages.in:
355         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
356         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
357         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
358
359 2018-03-21  Chris Dumez  <cdumez@apple.com>
360
361         ScrollViewInsetTests.RestoreInitialContentOffsetAfterCrash API test is failing with async delegates
362         https://bugs.webkit.org/show_bug.cgi?id=183787
363
364         Reviewed by Wenson Hsieh.
365
366         Without asynchronous policy delegates, when the client requests a navigation, we would:
367         1. Do a synchronous navigation policy check
368         2. If the client allows the navigation, start the provisional load
369
370         Starting the provisional load would freeze the layer tree until first meaningful
371         layout via WebFrameLoaderClient::provisionalLoadStarted() -> WebPage::didStartPageTransition().
372
373         When constructing a WebView and then requesting a load right away. This would make sure
374         we do not commit a layer tree for the initial about:blank page because the layer tree
375         would be frozen until we have something meaningful to show for the following load.
376
377         However, with asynchronous policy delegates, we are able to do a layer tree commit
378         during the asynchronous navigation policy check because the layer tree is not frozen
379         yet (provisional load has not started) and the process is not stuck on synchronous
380         IPC. When constructing a WebView and then requesting a load right away, this would
381         allow a layer tree commit for about:blank to happen before we've even started the
382         load. This would cause some API tests to fail on iOS.
383
384         To address the issue, we try and maintain pre-existing behavior by freezing the
385         layer tree during navigation policy decision.
386
387         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
388         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
389         (WebKit::WebFrameLoaderClient::didDecidePolicyForNavigationAction):
390         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
391         * WebProcess/WebPage/WebPage.cpp:
392         (WebKit::WebPage::didStartNavigationPolicyCheck):
393         (WebKit::WebPage::didCompleteNavigationPolicyCheck):
394         * WebProcess/WebPage/WebPage.h:
395
396 2018-03-21  Brent Fulgham  <bfulgham@apple.com>
397
398         Allow the WebContent process to read ViewBridge preferences
399         https://bugs.webkit.org/show_bug.cgi?id=183862
400         <rdar://problem/38459456>
401
402         Reviewed by Eric Carlson.
403
404         * WebProcess/com.apple.WebProcess.sb.in:
405
406 2018-03-21  Frederic Wang  <fwang@igalia.com>
407
408         [iOS] Text highlighted by the Find UI overlaps with NBC news header on google.com
409         https://bugs.webkit.org/show_bug.cgi?id=183658
410
411         Reviewed by Tim Horton.
412
413         On Mobile, many sites have overlay headers or footers that may overlap with the highlighted
414         text inside a scrollable overflow node. To workaround that issue, this commit changes the
415         behavior so that the text is revealed at the center of the overflow node.
416
417         * WebProcess/WebPage/ios/FindControllerIOS.mm:
418         (WebKit::FindController::didFindString): Use alignCenterAlways instead of alignToEdgeIfNeeded.
419
420 2018-03-21  Carlos Garcia Campos  <cgarcia@igalia.com>
421
422         [GTK][WPE] JSC bindings not introspectable
423         https://bugs.webkit.org/show_bug.cgi?id=136989
424
425         Reviewed by Michael Catanzaro.
426
427         Deprecate the functions that are not introspectable due to JSC C API in GTK+ port and remove them in WPE
428         port. Add alternative functions using the new JSC GLib API. We no longer need to keep a global context attached
429         to every view. We can simply create a temporary global context on demand and release it after 1 second. This
430         also allows us to remove WebPageProxy::javascriptGlobalContext() and all the related code.
431
432         * PlatformGTK.cmake:
433         * PlatformWPE.cmake:
434         * UIProcess/API/glib/WebKitJavascriptResult.cpp:
435         (_WebKitJavascriptResult::_WebKitJavascriptResult):
436         (webkitJavascriptResultCreate):
437         (webkit_javascript_result_get_global_context):
438         (webkit_javascript_result_get_value):
439         (webkit_javascript_result_get_js_value):
440         * UIProcess/API/glib/WebKitJavascriptResultPrivate.h:
441         (SharedJavascriptContext::singleton):
442         (SharedJavascriptContext::SharedJavascriptContext):
443         (SharedJavascriptContext::getOrCreateContext):
444         (SharedJavascriptContext::releaseContext):
445         * UIProcess/API/glib/WebKitUserContentManager.cpp:
446         * UIProcess/API/glib/WebKitWebView.cpp:
447         (webkit_web_view_get_javascript_global_context):
448         (webkitWebViewRunJavaScriptCallback):
449         * UIProcess/API/gtk/PageClientImpl.cpp:
450         * UIProcess/API/gtk/PageClientImpl.h:
451         * UIProcess/API/gtk/WebKitJavascriptResult.h:
452         * UIProcess/API/gtk/WebKitWebView.h:
453         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
454         * UIProcess/API/wpe/APIViewClient.h:
455         (API::ViewClient::handleDownloadRequest):
456         * UIProcess/API/wpe/PageClientImpl.cpp:
457         * UIProcess/API/wpe/PageClientImpl.h:
458         * UIProcess/API/wpe/WPEView.cpp:
459         * UIProcess/API/wpe/WPEView.h:
460         * UIProcess/API/wpe/WebKitJavascriptResult.h:
461         * UIProcess/API/wpe/WebKitWebView.h:
462         * UIProcess/PageClient.h:
463         * UIProcess/WebPageProxy.h:
464         * UIProcess/gtk/WebPageProxyGtk.cpp:
465         * UIProcess/wpe/WebPageProxyWPE.cpp:
466         * WebProcess/InjectedBundle/API/glib/WebKitFrame.cpp:
467         (webkit_frame_get_js_context):
468         (webkit_frame_get_js_context_for_script_world):
469         * WebProcess/InjectedBundle/API/gtk/WebKitFrame.h:
470         * WebProcess/InjectedBundle/API/wpe/WebKitFrame.h:
471
472 2018-03-21  Carlos Garcia Campos  <cgarcia@igalia.com>
473
474         [GTK][WPE] Initial implementation of JavaScriptCore glib bindings
475         https://bugs.webkit.org/show_bug.cgi?id=164061
476
477         Reviewed by Michael Catanzaro.
478
479         Set decorator and deprecation_guard options in API docs config files, since they are no longer common to all
480         libraries.
481
482         * PlatformGTK.cmake:
483
484 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
485
486         [CoordGraphics] Simplify CoordinatedGraphicsScene activation
487         https://bugs.webkit.org/show_bug.cgi?id=183772
488
489         Reviewed by Carlos Garcia Campos.
490
491         Simplify CoordinatedGraphicsScene::setActive() into a simple setter of
492         the m_isActive member variable. We don't have to call renderNextFrame()
493         anymore as that was only necessary to unblock CoordinatedLayerTreeHost,
494         but that can be avoided if m_isWaitingForRenderer in that class is
495         initialized to false.
496
497         CoordinatedGraphicsSceneClient::renderNextFrame() virtual method and its
498         ThreadedCompositor implementation are removed. renderNextFrame() in the
499         CoordinatedGraphicsScene class can also be removed, along with the
500         unused dispatchOnMainThread() and dispatchOnClientRunLoop() methods and
501         the associated m_clientRunLoop member variable.
502
503         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
504         (WebKit::CoordinatedGraphicsScene::CoordinatedGraphicsScene):
505         (WebKit::CoordinatedGraphicsScene::dispatchOnMainThread): Deleted.
506         (WebKit::CoordinatedGraphicsScene::dispatchOnClientRunLoop): Deleted.
507         (WebKit::CoordinatedGraphicsScene::renderNextFrame): Deleted.
508         (WebKit::CoordinatedGraphicsScene::setActive): Deleted.
509         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
510         (WebKit::CoordinatedGraphicsSceneClient::~CoordinatedGraphicsSceneClient):
511         (WebKit::CoordinatedGraphicsScene::setActive):
512         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
513         (WebKit::m_displayRefreshMonitor):
514         (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing):
515         (WebKit::ThreadedCompositor::renderNextFrame): Deleted.
516         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
517         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
518
519 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
520
521         [TexMap] Have TextureMapperLayer::applyAnimationsRecursively() return running animation status
522         https://bugs.webkit.org/show_bug.cgi?id=183771
523
524         Reviewed by Carlos Garcia Campos.
525
526         In CoordinatedGraphicsScene::paintToCurrentGLContext(), retrieve
527         information about any running animation in the scene via the
528         TextureMapperLayer::applyAnimationsRecursively() call. Use that boolean
529         value at the end up the method, instead of again traversing the
530         TextureMapperLayer tree to determine whether any running animations are
531         present.
532
533         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
534         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
535
536 2018-03-20  Tim Horton  <timothy_horton@apple.com>
537
538         Enable the minimal simulator feature flag when appropriate
539         https://bugs.webkit.org/show_bug.cgi?id=183807
540
541         Reviewed by Dan Bernstein.
542
543         * Configurations/FeatureDefines.xcconfig:
544
545 2018-03-19  Ryosuke Niwa  <rniwa@webkit.org>
546
547         Expose content attributes on _WKLinkIconParameters
548         https://bugs.webkit.org/show_bug.cgi?id=183768
549
550         Reviewed by Alex Christensen.
551
552         Added _WKLinkIconParameters.attributes to expose content attributes of a link element
553         which defined a favicon, touch icon, or pre-compressed touch icon.
554
555         * UIProcess/API/Cocoa/_WKLinkIconParameters.h:
556         (_WKLinkIconParameters.attributes): Added.
557         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm:
558         (_WKLinkIconParameters._attributes): Added.
559         (-[_WKLinkIconParameters _initWithLinkIcon:]): Convert the hash map from WebCore to a NSDictionary.
560         (-[_WKLinkIconParameters attributes]): Added.
561
562 2018-03-20  Wenson Hsieh  <wenson_hsieh@apple.com>
563
564         Add AssistedNodeInformation plumbing for form control placeholder text and label text
565         https://bugs.webkit.org/show_bug.cgi?id=183802
566         <rdar://problem/38686273>
567
568         Reviewed by Tim Horton.
569
570         Surfaces some additional information about the currently focused element to the input delegate in the UI process.
571         See comments below for more details.
572
573         Test: WebKit.FocusedElementInfo
574
575         * Shared/AssistedNodeInformation.cpp:
576         (WebKit::AssistedNodeInformation::encode const):
577         (WebKit::AssistedNodeInformation::decode):
578         * Shared/AssistedNodeInformation.h:
579
580         Add `placeholder` and `label` to AssistedNodeInformation, which capture the value of the placeholder attribute
581         and the text of the first associated label element for the focused form control. Also add boilerplate encoder/
582         decoder support for these members.
583
584         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
585
586         Augment _WKFocusedElementInfo to include placeholder and label.
587
588         * UIProcess/ios/WKContentViewInteraction.mm:
589         (-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:userObject:]):
590         (-[WKFocusedElementInfo label]):
591         (-[WKFocusedElementInfo placeholder]):
592         * WebProcess/WebPage/ios/WebPageIOS.mm:
593         (WebKit::WebPage::getAssistedNodeInformation):
594
595         For input elements and textareas, set the placeholder to the value of the placeholder attribute. For all
596         elements with associated labels, grab the inner text of the first label that is not empty, ignoring all labels
597         that are `display: none` (i.e. not being rendered).
598
599 2018-03-20  Brady Eidson  <beidson@apple.com>
600
601         First piece of process swapping on navigation.
602         https://bugs.webkit.org/show_bug.cgi?id=183665
603
604         Reviewed by Andy Estes.
605
606         This patch adds the first pieces of the following feature:
607         "When a navigation originating inside a WKWebView goes to a different origin,
608          swap to a new WebProcess for that navigation"
609
610         There are significant bugs to be resolved and significant optimizations to be made.
611         Which is why the feature is disabled by default.
612
613         Besides the core logic implementing the feature, this patch does a lot of related 
614         work such as:
615         - Removing some now-invalid ASSERTs
616         - Adding some ASSERTs
617         - Update various switch states to handle the new "Suspend" policy and "NavigationSwap"
618           process termination reason
619
620         * NetworkProcess/NetworkDataTaskBlob.cpp:
621         (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):
622
623         * NetworkProcess/capture/NetworkDataTaskReplay.cpp:
624         (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse):
625
626         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
627         (toNSURLSessionResponseDisposition):
628
629         * Platform/Logging.h:
630
631         * Shared/LoadParameters.cpp:
632         (WebKit::LoadParameters::encode const):
633         (WebKit::LoadParameters::decode):
634         * Shared/LoadParameters.h:
635
636         * Shared/ProcessTerminationReason.h: Add "NavigationSwap" as a process termination reason.
637
638         * UIProcess/API/APINavigation.h:
639
640         * UIProcess/API/APIProcessPoolConfiguration.cpp:
641         (API::ProcessPoolConfiguration::copy):
642
643         * UIProcess/API/C/WKAPICast.h:
644         (WebKit::toAPI):
645
646         * UIProcess/Cocoa/NavigationState.mm:
647         (WebKit::wkProcessTerminationReason):
648
649         * UIProcess/WebFramePolicyListenerProxy.cpp:
650         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
651         * UIProcess/WebFramePolicyListenerProxy.h:
652         (WebKit::WebFramePolicyListenerProxy::create):
653         (WebKit::WebFramePolicyListenerProxy::policyListenerType const):
654
655         * UIProcess/WebFrameProxy.cpp:
656         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
657         (WebKit::WebFrameProxy::activePolicyListenerProxy):
658         * UIProcess/WebFrameProxy.h:
659
660         * UIProcess/WebNavigationState.cpp:
661         (WebKit::WebNavigationState::navigation):
662         (WebKit::WebNavigationState::takeNavigation):
663
664         * UIProcess/WebPageProxy.cpp:
665         (WebKit::WebPageProxy::reattachToWebProcess):
666         (WebKit::WebPageProxy::attachToProcessForNavigation): Pretend that the existing process 
667           terminated using the new "NavigationSwap" reason, then manually start the next load.
668         (WebKit::WebPageProxy::loadRequest):
669         (WebKit::WebPageProxy::loadRequestWithNavigation):
670         (WebKit::WebPageProxy::receivedPolicyDecision):
671         (WebKit::WebPageProxy::continueNavigationInNewProcess):
672         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
673         (WebKit::WebPageProxy::decidePolicyForResponse):
674         (WebKit::WebPageProxy::processDidTerminate):
675         (WebKit::WebPageProxy::resetState):
676         (WebKit::WebPageProxy::resetStateAfterProcessExited):
677         * UIProcess/WebPageProxy.h:
678
679         * UIProcess/WebProcessPool.cpp:
680         (WebKit::WebProcessPool::processForNavigation): Determine which process should be used
681           for a proposed navigation, creating a new one if necessary.
682         * UIProcess/WebProcessPool.h:
683
684         * UIProcess/WebStorage/StorageManager.cpp:
685         (WebKit::StorageManager::SessionStorageNamespace::setAllowedConnection):
686
687         * WebProcess/WebPage/WebPage.cpp:
688         (WebKit::WebPage::loadRequest):
689
690 2018-03-20  Youenn Fablet  <youenn@apple.com>
691
692         ServiceWorkerClientFetch::didReceiveData should check for m_encodedDataLength
693         https://bugs.webkit.org/show_bug.cgi?id=183668
694
695         Reviewed by Chris Dumez.
696
697         Crash happens when releasing a RefPtr<SharedBuffer> buffer that is null.
698         It happens because ServiceWorkerClientFetch can call m_loader->didReceiveBuffer at two different places.
699         Either when receiving an IPC call or as part of completion handler for the response validation check.
700         At each call site, we release the buffer to pass it to the loader and we set m_encodedLength to zero.
701         The fix is to add the m_encodedLength check like done in the case of response validation check completion handler.
702
703         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
704         (WebKit::ServiceWorkerClientFetch::didReceiveData):
705
706 2018-03-20  Jeff Miller  <jeffm@apple.com>
707
708         Expose aggressiveTileRetentionEnabled in WKPreferences SPI to match C SPI
709         https://bugs.webkit.org/show_bug.cgi?id=183790
710
711         Reviewed by Alex Christensen.
712         
713         Expose this property on macOS only.
714
715         * UIProcess/API/Cocoa/WKPreferences.mm:
716         (-[WKPreferences _setAggressiveTileRetentionEnabled:]):
717         (-[WKPreferences _aggressiveTileRetentionEnabled]):
718         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
719
720 2018-03-20  Tim Horton  <timothy_horton@apple.com>
721
722         Add and adopt WK_PLATFORM_NAME and adjust default feature defines
723         https://bugs.webkit.org/show_bug.cgi?id=183758
724         <rdar://problem/38017644>
725
726         Reviewed by Dan Bernstein.
727
728         * Configurations/FeatureDefines.xcconfig:
729
730 2018-03-20  Chris Dumez  <cdumez@apple.com>
731
732         Unreviewed, rolling out r229726 and r229763.
733
734         Caused some API test failures on iOS
735
736         Reverted changesets:
737
738         "Make policy decisions asynchronous"
739         https://bugs.webkit.org/show_bug.cgi?id=180568
740         https://trac.webkit.org/changeset/229726
741
742         "Rebaseline three webarchive tests for WK2 after r229726."
743         https://bugs.webkit.org/show_bug.cgi?id=180568
744         https://trac.webkit.org/changeset/229763
745
746 2018-03-20  Brent Fulgham  <bfulgham@apple.com>
747
748         [iOS] Grant IOKit preference access for the Home button
749         https://bugs.webkit.org/show_bug.cgi?id=183754
750         <rdar://problem/38179704>
751
752         Reviewed by Eric Carlson.
753
754         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
755
756 2018-03-20  Wenson Hsieh  <wenson_hsieh@apple.com>
757
758         [Extra zoom mode] Adopt updated input view controller machinery for text input
759         https://bugs.webkit.org/show_bug.cgi?id=183765
760         <rdar://problem/36926269>
761
762         Reviewed by Tim Horton.
763
764         Adopt new classes for extra zoomed text inputs. Massage WKTextInputViewController into WKTextInputListView-
765         Controller and introduce WKFormControlListViewController, the eventual replacement for the base class
766         WKTextFormControlViewController that will act as the base class of all list-view-controller-based input UI in
767         extra zoom mode.
768
769         * UIProcess/ios/WKContentViewInteraction.h:
770         * UIProcess/ios/WKContentViewInteraction.mm:
771         (-[WKContentView presentTextInputViewController:]):
772         (-[WKContentView dismissTextInputViewController:]):
773         (-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
774         (-[WKContentView _wheelChangedWithEvent:]):
775         * UIProcess/ios/forms/WKFormControlListViewController.h: Copied from Source/WebKit/UIProcess/ios/forms/WKTextInputViewController.h.
776         * UIProcess/ios/forms/WKFormControlListViewController.mm: Renamed from Source/WebKit/UIProcess/ios/forms/WKTextInputViewController.mm.
777         * UIProcess/ios/forms/WKTextInputListViewController.h: Copied from Source/WebKit/UIProcess/ios/forms/WKTextInputViewController.h.
778         * UIProcess/ios/forms/WKTextInputListViewController.mm: Renamed from Source/WebKit/UIProcess/ios/forms/WKTextInputViewController.h.
779         * WebKit.xcodeproj/project.pbxproj:
780
781 2018-03-19  Megan Gardner  <megan_gardner@apple.com>
782
783         Clear style colors when setting default appearance
784         https://bugs.webkit.org/show_bug.cgi?id=183759
785
786         Reviewed by Tim Horton.
787
788         Colors are cached and need to be cleared and recalculated.
789
790         * WebProcess/WebPage/WebPage.cpp:
791         (WebKit::WebPage::setDefaultAppearance):
792
793 2018-03-19  Chris Dumez  <cdumez@apple.com>
794
795         WKWebView.ClearAppCache is a flaky API test failure on High Sierra.
796         https://bugs.webkit.org/show_bug.cgi?id=181546
797         <rdar://problem/36444327>
798
799         Reviewed by Ryosuke Niwa.
800
801         in LocalStorageDatabaseTracker::deleteDatabasesModifiedSince(), add origin
802         to originIdentifiersToDelete if we cannot determine the last modification
803         time of the database file. This likely means the database file does not
804         exist. However, we still needs to make sure the origin gets removed from
805         the origins database and there may be *.wal / *.shm variants of the database
806         that are still on disk and need to be deleted.
807
808         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
809         (WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince):
810
811 2018-03-19  Chris Dumez  <cdumez@apple.com>
812
813         Have one service worker process per security origin
814         https://bugs.webkit.org/show_bug.cgi?id=183600
815         <rdar://problem/35280128>
816
817         Reviewed by Brady Eidson.
818
819         Split service workers from different origins into their own processes
820         for security reasons.
821
822         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
823         (WebKit::WebSWServerConnection::startFetch):
824         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
825         (WebKit::WebSWServerConnection::scheduleJobInServer):
826         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
827         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
828         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
829         * StorageProcess/StorageProcess.cpp:
830         (WebKit::StorageProcess::connectionToContextProcessFromIPCConnection):
831         (WebKit::StorageProcess::didClose):
832         (WebKit::StorageProcess::connectionToContextProcessWasClosed):
833         (WebKit::StorageProcess::needsServerToContextConnectionForOrigin const):
834         (WebKit::StorageProcess::didReceiveMessage):
835         (WebKit::StorageProcess::createStorageToWebProcessConnection):
836         (WebKit::StorageProcess::serverToContextConnectionForOrigin):
837         (WebKit::StorageProcess::createServerToContextConnection):
838         * StorageProcess/StorageProcess.h:
839         * StorageProcess/StorageProcess.messages.in:
840         * StorageProcess/StorageToWebProcessConnection.cpp:
841         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
842         (WebKit::StorageToWebProcessConnection::didClose):
843         * StorageProcess/StorageToWebProcessConnection.h:
844         * UIProcess/API/C/WKContext.cpp:
845         (WKContextTerminateServiceWorkerProcess):
846         * UIProcess/API/Cocoa/WKProcessPool.mm:
847         (-[WKProcessPool _terminateServiceWorkerProcesses]):
848         (-[WKProcessPool _webPageContentProcessCount]):
849         (-[WKProcessPool _serviceWorkerProcessCount]):
850         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
851         * UIProcess/Network/NetworkProcessProxy.cpp:
852         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
853         (WebKit::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace):
854         * UIProcess/ServiceWorkerProcessProxy.cpp:
855         (WebKit::ServiceWorkerProcessProxy::create):
856         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
857         * UIProcess/ServiceWorkerProcessProxy.h:
858         (isType):
859         * UIProcess/Storage/StorageProcessProxy.cpp:
860         (WebKit::StorageProcessProxy::getStorageProcessConnection):
861         (WebKit::StorageProcessProxy::didFinishLaunching):
862         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcess):
863         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcessForExplicitSession):
864         * UIProcess/Storage/StorageProcessProxy.h:
865         * UIProcess/Storage/StorageProcessProxy.messages.in:
866         * UIProcess/WebProcessPool.cpp:
867         (WebKit::WebProcessPool::getStorageProcessConnection):
868         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
869         (WebKit::WebProcessPool::createNewWebProcess):
870         (WebKit::WebProcessPool::disconnectProcess):
871         (WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
872         (WebKit::WebProcessPool::createWebPage):
873         (WebKit::WebProcessPool::updateServiceWorkerUserAgent):
874         (WebKit::WebProcessPool::mayHaveRegisteredServiceWorkers):
875         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
876         (WebKit::WebProcessPool::terminateServiceWorkerProcesses):
877         (WebKit::WebProcessPool::updateProcessAssertions):
878         (WebKit::WebProcessPool::serviceWorkerProcessProxyFromPageID const):
879         * UIProcess/WebProcessPool.h:
880         * UIProcess/WebProcessProxy.cpp:
881         (WebKit::WebProcessProxy::getStorageProcessConnection):
882
883 2018-03-19  Jiewen Tan  <jiewen_tan@apple.com>
884
885         Unreviewed, another quick fix for r229699
886
887         Restricts ENABLE_WEB_AUTHN to only macOS and iOS.
888
889         * Configurations/FeatureDefines.xcconfig:
890
891 2018-03-19  Chris Dumez  <cdumez@apple.com>
892
893         Make policy decisions asynchronous
894         https://bugs.webkit.org/show_bug.cgi?id=180568
895         <rdar://problem/37131297>
896
897         Reviewed by Alex Christensen.
898
899         Get rid of synchronous IPC and synchronous code paths for policy delegates.
900         Policy decisions are now all made asynchronously and rely on asynchronous
901         IPC.
902
903         This code change is based on work by Alex Christensen.
904
905         * UIProcess/WebPageProxy.cpp:
906         (WebKit::WebPageProxy::receivedPolicyDecision):
907         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
908         (WebKit::WebPageProxy::decidePolicyForResponse):
909         * UIProcess/WebPageProxy.h:
910         * UIProcess/WebPageProxy.messages.in:
911         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
912         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
913         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
914
915 2018-03-19  Brian Burg  <bburg@apple.com>
916
917         Web Inspector: clean up WKWebView configuration code
918         https://bugs.webkit.org/show_bug.cgi?id=183747
919         <rdar://problem/38629343>
920
921         Reviewed by Timothy Hatcher.
922
923         * UIProcess/mac/WKInspectorViewController.mm:
924         (-[WKInspectorViewController webView]): Always use system
925         appearance for Inspector's web content.
926
927 2018-03-19  Eric Carlson  <eric.carlson@apple.com>
928
929         [Extra zoom mode] Require fullscreen for video playback
930         https://bugs.webkit.org/show_bug.cgi?id=183742
931         <rdar://problem/38235862>
932
933         Reviewed by Jer Noble.
934
935         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
936         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
937         (-[WKVideoFullScreenViewController initWithAVPlayerViewController:]):
938         (-[WKVideoFullScreenViewController viewDidLoad]):
939         (-[WKVideoFullScreenViewController prefersStatusBarHidden]):
940         (WebKit::VideoFullscreenModelContext::presentingViewController):
941         (WebKit::VideoFullscreenModelContext::createVideoFullscreenViewController):
942         * WebProcess/cocoa/VideoFullscreenManager.mm:
943         (WebKit::VideoFullscreenManager::didEnterFullscreen):
944
945 2018-03-19  Daniel Bates  <dabates@apple.com>
946
947         test-webkitpy no longer runs WebKit2 tests
948         https://bugs.webkit.org/show_bug.cgi?id=183724
949
950         Reviewed by Alexey Proskuryakov.
951
952         Fixes an issue where Python emits errors "global name reset_results is not defined" when
953         running tests in messages_unittest.py using test-webkitpy.
954
955         Currently messages_unittest.py conditionally defines the global variable reset_results
956         when run as the main program (i.e. __name__ == "__main__"). When messages_unittest.py is
957         imported as a module as test-webkitpy does then it is not considered the main program
958         ;=> the top-level script environment is not __main__ ;=> we do not define the global
959         variable reset_results. Instead we should unconditionally define the global variable
960         reset_results.
961
962         * Scripts/webkit/messages_unittest.py:
963
964 2018-03-19  Per Arne Vollan  <pvollan@apple.com>
965
966         When the WebContent process is blocked from accessing the WindowServer, the call CVDisplayLinkCreateWithCGDisplay will fail.
967         https://bugs.webkit.org/show_bug.cgi?id=183604
968         <rdar://problem/38305109>
969
970         Reviewed by Brent Fulgham.
971
972         * UIProcess/WebPageProxy.h:
973         * UIProcess/WebPageProxy.messages.in:
974         * UIProcess/mac/DisplayLink.cpp: Added.
975         (WebKit::DisplayLink::DisplayLink):
976         (WebKit::DisplayLink::~DisplayLink):
977         (WebKit::DisplayLink::displayLinkCallback):
978         * UIProcess/mac/DisplayLink.h: Added.
979         * UIProcess/mac/WebPageProxyMac.mm:
980         (WebKit::WebPageProxy::startDisplayRefreshMonitor):
981         (WebKit::WebPageProxy::stopDisplayRefreshMonitor):
982         * WebKit.xcodeproj/project.pbxproj:
983         * WebProcess/WebPage/DrawingArea.cpp:
984         (WebKit::DrawingArea::createDisplayRefreshMonitor):
985         * WebProcess/WebPage/DrawingArea.h:
986         * WebProcess/WebPage/DrawingArea.messages.in:
987         * WebProcess/WebPage/mac/DrawingAreaMac.cpp: Added.
988         (WebKit::DisplayRefreshMonitorMac::create):
989         (WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
990         (WebKit::DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac):
991         (WebKit::DisplayRefreshMonitorMac::requestRefreshCallback):
992         (WebKit::DisplayRefreshMonitorMac::displayLinkFired):
993         (WebKit::DrawingArea::screenWasRefreshed):
994         (WebKit::DrawingArea::createDisplayRefreshMonitor):
995
996 2018-03-17  Jiewen Tan  <jiewen_tan@apple.com>
997
998         [WebAuthN] Implement authenticatorMakeCredential
999         https://bugs.webkit.org/show_bug.cgi?id=183527
1000         <rdar://problem/35275886>
1001
1002         Reviewed by Brent Fulgham.
1003
1004         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.cpp:
1005         (WebKit::WebCredentialsMessengerProxy::WebCredentialsMessengerProxy):
1006         (WebKit::WebCredentialsMessengerProxy::makeCredential):
1007         (WebKit::WebCredentialsMessengerProxy::getAssertion):
1008         (WebKit::WebCredentialsMessengerProxy::isUserVerifyingPlatformAuthenticatorAvailable):
1009         (WebKit::WebCredentialsMessengerProxy::exceptionReply):
1010         (WebKit::WebCredentialsMessengerProxy::makeCredentialReply):
1011         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.h:
1012         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.messages.in:
1013         * UIProcess/CredentialManagement/cocoa/WebCredentialsMessengerProxyCocoa.mm: Removed.
1014         * WebKit.xcodeproj/project.pbxproj:
1015         * WebProcess/CredentialManagement/WebCredentialsMessenger.cpp:
1016         (WebKit::WebCredentialsMessenger::makeCredential):
1017         (WebKit::WebCredentialsMessenger::makeCredentialReply):
1018         * WebProcess/CredentialManagement/WebCredentialsMessenger.h:
1019         * WebProcess/CredentialManagement/WebCredentialsMessenger.messages.in:
1020
1021 2018-03-17  Daniel Bates  <dabates@apple.com>
1022
1023         Tests fail in messages_unittest.py
1024         https://bugs.webkit.org/show_bug.cgi?id=183725
1025
1026         Partial revert of r222113. The messages generator machinery does not know when
1027         it is sufficient to emit an include for wtf/Forward.h as opposed to a concrete
1028         header.
1029
1030         * Scripts/webkit/LegacyMessages-expected.h:
1031         * Scripts/webkit/Messages-expected.h:
1032
1033 2018-03-16  Wenson Hsieh  <wenson_hsieh@apple.com>
1034
1035         Unreviewed, rolling out r229688.
1036
1037         There's a solution that doesn't require this SPI.
1038
1039         Reverted changeset:
1040
1041         "Add SPI to expose width and height anchors for WKWebView's
1042         content view"
1043         https://bugs.webkit.org/show_bug.cgi?id=183711
1044         https://trac.webkit.org/changeset/229688
1045
1046 2018-03-16  Wenson Hsieh  <wenson_hsieh@apple.com>
1047
1048         Add SPI to expose width and height anchors for WKWebView's content view
1049         https://bugs.webkit.org/show_bug.cgi?id=183711
1050         <rdar://problem/38562899>
1051
1052         Reviewed by Tim Horton.
1053
1054         Add _contentWidthAnchor and _contentHeightAnchor SPI to WKWebView for internal clients to be able to reason
1055         about the size of the content view on iOS using autolayout.
1056
1057         Test: WebKit.AutoLayoutPositionHeaderAndFooterViewsInScrollView.
1058
1059         * UIProcess/API/Cocoa/WKWebView.mm:
1060         (-[WKWebView _contentWidthAnchor]):
1061         (-[WKWebView _contentHeightAnchor]):
1062         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1063
1064 2018-03-16  Megan Gardner  <megan_gardner@apple.com>
1065
1066         Add _useSystemAppearance to WKView
1067         https://bugs.webkit.org/show_bug.cgi?id=183706
1068         <rdar://problem/38516584>
1069
1070         Reviewed by Tim Horton.
1071
1072         Plumb useSystemAppearance and other supporting functions to WKView
1073
1074         * UIProcess/API/Cocoa/WKViewPrivate.h:
1075         * UIProcess/API/Cocoa/WKWebView.mm:
1076         (-[WKWebView _initializeWithConfiguration:]):
1077         (-[WKWebView _useSystemAppearance]):
1078         (-[WKWebView _setUseSystemAppearance:]):
1079         (-[WKWebView effectiveAppearanceDidChange]):
1080         * UIProcess/API/mac/WKView.mm:
1081         (-[WKView effectiveAppearanceDidChange]):
1082         (-[WKView _setUseSystemAppearance:]):
1083         (-[WKView _useSystemAppearance]):
1084         (-[WKView _setDefaultAppearance:]):
1085         * UIProcess/Cocoa/WebViewImpl.h:
1086         * UIProcess/Cocoa/WebViewImpl.mm:
1087         (WebKit::WebViewImpl::setUseSystemAppearance):
1088         (WebKit::WebViewImpl::useSystemAppearance):
1089         (WebKit::WebViewImpl::setDefaultAppearance):
1090
1091 2018-03-16  Brent Fulgham  <bfulgham@apple.com>
1092
1093         Set a trap to catch an infrequent form-related nullptr crash
1094         https://bugs.webkit.org/show_bug.cgi?id=183704
1095         <rdar://problem/37579354>
1096
1097         Reviewed by Ryosuke Niwa.
1098
1099         Add a RELEASE_ASSERT to see if we ever encounter a nullptr WebCore frame.
1100
1101         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1102         (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
1103
1104 2018-03-16  Jer Noble  <jer.noble@apple.com>
1105
1106         Make Fullscreen API an Experimental Feature
1107         https://bugs.webkit.org/show_bug.cgi?id=183662
1108
1109         Reviewed by Jon Lee.
1110
1111         Add the ability to have a conditional for whether an Experimental Feature is "visible", separate from
1112         whether the preference is available, for definining platform-specific Experimental Features.
1113
1114         * Scripts/GeneratePreferences.rb:
1115         * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb:
1116         * Shared/WebPreferences.yaml:
1117
1118 2018-03-16  Megan Gardner  <megan_gardner@apple.com>
1119
1120         Ensure that style is updated when the effective appearance changes
1121         https://bugs.webkit.org/show_bug.cgi?id=183690
1122         <rdar://problem/38385900>
1123
1124         Reviewed by Tim Horton and Wenson Hsieh.
1125
1126         Respond to and respect the effective appearance changing.
1127
1128         * UIProcess/API/Cocoa/WKWebView.mm:
1129         (-[WKWebView effectiveAppearanceDidChange]):
1130         * WebProcess/WebPage/WebPage.cpp:
1131         (WebKit::WebPage::setDefaultAppearance):
1132
1133 2018-03-16  Chris Dumez  <cdumez@apple.com>
1134
1135         URLSchemeHandler.Basic API test fails with async policy delegates
1136         https://bugs.webkit.org/show_bug.cgi?id=183678
1137
1138         Reviewed by Alex Christensen.
1139
1140         The issue is that the client calls _didPerformRedirection / didReceiveResponse / didReceiveData / didFinish
1141         on the URLScheme task one after the one, synchronously. However, redirects and responses can be processed
1142         asynchronously. To address the issue, we now queue operations requested by the client if we're waiting
1143         for an async policy delegate.
1144
1145         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
1146         (WebKit::WebURLSchemeTaskProxy::didPerformRedirection):
1147         (WebKit::WebURLSchemeTaskProxy::didReceiveResponse):
1148         (WebKit::WebURLSchemeTaskProxy::didReceiveData):
1149         (WebKit::WebURLSchemeTaskProxy::didComplete):
1150         (WebKit::WebURLSchemeTaskProxy::processNextPendingTask):
1151         * WebProcess/WebPage/WebURLSchemeTaskProxy.h:
1152         (WebKit::WebURLSchemeTaskProxy::queueTask):
1153
1154 2018-03-16  Claudio Saavedra  <csaavedra@igalia.com>
1155
1156         Suppress GCC warnings by using #include instead of #import
1157
1158         Unreviewed.
1159         * UIProcess/SystemPreviewController.cpp:
1160
1161 2018-03-15  Keith Rollin  <krollin@apple.com>
1162
1163         Telemetry for stalled webpage loads
1164         https://bugs.webkit.org/show_bug.cgi?id=183221
1165         <rdar://problem/36549013>
1166
1167         Reviewed by Chris Dumez.
1168
1169         Add telemetry for page loads, tracking the pages that succeed, fail,
1170         or are canceled. This information will be used to track the overall
1171         health of our page loading as time goes on.
1172
1173         * UIProcess/WebPageProxy.cpp:
1174         (WebKit::WebPageProxy::close):
1175         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
1176         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
1177         (WebKit::WebPageProxy::didFinishLoadForFrame):
1178         (WebKit::WebPageProxy::didFailLoadForFrame):
1179         (WebKit::WebPageProxy::reportPageLoadResult):
1180         * UIProcess/WebPageProxy.h:
1181         (WebKit::WebPageProxy::reportPageLoadResult):
1182
1183 2018-03-15  Wenson Hsieh  <wenson_hsieh@apple.com>
1184
1185         [iOS WK2] Hit-testing fails when specifying a large top content inset
1186         https://bugs.webkit.org/show_bug.cgi?id=183648
1187         <rdar://problem/38421894>
1188
1189         Reviewed by Tim Horton.
1190
1191         Currently, in the process of computing unobscured content rect in the UI process on iOS, we subtract away parts
1192         of the view that are obscured by insets (e.g. MobileSafari's chrome). The helper method -[WKWebView
1193         _computeContentInset] is intended to compute these obscuring insets around the view, but it takes scroll view
1194         insets into account. This means that if WKWebView's inner scroll view has content insets, we'll end up shrinking
1195         the unobscured content rect as if the insetted region obscures the viewport; this causes visible content on the
1196         page to be uninteractible, since WKWebView erroneously thinks it's obscured.
1197
1198         To address this, we rename _computeContentInset to _computeObscuredInset, and make it _not_ affected by the
1199         scroll view's content insets. From code inspection and testing, all but one of the former call sites of
1200         _computeContentInset really need the obscured inset instead (see below). The one exception, -[WKWebView
1201         _adjustedContentOffset:], takes a scroll position from the page and maps it to a content offset in the inner
1202         UIScrollView (see below for more details).
1203
1204         Tests:  ScrollViewInsetTests.InnerHeightWithLargeTopContentInset
1205                 ScrollViewInsetTests.InnerHeightWithLargeBottomContentInset
1206                 ScrollViewInsetTests.RestoreInitialContentOffsetAfterCrash
1207                 ScrollViewInsetTests.RestoreInitialContentOffsetAfterNavigation
1208
1209         * UIProcess/API/Cocoa/WKWebView.mm:
1210         (-[WKWebView _setHasCustomContentView:loadedMIMEType:]):
1211         (-[WKWebView _initialContentOffsetForScrollView]):
1212
1213         See -_contentOffsetAdjustedForObscuredInset: below.
1214
1215         (-[WKWebView _contentOffsetAdjustedForObscuredInset:]):
1216
1217         Formerly -_adjustedContentOffset:. -_contentOffsetAdjustedForObscuredInset: no longer takes scroll view content
1218         inset into account, and only cares about insets that obscure the view. This means that the scroll position
1219         (0, 0) in the document now maps to the content offset in the inner UIScrollView, such that the top of the page
1220         is aligned with the top of the viewport.
1221
1222         However, many call sites of -_adjustedContentOffset: were intended to compute the initial, top-left-most content
1223         offset in the scroll view to scroll to when resetting the web view (i.e., they pass in CGPointZero for the
1224         scroll position). An example of this is the scroll position to jump to after web content process termination, or
1225         the scroll position after main frame navigation. In these cases, we actually want to jump to the top of the
1226         scroll view, so we do want to use the version of the computed content insets that accounts for scroll view
1227         insets.
1228
1229         Since these cases are limited to finding the top-left-most scroll position, we pull this out into a separate
1230         helper method (-_initialContentOffsetForScrollView) and replace calls to
1231         `-[self _adjustedContentOffset:CGPointZero]` with this instead.
1232
1233         (-[WKWebView _computedObscuredInset]):
1234
1235         A version of -_computeContentInset that doesn't care about scroll view insets. Used whereever we need to account
1236         for obscured insets rather than the combination of content insets and unobscured insets (e.g.
1237         -_initialContentOffsetForScrollView).
1238
1239         (-[WKWebView _processDidExit]):
1240         (-[WKWebView _didCommitLayerTree:]):
1241         (-[WKWebView _dynamicViewportUpdateChangedTargetToScale:position:nextValidLayerTreeTransactionID:]):
1242         (-[WKWebView _scrollToContentScrollPosition:scrollOrigin:]):
1243         (-[WKWebView scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
1244         (-[WKWebView _updateVisibleContentRects]):
1245         (-[WKWebView _navigationGestureDidBegin]):
1246
1247         In all these places where we inset the view bounds to compute the unobscured region of the viewport, it doesn't
1248         make sense to additionally inset by the scroll view's content insets, since (1) the scroll view's content insets
1249         don't obscure the viewport, and (2) it's perfectly valid for the inner scroll view to have arbitrarily large
1250         content insets.
1251
1252         (-[WKWebView _adjustedContentOffset:]): Deleted.
1253
1254         Renamed to -_contentOffsetAdjustedForObscuredInset:.
1255
1256         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1257         * UIProcess/ios/WKPDFView.mm:
1258         (-[WKPDFView _offsetForPageNumberIndicator]):
1259
1260         Similar to -_scrollToFragment: (see below).
1261
1262         (-[WKPDFView _scrollToFragment:]):
1263
1264         This helper figures out which content offset to scroll to, given the y-origin of a page in a PDF document. If
1265         insets are added to the scroll view, we end up scrolling to the wrong content offset since we'll add the height
1266         of the top content inset (imagine that the top content inset is enormous — then we'll scroll an amount equal to
1267         the top content inset _past_ the point where the y-origin of the page is at the top of the viewport).
1268
1269 2018-03-15  Brent Fulgham  <bfulgham@apple.com>
1270
1271         [macOS] Correct sandbox violations during Flash playback under ToT WebKit
1272         https://bugs.webkit.org/show_bug.cgi?id=183672
1273         <rdar://problem/38510839>
1274
1275         Reviewed by Eric Carlson.
1276
1277         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
1278         * WebProcess/com.apple.WebProcess.sb.in:
1279
1280 2018-03-15  Brent Fulgham  <bfulgham@apple.com>
1281
1282         REGRESSION(r229484): Plugins often require CGS Connections to draw
1283         https://bugs.webkit.org/show_bug.cgi?id=183663
1284         <rdar://problem/38439218>
1285
1286         Reviewed by Per Arne Vollan.
1287
1288         Flash requires an active CGSConnection to work properly. Since we don't want the WebContent
1289         process to have on, create a new plugin process-specific layer host creation method that
1290         gives this access.
1291
1292         * Platform/mac/LayerHostingContext.h:
1293         * Platform/mac/LayerHostingContext.mm:
1294         (WebKit::LayerHostingContext::createForExternalPluginHostingProcess): Added.
1295         * PluginProcess/mac/PluginControllerProxyMac.mm:
1296         (WebKit::PluginControllerProxy::updateLayerHostingContext): Use the new creation
1297         method.
1298
1299 2018-03-15  Zan Dobersek  <zdobersek@igalia.com>
1300
1301         [TexMap] Remove TextureMapperLayer::texture()
1302         https://bugs.webkit.org/show_bug.cgi?id=183635
1303
1304         Reviewed by Michael Catanzaro.
1305
1306         Remove the CoordinatedBackingStore::texture() override since the virtual
1307         method is also being removed.
1308
1309         * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
1310         (WebKit::CoordinatedBackingStore::texture const): Deleted.
1311         * Shared/CoordinatedGraphics/CoordinatedBackingStore.h:
1312
1313 2018-03-14  John Wilander  <wilander@apple.com>
1314
1315         Resource Load Statistics: Add clearing of storage access to WebResourceLoadStatisticsStore::clearInMemory()
1316         https://bugs.webkit.org/show_bug.cgi?id=183641
1317         <rdar://problem/38469497>
1318
1319         Reviewed by Brent Fulgham and Chris Dumez.
1320
1321         This change is to stabilize existing layout tests by removing
1322         all storage access entries on a call to 
1323         WebResourceLoadStatisticsStore::clearInMemory().
1324         See Ryan Haddad's comment in https://bugs.webkit.org/show_bug.cgi?id=183620.
1325
1326         Almost all of the code changes are piping to get this
1327         call from the WebResourceLoadStatisticsStore to
1328         WebCore::NetworkStorageSession where entries reside.
1329
1330         * NetworkProcess/NetworkProcess.cpp:
1331         (WebKit::NetworkProcess::removeAllStorageAccess):
1332         * NetworkProcess/NetworkProcess.h:
1333         * NetworkProcess/NetworkProcess.messages.in:
1334         * UIProcess/Network/NetworkProcessProxy.cpp:
1335         (WebKit::NetworkProcessProxy::removeAllStorageAccess):
1336         * UIProcess/Network/NetworkProcessProxy.h:
1337         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1338         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1339         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
1340         (WebKit::WebResourceLoadStatisticsStore::clearInMemory):
1341             Now also clears all storage access entries in the network process.
1342         * UIProcess/WebResourceLoadStatisticsStore.h:
1343         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1344         (WebKit::WebsiteDataStore::removeAllStorageAccessHandler):
1345         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
1346         * UIProcess/WebsiteData/WebsiteDataStore.h:
1347
1348 2018-03-14  Ryan Haddad  <ryanhaddad@apple.com>
1349
1350         Unreviewed, rolling out r229613.
1351
1352         Caused API test failures
1353
1354         Reverted changeset:
1355
1356         "Make policy decisions asynchronous"
1357         https://bugs.webkit.org/show_bug.cgi?id=180568
1358         https://trac.webkit.org/changeset/229613
1359
1360 2018-03-14  Chris Dumez  <cdumez@apple.com>
1361
1362         Reduce use of SWServerToContextConnection::globalServerToContextConnection()
1363         https://bugs.webkit.org/show_bug.cgi?id=183626
1364
1365         Reviewed by Youenn Fablet.
1366
1367         Reduce use of SWServerToContextConnection::globalServerToContextConnection() as we are moving
1368         towards having multiple context connections.
1369
1370         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1371         (WebKit::WebSWServerConnection::startFetch):
1372         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
1373
1374 2018-03-14  Chris Dumez  <cdumez@apple.com>
1375
1376         Make policy decisions asynchronous
1377         https://bugs.webkit.org/show_bug.cgi?id=180568
1378         <rdar://problem/37131297>
1379
1380         Reviewed by Alex Christensen.
1381
1382         Get rid of synchronous IPC and synchronous code paths for policy delegates.
1383         Policy decisions are now all made asynchronously and rely on asynchronous
1384         IPC.
1385
1386         This code change is based on work by Alex Christensen.
1387
1388         * UIProcess/WebPageProxy.cpp:
1389         (WebKit::WebPageProxy::receivedPolicyDecision):
1390         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1391         (WebKit::WebPageProxy::decidePolicyForResponse):
1392         * UIProcess/WebPageProxy.h:
1393         * UIProcess/WebPageProxy.messages.in:
1394         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1395         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
1396         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1397
1398 2018-03-14  Chris Dumez  <cdumez@apple.com>
1399
1400         Drop unnecessary StorageToWebProcessConnection::workerContextProcessConnectionCreated()
1401         https://bugs.webkit.org/show_bug.cgi?id=183624
1402
1403         Reviewed by Youenn Fablet.
1404
1405         Drop unnecessary StorageToWebProcessConnection::workerContextProcessConnectionCreated()
1406         since it was going through all SWServers. Calling workerContextProcessConnectionCreated()
1407         on every StorageToWebProcessConnection was thus doing redundant work.
1408
1409         * StorageProcess/StorageProcess.cpp:
1410         (WebKit::StorageProcess::createStorageToWebProcessConnection):
1411         * StorageProcess/StorageToWebProcessConnection.cpp:
1412         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
1413         (WebKit::StorageToWebProcessConnection::workerContextProcessConnectionCreated): Deleted.
1414         * StorageProcess/StorageToWebProcessConnection.h:
1415
1416 2018-03-14  Tim Horton  <timothy_horton@apple.com>
1417
1418         Fix the build after r229567
1419
1420         * Configurations/FeatureDefines.xcconfig:
1421
1422 2018-03-13  John Wilander  <wilander@apple.com>
1423
1424         Resource Load Statistics: Immediately forward cookie access for domains with previous user interaction when there's an opener document
1425         https://bugs.webkit.org/show_bug.cgi?id=183620
1426         <rdar://problem/38431469>
1427
1428         Reviewed by Brent Fulgham.
1429
1430         It turns out the fix in https://bugs.webkit.org/show_bug.cgi?id=183577
1431         wasn't enough to address the compatibility issues with popups. Some of
1432         them just detect their unpartitioned cookies, auto-dismiss themselves,
1433         and expect their unpartitioned cookies to be available under the opener
1434         afterwards. We should grant them access if the popup's domain has had
1435         user interaction _previously_.
1436
1437         Note that we still need https://bugs.webkit.org/show_bug.cgi?id=183577
1438         because if the popup's domain has not received user interaction
1439         previously, we will not grant it storage access on just the window open.
1440
1441         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1442         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
1443         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessUnderOpener): Deleted.
1444             Renamed WebResourceLoadStatisticsStore::grantStorageAccessUnderOpener()
1445             to WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener()
1446             since there is now a case where access will not be granted, i.e. when
1447             the popup domain has not had user interaction previously.
1448         * UIProcess/WebResourceLoadStatisticsStore.h:
1449         * UIProcess/WebResourceLoadStatisticsStore.messages.in:
1450              Similar renaming.
1451         * WebProcess/WebProcess.cpp:
1452         (WebProcess::WebProcess):
1453              Similar renaming.
1454
1455 2018-03-13  Jer Noble  <jer.noble@apple.com>
1456
1457         Add missing artwork for fullscreen mode.
1458         https://bugs.webkit.org/show_bug.cgi?id=183618
1459
1460         Reviewed by Jon Lee.
1461
1462         * Resources/ios/iOS.xcassets/Done.imageset/Contents.json: Added.
1463         * Resources/ios/iOS.xcassets/Done.imageset/Done.pdf: Added.
1464         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/Contents.json: Added.
1465         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@1x.png: Added.
1466         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@2x.png: Added.
1467         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@3x.png: Added.
1468         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/Contents.json: Added.
1469         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@1x.png: Added.
1470         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@2x.png: Added.
1471         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@3x.png: Added.
1472
1473 2018-03-13  Brian Burg  <bburg@apple.com>
1474
1475         [WK2] Web Inspector: NavigationAction for opening a link in a new tab should have a UserGestureIndicator
1476         https://bugs.webkit.org/show_bug.cgi?id=183612
1477         <rdar://problem/38388641>
1478
1479         Reviewed by Timothy Hatcher.
1480
1481         The current gesture token will be attached to the NavigationAction at construction time,
1482         so set up a UserGestureIndicator when creating the action and sending it out.
1483
1484         * WebProcess/WebPage/WebInspector.cpp:
1485         (WebKit::WebInspector::openInNewTab):
1486
1487 2018-03-13  Dean Jackson  <dino@apple.com>
1488
1489         WKSystemPreviewView needs to implement some of UIScrollViewDelegate
1490         https://bugs.webkit.org/show_bug.cgi?id=183607
1491         <rdar://problem/38427622>
1492
1493         Reviewed by Antoine Quint.
1494
1495         Add an empty implementation of scrollViewDidScroll.
1496
1497         * UIProcess/ios/WKSystemPreviewView.mm:
1498         (-[WKSystemPreviewView scrollViewDidScroll:]):
1499
1500 2018-03-13  Jiewen Tan  <jiewen_tan@apple.com>
1501
1502         Soft-link LocalAuthentication.Framework
1503         https://bugs.webkit.org/show_bug.cgi?id=183587
1504         <rdar://problem/38219763>
1505
1506         Reviewed by Brian Burg.
1507
1508         * UIProcess/CredentialManagement/cocoa/WebCredentialsMessengerProxyCocoa.mm:
1509         (WebKit::WebCredentialsMessengerProxy::platformIsUserVerifyingPlatformAuthenticatorAvailable):
1510         * WebKit.xcodeproj/project.pbxproj:
1511
1512 2018-03-12  Dean Jackson  <dino@apple.com>
1513
1514         Add a WKWebViewContentProvider for system previews
1515         https://bugs.webkit.org/show_bug.cgi?id=183582
1516         <rdar://problem/38393569>
1517
1518         Reviewed by Tim Horton.
1519
1520         Implement WKSystemPreviewView, which conforms to WKWebViewContentProvider, in
1521         order to view content as a "system preview". This effectively replaces the
1522         SystemPreviewController, which will be removed soon.
1523
1524         Some of the required methods of WKWebViewContentProvider are not necessary on
1525         this instance, so a follow-up patch will clean the protocol up a bit.
1526
1527         * UIProcess/Cocoa/NavigationState.mm: Don't trigger a SystemPreview when downloading.
1528         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
1529
1530         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
1531         (-[WKWebViewContentProviderRegistry init]): Register the WKSystemPreviewView for
1532         MIME types retrieved from WebKitAdditions.
1533
1534         * UIProcess/ios/WKSystemPreviewView.h: Added.
1535         * UIProcess/ios/WKSystemPreviewView.mm: Added.
1536
1537         (-[WKSystemPreviewView web_initWithFrame:webView:]):
1538         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]): This is the
1539         method that actually creates a QuickLook preview and provides the data.
1540         (-[WKSystemPreviewView web_setMinimumSize:]):
1541         (-[WKSystemPreviewView web_setOverlaidAccessoryViewsInset:]):
1542         (-[WKSystemPreviewView web_computedContentInsetDidChange]):
1543         (-[WKSystemPreviewView web_setFixedOverlayView:]):
1544         (-[WKSystemPreviewView web_didSameDocumentNavigation:]):
1545         (-[WKSystemPreviewView web_countStringMatches:options:maxCount:]):
1546         (-[WKSystemPreviewView web_findString:options:maxCount:]):
1547         (-[WKSystemPreviewView web_hideFindUI]):
1548
1549         (-[WKSystemPreviewView numberOfPreviewItemsInPreviewController:]): QuickLook delegates.
1550         (-[WKSystemPreviewView previewController:previewItemAtIndex:]):
1551         (-[WKSystemPreviewView provideDataForItem:]):
1552         (-[WKSystemPreviewView previewControllerWillDismiss:]):
1553
1554         * WebKit.xcodeproj/project.pbxproj: Add new files.
1555
1556 2018-03-12  John Wilander  <wilander@apple.com>
1557
1558         Resource Load Statistics: Immediately forward cookie access at user interaction when there's an opener document
1559         https://bugs.webkit.org/show_bug.cgi?id=183577
1560         <rdar://problem/38266987>
1561
1562         Reviewed by Brent Fulgham.
1563
1564         * NetworkProcess/NetworkProcess.cpp:
1565         (WebKit::NetworkProcess::hasStorageAccessForFrame):
1566             Now also checks for general page access.
1567         (WebKit::NetworkProcess::grantStorageAccess):
1568             Renamed from grantStorageAccessForFrame since the frameID now is optional.
1569         (WebKit::NetworkProcess::grantStorageAccessForFrame): Deleted.
1570             Renamed since the frameID now is optional.
1571         * NetworkProcess/NetworkProcess.h:
1572             Renaming since the frameID now is optional.
1573         * NetworkProcess/NetworkProcess.messages.in:
1574             Renaming since the frameID now is optional.
1575         * NetworkProcess/NetworkResourceLoader.cpp:
1576         (WebKit::NetworkResourceLoader::logCookieInformation):
1577             Consequence of function renaming.
1578         * UIProcess/Network/NetworkProcessProxy.cpp:
1579         (WebKit::NetworkProcessProxy::grantStorageAccess):
1580         (WebKit::NetworkProcessProxy::grantStorageAccessForFrame): Deleted.
1581             Renaming since the frameID now is optional.
1582         * UIProcess/Network/NetworkProcessProxy.h:
1583         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1584         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1585             Renaming since the frameID now is optional.
1586         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
1587             Handler renaming since the frameID now is optional.
1588         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessUnderOpener):
1589             New function for that grants cookie access under a whole page.
1590         * UIProcess/WebResourceLoadStatisticsStore.h:
1591             Member renaming since the frameID now is optional.
1592         * UIProcess/WebResourceLoadStatisticsStore.messages.in:
1593             New message received straight from WebCore::ResourceLoadObserver.
1594         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1595         (WebKit::WebsiteDataStore::grantStorageAccessHandler):
1596             Renamed and made frameID optional.
1597         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
1598             Consequence of renaming and making frameID optional.
1599         (WebKit::WebsiteDataStore::grantStorageAccessForFrameHandler): Deleted.
1600             Renamed and made frameID optional.
1601         * UIProcess/WebsiteData/WebsiteDataStore.h:
1602         * WebProcess/WebProcess.cpp:
1603         (WebProcess::WebProcess):
1604             Now calls setGrantStorageAccessUnderOpenerCallback() on the shared
1605             WebCore::ResourceLoadObserver.
1606
1607 2018-03-12  Tim Horton  <timothy_horton@apple.com>
1608
1609         Stop using SDK conditionals to control feature definitions
1610         https://bugs.webkit.org/show_bug.cgi?id=183430
1611         <rdar://problem/38251619>
1612
1613         Reviewed by Dan Bernstein.
1614
1615         * Configurations/FeatureDefines.xcconfig:
1616         * Configurations/WebKitTargetConditionals.xcconfig: Renamed.
1617
1618 2018-03-12  Yoav Weiss  <yoav@yoav.ws>
1619
1620         Runtime flag for link prefetch and remove link subresource.
1621         https://bugs.webkit.org/show_bug.cgi?id=183540
1622
1623         Reviewed by Chris Dumez.
1624
1625         Remove the LINK_PREFETCH build time flag.
1626
1627         * Configurations/FeatureDefines.xcconfig:
1628         * WebProcess/Network/WebLoaderStrategy.cpp:
1629         (WebKit::maximumBufferingTime):
1630
1631 2018-03-12  Chris Dumez  <cdumez@apple.com>
1632
1633         Load may get committed before receiving policy for the resource response
1634         https://bugs.webkit.org/show_bug.cgi?id=183579
1635         <rdar://problem/38268780>
1636
1637         Reviewed by Youenn Fablet.
1638
1639         r228852 updated WebResourceLoader::didReceiveResponse to only send the
1640         ContinueDidReceiveResponse IPC back to the Networkprocess *after* the
1641         policy decision for the resource response has been made. This is necessary
1642         now that policy decisions can be made asynchronously.
1643
1644         However, one of the 2 code paths in NetworkProcess side (code path when
1645         the resource is already in the HTTP disk cache) failed to wait for the
1646         ContinueDidReceiveResponse IPC before sending over the data to the WebProcess.
1647         As a result, the WebProcess could commit the load before even receiving the
1648         policy response from the client.        
1649
1650         * NetworkProcess/NetworkResourceLoader.cpp:
1651         (WebKit::NetworkResourceLoader::continueDidReceiveResponse):
1652         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
1653         (WebKit::NetworkResourceLoader::continueProcessingCachedEntryAfterDidReceiveResponse):
1654         * NetworkProcess/NetworkResourceLoader.h:
1655         Make sure NetworkResourceLoader::didRetrieveCacheEntry() does not start sending the data
1656         until the network process gets the ContinueDidReceiveResponse IPC back from the WebProcess.
1657
1658         * WebProcess/Network/WebResourceLoader.cpp:
1659         (WebKit::WebResourceLoader::didReceiveResponse):
1660         (WebKit::WebResourceLoader::didReceiveData):
1661         * WebProcess/Network/WebResourceLoader.h:
1662         Add assertion to make sure didReceiveData() never gets called before didReceiveResponse's
1663         completion handler has been called. If this hits, then the load may get committed even
1664         though the client did not reply to the policy for the resource response yet.
1665
1666 2018-03-12  Ali Juma  <ajuma@chromium.org>
1667
1668         http/tests/workers/service/service-worker-download.https.html times out with async policy delegates
1669         https://bugs.webkit.org/show_bug.cgi?id=183479
1670
1671         Reviewed by Youenn Fablet.
1672
1673         Ensure that ServiceWorkerFetchClient::m_isCheckingResponse is set before code that depends on it
1674         executes. This bit was set by code that's posted to the runloop using 'callOnMainThread' in
1675         ServiceWorkerFetchClient::didReceiveResponse. But when didReceiveResponse is executing, tasks for
1676         handling didReceiveData, didFail, or didFinish may already have been posted to the runloop, and in
1677         that case would execute before m_isCheckingResponse gets set, and then incorrectly fail to 
1678         early-out. Fix this by directly setting m_isCheckingResponse in didReceiveResponse.
1679
1680         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
1681         (WebKit::ServiceWorkerClientFetch::start):
1682         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
1683
1684 2018-03-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1685
1686         REGRESSION(r211643): Dismissing WKActionSheet should not also dismiss its presenting view controller
1687         https://bugs.webkit.org/show_bug.cgi?id=183549
1688         <rdar://problem/34960698>
1689
1690         Reviewed by Andy Estes.
1691
1692         Fixes the bug by dismissing the presented view controller (i.e. the action sheet or the view controller being
1693         presented during rotation) rather than the presenting view controller.
1694
1695         Test: ActionSheetTests.DismissingActionSheetShouldNotDismissPresentingViewController
1696
1697         * UIProcess/ios/WKActionSheet.mm:
1698         (-[WKActionSheet doneWithSheet:]):
1699
1700 2018-03-12  Javier Fernandez  <jfernandez@igalia.com>
1701
1702         Remove GridLayout runtime flag
1703         https://bugs.webkit.org/show_bug.cgi?id=183484
1704
1705         Reviewed by Myles C. Maxfield.
1706
1707         The Grid Layout feature has been enabled by default for almost a
1708         year, so I think it's time to remove the runtime flag and the
1709         codepath run when the feature is disabled.
1710
1711         * Shared/WebPreferences.yaml:
1712         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1713         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1714
1715 2018-03-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1716
1717         Fix the internal iOS build after r229512
1718         https://bugs.webkit.org/show_bug.cgi?id=183550
1719
1720         Reviewed by Zalan Bujtas.
1721
1722         Fixes a typo in a header import, as well as a nullability error. `SecTrustEvaluate()` takes in a nonnull outparam,
1723         which was removed in r229512; this adds the outparam back, but does not consult its value when setting the
1724         `infoDictionary`.
1725
1726         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1727         (-[WKFullScreenWindowController _EVOrganizationName]):
1728
1729 2018-03-10  Jer Noble  <jer.noble@apple.com>
1730
1731         Improvements to fullscreen; new UI and security features
1732         https://bugs.webkit.org/show_bug.cgi?id=183503
1733
1734         Reviewed by Dean Jackson.
1735
1736         Now that the iOS Fullscreen code has more than one major class, move it into an ios/
1737         directory.
1738
1739         Clean up the WKFullScreenWindowControllerIOS class to more clearly separate external
1740         facing API from purely internal functions.
1741
1742         Move the WKFullScreenViewController out into its own file. Add support for fullscreen
1743         top inset and fullscreen autohide duration CSS constants.
1744
1745         Add a heuristic to distinguish between media control related touches and ones that look
1746         more keyboard interactions.
1747
1748         Add a new UIStackView based control to hold the fullscreen controls.
1749
1750         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm: Removed.
1751         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.cpp: Added.
1752         (WebKit::FullscreenTouchSecheuristic::scoreOfNextTouch):
1753         (WebKit::FullscreenTouchSecheuristic::reset):
1754         (WebKit::FullscreenTouchSecheuristic::distanceScore):
1755         (WebKit::FullscreenTouchSecheuristic::attenuationFactor):
1756         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.h: 
1757         (WebKit::FullscreenTouchSecheuristic::setRampUpSpeed):
1758         (WebKit::FullscreenTouchSecheuristic::setRampDownSpeed):
1759         (WebKit::FullscreenTouchSecheuristic::setXWeight):
1760         (WebKit::FullscreenTouchSecheuristic::setYWeight):
1761         (WebKit::FullscreenTouchSecheuristic::setSize):
1762         (WebKit::FullscreenTouchSecheuristic::setGamma):
1763         (WebKit::FullscreenTouchSecheuristic::setGammaCutoff):
1764         * UIProcess/ios/fullscreen/WKFullScreenViewController.h:
1765         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: Added.
1766         (WKFullScreenViewControllerPlaybackSessionModelClient::setParent):
1767         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
1768         (-[_WKExtrinsicButton setExtrinsicContentSize:]):
1769         (-[_WKExtrinsicButton intrinsicContentSize]):
1770         (-[WKFullScreenViewController initWithWebView:]):
1771         (-[WKFullScreenViewController dealloc]):
1772         (-[WKFullScreenViewController showUI]):
1773         (-[WKFullScreenViewController hideUI]):
1774         (-[WKFullScreenViewController videoControlsManagerDidChange]):
1775         (-[WKFullScreenViewController setPrefersStatusBarHidden:]):
1776         (-[WKFullScreenViewController setPlaying:]):
1777         (-[WKFullScreenViewController setPictureInPictureActive:]):
1778         (-[WKFullScreenViewController loadView]):
1779         (-[WKFullScreenViewController viewWillAppear:]):
1780         (-[WKFullScreenViewController viewDidLayoutSubviews]):
1781         (-[WKFullScreenViewController viewWillTransitionToSize:withTransitionCoordinator:]):
1782         (-[WKFullScreenViewController preferredStatusBarStyle]):
1783         (-[WKFullScreenViewController prefersStatusBarHidden]):
1784         (-[WKFullScreenViewController gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
1785         (-[WKFullScreenViewController gestureRecognizer:shouldReceiveTouch:]):
1786         (-[WKFullScreenViewController _manager]):
1787         (-[WKFullScreenViewController _effectiveFullscreenInsetTop]):
1788         (-[WKFullScreenViewController _cancelAction:]):
1789         (-[WKFullScreenViewController _togglePiPAction:]):
1790         (-[WKFullScreenViewController _touchDetected:]):
1791         (-[WKFullScreenViewController _statusBarFrameDidChange:]):
1792         (-[WKFullScreenViewController _updateWebViewFullscreenInsets]):
1793         (-[WKFullScreenViewController _showPhishingAlert]):
1794         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.h: Copied from Source/WebKit/UIProcess/ios/WKFullScreenWindowControllerIOS.h.
1795         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: Added.
1796         (WebKit::replaceViewWithView):
1797         (WebKit::WKWebViewState::applyTo):
1798         (WebKit::WKWebViewState::store):
1799         (-[WKFullscreenAnimationController transitionDuration:]):
1800         (-[WKFullscreenAnimationController configureInitialAndFinalStatesForTransition:]):
1801         (-[WKFullscreenAnimationController animateTransition:]):
1802         (-[WKFullscreenAnimationController animationEnded:]):
1803         (-[WKFullscreenAnimationController startInteractiveTransition:]):
1804         (-[WKFullscreenAnimationController updateWithPercent:]):
1805         (-[WKFullscreenAnimationController updateWithPercent:translation:anchor:]):
1806         (-[WKFullscreenAnimationController end:]):
1807         (-[WKFullScreenInteractiveTransition initWithAnimator:anchor:]):
1808         (-[WKFullScreenInteractiveTransition wantsInteractiveStart]):
1809         (-[WKFullScreenInteractiveTransition startInteractiveTransition:]):
1810         (-[WKFullScreenInteractiveTransition updateInteractiveTransition:withTranslation:]):
1811         (-[WKFullScreenInteractiveTransition cancelInteractiveTransition]):
1812         (-[WKFullScreenInteractiveTransition finishInteractiveTransition]):
1813         (-[WKFullScreenWindowController initWithWebView:]):
1814         (-[WKFullScreenWindowController dealloc]):
1815         (-[WKFullScreenWindowController isFullScreen]):
1816         (-[WKFullScreenWindowController webViewPlaceholder]):
1817         (-[WKFullScreenWindowController enterFullScreen]):
1818         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
1819         (-[WKFullScreenWindowController requestExitFullScreen]):
1820         (-[WKFullScreenWindowController exitFullScreen]):
1821         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
1822         (-[WKFullScreenWindowController _completedExitFullScreen]):
1823         (-[WKFullScreenWindowController close]):
1824         (-[WKFullScreenWindowController webViewDidRemoveFromSuperviewWhileInFullscreen]):
1825         (-[WKFullScreenWindowController videoControlsManagerDidChange]):
1826         (-[WKFullScreenWindowController gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
1827         (-[WKFullScreenWindowController animationControllerForPresentedController:presentingController:sourceController:]):
1828         (-[WKFullScreenWindowController animationControllerForDismissedController:]):
1829         (-[WKFullScreenWindowController interactionControllerForDismissal:]):
1830         (-[WKFullScreenWindowController _exitFullscreenImmediately]):
1831         (-[WKFullScreenWindowController _invalidateEVOrganizationName]):
1832         (-[WKFullScreenWindowController _isSecure]):
1833         (-[WKFullScreenWindowController _serverTrust]):
1834         (-[WKFullScreenWindowController _EVOrganizationName]):
1835         (-[WKFullScreenWindowController _updateLocationInfo]):
1836         (-[WKFullScreenWindowController _manager]):
1837         (-[WKFullScreenWindowController _startToDismissFullscreenChanged:]):
1838         (-[WKFullScreenWindowController _interactiveDismissChanged:]):
1839         * UIProcess/ios/fullscreen/WKFullscreenStackView.h: Renamed from Source/WebKit/UIProcess/ios/WKFullScreenWindowControllerIOS.h.
1840         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm: Added.
1841         (+[WKFullscreenStackView baseEffects]):
1842         (+[WKFullscreenStackView configureView:forTintEffectWithColor:filterType:]):
1843         (+[WKFullscreenStackView configureView:withBackgroundFillOfColor:opacity:filter:]):
1844         (+[WKFullscreenStackView secondaryMaterialOverlayView]):
1845         (+[WKFullscreenStackView applyPrimaryGlyphTintToView:]):
1846         (+[WKFullscreenStackView applySecondaryGlyphTintToView:]):
1847         (-[WKFullscreenStackView initWithArrangedSubviews:axis:]):
1848         (-[WKFullscreenStackView setTargetViewForSecondaryMaterialOverlay:]):
1849         (-[WKFullscreenStackView contentView]):
1850         (-[WKFullscreenStackView _setArrangedSubviews:axis:]):
1851         (-[WKFullscreenStackView setBounds:]):
1852         (-[WKFullscreenStackView updateConstraints]):
1853         * WebKit.xcodeproj/project.pbxproj:
1854
1855 2018-03-10  Megan Gardner  <megan_gardner@apple.com>
1856
1857         Media query for default appearance
1858         https://bugs.webkit.org/show_bug.cgi?id=183539
1859         <rdar://problem/38326388>
1860
1861         Reviewed by Tim Horton.
1862
1863         Write a media query to evaluate appearance.
1864
1865         * Shared/WebPageCreationParameters.cpp:
1866         (WebKit::WebPageCreationParameters::encode const):
1867         (WebKit::WebPageCreationParameters::decode):
1868         * Shared/WebPageCreationParameters.h:
1869         * UIProcess/API/Cocoa/WKWebView.mm:
1870         (-[WKWebView _initializeWithConfiguration:]):
1871         (-[WKWebView _setUseSystemAppearance:]):
1872         * UIProcess/WebPageProxy.cpp:
1873         (WebKit::WebPageProxy::creationParameters):
1874         (WebKit::WebPageProxy::setDefaultAppearance):
1875         * UIProcess/WebPageProxy.h:
1876         (WebKit::WebPageProxy::defaultAppearance const):
1877         * WebProcess/WebPage/WebPage.cpp:
1878         (WebKit::m_credentialsMessenger):
1879         (WebKit::WebPage::setDefaultAppearance):
1880         * WebProcess/WebPage/WebPage.h:
1881         * WebProcess/WebPage/WebPage.messages.in:
1882
1883 2018-03-09  Jer Noble  <jer.noble@apple.com>
1884
1885         Unconditionalize more methods in VideoFullscreenInterface (and related classes)
1886         https://bugs.webkit.org/show_bug.cgi?id=183501
1887         <rdar://problem/38312038>
1888
1889         Unreviewed build fix; add correct pragmas to code referencing m_playbackSessionManager.
1890
1891         * UIProcess/WebPageProxy.cpp:
1892         (WebKit::WebPageProxy::hasActiveVideoForControlsManager const):
1893         (WebKit::WebPageProxy::requestControlledElementID const):
1894         (WebKit::WebPageProxy::isPlayingVideoInEnhancedFullscreen const):
1895
1896 2018-03-09  Brian Burg  <bburg@apple.com>
1897
1898         Web Inspector: there should only be one way for async backend commands to send failure
1899         https://bugs.webkit.org/show_bug.cgi?id=183524
1900
1901         Reviewed by Timothy Hatcher.
1902
1903         Remove useless ErrorString argument from async commands.
1904
1905         For Automation protocol, introduce sync and async macros for filling
1906         in and sending a failure response. Now that async commands don't have
1907         an ErrorString and sync commands don't have a callback, trying to send
1908         an error with the wrong macro is a compile-time error.
1909
1910         * UIProcess/Automation/WebAutomationSession.cpp:
1911         (WebKit::WebAutomationSession::getBrowsingContexts):
1912         (WebKit::WebAutomationSession::getBrowsingContext):
1913         (WebKit::WebAutomationSession::createBrowsingContext):
1914         (WebKit::WebAutomationSession::closeBrowsingContext):
1915         (WebKit::WebAutomationSession::switchToBrowsingContext):
1916         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext):
1917         (WebKit::WebAutomationSession::waitForNavigationToComplete):
1918         (WebKit::WebAutomationSession::navigateBrowsingContext):
1919         (WebKit::WebAutomationSession::goBackInBrowsingContext):
1920         (WebKit::WebAutomationSession::goForwardInBrowsingContext):
1921         (WebKit::WebAutomationSession::reloadBrowsingContext):
1922         (WebKit::WebAutomationSession::evaluateJavaScriptFunction):
1923         (WebKit::WebAutomationSession::resolveChildFrameHandle):
1924         (WebKit::WebAutomationSession::resolveParentFrameHandle):
1925         (WebKit::WebAutomationSession::computeElementLayout):
1926         (WebKit::WebAutomationSession::selectOptionElement):
1927         (WebKit::WebAutomationSession::isShowingJavaScriptDialog):
1928         (WebKit::WebAutomationSession::dismissCurrentJavaScriptDialog):
1929         (WebKit::WebAutomationSession::acceptCurrentJavaScriptDialog):
1930         (WebKit::WebAutomationSession::messageOfCurrentJavaScriptDialog):
1931         (WebKit::WebAutomationSession::setUserInputForCurrentJavaScriptPrompt):
1932         (WebKit::WebAutomationSession::setFilesToSelectForFileUpload):
1933         (WebKit::WebAutomationSession::getAllCookies):
1934         (WebKit::WebAutomationSession::deleteSingleCookie):
1935         (WebKit::WebAutomationSession::addSingleCookie):
1936         (WebKit::WebAutomationSession::deleteAllCookies):
1937         (WebKit::WebAutomationSession::setSessionPermissions):
1938         (WebKit::WebAutomationSession::performMouseInteraction):
1939         (WebKit::WebAutomationSession::performKeyboardInteractions):
1940         (WebKit::WebAutomationSession::takeScreenshot):
1941         (WebKit::WebAutomationSession::didTakeScreenshot):
1942         * UIProcess/Automation/WebAutomationSession.h:
1943         * UIProcess/Automation/WebAutomationSessionMacros.h:
1944         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
1945         (WebKit::WebAutomationSession::inspectBrowsingContext):
1946
1947 2018-03-09  Jer Noble  <jer.noble@apple.com>
1948
1949         Don't pass NULL to the result parameter of SecTrustEvaluate()
1950         https://bugs.webkit.org/show_bug.cgi?id=183495
1951         <rdar://problem/38185688>
1952
1953         Reviewed by Andy Estes.
1954
1955         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
1956         (-[WKFullScreenWindowController _EVOrganizationName]):
1957
1958 2018-03-09  Dean Jackson  <dino@apple.com>
1959
1960         Allow NavigationState to intercept requests and send them to SystemPreviewController
1961         https://bugs.webkit.org/show_bug.cgi?id=183526
1962         <rdar://problem/37801140>
1963
1964         Reviewed by Tim Horton.
1965
1966         Implement a bit more of SystemPreviewController, such that it can be used
1967         from NavigationState to identify and handle content that can be previewed.
1968
1969         * UIProcess/Cocoa/NavigationState.mm:
1970         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
1971             If we'd in a download response policy, then check if SystemPreviewController
1972             can show the content. We ignore the download, but pass the original URL onto
1973             the preview. Ultimately, we'd want to avoid the navigation
1974             but use the download destination URL for preview.
1975
1976         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
1977         (-[_WKPreviewControllerDataSource initWithURL:]):
1978             Move the URL to property, to help use a single datasource object for all previews.
1979         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
1980         (-[_WKPreviewControllerDelegate initWithSystemPreviewController:]):
1981             Add a delegate object, so we can detect when the preview is dismissed and return
1982             to the previous page.
1983         (-[_WKPreviewControllerDelegate previewControllerWillDismiss:]):
1984         (WebKit::SystemPreviewController::showPreview):
1985             Use single instances of the QLPreviewController, its datasource and delegate.
1986
1987         * UIProcess/SystemPreviewController.cpp:
1988             Add a helper to navigate back.
1989         (WebKit::SystemPreviewController::SystemPreviewController):
1990         (WebKit::SystemPreviewController::sendPageBack):
1991         * UIProcess/SystemPreviewController.h:
1992
1993 2018-03-09  Jer Noble  <jer.noble@apple.com>
1994
1995         webkitfullscreenchange event not fired at the same time as :-webkit-full-screen pseudo selector changes; causes glitchiness
1996         https://bugs.webkit.org/show_bug.cgi?id=183383
1997         <rdar://problem/38197028>
1998
1999         Reviewed by Eric Carlson.
2000
2001         Follow-up patch: now that the 'fullscreenchange' event is being fired slightly earlier, the
2002         Fullscreen.TopContentInset tests triggers what appears to be an existing behavior: if you
2003         exit in the middle of an enter fullscreen animation, the exit never happens, because the
2004         NSWindow never starts the exit animation. The solution is to store the exit fullscreen
2005         request, and only act upon it when the enter animation completes.
2006
2007         * UIProcess/mac/WKFullScreenWindowController.h:
2008         * UIProcess/mac/WKFullScreenWindowController.mm:
2009         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
2010         (-[WKFullScreenWindowController exitFullScreen]):
2011
2012 2018-03-09  Jer Noble  <jer.noble@apple.com>
2013
2014         Unconditionalize more methods in VideoFullscreenInterface (and related classes)
2015         https://bugs.webkit.org/show_bug.cgi?id=183501
2016
2017         Reviewed by Eric Carlson.
2018
2019         No reason for these methods to be PLATFORM(MAC) only.
2020
2021         * UIProcess/API/Cocoa/WKWebView.mm:
2022         (-[WKWebView _videoControlsManagerDidChange]):
2023         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2024         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
2025         (WebKit::PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID):
2026         (WebKit::PlaybackSessionManagerProxy::clearPlaybackControlsManager):
2027         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
2028         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2029         * UIProcess/PageClient.h:
2030         * UIProcess/WebPageProxy.cpp:
2031         (WebKit::WebPageProxy::isPlayingMediaDidChange):
2032         (WebKit::WebPageProxy::handleControlledElementIDResponse const):
2033         (WebKit::WebPageProxy::isPlayingVideoInEnhancedFullscreen const):
2034         * UIProcess/WebPageProxy.h:
2035         * UIProcess/ios/PageClientImplIOS.h:
2036         * UIProcess/ios/PageClientImplIOS.mm:
2037         (WebKit::PageClientImpl::videoControlsManagerDidChange):
2038         * UIProcess/ios/WKFullScreenWindowControllerIOS.h:
2039         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
2040         (-[WKFullScreenWindowController videoControlsManagerDidChange]):
2041         * WebProcess/cocoa/PlaybackSessionManager.mm:
2042         (WebKit::PlaybackSessionManager::setUpPlaybackControlsManager):
2043
2044 2018-03-09  Per Arne Vollan  <pvollan@apple.com>
2045
2046         Create CA layer contexts with +remoteContextWithOptions.
2047         https://bugs.webkit.org/show_bug.cgi?id=182747
2048
2049         Reviewed by Brent Fulgham.
2050
2051         CA layer contexts (CAContext) are currently created with +contextWithCGSConnection, which is
2052         using the main WindowServer connection to create the context. Instead, the contexts can be
2053         created with +remoteContextWithOptions, which does not use the main WindowServer connection.
2054         This is a step towards limiting the access the WebContent process has to the window server.
2055         To make the +remoteContextWithOptions call succeed, the sandbox has to be modified to allow
2056         access to CARenderServer. Also, access to the WindowServer should be denied by calling
2057         CGSSetDenyWindowServerConnections(true) before entering the sandbox. This is planned to do
2058         in a follow-up patch. The call to +remoteContextWithOptions will open up WindowServer
2059         connections, since the WindowServer is the system default CA render server, but these
2060         connections come with limited WindowServer exposure. In addition, we need to open up the
2061         sandbox for accessing some IOKit properties.
2062
2063         * Platform/mac/LayerHostingContext.mm:
2064         (WebKit::LayerHostingContext::createForExternalHostingProcess):
2065         * Shared/mac/HangDetectionDisablerMac.mm:
2066         (WebKit::setClientsMayIgnoreEvents):
2067         * WebProcess/com.apple.WebProcess.sb.in:
2068
2069 2018-03-09  Brent Fulgham  <bfulgham@apple.com>
2070
2071         Remove cookie API access from WebContent Process
2072         https://bugs.webkit.org/show_bug.cgi?id=183519
2073         <rdar://problem/35368802>
2074
2075         Reviewed by Alex Christensen.
2076
2077         All cookie access is now handled in the Network Process. However, there are vestiges of the original logic that used CFNetwork APIs in the WebContent process.
2078
2079         This patch removes CFNetwork calls from the WebProcess code paths, since they serve no purpose in modern WebKit.
2080
2081         No tests because this is a code cleanup with no expected change in behavior.
2082
2083         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
2084         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy): Moved from WebFrameNetworkingContext.
2085         * NetworkProcess/NetworkProcess.h:
2086         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2087         (WebKit::NetworkProcess::setSharedHTTPCookieStorage): Moved from ChildProcess, since this should only be
2088         called in the NetworkProcess.
2089         * Shared/ChildProcess.h:
2090         * Shared/mac/ChildProcessMac.mm:
2091         (WebKit::ChildProcess::setSharedHTTPCookieStorage): Deleted.
2092         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
2093         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
2094         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession): Remove CFNetwork code. This version of
2095         'ensureWebsiteDataStoreSession' is needed to maintain a dictionary on the WebProcess side so we can refer to
2096         the same network session in both the WebContent and Network processes.
2097         (WebKit::WebFrameNetworkingContext::webFrameLoaderClient const):
2098         (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts): Deleted.
2099         * WebProcess/cocoa/WebProcessCocoa.mm:
2100         (WebKit::WebProcess::platformInitializeWebProcess): Remove calls to CFNetwork.
2101
2102 2018-03-09  Youenn Fablet  <youenn@apple.com>
2103
2104         ServiceWorkerClientFetch should send data to its resource loader once the didReceiveResponse completion handler is called
2105         https://bugs.webkit.org/show_bug.cgi?id=183110
2106
2107         Reviewed by Chris Dumez.
2108
2109         Buffering data/finish event/fail event until the response completion handler is called.
2110
2111         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2112         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
2113         (WebKit::ServiceWorkerClientFetch::didReceiveData):
2114         (WebKit::ServiceWorkerClientFetch::didFinish):
2115         (WebKit::ServiceWorkerClientFetch::didFail):
2116         (WebKit::ServiceWorkerClientFetch::didNotHandle):
2117         (WebKit::ServiceWorkerClientFetch::cancel):
2118         (WebKit::ServiceWorkerClientFetch::continueLoadingAfterCheckingResponse):
2119         * WebProcess/Storage/ServiceWorkerClientFetch.h:
2120
2121 2018-03-09  Jer Noble  <jer.noble@apple.com>
2122
2123         Add new CSS env constants for use with fullscreen
2124         https://bugs.webkit.org/show_bug.cgi?id=183498
2125
2126         Reviewed by Dean Jackson.
2127
2128         Pass the values given to WebFullScreenManagerProxy through the process boundary and
2129         into WebCore.
2130
2131         * UIProcess/WebFullScreenManagerProxy.cpp:
2132         (WebKit::WebFullScreenManagerProxy::setFullscreenInsetTop):
2133         (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideDelay):
2134         * UIProcess/WebFullScreenManagerProxy.h:
2135         * WebProcess/FullScreen/WebFullScreenManager.cpp:
2136         (WebKit::WebFullScreenManager::didExitFullScreen):
2137         (WebKit::WebFullScreenManager::setFullscreenInsetTop):
2138         (WebKit::WebFullScreenManager::setFullscreenAutoHideDelay):
2139         * WebProcess/FullScreen/WebFullScreenManager.h:
2140         * WebProcess/FullScreen/WebFullScreenManager.messages.in:
2141
2142 2018-03-09  Jer Noble  <jer.noble@apple.com>
2143
2144         Add isPictureInPictureActive messaging across WebKit process boundary
2145         https://bugs.webkit.org/show_bug.cgi?id=183499
2146
2147         Reviewed by Eric Carlson.
2148
2149         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
2150         * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
2151         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
2152         (WebKit::PlaybackSessionModelContext::pictureInPictureActiveChanged):
2153         (WebKit::PlaybackSessionManagerProxy::pictureInPictureActiveChanged):
2154
2155 2018-03-09  Stephan Szabo  <stephan.szabo@sony.com>
2156
2157         Add guard for wtf/glib include
2158         https://bugs.webkit.org/show_bug.cgi?id=183521
2159
2160         Reviewed by Alex Christensen.
2161
2162         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
2163
2164 2018-03-09  Andy Estes  <aestes@apple.com>
2165
2166         [Mac] WebKit fails to receive file promises when the embedding app is sandboxed
2167         https://bugs.webkit.org/show_bug.cgi?id=183489
2168         <rdar://problem/38267517>
2169
2170         WebKit calls -[NSFilePromiseReceiver receivePromisedFilesAtDestination:...] with
2171         NSTemporaryDirectory() as the destination for receiving file promise drops. AppKit attempts
2172         to issue a sandbox extension for this directory, but for security reasons App Sandbox
2173         refuses to do so for NSTemporaryDirectory() itself. As a result, AppKit will call our reader
2174         block with a nil error and a valid file URL, but no file will actually exist at that URL.
2175
2176         In order for App Sandbox to grant issuing the sandbox extension needed by AppKit, we need to
2177         use some other destination directory. This patch uses FileSystem::createTemporaryDirectory()
2178         to securely create a unique temporary directory inside NSTemporaryDirectory() for use as the
2179         drop destination.
2180
2181         Reviewed by Wenson Hsieh.
2182
2183         * UIProcess/Cocoa/WebViewImpl.mm:
2184         (WebKit::WebViewImpl::performDragOperation):
2185
2186 2018-03-09  Carlos Garcia Campos  <cgarcia@igalia.com>
2187
2188         [GTK] Do not use WebKitDOMHTMLFormElement as argument of signal WebKitWebPage::will-submit-form
2189         https://bugs.webkit.org/show_bug.cgi?id=183510
2190
2191         Reviewed by Michael Catanzaro.
2192
2193         In 2.22 WebKitDOMHTMLFormElement will be deprecated in GTK+ port and won't still exist in WPE. The new
2194         JavaScript GLib API will be used to replace most of the DOM API, but a few classes will remain with a minimal
2195         API for things that can't be done with JavaScript. WebKitDOMElement will stay and will be added to WPE as well,
2196         so if we change the signal parameter to WebKitDOMElement we will be able to keep using
2197         WebKitWebPage::will-submit-form without any changes. WPE will gain this signal and the rest of the API that uses
2198         DOM.
2199
2200         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
2201         (webkit_web_page_class_init):
2202
2203 2018-03-09  Carlos Garcia Campos  <cgarcia@igalia.com>
2204
2205         Unreviewed. [GTK][WPE] Bump Since tags of resource load stats API.
2206
2207         The functionality hasn't been properly tested to be released in WebKitGTK+ 2.20.
2208
2209         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
2210         (webkit_website_data_manager_class_init):
2211         * UIProcess/API/gtk/WebKitWebsiteData.h:
2212         * UIProcess/API/wpe/WebKitWebsiteData.h:
2213
2214 2018-03-08  Zan Dobersek  <zdobersek@igalia.com>
2215
2216         Unreviewed. Suppress GCC warnings in SystemPreviewController.cpp by
2217         using the cross-platform #include directives for header inclusion,
2218         instead of #import.
2219
2220         * UIProcess/SystemPreviewController.cpp:
2221
2222 2018-03-08  Megan Gardner  <megan_gardner@apple.com>
2223
2224         Allow WebViews to disable system appearance
2225         https://bugs.webkit.org/show_bug.cgi?id=183418
2226         <rdar://problem/36975642>
2227
2228         Reviewed by Tim Horton.
2229         
2230         Allow webviews to choose whether or not to follow the default system appearance.
2231
2232         * Shared/WebPageCreationParameters.cpp:
2233         (WebKit::WebPageCreationParameters::encode const):
2234         (WebKit::WebPageCreationParameters::decode):
2235         * Shared/WebPageCreationParameters.h:
2236         * UIProcess/API/Cocoa/WKWebView.mm:
2237         (-[WKWebView _useSystemAppearance]):
2238         (-[WKWebView _setUseSystemAppearance:]):
2239         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2240         * UIProcess/WebPageProxy.cpp:
2241         (WebKit::WebPageProxy::creationParameters):
2242         (WebKit::WebPageProxy::setUseSystemAppearance):
2243         * UIProcess/WebPageProxy.h:
2244         (WebKit::WebPageProxy::useSystemAppearance const):
2245         * WebProcess/WebPage/WebPage.cpp:
2246         (WebKit::WebPage::setUseSystemAppearance):
2247         * WebProcess/WebPage/WebPage.h:
2248         * WebProcess/WebPage/WebPage.messages.in:
2249
2250 2018-03-08  Michael Catanzaro  <mcatanzaro@igalia.com>
2251
2252         Unreviewed, speculative attempt to fix CMake build after r229426
2253         https://bugs.webkit.org/show_bug.cgi?id=183382
2254         <rdar://problem/38191450>
2255
2256         * CMakeLists.txt:
2257
2258 2018-03-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2259
2260         [Extra zoom mode] Support resigning first responder status when focusing a form control
2261         https://bugs.webkit.org/show_bug.cgi?id=183477
2262         <rdar://problem/38225994>
2263
2264         Reviewed by Tim Horton.
2265
2266         Currently, when presenting an input view controller in extra zoom mode, if the web view loses first responder
2267         status, we will blur the focused element, which dismisses all focused form control UI. For certain types of form
2268         controls, this prevents the user from using key pieces of functionality.
2269
2270         To address this, disconnect the notion of first responder status from DOM element focus while the form control
2271         overlay is shown. Later, when the active input session ends, if the web content view was first responder before
2272         upon focusing the element, restore first responder status on the web view. This extra tweak is needed to ensure
2273         that certain UI affordances which require first responder status on the web view continue to work after
2274         interacting with a form control that changes the first responder.
2275
2276         * UIProcess/ios/WKContentViewInteraction.h:
2277         * UIProcess/ios/WKContentViewInteraction.mm:
2278         (-[WKContentView presentFocusedFormControlViewController:]):
2279         (-[WKContentView dismissFocusedFormControlViewController:]):
2280
2281 2018-03-08  John Wilander  <wilander@apple.com>
2282
2283         Resource Load Statistics: Revert defaults read of zero values
2284         https://bugs.webkit.org/show_bug.cgi?id=183476
2285
2286         Unreviewed revert of three small changes landed in r229427.
2287
2288         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
2289         (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
2290             Reverted back to strict check of greater than zero for defaults reads.
2291
2292 2018-03-08  Tim Horton  <timothy_horton@apple.com>
2293
2294         Don't have SafariServices in minimal simulator build
2295         https://bugs.webkit.org/show_bug.cgi?id=183436
2296         <rdar://problem/38254778>
2297
2298         Reviewed by Dan Bernstein.
2299
2300         * config.h:
2301
2302 2018-03-08  John Wilander  <wilander@apple.com>
2303
2304         Resource Load Statistics: Make debug mode always partition prevalent resources
2305         https://bugs.webkit.org/show_bug.cgi?id=183468
2306         <rdar://problem/38269437>
2307
2308         Reviewed by Brent Fulgham.
2309
2310         After some testing we decided that a 30 second timeout in ITP debug mode just makes
2311         it confusing. We should instead always partition prevalent resources in debug mode
2312         to make it easy to understand. The partitioned state is what developers want to test
2313         anyway.
2314
2315         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
2316         (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
2317             Minor change to include 0 as valid setting.
2318         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2319         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
2320             Now just stores the setting of debug mode instead of changing the timeout.
2321         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
2322             Now does not disable partitioning under debug mode.
2323         (WebKit::WebResourceLoadStatisticsStore::shouldPartitionCookies const):
2324             Now returns true for prevalent resources with user interaction under debug mode.            
2325         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
2326             Removed duplicate debug logging statement.
2327         * UIProcess/WebResourceLoadStatisticsStore.h:
2328             Added member m_debugModeEnabled.
2329
2330 2018-03-08  Brent Fulgham  <bfulgham@apple.com>
2331
2332         Remove WebCookieManager and messaging from WebContent process.
2333         https://bugs.webkit.org/show_bug.cgi?id=183382
2334         <rdar://problem/38191450>
2335
2336         Reviewed by Alex Christensen.
2337
2338         Networking access was fully removed from the WebContent process in Bug 183192 (and related bugs). The
2339         UIProcess no longer needs to ask the WebContent process about networking-related things, and shouldn't
2340         waste everyone's time doing so.
2341
2342         This bug removes some left-over WebCookieManager API stuff, and is a first step in purging the
2343         WebContent Process from accessing cookie data.
2344
2345         * NetworkProcess/Cookies: Copied from WebProcess/Cookies.
2346         * NetworkProcess/Cookies/WebCookieManager.h:
2347         * WebKit.xcodeproj/project.pbxproj:
2348         * WebProcess/Cookies: Removed.
2349         * WebProcess/Cookies/WebCookieManager.cpp: Removed.
2350         * WebProcess/Cookies/WebCookieManager.h: Removed.
2351         * WebProcess/Cookies/WebCookieManager.messages.in: Removed.
2352         * WebProcess/Cookies/curl: Removed.
2353         * WebProcess/Cookies/curl/WebCookieManagerCurl.cpp: Removed.
2354         * WebProcess/Cookies/mac: Removed.
2355         * WebProcess/Cookies/mac/WebCookieManagerMac.mm: Removed.
2356         * WebProcess/Cookies/soup: Removed.
2357         * WebProcess/Cookies/soup/WebCookieManagerSoup.cpp: Removed.
2358         * WebProcess/InjectedBundle/InjectedBundle.cpp: Remove 'WebCookieManager.h" header.
2359         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: Ditto.
2360         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm: Ditto.
2361         * WebProcess/WebProcess.cpp:
2362         (WebKit::WebProcess::WebProcess): Remove call to add WebCookieManager as a
2363         WebProcessSupplement.
2364         * CMakeLists.txt: Revised paths.
2365         * DerivedSources.make: Ditto.
2366         * PlatformMac.cmake: Ditto.
2367         * PlatformWin.cmake: Ditto.
2368         * SourcesGTK.txt: Ditto.
2369         * SourcesWPE.txt: Ditto.
2370
2371 2018-03-08  Youenn Fablet  <youenn@apple.com>
2372
2373         libwebrtc update broke internal builds
2374         https://bugs.webkit.org/show_bug.cgi?id=183454
2375
2376         Reviewed by Eric Carlson.
2377
2378         * Configurations/BaseTarget.xcconfig:
2379
2380 2018-03-08  Youenn Fablet  <youenn@apple.com>
2381
2382         PluginInfoStore::isSupportedPlugin should check for empty mime type
2383         https://bugs.webkit.org/show_bug.cgi?id=183457
2384         <rdar://problem/38159575>
2385
2386         Reviewed by Chris Dumez.
2387
2388         * UIProcess/Plugins/PluginInfoStore.cpp:
2389         (WebKit::PluginInfoStore::isSupportedPlugin):
2390
2391 2018-03-08  Yusuke Suzuki  <utatane.tea@gmail.com>
2392
2393         [JSC][WebCore] Extend jsDynamicCast for WebCore types in WebCore and remove jsDynamicDowncast
2394         https://bugs.webkit.org/show_bug.cgi?id=183449
2395
2396         Reviewed by Mark Lam.
2397
2398         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2399         (WebKit::WebAutomationSessionProxy::elementForNodeHandle):
2400         * WebProcess/WebPage/WebFrame.cpp:
2401         (WebKit::WebFrame::frameForContext):
2402
2403 2018-03-08  Yusuke Suzuki  <utatane.tea@gmail.com>
2404
2405         [JSC] Add inherits<T>(VM&) leveraging JSCast fast path
2406         https://bugs.webkit.org/show_bug.cgi?id=183429
2407
2408         Reviewed by Mark Lam.
2409
2410         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
2411         (WebKit::callMethod):
2412         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
2413         (WebKit::callNPJSObject):
2414         (WebKit::constructWithConstructor):
2415         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
2416         (WebKit::NPJSObject::create):
2417         * WebProcess/WebPage/WebFrame.cpp:
2418         (WebKit::WebFrame::counterValue):
2419
2420 2018-03-08  Zan Dobersek  <zdobersek@igalia.com>
2421
2422         Remove WebCore::TextureMapperAnimation as a special case in WebKit IPC
2423         generation. Values of this type aren't being transferred across IPC.
2424
2425         Rubber-stamped by Carlos Garcia Campos.
2426
2427         * Scripts/webkit/messages.py:
2428
2429 2018-03-08  Tim Horton  <timothy_horton@apple.com>
2430
2431         Stop linking ApplicationServices directly
2432         https://bugs.webkit.org/show_bug.cgi?id=182867
2433         <rdar://problem/38252142>
2434
2435         Reviewed by Alex Christensen.
2436
2437         The frameworks that we use that live inside ApplicationServices
2438         have mostly moved out, so import them directly.
2439
2440         * Configurations/WebKit.xcconfig:
2441
2442 2018-03-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2443
2444         [Extra zoom mode] Specify password mode as needed when inputting text
2445         https://bugs.webkit.org/show_bug.cgi?id=183428
2446         <rdar://problem/37609386>
2447
2448         Reviewed by Tim Horton.
2449
2450         If the focused element is a password field, or the input delegate has forced secure text entry, set a flag on
2451         the text input view controller to opt in to password text input mode.
2452
2453         * UIProcess/ios/WKContentViewInteraction.mm:
2454         (-[WKContentView presentTextInputViewController:]):
2455
2456 2018-03-07  Tim Horton  <timothy_horton@apple.com>
2457
2458         Sort and separate FeatureDefines.xcconfig
2459         https://bugs.webkit.org/show_bug.cgi?id=183427
2460
2461         Reviewed by Dan Bernstein.
2462
2463         * Configurations/FeatureDefines.xcconfig:
2464         Sort and split FeatureDefines into paragraphs
2465         (to make it easier to sort later).
2466
2467 2018-03-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2468
2469         REGRESSION(r218089): [GTK] webkit_web_view_get_inspector() needs to be called, otherwise inspector does not close
2470         https://bugs.webkit.org/show_bug.cgi?id=181126
2471
2472         Reviewed by Carlos Alberto Lopez Perez.
2473
2474         Fix the condition to decide whether to detach the inspector view ourselves.
2475
2476         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
2477         (WebKit::WebInspectorProxy::platformDetach): Remove the inspector view from its parent if we don't have a client
2478         or the client didn't detach it.
2479
2480 2018-03-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2481
2482         [GTK][WPE] Leak checker is not working in WebKitGLib web process tests
2483         https://bugs.webkit.org/show_bug.cgi?id=183404
2484
2485         Reviewed by Michael Catanzaro.
2486
2487         Add private helper for testing to do a garbage collection when the page is closing.
2488
2489         * WebProcess/InjectedBundle/API/glib/WebKitWebExtension.cpp:
2490         (webkitWebExtensionSetGarbageCollectOnPageDestroy):
2491         * WebProcess/InjectedBundle/API/glib/WebKitWebExtensionPrivate.h:
2492         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.h: Fix annotation of
2493         webkit_dom_client_rect_list_item(), it should be transfer full.
2494
2495 2018-03-07  Youenn Fablet  <youenn@apple.com>
2496
2497         Match unsupported plugins based on domains and not origin
2498         https://bugs.webkit.org/show_bug.cgi?id=183384
2499
2500         Reviewed by Chris Dumez.
2501
2502         Moved from a HashMap of plugins to a Vector of plugins since we cannot match exactly based on the origin.
2503
2504         * Scripts/webkit/messages.py:
2505         * UIProcess/API/C/WKContext.cpp:
2506         (WKContextAddSupportedPlugin):
2507         * UIProcess/API/Cocoa/WKProcessPool.mm:
2508         (-[WKProcessPool _addSupportedPlugin:named:withMimeTypes:withExtensions:]):
2509         * UIProcess/Plugins/PluginInfoStore.cpp:
2510         (WebKit::PluginInfoStore::isSupportedPlugin):
2511         (WebKit::PluginInfoStore::supportedPluginNames):
2512         (WebKit::PluginInfoStore::addSupportedPlugin):
2513         * UIProcess/Plugins/PluginInfoStore.h:
2514         * UIProcess/WebProcessPool.cpp:
2515         (WebKit::WebProcessPool::addSupportedPlugin):
2516         * UIProcess/WebProcessPool.h:
2517         * UIProcess/WebProcessProxy.cpp:
2518         (WebKit::WebProcessProxy::getPlugins):
2519         * UIProcess/WebProcessProxy.h:
2520         * UIProcess/WebProcessProxy.messages.in:
2521         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
2522         (WebKit::WebPluginInfoProvider::getPluginInfo):
2523         (WebKit::WebPluginInfoProvider::getWebVisiblePluginInfo):
2524         * WebProcess/Plugins/WebPluginInfoProvider.h:
2525
2526 2018-03-07  Brent Fulgham  <bfulgham@apple.com>
2527
2528         REGRESSION (r229093): Media playback on Facebook and Hulu require mDNSResponder access
2529         https://bugs.webkit.org/show_bug.cgi?id=183421
2530         <rdar://problem/38191574>
2531
2532         Reviewed by Dean Jackson.
2533
2534         CoreMedia fails to properly play back media on Facebook and Hulu if access to the
2535         mDNSResponder is blocked by the sandbox. This Bug unblocks that access while we
2536         investigate the underlying issue.
2537
2538         * WebProcess/com.apple.WebProcess.sb.in:
2539
2540 2018-03-07  Dean Jackson  <dino@apple.com>
2541
2542         Try to fix build for watchOS and tvOS.
2543
2544         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2545         * UIProcess/SystemPreviewController.cpp:
2546
2547 2018-03-07  Dean Jackson  <dino@apple.com>
2548
2549         Add SystemPreviewController for showing system-level views of special file types
2550         https://bugs.webkit.org/show_bug.cgi?id=183413
2551         <rdar://problem/37800834>
2552
2553         Reviewed by Tim Horton.
2554
2555         Add a new controller class that hangs off WebPageProxy, with the goal
2556         of providing system-level viewing of some some file types. Specifically
2557         those that can't be shown by WebKit.
2558
2559         This is the initial implementation which is quite simple. The controller
2560         can be queried about whether it supports a MIME type, then it can be
2561         asked to show a URL.
2562
2563         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Added.
2564         (-[_WKPreviewControllerDataSource initWithURL:]):
2565         (-[_WKPreviewControllerDataSource numberOfPreviewItemsInPreviewController:]):
2566         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
2567         (WebKit::SystemPreviewController::canPreview const):
2568         (WebKit::SystemPreviewController::showPreview):
2569         * UIProcess/SystemPreviewController.cpp: Added.
2570         (WebKit::SystemPreviewController::SystemPreviewController):
2571         (WebKit::SystemPreviewController::canPreview const):
2572         (WebKit::SystemPreviewController::showPreview):
2573         * UIProcess/SystemPreviewController.h: Added.
2574         * UIProcess/WebPageProxy.cpp:
2575         (WebKit::m_configurationPreferenceValues):
2576         (WebKit::WebPageProxy::reattachToWebProcess):
2577         (WebKit::WebPageProxy::resetState):
2578         * UIProcess/WebPageProxy.h:
2579         (WebKit::WebPageProxy::systemPreviewController):
2580         * WebKit.xcodeproj/project.pbxproj:
2581
2582 2018-03-07  Alejandro G. Castro  <alex@igalia.com>
2583
2584         Make NetworkRTCResolver port agnostic
2585         https://bugs.webkit.org/show_bug.cgi?id=178855
2586
2587         Reviewed by Youenn Fablet.
2588
2589         Create a specific Cocoa class to isolate the generic code in the base class, make the base implementation port
2590         agnostic and dependent on DNS API in the platform directory which encapsulates the platform specific details.
2591
2592         * NetworkProcess/webrtc/NetworkRTCProvider.cpp: Create an alias class name defined per platform to instantiate the resolver.
2593         (WebKit::NetworkRTCProvider::createResolver): Used the alias class name and receive a new IPAddress class that is not
2594         dependent on rtc libwebrtc library.
2595         * NetworkProcess/webrtc/NetworkRTCResolver.cpp: Remove the platform specific code. Use the DNS API to implement the
2596         platform specific code in the default start and stop methods. Add the identifier of the resolve operation to the class.
2597         (WebKit::NetworkRTCResolver::NetworkRTCResolver): Add the identifier in the initialization.
2598         (WebKit::NetworkRTCResolver::~NetworkRTCResolver): Remove the platform specific code.
2599         (WebKit::NetworkRTCResolver::completed): Ditto.
2600         (WebKit::NetworkRTCResolver::start): Add a new implementation using the DNS API.
2601         (WebKit::NetworkRTCResolver::stop): Ditto
2602         * NetworkProcess/webrtc/NetworkRTCResolver.h: Remove the platform specific code and use the DNSResolveQueue for a general
2603         solution to implement the platform specific code. Avoid using the IPAddress class that depends on libwertc classes to make
2604         it more general regarding DNS name resolution.
2605         (WebKit::NetworkRTCResolver::start): Make this class virtual.
2606         (WebKit::NetworkRTCResolver::stop): Ditto.
2607         * NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp: Copied Cocoa code from Source/WebKit/NetworkProcess/webrtc/NetworkRTCResolver.cpp.
2608         Now this class overrides the start and stop methods that use DNS, cocoa implementation should use the DNS methods in the future and
2609         remove this class, making sure all the platform specific class is in the platform directory.
2610         * NetworkProcess/webrtc/NetworkRTCResolverCocoa.h: Copied Cocoa code from Source/WebKit/NetworkProcess/webrtc/NetworkRTCResolver.h.
2611         * PlatformGTK.cmake: Add NetworkRTCResolver compilation for GTK.
2612         * WebKit.xcodeproj/project.pbxproj: Add the NetworkRTCResolverCocoa class to the compilation.
2613
2614 2018-03-06  Brent Fulgham  <bfulgham@apple.com>
2615
2616         NetworkDataTask should enable logging for automation clients
2617         https://bugs.webkit.org/show_bug.cgi?id=183378
2618         <rdar://problem/38189556>
2619
2620         Reviewed by Brian Burg.
2621
2622         The NetworkDataTaskCocoa class was only logging if the SessionID object allowed logging.
2623         It should also be considering whether the current session is working on behalf of an
2624         automation client. If so, it should allow logging.
2625
2626         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2627         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2628         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2629         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
2630         (WebKit::NetworkDataTaskCocoa::isAlwaysOnLoggingAllowed const):
2631
2632 2018-03-06  Ryan Haddad  <ryanhaddad@apple.com>
2633
2634         Unreviewed build fix.
2635
2636         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
2637         (-[WKFullScreenWindowController _EVOrganizationName]):
2638
2639 2018-03-06  Antoine Quint  <graouts@apple.com>
2640
2641         [Web Animations] Add a new runtime flag to control whether CSS Animations and CSS Transitions should run using the Web Animations timeline
2642         https://bugs.webkit.org/show_bug.cgi?id=183370
2643         <rdar://problem/38180729>
2644
2645         Reviewed by Dean Jackson.
2646
2647         Before we start creating WebAnimation objects to perform CSS Animations and CSS Transitions, which will replace the existing codepath
2648         involving CSSAnimationController and CompositeAnimation, we need a runtime flag that will allow all the new code to be turned off by
2649         default while we bring this feature up.
2650
2651         * Shared/WebPreferences.yaml:
2652         * UIProcess/API/C/WKPreferences.cpp:
2653         (WKPreferencesSetCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled):
2654         (WKPreferencesGetCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled):
2655         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2656         * UIProcess/API/Cocoa/WKPreferences.mm:
2657         (-[WKPreferences _setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled:]):
2658         (-[WKPreferences _cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled]):
2659         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2660         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2661         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2662         (WebKit::InjectedBundle::setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled):
2663         * WebProcess/InjectedBundle/InjectedBundle.h:
2664
2665 2018-03-06  Ms2ger  <Ms2ger@igalia.com>
2666
2667         [GLib] Implement WebsiteDataStore::defaultServiceWorkerRegistrationDirectory().
2668         https://bugs.webkit.org/show_bug.cgi?id=183364
2669
2670         Reviewed by Michael Catanzaro.
2671
2672         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
2673         (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory): implement.
2674
2675 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
2676
2677         Unreviewed. Addressing further review feedback for patch landed in r229315.
2678
2679         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2680         (WebKit::CoordinatedGraphicsScene::commitSceneState): There's no need for
2681         explicit calls of the clear() method on both containers in the CommitScope
2682         objects, the destructors invoked for these objects from the CommitScope
2683         destructor will have the same effect.
2684
2685 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
2686
2687         [CoordGraphics] Remove unused scrolling-related code in TextureMapperLayer, CoordinatedGraphics stack
2688         https://bugs.webkit.org/show_bug.cgi?id=183340
2689
2690         Reviewed by Michael Catanzaro.
2691
2692         With most of the scrolling-related code in TextureMapperLayer on the
2693         chopping block, we can now drop the ScrollingClient inheritance and the
2694         commitScrollOffset() virtual method implementation. This enables
2695         removing the whole commitScrollOffset() call chain that ran from
2696         CoordinatedGraphicsScene through CoordinatedLayerTreeHost and
2697         CompositingCoordinator to the affected CoordinatedGraphicsLayer object.
2698
2699         The CoordinatedGraphicsScene::findScrollableContentsLayerAt() method is
2700         also unused and can be deleted.
2701
2702         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2703         (WebKit::CoordinatedGraphicsScene::setLayerState):
2704         (WebKit::CoordinatedGraphicsScene::createLayer):
2705         (WebKit::CoordinatedGraphicsScene::commitScrollOffset): Deleted.
2706         (WebKit::CoordinatedGraphicsScene::findScrollableContentsLayerAt): Deleted.
2707         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
2708         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2709         (WebKit::ThreadedCompositor::commitScrollOffset): Deleted.
2710         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2711         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2712         (WebKit::CompositingCoordinator::commitScrollOffset): Deleted.
2713         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
2714         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
2715         (WebKit::CoordinatedLayerTreeHost::commitScrollOffset): Deleted.
2716         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
2717         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
2718
2719 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
2720
2721         [CoordGraphics] Apply TextureMapperLayer animations with a single MonotonicTime value
2722         https://bugs.webkit.org/show_bug.cgi?id=183360
2723
2724         Reviewed by Sergio Villar Senin.
2725
2726         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2727         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
2728         Pass the monotic time value, as returned by MonotonicTime::now(), to the
2729         TextureMapperLayer::applyAnimationsRecursively() call.
2730
2731 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
2732
2733         [CoordGraphics] Clean up CoordinatedImageBacking
2734         https://bugs.webkit.org/show_bug.cgi?id=183332
2735
2736         Reviewed by Carlos Garcia Campos.
2737
2738         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2739         (WebKit::CompositingCoordinator::createImageBackingIfNeeded):
2740         Adjust call to CoordinatedImageBacking::getCoordinatedImageBackingID().
2741
2742 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
2743
2744         CoordinatedGraphicsScene: properly limit data specific to state commit operation
2745         https://bugs.webkit.org/show_bug.cgi?id=183326
2746
2747         Reviewed by Sergio Villar Senin.
2748
2749         In the process of state commit in CoordinatedGraphicsScene, the released
2750         image backings and backing stores with pending updates are stored in
2751         Vector and HashSet objects, respectively. Instead of these two objects
2752         being member variables on the CoordinatedGraphicsScene class, keep them
2753         in the CommitScope structure that's limited to the operations done in
2754         the commitSceneState() method.
2755
2756         The two member variables are dropped, and the CommitScope object is
2757         passed by reference to any helper method that needs to append either
2758         kind of object to the respective container. At the end of the state
2759         commit, backing stores with pending updates have those updates applied,
2760         and the two containers are cleared out as the CommitScope object is
2761         destroyed.
2762
2763         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2764         (WebKit::CoordinatedGraphicsScene::setLayerState):
2765         (WebKit::CoordinatedGraphicsScene::prepareContentBackingStore):
2766         (WebKit::CoordinatedGraphicsScene::resetBackingStoreSizeToLayerSize):
2767         (WebKit::CoordinatedGraphicsScene::removeTilesIfNeeded):
2768         (WebKit::CoordinatedGraphicsScene::updateTilesIfNeeded):
2769         (WebKit::CoordinatedGraphicsScene::syncImageBackings):
2770         (WebKit::CoordinatedGraphicsScene::updateImageBacking):
2771         (WebKit::CoordinatedGraphicsScene::clearImageBackingContents):
2772         (WebKit::CoordinatedGraphicsScene::removeImageBacking):
2773         (WebKit::CoordinatedGraphicsScene::commitSceneState):
2774         (WebKit::CoordinatedGraphicsScene::purgeGLResources):
2775         (WebKit::CoordinatedGraphicsScene::removeReleasedImageBackingsIfNeeded): Deleted.
2776         (WebKit::CoordinatedGraphicsScene::commitPendingBackingStoreOperations): Deleted.
2777         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
2778
2779 2018-03-05  Yusuke Suzuki  <utatane.tea@gmail.com>
2780
2781         Fix std::make_unique / new[] using system malloc
2782         https://bugs.webkit.org/show_bug.cgi?id=182975
2783
2784         Reviewed by JF Bastien.
2785
2786         Use Vector instead.
2787
2788         * NetworkProcess/win/SystemProxyWin.cpp:
2789         (WindowsSystemProxy::getSystemHttpProxy):
2790         * Platform/IPC/unix/ConnectionUnix.cpp:
2791         (IPC::Connection::processMessage):
2792         (IPC::Connection::sendOutputMessage):
2793         * Platform/win/LoggingWin.cpp:
2794         (WebKit::logLevelString):
2795         * Shared/SandboxExtension.h:
2796         * Shared/mac/SandboxExtensionMac.mm:
2797         (WebKit::SandboxExtension::HandleArray::allocate):
2798         (WebKit::SandboxExtension::HandleArray::operator[]):
2799         (WebKit::SandboxExtension::HandleArray::operator[] const):
2800         (WebKit::SandboxExtension::HandleArray::size const):
2801         (WebKit::SandboxExtension::HandleArray::encode const):
2802
2803 2018-03-05  Andy Estes  <aestes@apple.com>
2804
2805         [Mac] Teach WebCore::Pasteboard about file promise drags
2806         https://bugs.webkit.org/show_bug.cgi?id=183314
2807         <rdar://problem/38105493>
2808
2809         Reviewed by Darin Adler.
2810
2811         Added a FIXME comment.
2812
2813         * UIProcess/Cocoa/WebViewImpl.mm:
2814         (WebKit::WebViewImpl::performDragOperation):
2815
2816 2018-03-05  Jeff Miller  <jeffm@apple.com>
2817
2818         Expose still more WKPreferences SPI to match C SPI
2819         https://bugs.webkit.org/show_bug.cgi?id=183045
2820
2821         Reviewed by Alex Christensen.
2822
2823         * UIProcess/API/Cocoa/WKPreferences.mm:
2824         (-[WKPreferences _setAllowsInlineMediaPlayback:]):
2825         (-[WKPreferences _allowsInlineMediaPlayback]):
2826         (-[WKPreferences _setApplePayEnabled:]):
2827         (-[WKPreferences _applePayEnabled]):
2828         (-[WKPreferences _setDNSPrefetchingEnabled:]):
2829         (-[WKPreferences _dnsPrefetchingEnabled]):
2830         (-[WKPreferences _setInlineMediaPlaybackRequiresPlaysInlineAttribute:]):
2831         (-[WKPreferences _inlineMediaPlaybackRequiresPlaysInlineAttribute]):
2832         (-[WKPreferences _setInvisibleMediaAutoplayNotPermitted:]):
2833         (-[WKPreferences _invisibleMediaAutoplayNotPermitted]):
2834         (-[WKPreferences _setLegacyEncryptedMediaAPIEnabled:]):
2835         (-[WKPreferences _legacyEncryptedMediaAPIEnabled]):
2836         (-[WKPreferences _setMainContentUserGestureOverrideEnabled:]):
2837         (-[WKPreferences _mainContentUserGestureOverrideEnabled]):
2838         (-[WKPreferences _setMediaStreamEnabled:]):
2839         (-[WKPreferences _mediaStreamEnabled]):
2840         (-[WKPreferences _setNeedsStorageAccessFromFileURLsQuirk:]):
2841         (-[WKPreferences _needsStorageAccessFromFileURLsQuirk]):
2842         (-[WKPreferences _setPDFPluginEnabled:]):
2843         (-[WKPreferences _pdfPluginEnabled]):
2844         (-[WKPreferences _setRequiresUserGestureForAudioPlayback:]):
2845         (-[WKPreferences _requiresUserGestureForAudioPlayback]):
2846         (-[WKPreferences _setRequiresUserGestureForVideoPlayback:]):
2847         (-[WKPreferences _requiresUserGestureForVideoPlayback]):
2848         (-[WKPreferences _setServiceControlsEnabled:]):
2849         (-[WKPreferences _serviceControlsEnabled]):
2850         (-[WKPreferences _setShowsToolTipOverTruncatedText:]):
2851         (-[WKPreferences _showsToolTipOverTruncatedText]):
2852         (-[WKPreferences _setTextAreasAreResizable:]):
2853         (-[WKPreferences _textAreasAreResizable]):
2854         (-[WKPreferences _setUseGiantTiles:]):
2855         (-[WKPreferences _useGiantTiles]):
2856         (-[WKPreferences _setWantsBalancedSetDefersLoadingBehavior:]):
2857         (-[WKPreferences _wantsBalancedSetDefersLoadingBehavior]):
2858         (-[WKPreferences _setWebAudioEnabled:]):
2859         (-[WKPreferences _webAudioEnabled]):
2860         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2861
2862 2018-03-05  Carlos Garcia Campos  <cgarcia@igalia.com>
2863
2864         Automation: clicking on a disabled option element shouldn't produce an error
2865         https://bugs.webkit.org/show_bug.cgi?id=183284
2866
2867         Reviewed by Brian Burg.
2868
2869         This was expected by selenium, but the WebDriver spec says we should simply do nothing in those cases.
2870
2871         14.1 Element Click.
2872         https://w3c.github.io/webdriver/webdriver-spec.html#element-click
2873
2874         Fixes: imported/w3c/webdriver/tests/element_click/select.py::test_option_disabled
2875
2876         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2877         (WebKit::WebAutomationSessionProxy::selectOptionElement):
2878
2879 2018-03-05  Carlos Garcia Campos  <cgarcia@igalia.com>
2880
2881         Automation: stale elements not detected when removed from the DOM
2882         https://bugs.webkit.org/show_bug.cgi?id=183278
2883
2884         Reviewed by Brian Burg.
2885
2886         We detect stale elements when the page is reloaded because the maps are recreated, but if an element is removed
2887         from the DOM for the same document we keep the nodes in the maps. We should clear stale elements before
2888         accessing the maps.
2889
2890         Fixes: imported/selenium/py/test/selenium/webdriver/common/webdriverwait_tests.py::testExpectedConditionStalenessOf
2891
2892         * WebProcess/Automation/WebAutomationSessionProxy.js:
2893         (let.AutomationSessionProxy.prototype.evaluateJavaScriptFunction): Call _clearStaleNodes()
2894         (let.AutomationSessionProxy.prototype.nodeForIdentifier): Ditto.
2895         (let.AutomationSessionProxy.prototype._clearStaleNodes): Check if cached nodes are still in document and remove them
2896         from the maps if they aren't.
2897
2898 2018-03-04  Yusuke Suzuki  <utatane.tea@gmail.com>
2899
2900         [WTF] Move currentCPUTime and sleep(Seconds) to CPUTime.h and Seconds.h respectively
2901         https://bugs.webkit.org/show_bug.cgi?id=183312
2902
2903         Reviewed by Mark Lam.
2904
2905         Remove wtf/CurrentTime.h include pragma.
2906
2907         * NetworkProcess/NetworkResourceLoader.cpp:
2908         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
2909         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2910         * Platform/IPC/Connection.cpp:
2911         * Platform/unix/SharedMemoryUnix.cpp:
2912         * PluginProcess/WebProcessConnection.cpp:
2913         * Shared/ios/NativeWebTouchEventIOS.mm:
2914         * UIProcess/DrawingAreaProxyImpl.cpp:
2915         * UIProcess/ios/WKContentView.mm:
2916         * UIProcess/linux/MemoryPressureMonitor.cpp:
2917         * WebProcess/Gamepad/WebGamepad.cpp:
2918         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2919         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
2920         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
2921         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
2922         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
2923         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
2924         * WebProcess/WebProcess.cpp:
2925         * WebProcess/cocoa/WebProcessCocoa.mm:
2926         * WebProcess/gtk/WebProcessMainGtk.cpp:
2927         * WebProcess/win/WebProcessMainWin.cpp:
2928         * WebProcess/wpe/WebProcessMainWPE.cpp:
2929
2930 2018-03-02  Brian Burg  <bburg@apple.com>
2931
2932         Web Automation: script evaluations via WebDriver should have a user gesture indicator
2933         https://bugs.webkit.org/show_bug.cgi?id=183230
2934         <rdar://problem/37959739>
2935
2936         Reviewed by Andy Estes.
2937
2938         APIs that normally require a user gesture should just work when using via WebDriver.
2939         To support cases where tests need to simulate user actions with JavaScript, use a
2940         fake user gesture, similar to how -[WKWebView evaluateJavaScript:] forces a user
2941         gesture when clients evaluate JavaScript in their web view.
2942
2943         No new tests, this is covered by W3C tests that use the Fullscreen API.
2944         This API does nothing if there is no user gesture; with this patch, it just works.
2945
2946         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2947         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
2948
2949 2018-03-04  Tim Horton  <timothy_horton@apple.com>
2950
2951         Make !ENABLE(DATA_DETECTION) iOS build actually succeed
2952         https://bugs.webkit.org/show_bug.cgi?id=183283
2953         <rdar://problem/38062148>
2954
2955         Reviewed by Sam Weinig.
2956
2957         * UIProcess/ios/WKContentViewInteraction.mm:
2958         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
2959         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
2960         Guard some more code with ENABLE(DATA_DETECTION).
2961
2962 2018-03-04  Dan Bernstein  <mitz@apple.com>
2963
2964         Building with ONLY_ACTIVE_ARCH=NO and ARCHS=x86_64 fails
2965         https://bugs.webkit.org/show_bug.cgi?id=183320
2966
2967         Reviewed by Tim Horton.
2968
2969         * Configurations/PluginService.32.xcconfig: If the Apple build tool specifies
2970           RC_ARCHS=x86_64, then let the service build for x86_64, but don’t install it.
2971
2972 2018-03-03  Brent Fulgham  <bfulgham@apple.com>
2973
2974         Notify the NetworkProcess when a session is servicing an automation client
2975         https://bugs.webkit.org/show_bug.cgi?id=183306
2976         <rdar://problem/37835783>
2977
2978         Reviewed by Brian Burg.
2979
2980         Network loads servicing WebDriver are done through an ephemeral session. While this is great
2981         for protecting a developer's machine from sharing state with test runs, it has the unintended
2982         effect of blocking certain logging operations.
2983
2984         We do not log content in ephemeral sessions to protect user privacy. However, ephemeral sessions
2985         generated by WebDriver should participate in logging so that proper testing (with logging) can
2986         be done.
2987
2988         This patch signals the NetworkProcess when an ephemeral session (created for automation purposes)
2989         is created, so that it can allow logging.
2990
2991         * NetworkProcess/NetworkProcess.cpp:
2992         (WebKit::NetworkProcess::destroySession): Remove controlled-by-automation entry.
2993         (WebKit::NetworkProcess::sessionIsControlledByAutomation const): Added.
2994         (WebKit::NetworkProcess::setSessionIsControlledByAutomation): Added.
2995         * NetworkProcess/NetworkProcess.h:
2996         * NetworkProcess/NetworkProcess.messages.in:
2997         * NetworkProcess/NetworkResourceLoader.cpp:
2998         (WebKit::NetworkResourceLoader::isAlwaysOnLoggingAllowed const): Checks if the relevant session
2999         is servicing an automation client, and returns true if it is.
3000         * UIProcess/WebPageProxy.cpp:
3001         (WebKit::WebPageProxy::WebPageProxy): Signal the network process if this page is being created
3002         for an automation client.
3003
3004 2018-03-02  Yusuke Suzuki  <utatane.tea@gmail.com>
3005
3006         [WTF] Remove RunLoop and RunLoop::Timer's interface using double as seconds
3007         https://bugs.webkit.org/show_bug.cgi?id=183293
3008
3009         Reviewed by Alex Christensen.
3010
3011         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
3012         (WebKit::CompositingRunLoop::scheduleUpdate):
3013         (WebKit::CompositingRunLoop::compositionCompleted):
3014         (WebKit::CompositingRunLoop::updateCompleted):
3015         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
3016         (WebKit::ThreadedDisplayRefreshMonitor::dispatchDisplayRefreshCallback):
3017
3018 2018-03-02  Don Olmstead  <don.olmstead@sony.com>
3019
3020         Share common WebError implementation
3021         https://bugs.webkit.org/show_bug.cgi?id=183303
3022
3023         Reviewed by Ryosuke Niwa.
3024
3025         * Shared/WebErrors.cpp:
3026         (WebKit::cancelledError):
3027         (WebKit::fileDoesNotExistError):
3028         * Shared/glib/WebErrorsGlib.cpp: Removed.
3029         * SourcesGTK.txt:
3030         * SourcesWPE.txt:
3031
3032 2018-03-02  Youenn Fablet  <youenn@apple.com>
3033
3034         LayoutTest imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-within-sw.https.html is a flaky failure
3035         https://bugs.webkit.org/show_bug.cgi?id=179248
3036         <rdar://problem/35377756>
3037
3038         Reviewed by Chris Dumez.
3039
3040         In case we go up to the initializeSize step and Caches was cleared
3041         between the time we stated to initialize and the time we got there,
3042         we need to make as if Caches was not initialized,
3043         thus keeping m_isInitialized to false and m_storage to nullptr.
3044
3045         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
3046         (WebKit::CacheStorage::Caches::initializeSize):
3047
3048 2018-03-02  Youenn Fablet  <youenn@apple.com>
3049
3050         Clients should register to StorageProcess with their service worker registration identifier
3051         https://bugs.webkit.org/show_bug.cgi?id=182313
3052         <rdar://problem/38044403>
3053
3054         Reviewed by Chris Dumez.
3055
3056         Relanding.
3057
3058         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3059         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
3060         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3061         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
3062         * WebProcess/Storage/WebSWClientConnection.cpp:
3063         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
3064         * WebProcess/Storage/WebSWClientConnection.h:
3065
3066 2018-03-02  Tim Horton  <timothy_horton@apple.com>
3067
3068         Make it possible to disable WKPDFView
3069         https://bugs.webkit.org/show_bug.cgi?id=183281
3070         <rdar://problem/38060815>
3071
3072         Reviewed by Dan Bates.
3073
3074         * UIProcess/API/Cocoa/WKWebView.mm:
3075         (-[WKWebView _isBackground]):
3076         (-[WKWebView _isDisplayingPDF]):
3077         (-[WKWebView _dataForDisplayedPDF]):
3078         (-[WKWebView _suggestedFilenameForDisplayedPDF]):
3079         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
3080         (-[WKWebViewContentProviderRegistry init]):
3081         * UIProcess/ios/WKPDFView.h:
3082         * UIProcess/ios/WKPDFView.mm:
3083
3084 2018-03-02  Youenn Fablet  <youenn@apple.com>
3085
3086         WebProcessProxy should handle its completion handler at destruction time
3087         https://bugs.webkit.org/show_bug.cgi?id=183224
3088
3089         Reviewed by Brady Eidson.
3090
3091         * UIProcess/WebProcessProxy.cpp:
3092         (WebKit::WebProcessProxy::~WebProcessProxy):
3093         * UIProcess/WebProcessProxy.h:
3094
3095 2018-03-02  Brent Fulgham  <bfulgham@apple.com>
3096
3097         Update WebContent process sandbox IOKit properties
3098         https://bugs.webkit.org/show_bug.cgi?id=183269
3099         <rdar://problem/37853282>
3100
3101         Reviewed by Eric Carlson.
3102
3103         * WebProcess/com.apple.WebProcess.sb.in:
3104
3105 2018-03-01  Yusuke Suzuki  <utatane.tea@gmail.com>
3106
3107         Remove monotonicallyIncreasingTime
3108         https://bugs.webkit.org/show_bug.cgi?id=182911
3109
3110         Reviewed by Michael Catanzaro.
3111
3112         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
3113         (WebKit::CacheStorage::Cache::toRecordInformation):
3114         * Platform/IPC/ArgumentCoders.cpp:
3115         (IPC::ArgumentCoder<Seconds>::encode):
3116         (IPC::ArgumentCoder<Seconds>::decode):
3117         (IPC::ArgumentCoder<MonotonicTime>::encode):
3118         (IPC::ArgumentCoder<MonotonicTime>::decode):
3119         * Platform/IPC/ArgumentCoders.h:
3120         * Shared/Gamepad/GamepadData.cpp:
3121         (WebKit::GamepadData::GamepadData):
3122         * Shared/Gamepad/GamepadData.h:
3123         (WebKit::GamepadData::lastUpdateTime const):
3124         * Shared/WebCoreArgumentCoders.cpp:
3125         (IPC::ArgumentCoder<MonotonicTime>::encode): Deleted.
3126         (IPC::ArgumentCoder<MonotonicTime>::decode): Deleted.
3127         (IPC::ArgumentCoder<Seconds>::encode): Deleted.
3128         (IPC::ArgumentCoder<Seconds>::decode): Deleted.
3129         ArgumentCoders for MonotonicTime and Seconds are now used internally.
3130         Move them to Platform/IPC/ArgumentCoders.h.
3131
3132         * Shared/WebCoreArgumentCoders.h:
3133         * UIProcess/API/glib/IconDatabase.cpp:
3134         (WebKit::IconDatabase::iconDatabaseSyncThread):
3135         * UIProcess/DrawingAreaProxyImpl.cpp:
3136         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::start):
3137         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::stop):
3138         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::didDraw):
3139         * UIProcess/DrawingAreaProxyImpl.h:
3140         * UIProcess/Gamepad/UIGamepad.h:
3141         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
3142         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
3143         (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidStart):
3144         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
3145         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
3146         (WebKit::RemoteLayerTreeHost::animationDidStart):
3147         * WebProcess/WebPage/DrawingArea.h:
3148         (WebKit::DrawingArea::acceleratedAnimationDidStart):
3149         * WebProcess/WebPage/DrawingArea.messages.in:
3150         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h:
3151         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
3152         (mediaTimeToCurrentTime):
3153         (-[WKAnimationDelegate animationDidStart:]):
3154         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
3155         (WebKit::PlatformCALayerRemote::animationStarted):
3156         This argument `beginTime` is not CFTimeInverval actually. We add currentTimeToMediaTime
3157         conversion here to fix this issue.
3158
3159         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
3160         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
3161         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
3162         (WebKit::RemoteLayerTreeContext::animationDidStart):
3163         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
3164         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
3165         (WebKit::RemoteLayerTreeDrawingArea::acceleratedAnimationDidStart):
3166         * WebProcess/cocoa/WebProcessCocoa.mm:
3167         (WebKit::WebProcess::destroyRenderingResources):
3168
3169 2018-03-02  Brent Fulgham  <bfulgham@apple.com>
3170
3171         [iOS] whitelist missing AppleJPEG logging feature
3172         https://bugs.webkit.org/show_bug.cgi?id=183270
3173         <rdar://problem/37808612>
3174
3175         Reviewed by Alex Christensen.
3176
3177         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3178
3179 2018-03-02  Youenn Fablet  <youenn@apple.com>
3180
3181         IOChannel::read and IOChannel::write can destroy the completion handler in the thread used to manipulate thread
3182         https://bugs.webkit.org/show_bug.cgi?id=183261
3183
3184         Reviewed by Antti Koivisto.
3185
3186         Moving the completion handler when being called so that it gets desttroyed in the thread it is called.
3187
3188         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
3189         (WebKit::NetworkCache::IOChannel::read):
3190         (WebKit::NetworkCache::IOChannel::write):
3191
3192 2018-03-02  Dan Bernstein  <mitz@apple.com>
3193
3194         Safari uses WebContent.Development when loading injected bundle embedded in its app bundle
3195         https://bugs.webkit.org/show_bug.cgi?id=183275
3196
3197         Reviewed by Tim Horton.
3198
3199         * UIProcess/mac/WebProcessProxyMac.mm:
3200         (WebKit::WebProcessProxy::shouldAllowNonValidInjectedCode const): Return false if this is
3201           a platform binary. We can also return false unconditionally when building for any shipping
3202           major macOS release.
3203
3204 2018-03-01  Commit Queue  <commit-queue@webkit.org>
3205
3206         Unreviewed, rolling out r229153.
3207         https://bugs.webkit.org/show_bug.cgi?id=183274
3208
3209         it is breaking imported/w3c/web-platform-tests/service-workers
3210         /service-worker/clients-matchall-exact-controller.https.html
3211         (Requested by youenn on #webkit).
3212
3213         Reverted changeset:
3214
3215         "Clients should register to StorageProcess with their service
3216         worker registration identifier"
3217         https://bugs.webkit.org/show_bug.cgi?id=182313
3218         https://trac.webkit.org/changeset/229153
3219
3220 2018-03-01  Brent Fulgham  <bfulgham@apple.com>
3221
3222         Add the "com.apple.security.cs.disable-library-validation” entitlement to the Plugin Process
3223         https://bugs.webkit.org/show_bug.cgi?id=183252
3224         <rdar://problem/37887136>
3225
3226         Reviewed by David Kilzer.
3227
3228         * Configurations/PluginService.entitlements:
3229
3230 2018-03-01  Youenn Fablet  <youenn@apple.com>
3231
3232         Clients should register to StorageProcess with their service worker registration identifier
3233         https://bugs.webkit.org/show_bug.cgi?id=182313
3234
3235         Reviewed by Chris Dumez.
3236
3237         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3238         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
3239         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3240         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
3241         * WebProcess/Storage/WebSWClientConnection.cpp:
3242         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
3243         * WebProcess/Storage/WebSWClientConnection.h:
3244
3245 2018-03-01  Youenn Fablet  <youenn@apple.com>
3246
3247         LayoutTest imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-within-sw.https.html is a flaky failure
3248         https://bugs.webkit.org/show_bug.cgi?id=179248
3249         <rdar://problem/35377756>
3250
3251         Reviewed by Chris Dumez.
3252
3253         WebKitTestRunner is clearing caches for every test but there might still be some on-going cache activity due to a previous test.
3254         In that case, the activity might try to open the Caches object at the same time the files are deleted by the clearing task.
3255         If the new test is trying to open the same caches, it will also receive the same error, hence the console log message.
3256
3257         To fix that issue, we clear the initialization pending callbacks when clearing the caches.
3258         This prevents the new test to receive the error since the new test should only start some cache activity after the cache clear task is done.
3259         Made refactoring to append the first callback into the list of pending callbacks.
3260
3261         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
3262         (WebKit::CacheStorage::Caches::initialize):
3263         (WebKit::CacheStorage::Caches::initializeSize):
3264         (WebKit::CacheStorage::Caches::clear):
3265         * NetworkProcess/cache/CacheStorageEngineCaches.h:
3266
3267 2018-03-01  Youenn Fablet  <youenn@apple.com>
3268
3269         Add API test to validate setting of service worker and cache storage directories
3270         https://bugs.webkit.org/show_bug.cgi?id=182543
3271
3272         Reviewed by Chris Dumez.
3273
3274         Add cache engine directory path to its representation dump.
3275         This is used in API tests to check that the path is correctly set.
3276
3277         Add a way for to know whether a service worker was registered from a WKWebsiteDataStore.
3278         This is used in API tests to check that the path is correctly set.
3279
3280         * NetworkProcess/cache/CacheStorageEngine.cpp:
3281         (WebKit::CacheStorage::Engine::representation):
3282         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3283         (-[WKWebsiteDataStore _hasRegisteredServiceWorker]):
3284         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3285
3286 2018-03-01  Wenson Hsieh  <wenson_hsieh@apple.com>
3287
3288         Fix some errors due to some mach port APIs being unavailable on watchOS
3289         https://bugs.webkit.org/show_bug.cgi?id=183262
3290         <rdar://problem/38028521>
3291
3292         Reviewed by Tim Horton.
3293
3294         Minor build fix; mach_port_guard and mach_port_unguard are not available on this platform.
3295
3296         * Platform/IPC/mac/ConnectionMac.mm:
3297         (IPC::Connection::platformInvalidate):
3298         (IPC::Connection::platformInitialize):
3299         (IPC::Connection::open):
3300
3301 2018-03-01  Per Arne Vollan  <pvollan@apple.com>
3302
3303         Unreviewed build fix after r229140.
3304
3305         * WebProcess/cocoa/WebProcessCocoa.mm:
3306
3307 2018-03-01  Per Arne Vollan  <pvollan@apple.com>
3308
3309         Scrollbar preferences are ignored when the WebContent process doesn't have access to the WindowServer.
3310         https://bugs.webkit.org/show_bug.cgi?id=183231
3311         <rdar://problem/37793457>
3312
3313         Reviewed by Brent Fulgham.
3314
3315         When the WebContent process doesn't have access to the WindowServer, the scrollbars are always of the overlay type.
3316         The notification about scrollbar preferences is never received by the WebContent process when there is no
3317         WindowServer access. This can be fixed by adding an observer of scrollbar preferences in the UI process, and
3318         notifying the WebProcess about this by sending it a message. This message should also contain the preferred
3319         scrollbar type, since the call '[NSScroller preferredScrollerStyle]' will always return the overlay style when
3320         there is no WindowServer access.
3321
3322         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3323         (WebKit::WebProcessPool::registerNotificationObservers):
3324         (WebKit::WebProcessPool::unregisterNotificationObservers):
3325         * UIProcess/WebProcessPool.h:
3326         * WebProcess/WebProcess.cpp:
3327         (WebKit::WebProcess::initializeProcess):
3328         * WebProcess/WebProcess.h:
3329         * WebProcess/WebProcess.messages.in:
3330         * WebProcess/cocoa/WebProcessCocoa.mm:
3331         (WebKit::WebProcess::scrollerStylePreferenceChanged):
3332
3333 2018-03-01  Antti Koivisto  <antti@apple.com>
3334
3335         Crash when updating cache entry after validation in apps that uses class A file protection
3336         https://bugs.webkit.org/show_bug.cgi?id=183242
3337         <rdar://problem/33289058>
3338
3339         Reviewed by Chris Dumez.
3340
3341         When validating a cache entry, we keep it alive until we get a network response. With 304 response
3342         we then update the headers of this existing entry. This accesses the body data of the entry which
3343         may be backed by a mapped file. If the app uses class A protection, user might have locked
3344         the device and the entry might have become inaccessible, leading to a crash.
3345
3346         * NetworkProcess/cache/NetworkCacheEntry.cpp:
3347         (WebKit::NetworkCache::Entry::setNeedsValidation):
3348
3349         In case of class A protection, pull the data to a memory buffer immediately before starting a revalidation request.
3350         This makes the window where the file could become inaccessible much shorter (since it no longer depends on network).
3351
3352 2018-03-01  Carlos Garcia Campos  <cgarcia@igalia.com>
3353
3354         REGRESSION(r221514): [GTK] UI process crash in WebKit::WaylandCompositor::Surface::flushPendingFrameCallbacks
3355         https://bugs.webkit.org/show_bug.cgi?id=183091
3356
3357         Reviewed by Michael Catanzaro.
3358
3359         Invalidate the surface in the page map when the backing store is destroyed.
3360
3361         * UIProcess/gtk/WaylandCompositor.cpp:
3362         (WebKit::WaylandCompositor::willDestroySurface):
3363         * UIProcess/gtk/WaylandCompositor.h:
3364
3365 2018-02-28  Brian Burg  <bburg@apple.com>
3366
3367         [Cocoa] Web Automation: provide a way to ask clients the type of a JavaScript dialog
3368         https://bugs.webkit.org/show_bug.cgi?id=182660
3369         <rdar://problem/37408183>
3370
3371         Reviewed by Tim Horton and Carlos Garcia Campos.
3372
3373         Add another delegate method to ask what type of dialog is being shown.
3374         This is used to implement §18.4 Step 5, where sending text to a dialog
3375         without a prompt will return several different kinds of errors.
3376
3377         No new tests, covered by web platform tests once Safari side has landed.
3378
3379         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h: Update FIXME radar numbers.
3380         * UIProcess/Cocoa/AutomationSessionClient.h:
3381         * UIProcess/Cocoa/AutomationSessionClient.mm:
3382         (WebKit::AutomationSessionClient::AutomationSessionClient):
3383         (WebKit::toImpl):
3384         (WebKit::AutomationSessionClient::typeOfCurrentJavaScriptDialogOnPage):
3385         If there is no current dialog to be checked, the client can return the 'None'
3386         type. This gets converted into a std::nullopt and causes a command error later.
3387
3388 2018-02-28  John Wilander  <wilander@apple.com>
3389
3390         Remove assertion from ResourceLoadStatisticsClassifier::calculateResourcePrevalence() which causes crashes when domains are explicitly set as prevalent without the associated statistics
3391         https://bugs.webkit.org/show_bug.cgi?id=183233
3392
3393         Unreviewed removal of an assertion that's causing layout test crashes.
3394
3395         * Platform/classifier/ResourceLoadStatisticsClassifier.cpp:
3396         (WebKit::ResourceLoadStatisticsClassifier::calculateResourcePrevalence):
3397             Removed ASSERT(currentPrevalence == Low).
3398
3399 2018-02-28  John Wilander  <wilander@apple.com>
3400
3401         Add a second tier of prevalence to facilitate telemetry on very prevalent domains
3402         https://bugs.webkit.org/show_bug.cgi?id=183218
3403         <rdar://problem/37992388>
3404
3405         Reviewed by Brent Fulgham.
3406
3407         * Platform/classifier/ResourceLoadStatisticsClassifier.cpp:
3408         (WebKit::vectorLength):
3409             New convenience function.
3410         (WebKit::ResourceLoadStatisticsClassifier::calculateResourcePrevalence):
3411             Renamed from ResourceLoadStatisticsClassifier::hasPrevalentResourceCharacteristics().
3412             Now returns a value from the enum ResourceLoadPrevalence.
3413         (WebKit::ResourceLoadStatisticsClassifier::classifyWithVectorThreshold):
3414             Now uses the new vectorLength() convenience function.
3415         (WebKit::ResourceLoadStatisticsClassifier::hasPrevalentResourceCharacteristics): Deleted.
3416             Renamed to ResourceLoadStatisticsClassifier::calculateResourcePrevalence().
3417         * Platform/classifier/ResourceLoadStatisticsClassifier.h:
3418             Added enum ResourceLoadPrevalence.
3419         * Shared/WebCoreArgumentCoders.cpp:
3420         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
3421         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
3422             Handling of the new boolean field isVeryPrevalentResource.
3423         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3424         (WKWebsiteDataStoreSetStatisticsVeryPrevalentResource):
3425         (WKWebsiteDataStoreIsStatisticsVeryPrevalentResource):
3426             Test infrastructure.
3427         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3428         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3429         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
3430         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
3431         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
3432         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
3433         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
3434             All of these are for handling of the two-tier classification.
3435             Also bumped the statisticsModelVersion to 12.
3436         * UIProcess/WebResourceLoadStatisticsStore.h: