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