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