Fix for crash in AppKit accessibility.
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2020-01-28  Andres Gonzalez  <andresg_22@apple.com>
2
3         Fix for crash in AppKit accessibility.
4         https://bugs.webkit.org/show_bug.cgi?id=206902
5
6         Reviewed by Chris Fleizach.
7
8         Accessibility methods invoked in the secondary thread that Return id
9         values retrieved from the main thread, need to retain/autoRelease the returned ids.
10
11         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
12         (-[WKAccessibilityWebPageObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
13         (-[WKAccessibilityWebPageObject accessibilityAttributeSizeValue]):
14         (-[WKAccessibilityWebPageObject accessibilityAttributePositionValue]):
15         (-[WKAccessibilityWebPageObject accessibilityDataDetectorValue:point:]):
16
17 2020-01-28  Brent Fulgham  <bfulgham@apple.com>
18
19         Unreviewed test fix after r255217
20
21         Re-activate SecurityServer mach port access in Catalina and older.
22
23         * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
24         * WebProcess/com.apple.WebProcess.sb.in:
25
26 2020-01-28  Brent Fulgham  <bfulgham@apple.com>
27
28         Reset the application bundle identifier between test runs
29         https://bugs.webkit.org/show_bug.cgi?id=206858
30         <rdar://problem/58844002>
31
32         Reviewed by Per Arne Vollan.
33
34         Clear the application bundle identifier set during testing when resetting the test system
35         to a known state in preparation for the next run.
36
37         Tests: fast/sandbox/ios/sandbox-mach-lookup.html, fast/sandbox/ios/sandbox-mach-lookup-mail.html
38
39         * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
40         * UIProcess/API/Cocoa/WKWebViewTesting.mm:
41         (+[WKWebView _clearApplicationBundleIdentifierTestingOverride]): Added.
42
43 2020-01-24  Sergio Villar Senin  <svillar@igalia.com>
44
45         Remove WebVR from the tree
46         https://bugs.webkit.org/show_bug.cgi?id=206739
47
48         Reviewed by Darin Adler.
49
50         * Shared/WebPreferences.yaml: removed WebVR preference.
51
52 2020-01-28  youenn fablet  <youenn@apple.com>
53
54         Remove unneeded message checks in GPUProcess code
55         https://bugs.webkit.org/show_bug.cgi?id=206866
56
57         Reviewed by Eric Carlson.
58
59         Remove message check macros and checks since they are not needed due to the use of ObjectIdentifier.
60         No change of behavior.
61
62         * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
63         (WebKit::RemoteMediaPlayerManagerProxy::createMediaPlayer):
64         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
65
66 2020-01-27  Antoine Quint  <graouts@apple.com>
67
68         [Web Animations] Make Animation.timeline read-write only if a runtime flag is enabled
69         https://bugs.webkit.org/show_bug.cgi?id=206173
70         <rdar://problem/58527432>
71
72         Reviewed by Dean Jackson.
73
74         Add a new WebAnimationsMutableTimelines runtime flag.
75
76         * Shared/WebPreferences.yaml:
77
78 2020-01-28  Carlos Garcia Campos  <cgarcia@igalia.com>
79
80         [GTK][WPE] QR code not loaded in web.whatsapp.com
81         https://bugs.webkit.org/show_bug.cgi?id=203404
82
83         Reviewed by Michael Catanzaro.
84
85         This is a regression of the switch to use libsoup API for the WebSockets implementation. The QR code is loaded
86         using a WebSocket connection, but the server is always replying with a 400 Bad Request to the Upgrade requests
87         coming from an existing HTTP connection. We need to ensure a new dedicated connection is used for WebSockets.
88
89         * NetworkProcess/soup/WebSocketTaskSoup.cpp:
90         (WebKit::WebSocketTask::WebSocketTask): Set the SOUP_MESSAGE_NEW_CONNECTION flag to the SoupMessage before
91         starting the connection.
92
93 2020-01-27  Carlos Garcia Campos  <cgarcia@igalia.com>
94
95         [GTK] Remote Inspector: add support for service workers targets
96         https://bugs.webkit.org/show_bug.cgi?id=206821
97
98         Reviewed by Žan Doberšek.
99
100         Add support for debugging service workers.
101
102         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
103         (WebKit::RemoteInspectorProtocolHandler::handleRequest): Pass target type to message handler too.
104         (WebKit::RemoteInspectorProtocolHandler::inspect): Pass the received target type to the client.
105         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.h:
106         * UIProcess/glib/RemoteInspectorClient.cpp:
107         (WebKit::RemoteInspectorProxy::load): It now receives the debuggable type that is set to the API::DebuggableInfo.
108         (WebKit::RemoteInspectorClient::messageHandlers): Handle service worker targets too.
109         (WebKit::debuggableType): Helper to convert the target type to debuggable type.
110         (WebKit::RemoteInspectorClient::inspect): Pass the debuggable tupe to RemoteInspectorProxy::load().
111         * UIProcess/glib/RemoteInspectorClient.h:
112         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
113         (WebKit::WebInspectorProxy::infoForLocalDebuggable): Use WebPage as debuggable type instead of the default.
114
115 2020-01-27  Simon Fraser  <simon.fraser@apple.com>
116
117         REGRESSION (r253634): cricbuzz.com media controls vanish depending on page scale
118         https://bugs.webkit.org/show_bug.cgi?id=206788
119         rdar://problem/58780584
120
121         Reviewed by Tim Horton.
122
123         r253634 changed "delegatesPageScaling"'" to a flag on ScrollView. However, this changed behavior
124         for subframes; Settings are propagated down, but only the main ScrollView had delegatesPageScaling
125         set on it.
126         
127         "delegatesPageScaling" is a page-level thing (subframes don't independently zoom), so it
128         should live on Page. Move it there.
129         
130         The bug was triggered by incorrectly taking page scale into account for rects in the compositing
131         overlap map (see RenderLayerCompositor::addToOverlapMap()) in subframes, and those rects
132         changing on zoom.
133
134         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
135         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
136         * WebProcess/WebPage/ios/FindControllerIOS.mm:
137         (WebKit::FindIndicatorOverlayClientIOS::drawRect):
138
139 2020-01-27  Fujii Hironori  <Hironori.Fujii@sony.com>
140
141         [WinCairo][curl] ASSERTION FAILED: sessionID != PAL::SessionID::defaultSessionID() in WebKit::CacheStorage::Engine::destroyEngine since r255137
142         https://bugs.webkit.org/show_bug.cgi?id=206859
143
144         Reviewed by Don Olmstead.
145
146         After r255137, WinCairo debug WK2 is still failing an assertion
147         while shutdown, which is ensuring the destructing session isn't
148         the default session.
149
150         * NetworkProcess/cache/CacheStorageEngine.cpp:
151         (WebKit::CacheStorage::Engine::destroyEngine): Conditioned out the
152         assertion for curl port as well as Soup port does.
153
154 2020-01-27  David Quesada  <david_quesada@apple.com>
155
156         Support observing a different set of view service state notifications in ApplicationStateTracker
157         https://bugs.webkit.org/show_bug.cgi?id=201737
158         rdar://problem/54786414
159
160         Reviewed by Chris Dumez.
161
162         * UIProcess/ApplicationStateTracker.mm:
163         Make ApplicationStateTracker conditionally (based on a flag to be defined in WebKitAdditions)
164         use a different pair of notifications when it is in a view service or extension. These
165         notifications report state changes of the individual scene that hosts the web view, rather
166         than the state of the overall host application. This allows for more accurate state tracking
167         for web views in extensions or view services hosted by apps with multiple open scenes.
168
169 2020-01-27  Alex Christensen  <achristensen@webkit.org>
170
171         Add WKWebView SPI equivalent of WKView.shouldClipToVisibleRect
172         https://bugs.webkit.org/show_bug.cgi?id=206849
173         <rdar://problem/58887004>
174
175         Reviewed by Simon Fraser.
176
177         Books currently uses WKView.setShouldClipToVisibleRect and needs to migrate to WKWebView, but it needs to do
178         so without modifying the other properties in _setMinimumLayoutWidth, which is currently the only other caller
179         of WebViewImpl::setClipsToVisibleRect.  Expose an SPI that only calls WebViewImpl::setClipsToVisibleRect.
180
181         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
182         * UIProcess/API/mac/WKWebViewMac.mm:
183         (-[WKWebView _clipsToVisibleRect]):
184         (-[WKWebView _setClipsToVisibleRect:]):
185
186 2020-01-27  Brent Fulgham  <bfulgham@apple.com>
187
188         Remove SecurityServer from WebContent sandboxes
189         https://bugs.webkit.org/show_bug.cgi?id=206832
190         <rdar://problem/46235370>
191
192         Reviewed by Per Arne Vollan.
193
194         We no longer need access to 'com.apple.SecurityServer' and
195         'com.apple.ocspd' on recent macaOS systems.
196
197         Tested by existing test suite.
198
199         * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
200         * WebProcess/com.apple.WebProcess.sb.in:
201
202 2020-01-27  Devin Rousso  <drousso@apple.com>
203
204         Web Inspector: consolidate UIProcess/WebProcess files into Inspector folders
205         https://bugs.webkit.org/show_bug.cgi?id=206721
206
207         Reviewed by Alex Christensen and Don Olmstead.
208
209         * CMakeLists.txt:
210         * DerivedSources-input.xcfilelist:
211         * DerivedSources.make:
212         * PlatformGTK.cmake:
213         * PlatformMac.cmake:
214         * PlatformFTW.cmake:
215         * PlatformWin.cmake:
216         * Sources.txt:
217         * SourcesCocoa.txt:
218         * SourcesGTK.txt:
219         * WebKit.xcodeproj/project.pbxproj:
220
221         * UIProcess/Inspector/InspectorTargetProxy.h: Renamed from Source/WebKit/UIProcess/InspectorTargetProxy.h.
222         * UIProcess/Inspector/InspectorTargetProxy.cpp: Renamed from Source/WebKit/UIProcess/InspectorTargetProxy.cpp.
223         * UIProcess/Inspector/RemoteWebInspectorProxy.messages.in: Renamed from Source/WebKit/UIProcess/RemoteWebInspectorProxy.messages.in.
224         * UIProcess/Inspector/RemoteWebInspectorProxy.h: Renamed from Source/WebKit/UIProcess/RemoteWebInspectorProxy.h.
225         * UIProcess/Inspector/RemoteWebInspectorProxy.cpp: Renamed from Source/WebKit/UIProcess/RemoteWebInspectorProxy.cpp.
226         * UIProcess/Inspector/WebInspectorProxy.messages.in: Renamed from Source/WebKit/UIProcess/WebInspectorProxy.messages.in.
227         * UIProcess/Inspector/WebInspectorProxy.h: Renamed from Source/WebKit/UIProcess/WebInspectorProxy.h.
228         * UIProcess/Inspector/WebInspectorProxy.cpp: Renamed from Source/WebKit/UIProcess/WebInspectorProxy.cpp.
229         * UIProcess/Inspector/WebInspectorUtilities.h: Renamed from Source/WebKit/UIProcess/WebInspectorUtilities.h.
230         * UIProcess/Inspector/WebInspectorUtilities.cpp: Renamed from Source/WebKit/UIProcess/WebInspectorUtilities.cpp.
231         * UIProcess/Inspector/WebPageDebuggable.h: Renamed from Source/WebKit/UIProcess/WebPageDebuggable.h.
232         * UIProcess/Inspector/WebPageDebuggable.cpp: Renamed from Source/WebKit/UIProcess/WebPageDebuggable.cpp.
233         * UIProcess/Inspector/WebPageInspectorController.h: Renamed from Source/WebKit/UIProcess/WebPageInspectorController.h.
234         * UIProcess/Inspector/WebPageInspectorController.cpp: Renamed from Source/WebKit/UIProcess/WebPageInspectorController.cpp.
235         * UIProcess/Inspector/glib/RemoteInspectorClient.h: Renamed from Source/WebKit/UIProcess/glib/RemoteInspectorClient.h.
236         * UIProcess/Inspector/glib/RemoteInspectorClient.cpp: Renamed from Source/WebKit/UIProcess/glib/RemoteInspectorClient.cpp.
237         * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp: Renamed from Source/WebKit/UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp.
238         * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp: Renamed from Source/WebKit/UIProcess/gtk/WebInspectorProxyGtk.cpp.
239         * UIProcess/Inspector/gtk/WebInspectorProxyClient.h: Renamed from Source/WebKit/UIProcess/gtk/WebInspectorProxyClient.h.
240         * UIProcess/Inspector/gtk/WebKitInspectorWindow.h: Renamed from Source/WebKit/UIProcess/gtk/WebKitInspectorWindow.h.
241         * UIProcess/Inspector/gtk/WebKitInspectorWindow.cpp: Renamed from Source/WebKit/UIProcess/gtk/WebKitInspectorWindow.cpp.
242         * UIProcess/Inspector/ios/WKInspectorHighlightView.h: Renamed from Source/WebKit/UIProcess/WKInspectorHighlightView.h.
243         * UIProcess/Inspector/ios/WKInspectorHighlightView.mm: Renamed from Source/WebKit/UIProcess/WKInspectorHighlightView.mm.
244         * UIProcess/Inspector/ios/WKInspectorNodeSearchGestureRecognizer.h: Renamed from Source/WebKit/UIProcess/ios/WKInspectorNodeSearchGestureRecognizer.h.
245         * UIProcess/Inspector/ios/WKInspectorNodeSearchGestureRecognizer.mm: Renamed from Source/WebKit/UIProcess/ios/WKInspectorNodeSearchGestureRecognizer.mm.
246         * UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm: Renamed from Source/WebKit/UIProcess/mac/RemoteWebInspectorProxyMac.mm.
247         * UIProcess/Inspector/mac/WKInspectorViewController.h: Renamed from Source/WebKit/UIProcess/mac/WKInspectorViewController.h.
248         * UIProcess/Inspector/mac/WKInspectorViewController.mm: Renamed from Source/WebKit/UIProcess/mac/WKInspectorViewController.mm.
249         * UIProcess/Inspector/mac/WKInspectorWKWebView.h: Renamed from Source/WebKit/UIProcess/mac/WKInspectorWKWebView.h.
250         * UIProcess/Inspector/mac/WKInspectorWKWebView.mm: Renamed from Source/WebKit/UIProcess/mac/WKInspectorWKWebView.mm.
251         * UIProcess/Inspector/mac/WebInspectorProxyMac.mm: Renamed from Source/WebKit/UIProcess/mac/WebInspectorProxyMac.mm.
252         * UIProcess/Inspector/socket/RemoteInspectorClient.h: Renamed from Source/WebKit/UIProcess/socket/RemoteInspectorClient.h.
253         * UIProcess/Inspector/socket/RemoteInspectorClient.cpp: Renamed from Source/WebKit/UIProcess/socket/RemoteInspectorClient.cpp.
254         * UIProcess/Inspector/socket/RemoteInspectorProtocolHandler.h: Renamed from Source/WebKit/UIProcess/socket/RemoteInspectorProtocolHandler.h.
255         * UIProcess/Inspector/socket/RemoteInspectorProtocolHandler.cpp: Renamed from Source/WebKit/UIProcess/socket/RemoteInspectorProtocolHandler.cpp.
256         * UIProcess/Inspector/win/RemoteWebInspectorProxyWin.cpp: Renamed from Source/WebKit/UIProcess/win/RemoteWebInspectorProxyWin.cpp.
257         * UIProcess/Inspector/win/WebInspectorProxyWin.cpp: Renamed from Source/WebKit/UIProcess/win/WebInspectorProxyWin.cpp.
258
259         * WebProcess/Inspector/RemoteWebInspectorUI.messages.in: Renamed from Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.messages.in.
260         * WebProcess/Inspector/RemoteWebInspectorUI.h: Renamed from Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.h.
261         * WebProcess/Inspector/RemoteWebInspectorUI.cpp: Renamed from Source/WebKit/WebProcess/WebPage/RemoteWebInspectorUI.cpp.
262         * WebProcess/Inspector/WebInspector.messages.in: Renamed from Source/WebKit/WebProcess/WebPage/WebInspector.messages.in.
263         * WebProcess/Inspector/WebInspector.h: Renamed from Source/WebKit/WebProcess/WebPage/WebInspector.h.
264         * WebProcess/Inspector/WebInspector.cpp: Renamed from Source/WebKit/WebProcess/WebPage/WebInspector.cpp.
265         * WebProcess/Inspector/WebInspectorClient.h: Renamed from Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.h.
266         * WebProcess/Inspector/WebInspectorClient.cpp: Renamed from Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp.
267         * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.h: Renamed from Source/WebKit/WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.h.
268         * WebProcess/Inspector/WebInspectorFrontendAPIDispatcher.cpp: Renamed from Source/WebKit/WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.cpp.
269         * WebProcess/Inspector/WebInspectorInterruptDispatcher.messages.in: Renamed from Source/WebKit/WebProcess/WebPage/WebInspectorInterruptDispatcher.messages.in.
270         * WebProcess/Inspector/WebInspectorInterruptDispatcher.h: Renamed from Source/WebKit/WebProcess/WebPage/WebInspectorInterruptDispatcher.h.
271         * WebProcess/Inspector/WebInspectorInterruptDispatcher.cpp: Renamed from Source/WebKit/WebProcess/WebPage/WebInspectorInterruptDispatcher.cpp.
272         * WebProcess/Inspector/WebInspectorUI.messages.in: Renamed from Source/WebKit/WebProcess/WebPage/WebInspectorUI.messages.in.
273         * WebProcess/Inspector/WebInspectorUI.h: Renamed from Source/WebKit/WebProcess/WebPage/WebInspectorUI.h.
274         * WebProcess/Inspector/WebInspectorUI.cpp: Renamed from Source/WebKit/WebProcess/WebPage/WebInspectorUI.cpp.
275         * WebProcess/Inspector/WebPageInspectorTarget.h: Renamed from Source/WebKit/WebProcess/WebPage/WebPageInspectorTarget.h.
276         * WebProcess/Inspector/WebPageInspectorTarget.cpp: Renamed from Source/WebKit/WebProcess/WebPage/WebPageInspectorTarget.cpp.
277         * WebProcess/Inspector/WebPageInspectorTargetController.h: Renamed from Source/WebKit/WebProcess/WebPage/WebPageInspectorTargetController.h.
278         * WebProcess/Inspector/WebPageInspectorTargetController.cpp: Renamed from Source/WebKit/WebProcess/WebPage/WebPageInspectorTargetController.cpp.
279         * WebProcess/Inspector/WebPageInspectorTargetFrontendChannel.h: Renamed from Source/WebKit/WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h.
280         * WebProcess/Inspector/WebPageInspectorTargetFrontendChannel.cpp: Renamed from Source/WebKit/WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp.
281         * WebProcess/Inspector/gtk/WebInspectorUIGtk.cpp: Renamed from Source/WebKit/WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp.
282         * WebProcess/Inspector/mac/WebInspectorUIMac.mm: Renamed from Source/WebKit/WebProcess/WebPage/mac/WebInspectorUIMac.mm.
283         * WebProcess/Inspector/win/WebInspectorUIWin.mm: Renamed from Source/WebKit/WebProcess/WebPage/win/WebInspectorUIWin.mm.
284
285         * UIProcess/API/APIAttachment.h:
286         * UIProcess/API/Cocoa/WKWebViewTesting.mm:
287         Add some missing includes.
288
289 2020-01-27  Chris Dumez  <cdumez@apple.com>
290
291         Unreviewed, drop unused MESSAGE_CHECK_CONTEXTID() macro in UserMediaCaptureManagerProxy.cpp.
292
293         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
294
295 2020-01-27  Devin Rousso  <drousso@apple.com>
296
297         Web Inspector: unable to evaluate in the isolated world of content scripts injected by safari app extensions
298         https://bugs.webkit.org/show_bug.cgi?id=206110
299         <rdar://problem/16945643>
300
301         Reviewed by Timothy Hatcher, Joseph Pecoraro, and Brian Burg.
302
303         In addition to evaluating in subframe execution contexts, add the ability for Web Inspector
304         to evaluate in non-normal isolated worlds.
305
306         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.h:
307         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
308         (WebKit::InjectedBundleScriptWorld::create):
309
310         * WebProcess/UserContent/WebUserContentController.cpp:
311         (WebKit::WebUserContentController::addUserContentWorlds):
312         * WebProcess/InjectedBundle/API/glib/WebKitScriptWorld.cpp:
313         (webkit_script_world_new):
314         (webkit_script_world_new_with_name):
315         Treat isolated worlds created by API calls as `User` worlds.
316
317 2020-01-27  Chris Dumez  <cdumez@apple.com>
318
319         Unreviewed, revert r253984 as it appears to be causing assertion leaks.
320         https://bugs.webkit.org/show_bug.cgi?id=205687
321
322         * Configurations/WebKit.xcconfig:
323         * Platform/spi/ios/RunningBoardServicesSPI.h: Removed.
324         * Scripts/process-entitlements.sh:
325         * Shared/DependencyProcessAssertion.cpp: Removed.
326         * Shared/DependencyProcessAssertion.h: Removed.
327         * Shared/NativeWebTouchEvent.h:
328         * Shared/ios/DependencyProcessAssertionIOS.mm: Removed.
329         * Sources.txt:
330         * SourcesCocoa.txt:
331         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
332         (WebKit::WebProcessProxy::processWasResumed):
333         * UIProcess/WebProcessProxy.h:
334         * UIProcess/WebProcessProxy.messages.in:
335         * WebKit.xcodeproj/project.pbxproj:
336         * WebProcess/WebProcess.cpp:
337         (WebKit::WebProcess::initializeConnection):
338         * WebProcess/WebProcess.h:
339         * WebProcess/cocoa/WebProcessCocoa.mm:
340         (WebKit::WebProcess::processTaskStateDidChange):
341         (WebKit::WebProcess::releaseProcessWasResumedAssertions):
342
343 2020-01-27  Jiewen Tan  <jiewen_tan@apple.com>
344
345         Unreviewed, a build fix after r255111
346
347         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
348         Adding some missing headers.
349
350 2020-01-27  Chris Dumez  <cdumez@apple.com>
351
352         Unreviewed, revert r254210 as it seems to be causing process assertion leaks.
353         https://bugs.webkit.org/show_bug.cgi?id=205836
354
355         * Shared/AuxiliaryProcess.cpp:
356         (WebKit::AuxiliaryProcess::initializeConnection):
357         * Shared/AuxiliaryProcess.h:
358         * WebProcess/WebProcess.cpp:
359         (WebKit::WebProcess::initializeConnection):
360         * WebProcess/WebProcess.h:
361
362 2020-01-27  Brent Fulgham  <bfulgham@apple.com>
363
364         Remove last bits of location services rules
365         https://bugs.webkit.org/show_bug.cgi?id=206023
366         <rdar://problem/58452505>
367
368         Reviewed by Per Arne Vollan.
369
370         Remove the user preferences that were allowed by the sandbox back when location services
371         were used in the process.
372
373         * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
374         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
375
376 2020-01-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
377
378         Throttling requestAnimationFrame should be controlled by RenderingUpdateScheduler
379         https://bugs.webkit.org/show_bug.cgi?id=204713
380
381         Reviewed by Simon Fraser.
382
383         Create an IPC message on the DrawingArea to send a message from the
384         WebProcess to the UIProcess to setPreferredFramesPerSecond of the
385         DisplayRefreshMonitor.
386
387         * Shared/WebPreferences.yaml:
388         * UIProcess/API/C/WKPreferences.cpp:
389         (WKPreferencesSetRenderingUpdateThrottlingEnabled):
390         (WKPreferencesGetRenderingUpdateThrottlingEnabled):
391         * UIProcess/API/C/WKPreferencesRefPrivate.h:
392         Add a WKPreference key for RenderingUpdateThrottlingEnabled.
393
394         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
395         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in:
396
397         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
398         (-[WKOneShotDisplayLinkHandler setPreferredFramesPerSecond:]):
399         (WebKit::RemoteLayerTreeDrawingAreaProxy::setPreferredFramesPerSecond):
400         Set the preferredFramesPerSecond of the CADisplayLink.
401
402         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h:
403         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
404         (WebKit::RemoteLayerTreeDisplayRefreshMonitor::setPreferredFramesPerSecond):
405         Delegate the call to RemoteLayerTreeDrawingArea.
406
407         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
408         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
409         (WebKit::RemoteLayerTreeDrawingArea::setPreferredFramesPerSecond):
410         Send the IPC message from the WebProcess to the UIProcess.
411
412 2020-01-27  Kate Cheney  <katherine_cheney@apple.com>
413
414         Delete the ITP storage file that is not being used (plist or database file) when switching to a new storage type
415         https://bugs.webkit.org/show_bug.cgi?id=206601
416         <rdar://problem/58696521>
417
418         Reviewed by Alex Christensen.
419
420         This patch also deletes the temporary files SQLite creates when
421         constructing a new database.
422
423         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
424         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
425
426 2020-01-27  Brent Fulgham  <bfulgham@apple.com>
427
428         Remove locationd entitlements from the WebContent process
429         https://bugs.webkit.org/show_bug.cgi?id=206022
430         <rdar://problem/58452443>
431
432         Reviewed by Per Arne Vollan.
433
434         Now that we have removed mach connections related to 'com.apple.locationd', we should also
435         remove the process entitlements.
436         
437         No new tests. There are no changes to behavior.
438
439         * Scripts/process-entitlements.sh:
440
441 2020-01-27  Ryan Haddad  <ryanhaddad@apple.com>
442
443         Unreviewed, rolling out r255131.
444
445         Caused assertion failures on iOS debug bots.
446
447         Reverted changeset:
448
449         "Throttling requestAnimationFrame should be controlled by
450         RenderingUpdateScheduler"
451         https://bugs.webkit.org/show_bug.cgi?id=204713
452         https://trac.webkit.org/changeset/255131
453
454 2020-01-27  Chris Dumez  <cdumez@apple.com>
455
456         NetworkProcessProxy: MESSAGE_CHECK identifiers sent over IPC
457         https://bugs.webkit.org/show_bug.cgi?id=206814
458         <rdar://problem/58783422>
459
460         Reviewed by David Kilzer.
461
462         MESSAGE_CHECK identifiers sent over IPC in NetworkProcessProxy class.
463
464         * UIProcess/Network/NetworkProcessProxy.cpp:
465         (WebKit::NetworkProcessProxy::didFetchWebsiteData):
466         (WebKit::NetworkProcessProxy::didDeleteWebsiteData):
467         (WebKit::NetworkProcessProxy::didDeleteWebsiteDataForOrigins):
468
469 2020-01-26  Fujii Hironori  <Hironori.Fujii@sony.com>
470
471         [WinCairo][curl] ASSERTION FAILED: sessionID != PAL::SessionID::defaultSessionID() in NetworkProcess since r255067
472         https://bugs.webkit.org/show_bug.cgi?id=206817
473
474         Reviewed by Darin Adler.
475
476         Since r255067 (Bug 206700), the assertion is failing in
477         NetworkProcess::destroySession while shutdown, which is ensuring
478         the destructing session isn't the default session.
479
480         Covered by existing tests.
481
482         * NetworkProcess/NetworkProcess.cpp:
483         (WebKit::NetworkProcess::destroySession): Conditioned out the
484         assertion for curl port as well as Soup port does.
485
486 2020-01-26  Chris Dumez  <cdumez@apple.com>
487
488         Frequent sync BackForwardBackListCount/BackForwardForwardListCount IPC on reddit.com
489         https://bugs.webkit.org/show_bug.cgi?id=206438
490
491         Reviewed by Darin Adler.
492
493         Frequent sync BackForwardBackListCount/BackForwardForwardListCount IPC on reddit.com. When scrolling on reddit.com,
494         you frequently see 2 consecutive sync IPCs (WebPageProxy::BackForwardBackListCount then WebPageProxy::BackForwardForwardListCount)
495         from the WebContent process to the UIProcess. Those are bad for performance. This happens every time the script on the page accesses
496         history.length, which is unfortunate, since this history length rarely changes.
497
498         To address the issue, the following changes were made:
499         1. Merge BackForwardBackListCount / BackForwardForwardListCount IPCs into a single BackForwardListCounts IPC which returns both
500            the back & forward counts, since we often need both (e.g. when accessing history.length) and since gettings those counts is
501            very cheap compared to the cost of a sync IPC.
502         2. Cache those counts in WebBackForwardListProxy and blow away the cached counts whenever the back/forward list changes. In the
503            common case (where the back/forward list rarely changes), we now see a single sync IPC instead of many (verified on reddit.com).
504
505         No new tests, merely a performance improvement.
506
507         * UIProcess/WebPageProxy.cpp:
508         * UIProcess/WebPageProxy.h:
509         * UIProcess/WebPageProxy.messages.in:
510         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
511         (WebKit::WebBackForwardListProxy::addItemFromUIProcess):
512         (WebKit::WebBackForwardListProxy::addItem):
513         (WebKit::WebBackForwardListProxy::goToItem):
514         (WebKit::WebBackForwardListProxy::backListCount const):
515         (WebKit::WebBackForwardListProxy::forwardListCount const):
516         (WebKit::WebBackForwardListProxy::cacheListCountsIfNecessary const):
517         (WebKit::WebBackForwardListProxy::clearCachedListCounts):
518         (WebKit::WebBackForwardListProxy::close):
519         (WebKit::WebBackForwardListProxy::clear):
520         * WebProcess/WebPage/WebBackForwardListProxy.h:
521
522 2020-01-26  youenn fablet  <youenn@apple.com>
523
524         Use ObjectIdentifier for remote RealtimeMediaSource
525         https://bugs.webkit.org/show_bug.cgi?id=206808
526         <rdar://problem/58705405>
527
528         Reviewed by Eric Carlson.
529
530         Use ObjectIdentifier instead of uint64_t.
531         This is clearer and prevents receiving identifier of value zero from IPC.
532         Remove related message checks.
533
534         * Scripts/webkit/messages.py:
535         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
536         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::SourceProxy):
537         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
538         (WebKit::UserMediaCaptureManagerProxy::startProducingData):
539         (WebKit::UserMediaCaptureManagerProxy::stopProducingData):
540         (WebKit::UserMediaCaptureManagerProxy::end):
541         (WebKit::UserMediaCaptureManagerProxy::capabilities):
542         (WebKit::UserMediaCaptureManagerProxy::setMuted):
543         (WebKit::UserMediaCaptureManagerProxy::applyConstraints):
544         (WebKit::UserMediaCaptureManagerProxy::clone):
545         (WebKit::UserMediaCaptureManagerProxy::requestToEnd):
546         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
547         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
548         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
549         (WebKit::UserMediaCaptureManager::Source::Source):
550         (WebKit::UserMediaCaptureManager::Source::sourceID const):
551         (WebKit::UserMediaCaptureManager::createCaptureSource):
552         (WebKit::UserMediaCaptureManager::sourceStopped):
553         (WebKit::UserMediaCaptureManager::captureFailed):
554         (WebKit::UserMediaCaptureManager::sourceMutedChanged):
555         (WebKit::UserMediaCaptureManager::sourceSettingsChanged):
556         (WebKit::UserMediaCaptureManager::storageChanged):
557         (WebKit::UserMediaCaptureManager::ringBufferFrameBoundsChanged):
558         (WebKit::UserMediaCaptureManager::audioSamplesAvailable):
559         (WebKit::UserMediaCaptureManager::remoteVideoSampleAvailable):
560         (WebKit::UserMediaCaptureManager::sourceEnded):
561         (WebKit::UserMediaCaptureManager::applyConstraintsSucceeded):
562         (WebKit::UserMediaCaptureManager::applyConstraintsFailed):
563         (WebKit::UserMediaCaptureManager::cloneVideoSource):
564         * WebProcess/cocoa/UserMediaCaptureManager.h:
565         * WebProcess/cocoa/UserMediaCaptureManager.messages.in:
566
567 2020-01-26  Darin Adler  <darin@apple.com>
568
569         Protect against crashes during WKWebView init function when methods are called before the view is fully initialized
570         https://bugs.webkit.org/show_bug.cgi?id=206799
571         rdar://problem/58871371
572
573         Reviewed by Sam Weinig.
574
575         Part way through creating WKWebView, some methods can be called and they need to be careful
576         not to use anything that may not be initialized yet.
577
578         * UIProcess/API/Cocoa/WKWebView.mm:
579         (-[WKWebView dealloc]): Check _page for null, since this might happen if the superclass's
580         init method returned nil.
581
582         * UIProcess/API/ios/WKWebViewIOS.mm:
583         (-[WKWebView _frameOrBoundsChanged]): Check _page for null, since this might be called
584         before object initialization is complete.
585         (-[WKWebView setSemanticContentAttribute:]): Ditto.
586
587         * UIProcess/API/mac/WKWebViewMac.mm:
588         (-[WKWebView setFrameSize:]): Check _impl for null since this might be called before
589         oject initialization is complete.
590         (-[WKWebView setUserInterfaceLayoutDirection:]): Ditto.
591         (-[WKWebView renewGState]): Ditto.
592
593 2020-01-26  Said Abou-Hallawa  <said@apple.com>
594
595         Throttling requestAnimationFrame should be controlled by RenderingUpdateScheduler
596         https://bugs.webkit.org/show_bug.cgi?id=204713
597
598         Reviewed by Simon Fraser.
599
600         Create an IPC message on the DrawingArea to send a message from the
601         WebProcess to the UIProcess to setPreferredFramesPerSecond of the
602         DisplayRefreshMonitor.
603
604         * Shared/WebPreferences.yaml:
605         * UIProcess/API/C/WKPreferences.cpp:
606         (WKPreferencesSetRenderingUpdateThrottlingEnabled):
607         (WKPreferencesGetRenderingUpdateThrottlingEnabled):
608         * UIProcess/API/C/WKPreferencesRefPrivate.h:
609         Add a WKPreference key for RenderingUpdateThrottlingEnabled.
610
611         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
612         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in:
613
614         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
615         (-[WKOneShotDisplayLinkHandler setPreferredFramesPerSecond:]):
616         (WebKit::RemoteLayerTreeDrawingAreaProxy::setPreferredFramesPerSecond):
617         Set the preferredFramesPerSecond of the CADisplayLink.
618
619         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h:
620         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
621         (WebKit::RemoteLayerTreeDisplayRefreshMonitor::setPreferredFramesPerSecond):
622         Delegate the call to RemoteLayerTreeDrawingArea.
623
624         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
625         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
626         (WebKit::RemoteLayerTreeDrawingArea::setPreferredFramesPerSecond):
627         Send the IPC message from the WebProcess to the UIProcess.
628
629 2020-01-25  Brady Eidson  <beidson@apple.com>
630
631         Make ContentWorlds be identified by an ObjectIdentifier instead of a uint64_t
632         https://bugs.webkit.org/show_bug.cgi?id=206784
633
634         Reviewed by Alex Christensen.
635
636         Refactor: No behavior change.
637
638         * Scripts/webkit/messages.py:
639
640         * Shared/AuxiliaryProcess.cpp:
641         (WebKit::AuxiliaryProcess::initialize):
642
643         * Shared/ContentWorldShared.h:
644         (WebKit::pageContentWorldIdentifier):
645
646         * Shared/WebPageCreationParameters.cpp:
647         (WebKit::WebPageCreationParameters::decode):
648         * Shared/WebPageCreationParameters.h:
649
650         * Shared/WebUserContentControllerDataTypes.cpp:
651         (WebKit::WebUserScriptData::decode):
652         (WebKit::WebUserStyleSheetData::decode):
653         (WebKit::WebScriptMessageHandlerData::decode):
654         * Shared/WebUserContentControllerDataTypes.h:
655
656         * UIProcess/API/APIContentWorld.cpp:
657         (API::ContentWorld::pageContentWorld):
658         (API::ContentWorld::defaultClientWorld):
659         (API::ContentWorld::ContentWorld):
660         (API::ContentWorldBase::generateIdentifier): Deleted.
661
662         * UIProcess/API/APIContentWorld.h:
663         (API::ContentWorldBase::identifier const):
664         (API::ContentWorldBase::worldData const):
665         (API::ContentWorldBase::ContentWorldBase):
666         * UIProcess/API/APIUserContentWorld.cpp:
667         (API::UserContentWorld::UserContentWorld):
668
669         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
670         (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
671         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
672         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
673
674         * WebProcess/UserContent/WebUserContentController.cpp:
675         (WebKit::worldMap):
676         (WebKit::WebUserContentController::worldForIdentifier):
677         (WebKit::WebUserContentController::addUserContentWorld):
678         (WebKit::WebUserContentController::addUserContentWorlds):
679         (WebKit::WebUserContentController::removeUserContentWorlds):
680         (WebKit::WebUserContentController::addUserScripts):
681         (WebKit::WebUserContentController::removeUserScript):
682         (WebKit::WebUserContentController::removeAllUserScripts):
683         (WebKit::WebUserContentController::addUserStyleSheets):
684         (WebKit::WebUserContentController::removeUserStyleSheet):
685         (WebKit::WebUserContentController::removeAllUserStyleSheets):
686         (WebKit::WebUserContentController::addUserScriptMessageHandlers):
687         (WebKit::WebUserContentController::removeUserScriptMessageHandler):
688         (WebKit::WebUserContentController::removeAllUserScriptMessageHandlers):
689         * WebProcess/UserContent/WebUserContentController.h:
690         * WebProcess/UserContent/WebUserContentController.messages.in:
691
692         * WebProcess/WebPage/WebPage.cpp:
693         (WebKit::WebPage::runJavaScript):
694         (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld):
695         (WebKit::WebPage::runJavaScriptInFrame):
696         * WebProcess/WebPage/WebPage.h:
697         * WebProcess/WebPage/WebPage.messages.in:
698
699 2020-01-25  Per Arne Vollan  <pvollan@apple.com>
700
701         [Cocoa] Media mime types map should be created in the UI process
702         https://bugs.webkit.org/show_bug.cgi?id=206478
703
704         Reviewed by Darin Adler.
705
706         Send the mime type map from the UI process to the WebContent process as part of the
707         WebProcess creation parameters.
708
709         * Shared/WebProcessCreationParameters.cpp:
710         (WebKit::WebProcessCreationParameters::encode const):
711         (WebKit::WebProcessCreationParameters::decode):
712         * Shared/WebProcessCreationParameters.h:
713         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
714         (WebKit::WebProcessPool::platformInitializeWebProcess):
715         * WebProcess/cocoa/WebProcessCocoa.mm:
716         (WebKit::WebProcess::platformInitializeWebProcess):
717
718 2020-01-25  Antti Koivisto  <antti@apple.com>
719
720         [LFC][Integration] Re-enable line layout integration
721         https://bugs.webkit.org/show_bug.cgi?id=206795
722         <rdar://problem/58853907>
723
724         Reviewed by Zalan Bujtas.
725
726         * Shared/WebPreferences.yaml:
727
728 2020-01-24  Tim Horton  <timothy_horton@apple.com>
729
730         macCatalyst: Don't get any custom cursors in subframes
731         https://bugs.webkit.org/show_bug.cgi?id=206781
732         <rdar://problem/58698374>
733
734         Reviewed by Simon Fraser.
735
736         * WebProcess/WebPage/ios/WebPageIOS.mm:
737         (WebKit::WebPage::positionInformation):
738         Adjust the hit test to allow child frame content, and reorganize the
739         rest of the code to use the hit frame instead of the main frame.
740
741 2020-01-24  Jiewen Tan  <jiewen_tan@apple.com>
742
743         Unreviewed, a speculative test fix after r255041
744
745         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
746         (WebKit::MockLocalConnection::getAttestation const):
747
748 2020-01-24  Wenson Hsieh  <wenson_hsieh@apple.com>
749
750         [iOS] Long pressing text inside a selection should update the selection
751         https://bugs.webkit.org/show_bug.cgi?id=206769
752         <rdar://problem/58704316>
753
754         Reviewed by Tim Horton.
755
756         Makes it possible to update the selection using text interaction gestures inside an existing text selection. To
757         do this, we remove code that was previously required in order to disambiguate text selection and drag gestures.
758         However, since adopting asynchronous drag interaction SPI, this check has not been necessary.
759
760         The only other purpose of this check was to avoid triggering text selection gestures after canceling a drag
761         that did not begin (i.e. the touch location did not move). Instead of bailing in -textInteractionGestures:
762         shouldBeginAtPoint: and -hasSelectablePositionAtPoint:, we can achieve the same effect by simply resetting the
763         text interaction gestures when the drag lift begins (at which point we know the drag interaction is starting).
764         This also ensures that on iPad, in the case where the drag was cancelled by the page, long pressing may still
765         trigger text selection.
766
767         Test: editing/selection/ios/select-text-in-existing-selection.html
768
769         * Shared/ios/InteractionInformationAtPosition.h:
770         * Shared/ios/InteractionInformationAtPosition.mm:
771         (WebKit::InteractionInformationAtPosition::encode const):
772         (WebKit::InteractionInformationAtPosition::decode):
773
774         Remove the hasSelectionAtPosition flag from position information, since we no longer need it.
775
776         * UIProcess/ios/WKContentViewInteraction.mm:
777         (-[UIGestureRecognizer _wk_cancel]):
778
779         Drive-by fix: just ignore the gesture if it is already disabled. This prevents us from causing a gesture
780         recognizer that was previously disabled to become enabled as a result of calling -_wk_cancel.
781
782         (-[WKContentView hasSelectablePositionAtPoint:]):
783         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
784         (-[WKContentView cancelActiveTextInteractionGestures]):
785
786         Instead of making the text interaction gestures return NO from -gestureRecognizerShouldBegin:, explicitly cancel
787         the text interaction gestures that may select text.
788
789         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
790         * WebProcess/WebPage/ios/WebPageIOS.mm:
791         (WebKit::WebPage::positionInformation):
792
793         Remove the hasSelectionAtPosition flag from position information, since we no longer need it.
794
795 2020-01-24  Alex Christensen  <achristensen@webkit.org>
796
797         Update EditorState from WebProcess when requesting context menu
798         https://bugs.webkit.org/show_bug.cgi?id=206775
799         <rdar://problem/56305573>
800
801         Reviewed by Wenson Hsieh.
802
803         When generating a context menu, AppKit calls -validRequestorForSendType:returnType:
804         which queries the editor state in WebViewImpl::validRequestorForSendAndReturnTypes.
805         Without updating the editor state, the first time you right click on a link,
806         the Services menu item did not appear because we were looking at a stale editor state.
807         Verified manually this fixes the bug.
808
809         * WebProcess/WebPage/WebContextMenu.cpp:
810         (WebKit::WebContextMenu::show):
811         * WebProcess/WebPage/mac/WebPageMac.mm:
812         (WebKit::WebPage::handleSelectionServiceClick):
813
814 2020-01-24  Tim Horton  <timothy_horton@apple.com>
815
816         macCatalyst: Right clicking on links follows the link, but shouldn't
817         https://bugs.webkit.org/show_bug.cgi?id=206777
818         <rdar://problem/56586280>
819
820         Reviewed by Wenson Hsieh.
821
822         * UIProcess/ios/WKMouseGestureRecognizer.mm:
823         (-[WKMouseGestureRecognizer createMouseEventWithType:forEvent:]):
824         (-[WKMouseGestureRecognizer touchesEnded:withEvent:]):
825         I got 'button' and 'buttons' backwards.
826
827         'button' indicates which button the event is about, so in MouseUp,
828         it should still be 2.
829
830         'buttons' indicate which buttons are still down, so in MouseUp,
831         it should not include 2. Since we don't currently track mouse button
832         chording here, we'll just say "none". Leave a FIXME about that.
833
834         This makes WebCore's behavior correct, and now it doesn't follow the link.
835
836 2020-01-24  Jiewen Tan  <jiewen_tan@apple.com>
837
838         Unreviewed, a build fix after r255056
839
840         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
841         (WebKit::MockLocalConnection::getAttestation const):
842
843 2020-01-24  Per Arne Vollan  <pvollan@apple.com>
844
845         Unreviewed, rolling out r255050.
846
847         Introduced crashes on bots
848
849         Reverted changeset:
850
851         "[Cocoa] Media mime types map should be created in the UI
852         process"
853         https://bugs.webkit.org/show_bug.cgi?id=206478
854         https://trac.webkit.org/changeset/255050
855
856 2020-01-24  Brent Fulgham  <bfulgham@apple.com>
857
858         [iOS] Add missing sysctl-read permission (already available in macOS sandbox)
859         https://bugs.webkit.org/show_bug.cgi?id=206713
860         <rdar://problem/57665153>
861
862         Reviewed by Per Arne Vollan.
863
864         Correct a sandbox violation encountered when attempting to log the system hostname.
865         This was already handled properly on macOS, but the rule was not added to the iOS sandbox.
866
867         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
868
869 2020-01-24  Adrian Perez de Castro  <aperez@igalia.com>
870
871         Fix various non-unified build issues introduced since r254751
872         https://bugs.webkit.org/show_bug.cgi?id=206736
873
874         Reviewed by Carlos Garcia Campos.
875
876         * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp: Add missing WebFrame.h inclusion.
877
878 2020-01-24  Don Olmstead  <don.olmstead@sony.com>
879
880         Centralize AuxiliaryProcessMainBase implementations
881         https://bugs.webkit.org/show_bug.cgi?id=206700
882
883         Reviewed by Carlos Garcia Campos.
884
885         Non-Cocoa ports share a common usage of AuxiliaryProcessMainBase but the implementations
886         don't share a lot of code. This patch centralizes the code and the naming used.
887
888         * NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
889         (main):
890         * NetworkProcess/EntryPoint/win/NetworkProcessMain.cpp:
891         (main):
892         * NetworkProcess/NetworkProcessMain.h: Renamed from Source/WebKit/NetworkProcess/win/NetworkProcessMainWin.h.
893         * NetworkProcess/curl/NetworkProcessMainCurl.cpp: Renamed from Source/WebKit/NetworkProcess/win/NetworkProcessMainWin.cpp.
894         (WebKit::initializeAuxiliaryProcess<NetworkProcess>):
895         (WebKit::NetworkProcessMain):
896         * NetworkProcess/soup/NetworkProcessMainSoup.cpp:
897         (WebKit::NetworkProcessMain):
898         (WebKit::NetworkProcessMainUnix): Deleted.
899         * NetworkProcess/unix/NetworkProcessMainUnix.h: Removed.
900         * PlatformFTW.cmake:
901         * PlatformGTK.cmake:
902         * PlatformWPE.cmake:
903         * PlatformWin.cmake:
904         * PluginProcess/EntryPoint/unix/PluginProcessMain.cpp:
905         (main):
906         * PluginProcess/PluginProcessMain.h: Renamed from Source/WebKit/PluginProcess/unix/PluginProcessMainUnix.h.
907         * PluginProcess/unix/PluginProcessMainUnix.cpp:
908         (WebKit::PluginProcessMain):
909         (WebKit::PluginProcessMainUnix): Deleted.
910         * Shared/AuxiliaryProcessMain.h: Renamed from Source/WebKit/Shared/unix/AuxiliaryProcessMain.h.
911         * WebProcess/EntryPoint/unix/WebProcessMain.cpp:
912         (main):
913         * WebProcess/EntryPoint/win/WebProcessMain.cpp:
914         (main):
915         * WebProcess/WebProcessMain.h: Renamed from Source/WebKit/WebProcess/win/WebProcessMainWin.h.
916         * WebProcess/gtk/WebProcessMainGtk.cpp:
917         (WebKit::WebProcessMain):
918         (WebKit::WebProcessMainUnix): Deleted.
919         * WebProcess/playstation/WebProcessMainPlayStation.cpp: Renamed from Source/WebKit/WebProcess/unix/WebProcessMainUnix.h.
920         (WebKit::WebProcessMain):
921         * WebProcess/win/WebProcessMainWin.cpp:
922         (WebKit::WebProcessMain):
923         (WebKit::WebProcessMainWin): Deleted.
924         * WebProcess/wpe/WebProcessMainWPE.cpp:
925         (WebKit::WebProcessMain):
926         (WebKit::WebProcessMainUnix): Deleted.
927         * webkitglib-symbols.map:
928
929 2020-01-24  Carlos Garcia Campos  <cgarcia@igalia.com>
930
931         [GTK] Reduce the maximum time we wait for draw events in DrawingMonitor
932         https://bugs.webkit.org/show_bug.cgi?id=206662
933
934         Reviewed by Carlos Alberto Lopez Perez.
935
936         1 second is too much, we can wait up to 100_ms instead and wait for the next frame after 16_ms. We should also
937         ensure there's a draw event since this is called from dispatchAfterEnsuringDrawing().
938
939         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
940         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::start):
941         (WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::didDraw):
942
943 2020-01-24  youenn fablet  <youenn@apple.com>
944
945         Make sure fetch tasks go to network if service worker never gets to activated
946         https://bugs.webkit.org/show_bug.cgi?id=206648
947
948         Reviewed by Chris Dumez.
949
950         In case activating completion handlers are not called, the fetch task timeout should kick in and make the load go to network process.
951         The issue is that our code was using the context connection to do so.
952         If the fetch task is waiting for the worker activation, the context connection might not be set and the timeout will be a no-op.
953
954         To fix this, the fetch task will do as if its context is closed when the timeout fires.
955         The fetck task now has a weak pointer to the WebSWServerConnection and will use to terminate the service worker as done previously.
956
957         We no longer handle all ongoing fetch tasks of the ongoing service worker.
958         Each individual fetch task timeout provides the same level of protection.
959         The service worker will anyway get terminated which will race to finalize the service worker fetch tasks with each of their timeout.
960
961         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
962         (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask):
963         (WebKit::ServiceWorkerFetchTask::timeoutTimerFired):
964         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
965         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
966         (WebKit::WebSWServerConnection::createFetchTask):
967         (WebKit::WebSWServerConnection::fetchTaskTimedOut):
968         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
969         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
970         (WebKit::WebSWServerToContextConnection::fetchTaskTimedOut):
971
972 2020-01-23  Jiewen Tan  <jiewen_tan@apple.com>
973
974         Unreviewed, a follow up on r254894
975
976         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
977         (WebKit::MockLocalConnection::getAttestation const):
978         Includes the status code in the message.
979
980 2020-01-23  Wenson Hsieh  <wenson_hsieh@apple.com>
981
982         [iOS] Support setting minimum effective device width during dynamic viewport size updates
983         https://bugs.webkit.org/show_bug.cgi?id=206709
984         <rdar://problem/58713872>
985
986         Reviewed by Tim Horton.
987
988         Changes to minimum effective device width are currently always propagated to the web process via out-of-band
989         updates to the web process. During animated resize, Safari currently changes the minimum effective device width
990         prior to updating the view size; this causes the viewport configuration to temporarily be in a state where the
991         new value for minimum effective device width is used, but the old viewport width and height are still used.
992
993         This subsequently breaks existing logic in WebPage::dynamicViewportSizeUpdate that attempts to keep the portion
994         of the unobscured content width that is visible consistent before and after rotation (see
995         visibleHorizontalFraction), since that code will be mislead into believing that the wrong fraction of content
996         width is visible.
997
998         To fix this, we roll minimum effective device width changes along with view size (and other attributes) in
999         dynamic viewport size updates.
1000
1001         Test: WebKit.ChangeFrameAndMinimumEffectiveDeviceWidthDuringAnimatedResize
1002
1003         * UIProcess/API/Cocoa/WKWebView.mm:
1004         (-[WKWebView _setViewScale:]):
1005         (-[WKWebView _setMinimumEffectiveDeviceWidth:]):
1006
1007         During animated resize, just set m_minimumEffectiveDeviceWidth without notifying the web process; if the value
1008         changed during the update block, we send the new minimum effective device width to the web page as a part of
1009         the dynamic viewport size update.
1010
1011         Also, make a drive-by adjustment to use `_page->viewLayoutSize()` instead of recomputing the active layout
1012         bounds when we know that only the minimum effective device width is changing. We also apply the same adjustment
1013         above, in -_setViewScale:.
1014
1015         * UIProcess/API/ios/WKWebViewIOS.mm:
1016         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
1017         * UIProcess/WebPageProxy.h:
1018         (WebKit::WebPageProxy::viewLayoutSize const):
1019         (WebKit::WebPageProxy::setMinimumEffectiveDeviceWidthWithoutViewportConfigurationUpdate):
1020
1021         Add a helper method to update the minimum effective device width without updating the viewport configuration in
1022         the web process. This is only used when the minimum effective device width is specified in the middle of a
1023         dynamic viewport size update (i.e. animated resize).
1024
1025         * UIProcess/ios/WebPageProxyIOS.mm:
1026         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
1027
1028         Plumb the new minimum effective device width over to the web process as a part of the dynamic viewport size
1029         update, and update both the new view size and minimum effective device width on the viewport configuration at
1030         the same time.
1031
1032         * WebProcess/WebPage/WebPage.h:
1033         * WebProcess/WebPage/WebPage.messages.in:
1034         * WebProcess/WebPage/ios/WebPageIOS.mm:
1035         (WebKit::WebPage::dynamicViewportSizeUpdate):
1036
1037 2020-01-23  Per Arne Vollan  <pvollan@apple.com>
1038
1039         [Cocoa] Media mime types map should be created in the UI process
1040         https://bugs.webkit.org/show_bug.cgi?id=206478
1041
1042         Reviewed by Darin Adler.
1043
1044         Send the mime type map from the UI process to the WebContent process as part of the
1045         WebProcess creation parameters.
1046
1047         * Shared/WebProcessCreationParameters.cpp:
1048         (WebKit::WebProcessCreationParameters::encode const):
1049         (WebKit::WebProcessCreationParameters::decode):
1050         * Shared/WebProcessCreationParameters.h:
1051         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1052         (WebKit::WebProcessPool::platformInitializeWebProcess):
1053         * WebProcess/cocoa/WebProcessCocoa.mm:
1054         (WebKit::WebProcess::platformInitializeWebProcess):
1055
1056 2020-01-22  Darin Adler  <darin@apple.com>
1057
1058         Remove some unneeded definitions from Platform.h family headers
1059         https://bugs.webkit.org/show_bug.cgi?id=206642
1060
1061         Reviewed by Eric Carlson.
1062
1063         * Platform/cocoa/PaymentAuthorizationViewController.mm:
1064         (-[WKPaymentAuthorizationViewControllerDelegate _getPaymentServicesMerchantURL:]):
1065         Removed HAVE(PASSKIT_API_TYPE) because it's always 1 on Cocoa platforms and this
1066         is Cocoa-only code.
1067         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1068         (WebKit::toAPIType): Ditto.
1069         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Ditto.
1070
1071 2020-01-23  Tim Horton  <timothy_horton@apple.com>
1072
1073         macCatalyst: I-Beam is too conservative, doesn't show up in editable areas with no text
1074         https://bugs.webkit.org/show_bug.cgi?id=206716
1075         <rdar://problem/58359523>
1076
1077         Reviewed by Simon Fraser.
1078
1079         * WebProcess/WebPage/ios/WebPageIOS.mm:
1080         (WebKit::lineCaretExtent):
1081         (WebKit::populateCaretContext):
1082         (WebKit::WebPage::positionInformation):
1083         Instead of uniting the caret position for the first and last position
1084         on the line to find the I-Beam region, use the bounds of the selection
1085         rect for the line, which extends beyond existing text, matching our
1086         traditional behavior of showing the I-Beam over blank regions.
1087
1088 2020-01-23  Tomoki Imai  <Tomoki.Imai@sony.com>
1089
1090         Set proper TextureMapperLayer::m_contentsLayer in updateImageBacking
1091         https://bugs.webkit.org/show_bug.cgi?id=206212
1092
1093         Reviewed by Žan Doberšek.
1094
1095         There is a chance to set a wrong TextureMapperLayer::m_contentsLayer.
1096         It occurs when
1097         - The previous content layer is removed, and it doesn't have the next content layer. (layerState.contentLayer == nullptr)
1098         - It has an image backing, which is not visible. (layerState.imageBacking != nullptr, entry.update.isVisible == false)
1099         In that case, it didn't call TextureMapperLayer::setContentsLayer(nullptr) even if it doesn't have a new content layer.
1100
1101         This patch set TextureMapperLayer::m_contentsLayer in updateImageBacking regardless of the visibility.
1102         setBackingStore is not needed in updateImageBacking, as it should be handle only by layerState.backingStore.
1103
1104         Should be covered by the existing testcases.
1105
1106         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1107         (WebKit::updateImageBacking): Call TextureMapperLayer::setContentsLayer(nullptr) instead of TextureMapperLayer::setBackingStore(nullptr) when it's not visible.
1108
1109 2020-01-23  Daniel Bates  <dabates@apple.com>
1110
1111         Add a variant of -selectPositionAtPoint that can select an arbitrary point
1112         https://bugs.webkit.org/show_bug.cgi?id=206712
1113
1114         Reviewed by Wenson Hsieh.
1115
1116         Adds a variant of -selectPositionAtPoint, called _selectPositionAtPoint, that takes a boolean
1117         as to whether to constrain the specified point to stay within the focused element. I will
1118         make use of this functionality in a subsequent patch.
1119
1120         * UIProcess/ios/WKContentViewInteraction.h:
1121         * UIProcess/ios/WKContentViewInteraction.mm:
1122         (-[WKContentView selectPositionAtPoint:completionHandler:]): Moved implementation to -_selectPositionAtPoint
1123         and write this function in terms of it.
1124         (-[WKContentView _selectPositionAtPoint:stayingWithinFocusedElement:completionHandler:]): Added.
1125
1126 2020-01-23  Kate Cheney  <katherine_cheney@apple.com>
1127
1128         Background thread with ITP Database should lock when the network process is suspended
1129         https://bugs.webkit.org/show_bug.cgi?id=206593
1130         rdar://problem/58713379
1131
1132         Reviewed by Chris Dumez.
1133
1134         This patch adds a function to hang the background queue when the
1135         NetworkProcess is preparing to suspend.
1136
1137         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1138         (WebKit::WebResourceLoadStatisticsStore::suspend):
1139         (WebKit::WebResourceLoadStatisticsStore::resume):
1140         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1141         * NetworkProcess/NetworkProcess.cpp:
1142         (WebKit::NetworkProcess::prepareToSuspend):
1143         (WebKit::NetworkProcess::resume):
1144
1145 2020-01-23  Per Arne Vollan  <pvollan@apple.com>
1146
1147         [iOS] Make it possible for WebKit clients to enable connections to asset services in the WebContent process
1148         https://bugs.webkit.org/show_bug.cgi?id=206551
1149
1150         Reviewed by Brent Fulgham.
1151
1152         Add SPI to grant and revoke access to asset services in the WebContent process.
1153
1154         No new tests, since this should have an API test, but API tests are not running on iOS devices. We could
1155         create an API test for simulator, but the simulator has no sandbox.
1156
1157         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1158         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1159         * UIProcess/API/ios/WKWebViewIOS.mm:
1160         (-[WKWebView _grantAccessToAssetServices]):
1161         (-[WKWebView _revokeAccessToAssetServices]):
1162         * UIProcess/WebPageProxy.h:
1163         * UIProcess/ios/WebPageProxyIOS.mm:
1164         (WebKit::WebPageProxy::grantAccessToAssetServices):
1165         (WebKit::WebPageProxy::revokeAccessToAssetServices):
1166         * WebProcess/WebProcess.h:
1167         * WebProcess/WebProcess.messages.in:
1168         * WebProcess/cocoa/WebProcessCocoa.mm:
1169         (WebKit::WebProcess::grantAccessToAssetServices):
1170         (WebKit::WebProcess::revokeAccessToAssetServices):
1171
1172 2020-01-23  Brent Fulgham  <bfulgham@apple.com>
1173
1174         [iOS] Remove access to 'awd' directories
1175         https://bugs.webkit.org/show_bug.cgi?id=206098
1176         <rdar://problem/58491816>
1177
1178         Reviewed by Per Arne Vollan.
1179
1180         Now that we have removed 'awd' features from the WebContent process, and have blocked access to the
1181         mach service, we should remove the ability to interact with the 'awd' directories on device.
1182
1183         No new tests. No change in behavior.
1184
1185         * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
1186         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1187
1188 2020-01-23  Per Arne Vollan  <pvollan@apple.com>
1189
1190         [Cocoa] Broker access to the PowerManagement API
1191         https://bugs.webkit.org/show_bug.cgi?id=206373
1192         <rdar://problem/34722450>
1193
1194         Reviewed by Darin Adler.
1195
1196         Send flag indicating whether device has battery to the WebContent process as part of the
1197         WebProcess creation parameters.
1198
1199         * Shared/WebProcessCreationParameters.cpp:
1200         (WebKit::WebProcessCreationParameters::encode const):
1201         (WebKit::WebProcessCreationParameters::decode):
1202         * Shared/WebProcessCreationParameters.h:
1203         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1204         (WebKit::WebProcessPool::platformInitializeWebProcess):
1205         * WebProcess/cocoa/WebProcessCocoa.mm:
1206         (WebKit::WebProcess::platformInitializeWebProcess):
1207
1208 2020-01-23  Ryan Haddad  <ryanhaddad@apple.com>
1209
1210         Unreviewed, rolling out r254990.
1211
1212         Breaks watchOS / tvOS builds.
1213
1214         Reverted changeset:
1215
1216         "[iOS] Make it possible for WebKit clients to enable
1217         connections to asset services in the WebContent process"
1218         https://bugs.webkit.org/show_bug.cgi?id=206551
1219         https://trac.webkit.org/changeset/254990
1220
1221 2020-01-23  Brent Fulgham  <bfulgham@apple.com>
1222
1223         [iOS] Unreviewed follow-up sandbox fix.
1224         https://bugs.webkit.org/show_bug.cgi?id=206562
1225         <rdar://problem/58778970>
1226
1227         I missed a couple of rules that are being overly chatty in the logs in r254982.
1228         This adds appropriate commands to silence them.
1229
1230         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
1231         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1232
1233 2020-01-23  Per Arne Vollan  <pvollan@apple.com>
1234
1235         [iOS] Make it possible for WebKit clients to enable connections to asset services in the WebContent process
1236         https://bugs.webkit.org/show_bug.cgi?id=206551
1237
1238         Reviewed by Brent Fulgham.
1239
1240         Add SPI to grant and revoke access to asset services in the WebContent process.
1241
1242         No new tests, since this should have an API test, but API tests are not running on iOS devices. We could
1243         create an API test for simulator, but the simulator has no sandbox.
1244
1245         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1246         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1247         * UIProcess/API/ios/WKWebViewIOS.mm:
1248         (-[WKWebView _grantAccessToAssetServices]):
1249         (-[WKWebView _revokeAccessToAssetServices]):
1250         * UIProcess/WebPageProxy.h:
1251         * UIProcess/ios/WebPageProxyIOS.mm:
1252         (WebKit::WebPageProxy::grantAccessToAssetServices):
1253         (WebKit::WebPageProxy::revokeAccessToAssetServices):
1254         * WebProcess/WebProcess.h:
1255         * WebProcess/WebProcess.messages.in:
1256         * WebProcess/cocoa/WebProcessCocoa.mm:
1257         (WebKit::WebProcess::grantAccessToAssetServices):
1258         (WebKit::WebProcess::revokeAccessToAssetServices):
1259
1260 2020-01-23  Per Arne Vollan  <pvollan@apple.com>
1261
1262         [iOS] Camera is lost during WebRTC demo
1263         https://bugs.webkit.org/show_bug.cgi?id=206613
1264         <rdar://problem/58764572>
1265
1266         Reviewed by Brent Fulgham.
1267
1268         Fix observed sandbox violations in the Networking process.
1269
1270         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
1271
1272 2020-01-23  Brent Fulgham  <bfulgham@apple.com>
1273
1274         Stop capturing telemetry for well-understood sandbox rules (206562)
1275         https://bugs.webkit.org/show_bug.cgi?id=206562
1276         <rdar://problem/58778970>
1277
1278         Reviewed by Per Arne Vollan.
1279
1280         Remove logging of sandbox rules that are now understood, and either confirmed to be needed for proper WebKit operation
1281         or identified for removal through a future update.
1282
1283         No new tests. No change in behavior.
1284
1285         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
1286         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
1287         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1288
1289 2020-01-23  Alexander Mikhaylenko  <alexm@gnome.org>
1290
1291         [GTK] Navigation gesture creates CSS nodes and doesn't remove them
1292         https://bugs.webkit.org/show_bug.cgi?id=206591
1293
1294         Reviewed by Carlos Garcia Campos.
1295
1296         Even though foreign drawing uses a temporary GtkStyleContext, calling
1297         gtk_style_context_set_parent() adds all its CSS nodes to the global
1298         hierarchy, and then they aren't cleaned up. This shouldn't happen.
1299
1300         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
1301         (WebKit::ViewGestureController::createStyleContext):Stop setting GtkStyleContext parent.
1302
1303 2020-01-22  Jon Lee  <jonlee@apple.com>
1304
1305         [Media in GPU process] Pipe more MediaPlayerPrivate and client methods
1306         https://bugs.webkit.org/show_bug.cgi?id=206468
1307
1308         Reviewed by Eric Carlson.
1309
1310         Pipe more of the media player and client functions. Generally, these are void functions
1311         that require no parameters.
1312
1313         Also, the client *changed() functions, when implemented, tend to call the accessor of the property
1314         that just changed. This seems rather circuitous. The client methods ought to just also pass along
1315         the value of the new changed value. This patch refactors mediaPlayerCurrentPlaybackTargetIsWirelessChanged
1316         to do exactly that.
1317
1318         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
1319         (WebKit::RemoteMediaPlayerProxy::mediaPlayerResourceNotSupported):
1320         (WebKit::RemoteMediaPlayerProxy::mediaPlayerEngineUpdated):
1321         (WebKit::RemoteMediaPlayerProxy::mediaPlayerActiveSourceBuffersChanged):
1322         (WebKit::RemoteMediaPlayerProxy::mediaPlayerWaitingForKeyChanged):
1323         (WebKit::RemoteMediaPlayerProxy::mediaPlayerCurrentPlaybackTargetIsWirelessChanged):
1324         (WebKit::RemoteMediaPlayerProxy::setWirelessVideoPlaybackDisabled):
1325         (WebKit::RemoteMediaPlayerProxy::setShouldPlayToPlaybackTarget):
1326         (WebKit::RemoteMediaPlayerProxy::keyAdded):
1327         (WebKit::RemoteMediaPlayerProxy::beginSimulatedHDCPError):
1328         (WebKit::RemoteMediaPlayerProxy::endSimulatedHDCPError):
1329         (WebKit::RemoteMediaPlayerProxy::notifyActiveSourceBuffersChanged):
1330         (WebKit::RemoteMediaPlayerProxy::applicationWillResignActive):
1331         (WebKit::RemoteMediaPlayerProxy::applicationDidBecomeActive):
1332         * GPUProcess/media/RemoteMediaPlayerProxy.h:
1333         * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
1334         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
1335         (WebKit::MediaPlayerPrivateRemote::setWirelessVideoPlaybackDisabled):
1336         (WebKit::MediaPlayerPrivateRemote::currentPlaybackTargetIsWirelessChanged): Cache value in new member variable.
1337         (WebKit::MediaPlayerPrivateRemote::isCurrentPlaybackTargetWireless const): Return value.
1338         (WebKit::MediaPlayerPrivateRemote::setShouldPlayToPlaybackTarget):
1339         (WebKit::MediaPlayerPrivateRemote::keyAdded):
1340         (WebKit::MediaPlayerPrivateRemote::waitingForKeyChanged):
1341         (WebKit::MediaPlayerPrivateRemote::beginSimulatedHDCPError):
1342         (WebKit::MediaPlayerPrivateRemote::endSimulatedHDCPError):
1343         (WebKit::MediaPlayerPrivateRemote::notifyActiveSourceBuffersChanged):
1344         (WebKit::MediaPlayerPrivateRemote::applicationWillResignActive):
1345         (WebKit::MediaPlayerPrivateRemote::applicationDidBecomeActive):
1346         (WebKit::MediaPlayerPrivateRemote::resourceNotSupported):
1347         (WebKit::MediaPlayerPrivateRemote::engineUpdated):
1348         (WebKit::MediaPlayerPrivateRemote::activeSourceBuffersChanged):
1349         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
1350         * WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in:
1351
1352 2020-01-22  Keith Rollin  <krollin@apple.com>
1353
1354         Fix SDK availability macros
1355         https://bugs.webkit.org/show_bug.cgi?id=206463
1356         <rdar://problem/58581906>
1357
1358         Reviewed by Timothy Hatcher.
1359
1360         Bug 197841 updated WebKit.xcconfig with regards to when it runs a
1361         header post-processing script. This post-processing script grovels
1362         over our exported headers, changing macros like WK_API_AVAILABLE to
1363         the standard API_AVAILABLE. Because of the change in Bug 197841, the
1364         script was no longer being run when preparing macOS 10.15 SDKs, which
1365         was breaking those SDKs. Fix this by reverting the change, allowing
1366         the macros to be replaced for macOS 10.15.
1367
1368         We also need to touch WKFoundation.h in order to support incremental
1369         builds. If we don't, then the version of WKFoundation.h that was
1370         exported in the previous build and that was incorrectly post-processed
1371         would remain incorrectly post-processed. Touch the file so that it
1372         will get re-exported and re-post-processed.
1373
1374         No new tests - no added or changed functionality.
1375
1376         * Configurations/WebKit.xcconfig:
1377         * Shared/API/Cocoa/WKFoundation.h:
1378
1379 2020-01-22  Chris Dumez  <cdumez@apple.com>
1380
1381         Frequent NetworkConnectionToWebProcess::CookiesEnabled sync IPC when browsing reddit.com
1382         https://bugs.webkit.org/show_bug.cgi?id=206450
1383
1384         Reviewed by Darin Adler.
1385
1386         Frequent NetworkConnectionToWebProcess::CookiesEnabled sync IPC when browsing reddit.com. This
1387         happens every time the page script calls navigator.cookieEnabled. To address the issue, we now
1388         store the "cookie accept policy" on the WebContent process side. This allows us to know
1389         synchronously on the WebContent process if cookies are enabled or not and without any IPC to
1390         the network process. To achieve this, I added a new cookieAcceptPolicy member to
1391         NetworkProcessConnectionInfo so that the WebContent process is aware of the initial policy when
1392         it connects to the network process. The policy on the WebContent process side is then kept up
1393         to date via IPCs from the network process to the WebContent processes whenever the cookie
1394         accept policy changes.
1395
1396         * NetworkProcess/Cookies/WebCookieManager.cpp:
1397         (WebKit::WebCookieManager::setHTTPCookieAcceptPolicy):
1398         (WebKit::WebCookieManager::getHTTPCookieAcceptPolicy):
1399         * NetworkProcess/Cookies/WebCookieManager.h:
1400         * NetworkProcess/Cookies/WebCookieManager.messages.in:
1401         * NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp:
1402         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
1403         * NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp:
1404         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1405         (WebKit::NetworkConnectionToWebProcess::cookieAcceptPolicyChanged):
1406         * NetworkProcess/NetworkConnectionToWebProcess.h:
1407         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1408         * NetworkProcess/NetworkProcess.cpp:
1409         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
1410         (WebKit::NetworkProcess::cookieAcceptPolicyChanged):
1411         * NetworkProcess/NetworkProcess.h:
1412         * NetworkProcess/NetworkProcess.messages.in:
1413         * NetworkProcess/NetworkProcessCreationParameters.h:
1414         * Shared/WebProcessCreationParameters.h:
1415         * UIProcess/API/APIHTTPCookieStore.cpp:
1416         (API::HTTPCookieStore::setHTTPCookieAcceptPolicy):
1417         (API::HTTPCookieStore::setHTTPCookieAcceptPolicyInDefaultUIProcessCookieStore):
1418         * UIProcess/API/APIHTTPCookieStore.h:
1419         * UIProcess/API/C/WKAPICast.h:
1420         (WebKit::toHTTPCookieAcceptPolicy):
1421         (WebKit::toAPI):
1422         * UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm:
1423         (API::toNSHTTPCookieAcceptPolicy):
1424         (API::HTTPCookieStore::setHTTPCookieAcceptPolicyInDefaultUIProcessCookieStore):
1425         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
1426         * UIProcess/API/Cocoa/WKProcessPool.mm:
1427         (toHTTPCookieAcceptPolicy):
1428         * UIProcess/Network/NetworkProcessProxy.cpp:
1429         (WebKit::NetworkProcessProxy::openNetworkProcessConnection):
1430         * UIProcess/WebCookieManagerProxy.h:
1431         * UIProcess/WebProcessPool.h:
1432         * WebKit.xcodeproj/project.pbxproj:
1433         * WebProcess/Network/NetworkProcessConnection.cpp:
1434         (WebKit::NetworkProcessConnection::NetworkProcessConnection):
1435         (WebKit::NetworkProcessConnection::writeBlobsToTemporaryFiles):
1436         (WebKit::NetworkProcessConnection::cookiesEnabled):
1437         (WebKit::NetworkProcessConnection::cookieAcceptPolicyChanged):
1438         * WebProcess/Network/NetworkProcessConnection.h:
1439         (WebKit::NetworkProcessConnection::create):
1440         * WebProcess/Network/NetworkProcessConnection.messages.in:
1441         * WebProcess/Network/NetworkProcessConnectionInfo.h:
1442         (WebKit::NetworkProcessConnectionInfo::encode const):
1443         (WebKit::NetworkProcessConnectionInfo::decode):
1444         * WebProcess/WebPage/WebCookieJar.cpp:
1445         (WebKit::WebCookieJar::cookiesEnabled const):
1446         - Return false early if the document has no frame / page (cookie-averse as per spec)
1447         - Return false early if ITP is enabled and it is a third-party iframe without storage
1448           access. This bypasses the sync IPC call completely for such iframes.
1449
1450         * WebProcess/WebProcess.cpp:
1451         (WebKit::WebProcess::ensureNetworkProcessConnection):
1452
1453 2020-01-22  Chris Dumez  <cdumez@apple.com>
1454
1455         [IPC Hardening] Only process Messages::NetworkProcess messages when sent by the UIProcess
1456         https://bugs.webkit.org/show_bug.cgi?id=206558
1457
1458         Unreviewed post-landing review comments from Darin Adler after r254892.
1459
1460         * Platform/IPC/StringReference.h:
1461         (IPC::operator==):
1462         (IPC::operator!=):
1463         (IPC::StringReference::Hash::equal):
1464         (IPC::StringReference::operator==): Deleted.
1465         (IPC::StringReference::operator!=): Deleted.
1466
1467 2020-01-22  Antti Koivisto  <antti@apple.com>
1468
1469         [LFC][Integration] Disable integration to see performance impact
1470         https://bugs.webkit.org/show_bug.cgi?id=206576
1471         <rdar://problem/58562185>
1472
1473         Reviewed by Zalan Bujtas.
1474
1475         * Shared/WebPreferences.yaml:
1476
1477 2020-01-22  youenn fablet  <youenn@apple.com>
1478
1479         Add logging of the source of a response used to respond a fetch event
1480         https://bugs.webkit.org/show_bug.cgi?id=206426
1481
1482         Reviewed by Darin Adler.
1483
1484         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
1485         (WebKit::ServiceWorkerFetchTask::didReceiveResponse):
1486         Log the source of the response.
1487         * WebProcess/Network/WebLoaderStrategy.cpp:
1488         (WebKit::WebLoaderStrategy::havePerformedSecurityChecks const):
1489         Add case of DOMCache, similar to ServiceWorker.
1490
1491 2020-01-21  Fujii Hironori  <Hironori.Fujii@sony.com>
1492
1493         [Win][WK2] Pressing space key on text input form scrolls the page
1494         https://bugs.webkit.org/show_bug.cgi?id=201632
1495
1496         Reviewed by Ross Kirsling.
1497
1498         r223262 was add WebPage::performDefaultBehaviorForKeyEvent for
1499         Windows port by copying GTK port's implementation. But, Windows
1500         port is using unique key event processing. It dispatches
1501         WebEvent::RawKeyDown and WebEvent::Char separately even though
1502         other ports dispatch only WebEvent::KeyDown by unifying them.
1503
1504         Because WebPage::performDefaultBehaviorForKeyEvent handled
1505         WebEvent::RawKeyDown of space key to scroll page, and consumed the
1506         event, the keypress event of space key wasn't dispatched.
1507
1508         The keypress event of a space key is handled in
1509         EventHandler::defaultSpaceEventHandler.
1510         performDefaultBehaviorForKeyEvent don't need to do it.
1511
1512         Tests: Coverted by fast/events/space-scroll-event.html
1513
1514         * WebProcess/WebPage/win/WebPageWin.cpp:
1515         (WebKit::WebPage::performDefaultBehaviorForKeyEvent): Don't handle VK_SPACE.
1516
1517 2020-01-21  Jiewen Tan  <jiewen_tan@apple.com>
1518
1519         [WebAuthn] Incorporate more detailed UnknownError messages for LocalAuthenticator
1520         https://bugs.webkit.org/show_bug.cgi?id=191530
1521
1522         Reviewed by Brent Fulgham.
1523
1524         This patch replaces UnknownError messages within LocalAuthenticator with the LOG_ERROR
1525         messages. At the meantime, it enhances MockLocalConnection::getAttestation to return
1526         errors instead of assertions.
1527
1528         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
1529         (WebKit::LocalAuthenticator::makeCredential):
1530         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented):
1531         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
1532         (WebKit::LocalAuthenticator::getAssertion):
1533         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
1534         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
1535         (WebKit::MockLocalConnection::getAttestation const):
1536
1537 2020-01-21  Chris Dumez  <cdumez@apple.com>
1538
1539         [IPC Hardening] Only process Messages::NetworkProcess messages when sent by the UIProcess
1540         https://bugs.webkit.org/show_bug.cgi?id=206558
1541         <rdar://problem/58733679>
1542
1543         Reviewed by Alex Christensen.
1544
1545         Port UpdateQuotaBasedOnSpaceUsageForTesting IPC from the NetworkProcess to the NetworkConnectionToWebProcess
1546         since it is sent by the WebContent process. As a result, we can now stop forwarding all Messages::NetworkProcess
1547         IPC messages from the WebContent process to the NetworkProcess class.
1548
1549         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1550         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1551         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage):
1552         (WebKit::NetworkConnectionToWebProcess::updateQuotaBasedOnSpaceUsageForTesting):
1553         * NetworkProcess/NetworkConnectionToWebProcess.h:
1554         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1555         * NetworkProcess/NetworkProcess.cpp:
1556         (WebKit::NetworkProcess::didReceiveMessage):
1557         (WebKit::NetworkProcess::didReceiveSyncMessage):
1558         * NetworkProcess/NetworkProcess.h:
1559         * NetworkProcess/NetworkProcess.messages.in:
1560         * Platform/IPC/StringReference.h:
1561         (IPC::StringReference::operator!=):
1562         * WebProcess/Cache/WebCacheStorageConnection.cpp:
1563         (WebKit::WebCacheStorageConnection::updateQuotaBasedOnSpaceUsage):
1564
1565 2020-01-22  Simon Fraser  <simon.fraser@apple.com>
1566
1567         Fixed elements no longer stay fixed with elastic overscroll
1568         https://bugs.webkit.org/show_bug.cgi?id=206227
1569         rdar://problem/58707084
1570
1571         Reviewed by Antti Koivisto.
1572
1573         Intended behavior on iOS and macOS is for position:fixed and sticky elements to maintain
1574         their position relative to the view bounds when rubber-banding ("overscrolling"). This broke
1575         some time back. This change restores the correct behavior with the call to layoutViewportRespectingRubberBanding()
1576         in ScrollingTreeFixedNode::applyLayerPositions() and ScrollingTreeStickyNode::computeLayerPosition().
1577         layoutViewportRespectingRubberBanding() computes a layout viewport without clamping.
1578
1579         The rest of the changes are to support testing. internals.unconstrainedScrollTo()
1580         didn't work for main frame scrolling because of scroll position clamping in various places,
1581         so propagate ScrollClamping in more places (and replace the redundant ScrollPositionClamp with ScrollClamping).
1582
1583         "requested scroll position" updates now carry along both clamping and "is programmatic" data, wrapped in a struct
1584         which is passed around the scrolling tree. This allows us to not clamp the scroll position (for testing) in more places.
1585
1586         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1587         (ArgumentCoder<ScrollingStateScrollingNode>::encode):
1588         (ArgumentCoder<ScrollingStateScrollingNode>::decode):
1589         (ArgumentCoder<RequestedScrollData>::encode):
1590         (ArgumentCoder<RequestedScrollData>::decode):
1591         (WebKit::dump):
1592         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1593         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll):
1594         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
1595         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
1596         (WebKit::RemoteScrollingTree::scrollingTreeNodeRequestsScroll):
1597         * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
1598         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
1599         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):
1600         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1601         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
1602
1603 2020-01-21  Daniel Bates  <dabates@apple.com>
1604
1605         Add Legacy WebKit SPI and WebKit IPI to show and hide placeholder
1606         https://bugs.webkit.org/show_bug.cgi?id=206459
1607         <rdar://problem/58700534>
1608
1609         Reviewed by Wenson Hsieh.
1610
1611         Add Modern WebKit IPI to control whether the placeholder can be shown or not when a form
1612         control is empty. This is for aesthetics.
1613
1614         * UIProcess/WebPageProxy.cpp:
1615         (WebKit::WebPageProxy::setCanShowPlaceholder): Added.
1616         * UIProcess/WebPageProxy.h:
1617         * WebProcess/WebPage/WebPage.cpp:
1618         (WebKit::WebPage::setCanShowPlaceholder): Added. Maps the input text to its element. If it's
1619         a HTML text form control element then calls through to HTMLTextFormControlElement::setCanShowPlaceholder().
1620         * WebProcess/WebPage/WebPage.h:
1621         * WebProcess/WebPage/WebPage.messages.in:
1622         Added new message.
1623
1624 2020-01-21  Jiewen Tan  <jiewen_tan@apple.com>
1625
1626         ProvisionalPageProxy::loadData should pass last navigation's shouldOpenExternalURLsPolicy flag to WebPageProxy
1627         https://bugs.webkit.org/show_bug.cgi?id=206462
1628         <rdar://problem/57468718>
1629
1630         Reviewed by Chris Dumez.
1631
1632         Covered by API tests.
1633
1634         This patch also does it for ProvisionalPageProxy::loadRequest.
1635
1636         * UIProcess/ProvisionalPageProxy.cpp:
1637         (WebKit::ProvisionalPageProxy::loadData):
1638         (WebKit::ProvisionalPageProxy::loadRequest):
1639         * UIProcess/ProvisionalPageProxy.h:
1640         * UIProcess/WebPageProxy.cpp:
1641         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1642
1643 2020-01-21  Rob Buis  <rbuis@igalia.com>
1644
1645         Add build flag for stale-while-revalidate
1646         https://bugs.webkit.org/show_bug.cgi?id=204169
1647
1648         Reviewed by Youenn Fablet.
1649
1650         * Configurations/FeatureDefines.xcconfig:
1651         * NetworkProcess/cache/AsyncRevalidation.cpp:
1652         * NetworkProcess/cache/AsyncRevalidation.h:
1653         * NetworkProcess/cache/NetworkCache.cpp:
1654         (WebKit::NetworkCache::responseNeedsRevalidation):
1655         (WebKit::NetworkCache::makeStoreDecision):
1656         (WebKit::NetworkCache::Cache::retrieve):
1657         * NetworkProcess/cache/NetworkCache.h:
1658         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
1659         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
1660
1661 2020-01-21  David Kilzer  <ddkilzer@apple.com>
1662
1663         IPC::Decoder should use nullptr as invalid value
1664         <https://webkit.org/b/203880>
1665         <rdar://problem/53159906>
1666
1667         Follow-up fix noticed by Chris Dumez.
1668
1669         * Platform/IPC/Decoder.cpp:
1670         (IPC::alignedBufferIsLargeEnoughToContain): Fix typo in comment.
1671
1672 2020-01-21  Chris Dumez  <cdumez@apple.com>
1673
1674         [macOS] Add managed preference to allow synchronous XHR during page dismissal
1675         https://bugs.webkit.org/show_bug.cgi?id=206540
1676         <rdar://problem/58644447>
1677
1678         Reviewed by Alex Christensen.
1679
1680         Add managed preference to allow synchronous XHR during page dismissal. This is temporarily needed by some
1681         enterprise products until they can update their code.
1682
1683         * Shared/WebPreferences.yaml:
1684         * Shared/WebPreferencesDefaultValues.cpp:
1685         (WebKit::defaultDisallowSyncXHRDuringPageDismissalEnabled):
1686         * Shared/WebPreferencesDefaultValues.h:
1687
1688 2020-01-21  Ryan Haddad  <ryanhaddad@apple.com>
1689
1690         Unreviewed, rolling out r254876.
1691
1692         Broke Catalina builds.
1693
1694         Reverted changeset:
1695
1696         "Fix SDK availability macros"
1697         https://bugs.webkit.org/show_bug.cgi?id=206463
1698         https://trac.webkit.org/changeset/254876
1699
1700 2020-01-21  Jer Noble  <jer.noble@apple.com>
1701
1702         [iPad] YouTube does not automatically AirPlay when a route is selected from Control Center
1703         https://bugs.webkit.org/show_bug.cgi?id=206539
1704         <rdar://problem/54173689>
1705
1706         Reviewed by Eric Carlson.
1707
1708         * WebProcess/WebPage/mac/WebPageMac.mm:
1709         (WebKit::WebPage::playbackTargetSelected const):
1710
1711 2020-01-21  Alex Christensen  <achristensen@webkit.org>
1712
1713         Add SPI on WKURLSchemeTask to access WKFrameInfo of originating frame
1714         https://bugs.webkit.org/show_bug.cgi?id=204265
1715         <rdar://57193883>
1716
1717         Reviewed by Brady Eidson.
1718
1719         Covered by API tests.
1720
1721         * Shared/URLSchemeTaskParameters.cpp:
1722         (WebKit::URLSchemeTaskParameters::encode const):
1723         (WebKit::URLSchemeTaskParameters::decode):
1724         * Shared/URLSchemeTaskParameters.h:
1725         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
1726         (-[WKURLSchemeTaskImpl _frame]):
1727         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
1728         * UIProcess/WebPageProxy.cpp:
1729         (WebKit::WebPageProxy::startURLSchemeTaskShared):
1730         (WebKit::WebPageProxy::loadSynchronousURLSchemeTask):
1731         * UIProcess/WebURLSchemeHandler.cpp:
1732         (WebKit::WebURLSchemeHandler::startTask):
1733         * UIProcess/WebURLSchemeHandler.h:
1734         * UIProcess/WebURLSchemeTask.cpp:
1735         (WebKit::WebURLSchemeTask::create):
1736         (WebKit::WebURLSchemeTask::WebURLSchemeTask):
1737         * UIProcess/WebURLSchemeTask.h:
1738         (WebKit::WebURLSchemeTask::frameInfo const):
1739         * WebProcess/Network/WebLoaderStrategy.cpp:
1740         (WebKit::WebLoaderStrategy::tryLoadingUsingURLSchemeHandler):
1741         * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
1742         (WebKit::WebURLSchemeHandlerProxy::startNewTask):
1743         * WebProcess/WebPage/WebURLSchemeHandlerProxy.h:
1744         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
1745         (WebKit::WebURLSchemeTaskProxy::WebURLSchemeTaskProxy):
1746         (WebKit::WebURLSchemeTaskProxy::startLoading):
1747         (WebKit::WebURLSchemeTaskProxy::stopLoading):
1748         (WebKit::WebURLSchemeTaskProxy::didComplete):
1749         (WebKit::WebURLSchemeTaskProxy::hasLoader):
1750         * WebProcess/WebPage/WebURLSchemeTaskProxy.h:
1751         (WebKit::WebURLSchemeTaskProxy::create):
1752
1753 2020-01-21  Keith Rollin  <krollin@apple.com>
1754
1755         Fix SDK availability macros
1756         https://bugs.webkit.org/show_bug.cgi?id=206463
1757         <rdar://problem/58581906>
1758
1759         Reviewed by Timothy Hatcher.
1760
1761         Bug 197841 updated WebKit.xcconfig with regards to when it runs a
1762         header post-processing script. This post-processing script grovels
1763         over our exported headers, changing macros like WK_API_AVAILABLE to
1764         the standard API_AVAILABLE. Because of the change in Bug 197841, the
1765         script was no longer being run when preparing macOS 10.15 SDKs, which
1766         was breaking those SDKs. Fix this by reverting the change, allowing
1767         the macros to be replaced for macOS 10.15.
1768
1769         No new tests - no added or changed functionality.
1770
1771         * Configurations/WebKit.xcconfig:
1772
1773 2020-01-21  Tim Horton  <timothy_horton@apple.com>
1774
1775         macCatalyst: Two-finger click is dispatched to DOM as left click
1776         https://bugs.webkit.org/show_bug.cgi?id=206549
1777
1778         Reviewed by Simon Fraser.
1779
1780         * UIProcess/ios/WKMouseGestureRecognizer.mm:
1781         (-[WKMouseGestureRecognizer createMouseEventWithType:forEvent:]):
1782         (-[WKMouseGestureRecognizer touchesBegan:withEvent:]):
1783         (-[WKMouseGestureRecognizer touchesMoved:withEvent:]):
1784         (-[WKMouseGestureRecognizer touchesEnded:withEvent:]):
1785         (-[WKMouseGestureRecognizer _hoverEntered:withEvent:]):
1786         (-[WKMouseGestureRecognizer _hoverMoved:withEvent:]):
1787         (-[WKMouseGestureRecognizer _hoverExited:withEvent:]):
1788         (-[WKMouseGestureRecognizer createMouseEventWithType:]): Deleted.
1789         We correctly say button=2 for ctrl-click, but not for secondary-button click.
1790
1791 2020-01-21  Alex Christensen  <achristensen@webkit.org>
1792
1793         Revert suppressesConnectionTerminationOnSystemChange part of r254081
1794         https://bugs.webkit.org/show_bug.cgi?id=205751
1795         <rdar://problem/58725096>
1796
1797         There was an API client that still hadn't migrated to the replacement SPI.
1798
1799         * NetworkProcess/NetworkProcess.h:
1800         (WebKit::NetworkProcess::suppressesConnectionTerminationOnSystemChange const):
1801         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1802         (WebKit::NetworkProcessCreationParameters::encode const):
1803         (WebKit::NetworkProcessCreationParameters::decode):
1804         * NetworkProcess/NetworkProcessCreationParameters.h:
1805         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1806         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1807         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1808         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1809         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1810         (API::ProcessPoolConfiguration::copy):
1811         * UIProcess/API/APIProcessPoolConfiguration.h:
1812         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1813         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1814         (-[_WKProcessPoolConfiguration suppressesConnectionTerminationOnSystemChange]):
1815         (-[_WKProcessPoolConfiguration setSuppressesConnectionTerminationOnSystemChange:]):
1816         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1817         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1818
1819 2020-01-21  Brent Fulgham  <bfulgham@apple.com>
1820
1821         Performance tests fail if stderr logging is encountered
1822         https://bugs.webkit.org/show_bug.cgi?id=206544
1823         <rdar://problem/58714766>
1824
1825         Reviewed by Per Arne Vollan.
1826
1827         Switch to LOG_ERROR, rather than WTFLogAlways, to avoid confusing the PerformanceTests system.
1828
1829         * Shared/Cocoa/SandboxExtensionCocoa.mm:
1830         (WebKit::SandboxExtension::createHandleForReadByAuditToken):
1831
1832 2020-01-21  youenn fablet  <youenn@apple.com>
1833
1834         Provide camera/microphone sandbox extensions to GPUProcess
1835         https://bugs.webkit.org/show_bug.cgi?id=206531
1836
1837         Reviewed by Eric Carlson.
1838
1839         Send at creation of GPUProcess sandbox extensions to camera and microphone.
1840         This is currently gated by the UIProcess application being Safari.
1841         This should be changed to checks based on camera/microphone entitlements.
1842
1843         Extensions are provided at creation of the GPUProcess as it is as trusted as the UIProcess.
1844         We do not make it conditional to getUserMedia being enabled as GPUProcess may be created for more than one configuration.
1845
1846         Relax the GPUProcess sandbox on MacOS to allow microphone access until we can use microphone sandbox extension for that purpose.
1847
1848         Manually tested by capturing audio/video with real devices.
1849
1850         * GPUProcess/GPUProcess.cpp:
1851         (WebKit::GPUProcess::initializeGPUProcess):
1852         * GPUProcess/GPUProcessCreationParameters.cpp:
1853         (WebKit::GPUProcessCreationParameters::encode const):
1854         (WebKit::GPUProcessCreationParameters::decode):
1855         * GPUProcess/GPUProcessCreationParameters.h:
1856         * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
1857         * UIProcess/GPU/GPUProcessProxy.cpp:
1858         (WebKit::isSafari):
1859         (WebKit::shouldCreateCameraSandboxExtension):
1860         (WebKit::shouldCreateMicrophoneSandboxExtension):
1861         (WebKit::GPUProcessProxy::singleton):
1862
1863 2020-01-21  Brady Eidson  <beidson@apple.com>
1864
1865         API::(User)ContentWorld cleanup
1866         https://bugs.webkit.org/show_bug.cgi?id=206509
1867
1868         Reviewed by Darin Adler.
1869
1870         No behavior change.
1871         
1872         - Give (User)ContentWorld a shared base class for upcoming work.
1873         - Reference them by identifier instead of object instance whenever possible.
1874         - Other shared class cleanup.
1875
1876         * UIProcess/API/APIContentWorld.cpp:
1877         (API::ContentWorldBase::generateIdentifier):
1878         (API::ContentWorld::ContentWorld):
1879         (API::ContentWorld::~ContentWorld):
1880         * UIProcess/API/APIContentWorld.h:
1881         (API::ContentWorldBase::identifier const):
1882         (API::ContentWorldBase::name const):
1883         (API::ContentWorldBase::worldData const):
1884         (API::ContentWorldBase::ContentWorldBase):
1885         * UIProcess/API/APIUserContentWorld.cpp:
1886         (API::UserContentWorld::UserContentWorld):
1887         (API::UserContentWorld::generateIdentifier): Deleted.
1888         * UIProcess/API/APIUserContentWorld.h:
1889         * UIProcess/UserContent/WebScriptMessageHandler.h:
1890         (WebKit::WebScriptMessageHandler::world):
1891         (WebKit::WebScriptMessageHandler::userContentWorld const): Deleted.
1892         (WebKit::WebScriptMessageHandler::userContentWorld): Deleted.
1893         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
1894         (WebKit::WebUserContentControllerProxy::addProcess):
1895         (WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
1896         (WebKit::WebUserContentControllerProxy::shouldSendRemoveUserContentWorldsMessage):
1897         (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
1898         (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
1899         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
1900         * UIProcess/UserContent/WebUserContentControllerProxy.h:
1901
1902 2020-01-21  Chris Dumez  <cdumez@apple.com>
1903
1904         Minor improvements to StorageAreaMap
1905         https://bugs.webkit.org/show_bug.cgi?id=206433
1906
1907         Reviewed by Darin Adler.
1908
1909         Minor improvements to StorageAreaMap:
1910         1. The class does not need to be RefCounted, as it is solely owned by StorageNamespaceImpl. Having it
1911            RefCounted was actually dangerous because StorageAreaMap had a raw pointer data member to its owner:
1912            m_storageNamespace. This raw pointer could become stale if you extend the lifetime of the StorageAreaMap
1913            object to outlive its StorageNamespaceImpl.
1914         2. Make StorageAreaMap::connect() private as it is never called from outside the class
1915         3. Reorder data members for better packing
1916         4. Use modern loops in the implementation
1917         5. Rename loadValuesIfNeeded() to ensureStorageMap() and have it return the StorageMap object. This makes
1918            calls site more concise and it makes it clearer when this method needs to be called.
1919         6. Mark class as final
1920         7. Replace LOG_ERROR() with RELEASE_LOG_ERROR() so that we can see error logging in sysdiagnoses
1921         8. Use more references instead of raw pointers to make it clear when null checks are not needed
1922
1923         * WebProcess/WebStorage/StorageAreaImpl.cpp:
1924         (WebKit::StorageAreaImpl::create):
1925         (WebKit::StorageAreaImpl::StorageAreaImpl):
1926         * WebProcess/WebStorage/StorageAreaImpl.h:
1927         * WebProcess/WebStorage/StorageAreaMap.cpp:
1928         (WebKit::StorageAreaMap::StorageAreaMap):
1929         (WebKit::StorageAreaMap::length):
1930         (WebKit::StorageAreaMap::key):
1931         (WebKit::StorageAreaMap::item):
1932         (WebKit::StorageAreaMap::setItem):
1933         (WebKit::StorageAreaMap::removeItem):
1934         (WebKit::StorageAreaMap::clear):
1935         (WebKit::StorageAreaMap::contains):
1936         (WebKit::StorageAreaMap::resetValues):
1937         (WebKit::StorageAreaMap::ensureStorageMap):
1938         (WebKit::StorageAreaMap::applyChange):
1939         (WebKit::StorageAreaMap::dispatchSessionStorageEvent):
1940         (WebKit::StorageAreaMap::dispatchLocalStorageEvent):
1941         (WebKit::StorageAreaMap::connect):
1942         (WebKit::StorageAreaMap::disconnect):
1943         * WebProcess/WebStorage/StorageAreaMap.h:
1944         * WebProcess/WebStorage/StorageAreaMap.messages.in:
1945         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
1946         (WebKit::StorageNamespaceImpl::storageArea):
1947         * WebProcess/WebStorage/StorageNamespaceImpl.h:
1948
1949 2020-01-21  Alejandro G. Castro  <alex@igalia.com>
1950
1951         [GTK][WPE] TestWebKitUserContentFilterStore is crashing
1952         https://bugs.webkit.org/show_bug.cgi?id=206527
1953
1954         Reviewed by Adrian Perez de Castro.
1955
1956         We are asserting looking for a category of error when converting
1957         in the toGError function, but depending on the function called the
1958         category can be different.
1959
1960         * UIProcess/API/glib/WebKitUserContentFilterStore.cpp:
1961         (toGError):
1962         (webkitUserContentFilterStoreSaveBytes): Moved the ASSERT to the
1963         function that uses this category, the other functions calling
1964         toGError were already ASSERTing the correct category.
1965
1966 2020-01-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1967
1968         [GTK][WPE] Enable WebGL by default
1969         https://bugs.webkit.org/show_bug.cgi?id=205335
1970
1971         Reviewed by Adrian Perez de Castro.
1972
1973         * UIProcess/API/glib/WebKitSettings.cpp:
1974         (webkit_settings_class_init):
1975
1976 2020-01-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1977
1978         [GTK][WPE] Enable WebAudio by default
1979         https://bugs.webkit.org/show_bug.cgi?id=205334
1980
1981         Reviewed by Adrian Perez de Castro.
1982
1983         * UIProcess/API/glib/WebKitSettings.cpp:
1984         (webkit_settings_class_init):
1985
1986 2020-01-21  youenn fablet  <youenn@apple.com>
1987
1988         Log the destination of a load when hitting network process
1989         https://bugs.webkit.org/show_bug.cgi?id=206422
1990
1991         Reviewed by Darin Adler.
1992
1993         * NetworkProcess/NetworkResourceLoader.cpp:
1994         No change of behavior, adding more precise logging.
1995
1996 2020-01-20  David Kilzer  <ddkilzer@apple.com>
1997
1998         Fix missing header guards and clean up empty files in WebCore, WebKitLegacy, WebKit, Tools
1999         <https://webkit.org/b/206505>
2000
2001         Reviewed by Eric Carlson.
2002
2003         * Platform/IPC/Attachment.h:
2004         - Fix "# pragma" formatting. (It functioned, but WebKit style
2005           doesn't indent macros like this.)
2006
2007         * Platform/ios/AccessibilityIOS.h:
2008         * Shared/ShareSheetCallbackID.h:
2009         * Shared/mac/SecItemShim.h:
2010         * UIProcess/API/C/WKPageRenderingProgressEventsInternal.h:
2011         * UIProcess/API/Cocoa/WKNavigationData.h:
2012         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2013         * UIProcess/API/Cocoa/WKWebArchive.h:
2014         - Add #pragma once statement.
2015
2016 2020-01-20  Adrian Perez de Castro  <aperez@igalia.com>
2017
2018         Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.27.4 release
2019
2020         * wpe/NEWS: Add release notes for 2.27.4
2021
2022 2020-01-20  Zan Dobersek  <zdobersek@igalia.com>
2023
2024         [WPE] Add WebKitRectangle, use it for WebKitWebView's SHOW_MENU signal
2025         https://bugs.webkit.org/show_bug.cgi?id=206495
2026
2027         Reviewed by Carlos Garcia Campos.
2028
2029         Add WebKitRectangle, a new boxed-type API containing information about
2030         a simple rectangle consisting of integer coordinates. This would
2031         correspond to types like GdkRectangle or cairo_rectangle_int_t.
2032
2033         Objects of this type are for now needed to inform the position and size
2034         of the option menu. The `show-menu` signal signature is adjusted
2035         accordingly.
2036
2037         No new tests -- the relevant test was updated.
2038
2039         * PlatformWPE.cmake:
2040         * SourcesWPE.txt:
2041         * UIProcess/API/glib/WebKitWebView.cpp:
2042         (WebKitWebViewClient::showOptionMenu):
2043         (webkit_web_view_class_init):
2044         (webkitWebViewShowOptionMenu):
2045         * UIProcess/API/glib/WebKitWebViewPrivate.h:
2046         * UIProcess/API/wpe/WebKitPopupMenu.cpp:
2047         (WebKit::WebKitPopupMenu::showPopupMenu):
2048         * UIProcess/API/wpe/WebKitRectangle.cpp: Added.
2049         (webkit_rectangle_copy):
2050         (webkit_rectangle_free):
2051         * UIProcess/API/wpe/WebKitRectangle.h: Added.
2052         * UIProcess/API/wpe/WebKitWebView.h:
2053         * UIProcess/API/wpe/WebKitWebViewClient.h:
2054         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
2055         * UIProcess/API/wpe/docs/wpe-docs.sgml:
2056
2057 2020-01-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2058
2059         [GTK][WPE] InputMethodFilter: do not notify about focus in when only content type changed
2060         https://bugs.webkit.org/show_bug.cgi?id=206502
2061
2062         Reviewed by Adrian Perez de Castro.
2063
2064         That's unbalancing the focus in/out notifications.
2065
2066         * UIProcess/API/glib/InputMethodFilter.cpp:
2067         (WebKit::InputMethodFilter::setContext): Always call notifyContentType().
2068         (WebKit::InputMethodFilter::setState): Only call notifyFocusedIn() and notifyFocusedOut when there's a focus change.
2069         (WebKit::InputMethodFilter::notifyContentType): Notify content type if changed.
2070         (WebKit::InputMethodFilter::notifyFocusedIn): Move the content type notification to its own function.
2071         * UIProcess/API/glib/InputMethodFilter.h:
2072
2073 2020-01-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2074
2075         [GTK][WPE] Also include the selection index in webkit_input_method_context_notify_surrounding()
2076         https://bugs.webkit.org/show_bug.cgi?id=206497
2077
2078         Reviewed by Adrian Perez de Castro.
2079
2080         Input methods also want to know the selection.
2081
2082         * Shared/EditorState.cpp:
2083         (WebKit::EditorState::PostLayoutData::encode const): Encode paragraphContextSelectionPosition.
2084         (WebKit::EditorState::PostLayoutData::decode): Decode paragraphContextSelectionPosition.
2085         * Shared/EditorState.h: Add paragraphContextSelectionPosition.
2086         * UIProcess/API/glib/InputMethodFilter.cpp:
2087         (WebKit::InputMethodFilter::notifySurrounding): Also include the selection index.
2088         * UIProcess/API/glib/InputMethodFilter.h:
2089         * UIProcess/API/glib/WebKitInputMethodContext.cpp:
2090         (webkit_input_method_context_notify_surrounding):
2091         * UIProcess/API/gtk/WebKitInputMethodContext.h:
2092         * UIProcess/API/gtk/WebKitInputMethodContextImplGtk.cpp:
2093         (webkitInputMethodContextImplGtkNotifySurrounding): Ignore the selection index, since GtkIMContext doesn't
2094         support it.
2095         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2096         (webkitWebViewBaseUpdateTextInputState): Pass paragraphContextSelectionPosition to InputMethodFilter::notifySurrounding().
2097         * UIProcess/API/wpe/WPEView.cpp:
2098         (WKWPE::View::selectionDidChange): Ditto.
2099         * UIProcess/API/wpe/WebKitInputMethodContext.h:
2100         * WebProcess/WebPage/glib/WebPageGLib.cpp:
2101         (WebKit::WebPage::platformEditorState const): Get the selection index too.
2102
2103 2020-01-20  Zan Dobersek  <zdobersek@igalia.com>
2104
2105         [WPE] Expose the WebKitOptionMenu APIs
2106         https://bugs.webkit.org/show_bug.cgi?id=206287
2107
2108         Reviewed by Carlos Garcia Campos.
2109
2110         Enable the GLib-based API covering option menu functionality for WPE.
2111
2112         Most of this can be shared with the GTK port. The only difference is in
2113         the two additional parameters emitted on the WebKitWebView's "show-menu"
2114         signal (GdkEvent and GdkRectangle) that WPE doesn't support at the
2115         moment. The rectangle information will be possible to emit in the near
2116         future once a usable API type is available for this information.
2117
2118         The WebKitPopupMenu implementation for WPE would only work with the
2119         GLib-based API. To avoid using it with other APIs, this is implemented
2120         only on the WebKitWebViewClient interface (renamed from 'WebViewClient'
2121         and its declaration moved into a separate header file) inheriting from
2122         API::ViewClient.
2123
2124         The relevant API test is enabled for WPE.
2125
2126         * PlatformWPE.cmake:
2127         * SourcesWPE.txt:
2128         * UIProcess/API/glib/WebKitWebView.cpp:
2129         (WebKitWebViewClient::WebKitWebViewClient):
2130         (WebKitWebViewClient::showOptionMenu):
2131         (WebKitWebViewClient::handleDownloadRequest):
2132         (WebKitWebViewClient::frameDisplayed):
2133         (WebKitWebViewClient::willStartLoad):
2134         (WebKitWebViewClient::didChangePageID):
2135         (WebKitWebViewClient::didReceiveUserMessage):
2136         (webkitWebViewConstructed):
2137         (webkit_web_view_class_init):
2138         (webkitWebViewShowOptionMenu):
2139         * UIProcess/API/glib/WebKitWebViewPrivate.h:
2140         * UIProcess/API/wpe/APIViewClient.h:
2141         (API::ViewClient::isGLibBasedAPI):
2142         * UIProcess/API/wpe/PageClientImpl.cpp:
2143         (WebKit::PageClientImpl::createPopupMenuProxy):
2144         * UIProcess/API/wpe/WPEView.h:
2145         (WKWPE::View::client const):
2146         * UIProcess/API/wpe/WebKitOptionMenu.h: Added.
2147         * UIProcess/API/wpe/WebKitOptionMenuItem.h: Added.
2148         * UIProcess/API/wpe/WebKitPopupMenu.cpp: Added.
2149         (WebKit::WebKitPopupMenu::create):
2150         (WebKit::WebKitPopupMenu::WebKitPopupMenu):
2151         (WebKit::menuCloseCallback):
2152         (WebKit::WebKitPopupMenu::showPopupMenu):
2153         (WebKit::WebKitPopupMenu::hidePopupMenu):
2154         (WebKit::WebKitPopupMenu::cancelTracking):
2155         (WebKit::WebKitPopupMenu::selectItem):
2156         (WebKit::WebKitPopupMenu::activateItem):
2157         * UIProcess/API/wpe/WebKitPopupMenu.h: Added.
2158         * UIProcess/API/wpe/WebKitWebView.h:
2159         * UIProcess/API/wpe/WebKitWebViewClient.h: Added.
2160         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
2161         * UIProcess/API/wpe/webkit.h:
2162
2163 2020-01-20  youenn fablet  <youenn@apple.com>
2164
2165         Add support for MediaStream video track rendering in GPUProcess
2166         https://bugs.webkit.org/show_bug.cgi?id=206286
2167
2168         Reviewed by Eric Carlson.
2169
2170         Implement WebProcess SampleBufferDisplayLayer and GPUProcess RemoteSampleBufferDisplayLayer.
2171         RemoteSampleBufferDisplayLayer is a wrapper around LocalSampleBufferDisplayLayer.
2172
2173         A synchronous IPC is used at creation time of the layer to make sure we have a shared layer synchronously.
2174         Future refactoring should allow to remove that constraint as done in regular video playing.
2175
2176         Override SampleBufferDisplayLayer create function pointer when rendering is to be done in GPUProcess.
2177
2178         * DerivedSources-input.xcfilelist:
2179         * DerivedSources-output.xcfilelist:
2180         * DerivedSources.make:
2181         * GPUProcess/GPUConnectionToWebProcess.cpp:
2182         (WebKit::GPUConnectionToWebProcess::sampleBufferDisplayLayerManager):
2183         (WebKit::GPUConnectionToWebProcess::didReceiveMessage):
2184         (WebKit::GPUConnectionToWebProcess::didReceiveSyncMessage):
2185         * GPUProcess/GPUConnectionToWebProcess.h:
2186         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp: Added.
2187         (WebKit::RemoteSampleBufferDisplayLayer::create):
2188         (WebKit::RemoteSampleBufferDisplayLayer::RemoteSampleBufferDisplayLayer):
2189         (WebKit::RemoteSampleBufferDisplayLayer::~RemoteSampleBufferDisplayLayer):
2190         (WebKit::RemoteSampleBufferDisplayLayer::contextID):
2191         (WebKit::RemoteSampleBufferDisplayLayer::bounds const):
2192         (WebKit::RemoteSampleBufferDisplayLayer::updateDisplayMode):
2193         (WebKit::RemoteSampleBufferDisplayLayer::updateAffineTransform):
2194         (WebKit::RemoteSampleBufferDisplayLayer::updateBoundsAndPosition):
2195         (WebKit::RemoteSampleBufferDisplayLayer::flush):
2196         (WebKit::RemoteSampleBufferDisplayLayer::flushAndRemoveImage):
2197         (WebKit::RemoteSampleBufferDisplayLayer::enqueueSample):
2198         (WebKit::RemoteSampleBufferDisplayLayer::clearEnqueuedSamples):
2199         (WebKit::RemoteSampleBufferDisplayLayer::messageSenderConnection const):
2200         (WebKit::RemoteSampleBufferDisplayLayer::sampleBufferDisplayLayerStatusDidChange):
2201         (WebKit::RemoteSampleBufferDisplayLayer::streamTime const):
2202         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h: Added.
2203         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.messages.in: Added.
2204         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp: Added.
2205         (WebKit::RemoteSampleBufferDisplayLayerManager::RemoteSampleBufferDisplayLayerManager):
2206         (WebKit::RemoteSampleBufferDisplayLayerManager::didReceiveLayerMessage):
2207         (WebKit::RemoteSampleBufferDisplayLayerManager::createLayer):
2208         (WebKit::RemoteSampleBufferDisplayLayerManager::releaseLayer):
2209         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h: Added.
2210         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.messages.in: Added.
2211         * Scripts/webkit/messages.py:
2212         * Shared/WebCoreArgumentCoders.h:
2213         * Shared/mac/WebCoreArgumentCodersMac.mm:
2214         (IPC::ArgumentCoder<CGRect>::encode):
2215         (IPC::ArgumentCoder<CGRect>::decode):
2216         (IPC::ArgumentCoder<CGSize>::encode):
2217         (IPC::ArgumentCoder<CGSize>::decode):
2218         (IPC::ArgumentCoder<CGPoint>::encode):
2219         (IPC::ArgumentCoder<CGPoint>::decode):
2220         (IPC::ArgumentCoder<CGAffineTransform>::encode):
2221         (IPC::ArgumentCoder<CGAffineTransform>::decode):
2222         * Sources.txt:
2223         * SourcesCocoa.txt:
2224         * WebKit.xcodeproj/project.pbxproj:
2225         * WebProcess/GPU/GPUProcessConnection.cpp:
2226         (WebKit::GPUProcessConnection::sampleBufferDisplayLayerManager):
2227         (WebKit::GPUProcessConnection::didReceiveMessage):
2228         * WebProcess/GPU/GPUProcessConnection.h:
2229         * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
2230         (WebKit::RemoteMediaPlayerManager::updatePreferences):
2231         * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp: Added.
2232         (WebKit::SampleBufferDisplayLayer::create):
2233         (WebKit::SampleBufferDisplayLayer::SampleBufferDisplayLayer):
2234         (WebKit::SampleBufferDisplayLayer::~SampleBufferDisplayLayer):
2235         (WebKit::SampleBufferDisplayLayer::didFail const):
2236         (WebKit::SampleBufferDisplayLayer::updateDisplayMode):
2237         (WebKit::SampleBufferDisplayLayer::bounds const):
2238         (WebKit::SampleBufferDisplayLayer::updateAffineTransform):
2239         (WebKit::SampleBufferDisplayLayer::updateBoundsAndPosition):
2240         (WebKit::SampleBufferDisplayLayer::flush):
2241         (WebKit::SampleBufferDisplayLayer::flushAndRemoveImage):
2242         (WebKit::SampleBufferDisplayLayer::enqueueSample):
2243         (WebKit::SampleBufferDisplayLayer::clearEnqueuedSamples):
2244         (WebKit::SampleBufferDisplayLayer::rootLayer):
2245         (WebKit::SampleBufferDisplayLayer::setDidFail):
2246         (WebKit::SampleBufferDisplayLayer::boundsChanged):
2247         * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h: Added.
2248         * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.messages.in: Added.
2249         * WebProcess/GPU/webrtc/SampleBufferDisplayLayerIdentifier.h: Added.
2250         * WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.cpp: Added.
2251         (WebKit::SampleBufferDisplayLayerManager::didReceiveLayerMessage):
2252         (WebKit::SampleBufferDisplayLayerManager::createLayer):
2253         (WebKit::SampleBufferDisplayLayerManager::addLayer):
2254         (WebKit::SampleBufferDisplayLayerManager::removeLayer):
2255         * WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.h: Added.
2256         * WebProcess/WebProcess.h:
2257
2258 2020-01-19  Eric Carlson  <eric.carlson@apple.com>
2259
2260         Make MediaPlayerPrivateRemote a message receiver
2261         https://bugs.webkit.org/show_bug.cgi?id=206487
2262         <rdar://problem/58721559>
2263
2264         Reviewed by Dean Jackson.
2265
2266         Make MediaPlayerPrivateRemote a message receiver so we don't need a trampoline
2267         for every method in the MediaPlayerPrivateRemoteManager.
2268         
2269         No new tests, no change of behavior.
2270
2271         * DerivedSources-input.xcfilelist:
2272         * DerivedSources-output.xcfilelist:
2273         * DerivedSources.make:
2274         * GPUProcess/media/RemoteAudioTrackProxy.cpp:
2275         (WebKit::RemoteAudioTrackProxy::RemoteAudioTrackProxy):
2276         (WebKit::RemoteAudioTrackProxy::configurationChanged):
2277         (WebKit::RemoteAudioTrackProxy::willRemove):
2278         * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
2279         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
2280         (WebKit::RemoteMediaPlayerProxy::requestResource):
2281         (WebKit::RemoteMediaPlayerProxy::removeResource):
2282         (WebKit::RemoteMediaPlayerProxy::mediaPlayerNetworkStateChanged):
2283         (WebKit::RemoteMediaPlayerProxy::mediaPlayerReadyStateChanged):
2284         (WebKit::RemoteMediaPlayerProxy::mediaPlayerVolumeChanged):
2285         (WebKit::RemoteMediaPlayerProxy::mediaPlayerMuteChanged):
2286         (WebKit::RemoteMediaPlayerProxy::mediaPlayerTimeChanged):
2287         (WebKit::RemoteMediaPlayerProxy::mediaPlayerDurationChanged):
2288         (WebKit::RemoteMediaPlayerProxy::mediaPlayerRateChanged):
2289         (WebKit::RemoteMediaPlayerProxy::mediaPlayerEngineFailedToLoad const):
2290         (WebKit::RemoteMediaPlayerProxy::mediaPlayerPlaybackStateChanged):
2291         (WebKit::RemoteMediaPlayerProxy::mediaPlayerCharacteristicChanged):
2292         (WebKit::RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable):
2293         (WebKit::RemoteMediaPlayerProxy::sendCachedState):
2294         * GPUProcess/media/RemoteMediaResourceManager.cpp:
2295         * GPUProcess/media/RemoteVideoTrackProxy.cpp:
2296         (WebKit::RemoteVideoTrackProxy::RemoteVideoTrackProxy):
2297         (WebKit::RemoteVideoTrackProxy::configurationChanged):
2298         (WebKit::RemoteVideoTrackProxy::willRemove):
2299         * WebKit.xcodeproj/project.pbxproj:
2300         * WebProcess/GPU/GPUProcessConnection.cpp:
2301         (WebKit::GPUProcessConnection::didReceiveMessage):
2302         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
2303         (WebKit::MediaPlayerPrivateRemote::requestResource):
2304         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
2305         * WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in: Added.
2306         * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
2307         (WebKit::RemoteMediaPlayerManager::didReceivePlayerMessage):
2308         (WebKit::RemoteMediaPlayerManager::networkStateChanged): Deleted.
2309         (WebKit::RemoteMediaPlayerManager::readyStateChanged): Deleted.
2310         (WebKit::RemoteMediaPlayerManager::volumeChanged): Deleted.
2311         (WebKit::RemoteMediaPlayerManager::muteChanged): Deleted.
2312         (WebKit::RemoteMediaPlayerManager::timeChanged): Deleted.
2313         (WebKit::RemoteMediaPlayerManager::durationChanged): Deleted.
2314         (WebKit::RemoteMediaPlayerManager::rateChanged): Deleted.
2315         (WebKit::RemoteMediaPlayerManager::playbackStateChanged): Deleted.
2316         (WebKit::RemoteMediaPlayerManager::engineFailedToLoad): Deleted.
2317         (WebKit::RemoteMediaPlayerManager::characteristicChanged): Deleted.
2318         (WebKit::RemoteMediaPlayerManager::sizeChanged): Deleted.
2319         (WebKit::RemoteMediaPlayerManager::addRemoteAudioTrack): Deleted.
2320         (WebKit::RemoteMediaPlayerManager::removeRemoteAudioTrack): Deleted.
2321         (WebKit::RemoteMediaPlayerManager::remoteAudioTrackConfigurationChanged): Deleted.
2322         (WebKit::RemoteMediaPlayerManager::addRemoteVideoTrack): Deleted.
2323         (WebKit::RemoteMediaPlayerManager::removeRemoteVideoTrack): Deleted.
2324         (WebKit::RemoteMediaPlayerManager::remoteVideoTrackConfigurationChanged): Deleted.
2325         (WebKit::RemoteMediaPlayerManager::firstVideoFrameAvailable): Deleted.
2326         (WebKit::RemoteMediaPlayerManager::requestResource): Deleted.
2327         (WebKit::RemoteMediaPlayerManager::removeResource): Deleted.
2328         (WebKit::RemoteMediaPlayerManager::updateCachedState): Deleted.
2329         * WebProcess/GPU/media/RemoteMediaPlayerManager.h:
2330         (WebKit::RemoteMediaPlayerManager::didReceiveMessageFromGPUProcess): Deleted.
2331         * WebProcess/GPU/media/RemoteMediaPlayerManager.messages.in:
2332
2333 2020-01-19  Claudio Saavedra  <csaavedra@igalia.com>
2334
2335         [GTK] Remove usage of deprecated GTimeVal
2336         https://bugs.webkit.org/show_bug.cgi?id=206358
2337
2338         Reviewed by Žan Doberšek.
2339
2340         Use g_get_monotonic_time() for counting clicks instead of
2341         deprecated and unsafe API.
2342
2343         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2344         (ClickCounter::currentClickCountForGdkButtonEvent):
2345
2346 2020-01-17  Cathie Chen  <cathiechen@igalia.com>
2347
2348         Add support for scroll behavior parsing
2349         https://bugs.webkit.org/show_bug.cgi?id=205009
2350
2351         Reviewed by Frédéric Wang.
2352
2353         Based on the patch by Frédéric Wang.
2354
2355         Add CSSOM smooth scrolling as an experimental feature.
2356
2357         * Shared/WebPreferences.yaml:
2358
2359 2020-01-17  Peng Liu  <peng.liu6@apple.com>
2360
2361         Fix a build failure related to the feature flag (GPU_PROCESS)
2362         https://bugs.webkit.org/show_bug.cgi?id=206453
2363
2364         Reviewed by Eric Carlson.
2365
2366         No new tests - no added or changed functionality.
2367
2368         * GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in:
2369         * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
2370
2371 2020-01-17  Matt Lewis  <jlewis3@apple.com>
2372
2373         Unreviewed, rolling out r254688.
2374
2375         This caused internal test crashes.
2376
2377         Reverted changeset:
2378
2379         "Add support for MediaStream video track rendering in
2380         GPUProcess"
2381         https://bugs.webkit.org/show_bug.cgi?id=206286
2382         https://trac.webkit.org/changeset/254688
2383
2384 2020-01-17  Daniel Bates  <dabates@apple.com>
2385
2386         [iOS] ASSERTION FAILED: ASSERT_NOT_REACHED() in selectionChangedWithTouch(WKContentView*, WebCore::IntPoint const&, unsigned int, unsigned int, WebKit::CallbackBase::Error)
2387         https://bugs.webkit.org/show_bug.cgi?id=206427
2388
2389         Reviewed by Wenson Hsieh.
2390
2391         Remove ASSERT_NOT_REACHED() usage in callbacks selectionChangedWithTouch() and selectionChangedWithGesture().
2392         These callbacks can handle being- and should expect to sometimes be- invoked with a non-None error value.
2393         In particular, if the WebProcess crashes then these callbacks will be invoked with error CallbackBase::Error::ProcessExited.
2394
2395         * UIProcess/ios/WKContentViewInteraction.mm:
2396         (selectionChangedWithGesture): Remove ASSERT_NOT_REACHED() when an error occurs. This
2397         function is capable of handling this error.
2398         (selectionChangedWithTouch): Ditto.
2399
2400 2020-01-17  Brent Fulgham  <bfulgham@apple.com>
2401
2402         [iOS] Remove the IOHIDEventServiceFastPathUserClient IOKit class
2403         https://bugs.webkit.org/show_bug.cgi?id=206387
2404         <rdar://problem/58663849>
2405
2406         Reviewed by Per Arne Vollan.
2407
2408         After Bug 204770, we no longer interact with the device motion or geolocation systems inside
2409         the WebContent process. Testing and telemetry shows that we no longer access the
2410         IOHIDEventServiceFastPathUserClient, and so should remove access to it.
2411
2412         No new tests because there is no change in behavior.
2413
2414         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2415
2416 2020-01-17  Brady Eidson  <beidson@apple.com>
2417
2418         TestWebKitAPI.AsyncFunction.Promise times out on slower machines in debug builds.
2419         <rdar://problem/58445164> and https://bugs.webkit.org/show_bug.cgi?id=206012
2420
2421         Reviewed by Keith Miller.
2422
2423         For existing API test.
2424
2425         * UIProcess/API/Cocoa/WKProcessPool.mm:
2426         (-[WKProcessPool _garbageCollectJavaScriptObjectsForTesting]):
2427         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2428
2429 2020-01-17  Daniel Bates  <dabates@apple.com>
2430
2431         [iOS] Focusing editable element with WebPage::selectPositionAtPoint() does not bring up keyboard
2432         https://bugs.webkit.org/show_bug.cgi?id=206385
2433         <rdar://problem/57414380>
2434
2435         Reviewed by Wenson Hsieh.
2436
2437         Update the view's state to indicate that the user is performing an interaction for the scope of
2438         WebPage::selectPositionAtPoint(). This permits WebKit to show the keyboard if selecting the
2439         position causes a change in focus (say, the point is inside an unfocused text field).
2440
2441         We likely should do a similar change for all other WebKit IPIs that perform a WebCore::EUserTriggered::UserTriggered
2442         tagged selection change though the callers should be audited to ensure they weren't accidentally
2443         depending on the existing behavior that prevents such selections from bringing up the keyboard.
2444         For now, I only fix WebPage::selectPositionAtPoint() as I've audited that all callers expect it
2445         to bring up the keyboard, if needed.
2446
2447         * WebProcess/WebPage/ios/WebPageIOS.mm:
2448         (WebKit::WebPage::selectPositionAtPoint): 
2449
2450 2020-01-17  Adrian Perez de Castro  <aperez@igalia.com>
2451
2452         Fix various non-unified build issues introduced since r254327
2453         https://bugs.webkit.org/show_bug.cgi?id=206356
2454
2455         Reviewed by Chris Dumez.
2456
2457         * WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp:
2458         (WebKit::WebContextMenuClient::insertEmoji): Add missing namespace to WebCore::Frame parameter.
2459
2460 2020-01-17  Fujii Hironori  <Hironori.Fujii@sony.com>
2461
2462         [WinCairo][WK2] ASSERT(isUIThread()) is failing since r254723
2463         https://bugs.webkit.org/show_bug.cgi?id=206394
2464
2465         Reviewed by Carlos Alberto Lopez Perez.
2466
2467         AtomString::init() should be called after
2468         WTF::initializeThreading() is called on Windows because it has
2469         ASSERT(isUIThread()) and Windows doesn't have a API to get main
2470         thread handle like pthread_main_np.
2471
2472         * Shared/WebKit2Initialize.cpp:
2473         (WebKit::InitializeWebKit2): Call AtomString::init() after JSC::initializeThreading().
2474
2475 2020-01-17  Chris Dumez  <cdumez@apple.com>
2476
2477         IPC hardening for WebPasteboardProxy::SetPasteboardBufferForType message
2478         https://bugs.webkit.org/show_bug.cgi?id=206381
2479
2480         Reviewed by Anders Carlsson.
2481
2482         IPC hardening for WebPasteboardProxy::SetPasteboardBufferForType message. Make sure that the Strings passed over IPC are not
2483         null and that the SharedBuffer returned by SharedBuffer::map() is not null.
2484
2485         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
2486         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
2487
2488 2020-01-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2489
2490         [GTK][WPE] Composition underline color is not applied
2491         https://bugs.webkit.org/show_bug.cgi?id=206353
2492
2493         Reviewed by Sergio Villar Senin.
2494
2495         CompositionUnderline::compositionUnderlineColor is not encoded/decoded in IPC messages, so the web process
2496         always uses CompositionUnderlineColor::TextColor ignoring the given color.
2497
2498         * Shared/WebCoreArgumentCoders.cpp:
2499         (IPC::ArgumentCoder<CompositionUnderline>::encode): Encode compositionUnderlineColor.
2500         (IPC::ArgumentCoder<CompositionUnderline>::decode): Decode compositionUnderlineColor.
2501
2502 2020-01-16  Zan Dobersek  <zdobersek@igalia.com>
2503
2504         Unreviewed. Move the common WebKitOptionMenu GLib API implementation
2505         parts out from the GTK-specific directory and under UIProcess/API/glib/.
2506
2507         * SourcesGTK.txt:
2508         * UIProcess/API/glib/WebKitOptionMenu.cpp: Copied from Source/WebKit/UIProcess/API/gtk/WebKitOptionMenu.cpp.
2509         * UIProcess/API/glib/WebKitOptionMenuItem.cpp: Copied from Source/WebKit/UIProcess/API/gtk/WebKitOptionMenuItem.cpp.
2510         * UIProcess/API/glib/WebKitOptionMenuItemPrivate.h: Copied from Source/WebKit/UIProcess/API/gtk/WebKitOptionMenuItemPrivate.h.
2511         * UIProcess/API/glib/WebKitOptionMenuPrivate.h: Copied from Source/WebKit/UIProcess/API/gtk/WebKitOptionMenuPrivate.h.
2512         * UIProcess/API/gtk/WebKitOptionMenu.cpp: Removed.
2513         * UIProcess/API/gtk/WebKitOptionMenuItem.cpp: Removed.
2514         * UIProcess/API/gtk/WebKitOptionMenuItemPrivate.h: Removed.
2515         * UIProcess/API/gtk/WebKitOptionMenuPrivate.h: Removed.
2516
2517 2020-01-16  Brent Fulgham  <bfulgham@apple.com>
2518
2519         [iOS] Add telemetry for IOKIt classes not seen in test runs
2520         https://bugs.webkit.org/show_bug.cgi?id=206386
2521         <rdar://problem/58663519>
2522
2523         Reviewed by Per Arne Vollan.
2524
2525         Capture telemetry to show which IOKit classes are acitvely used in WebKit.
2526
2527         No new tests because this does not change behavior.
2528
2529         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2530
2531 2020-01-16  Chris Dumez  <cdumez@apple.com>
2532
2533         IPC hardening for WebPageProxy::SetPromisedDataForImage message
2534         https://bugs.webkit.org/show_bug.cgi?id=206380
2535         <rdar://problem/58625196>
2536
2537         Reviewed by Geoffrey Garen.
2538
2539         IPC hardening for WebPageProxy::SetPromisedDataForImage message. Make sure the shared memory handle sent over IPC is not null
2540         and null check the SharedMemory object after calling SharedMemory::map().
2541
2542         * UIProcess/mac/WebPageProxyMac.mm:
2543         (WebKit::WebPageProxy::setPromisedDataForImage):
2544
2545 2020-01-16  Daniel Chen  <thedanielchen@apple.com>
2546
2547         Call AtomString::init in WebKit2Initialize.
2548         <https://webkit.org/b/206375>
2549         <rdar://problem/58646578>
2550
2551         Reviewed by Timothy Hatcher.
2552
2553         * Shared/Cocoa/WebKit2InitializeCocoa.mm:
2554         (WebKit::runInitializationCode):
2555         * Shared/WebKit2Initialize.cpp:
2556         (WebKit::InitializeWebKit2):
2557
2558 2020-01-16  Chris Dumez  <cdumez@apple.com>
2559
2560         IPC hardening for WebPageProxy::savePDFToTemporaryFolder* / WebPageProxy::openPDFFromTemporaryFolder* messages
2561         https://bugs.webkit.org/show_bug.cgi?id=206378
2562         <rdar://problem/58622919>
2563
2564         Reviewed by Geoffrey Garen.
2565
2566         IPC hardening for WebPageProxy::savePDFToTemporaryFolder* / WebPageProxy::openPDFFromTemporaryFolder* messages.
2567         Make sure the UUID passed over IPC is a valid HashMap key.
2568
2569         * UIProcess/WebPageProxy.h:
2570         * UIProcess/mac/WebPageProxyMac.mm:
2571         (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication):
2572         (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication):
2573
2574 2020-01-16  Chris Dumez  <cdumez@apple.com>
2575
2576         IPC hardening for WebPageProxy::RegisterAttachmentIdentifier*
2577         https://bugs.webkit.org/show_bug.cgi?id=206376
2578         <rdar://problem/58622645>
2579
2580         Reviewed by David Kilzer.
2581
2582         IPC hardening for WebPageProxy::RegisterAttachmentIdentifier*, validate identifiers sent over
2583         IPC to make sure they are valid keys in our HashMap.
2584
2585         * UIProcess/WebPageProxy.cpp:
2586         * UIProcess/WebPageProxy.h:
2587
2588 2020-01-16  Don Olmstead  <don.olmstead@sony.com>
2589
2590         [PlayStation] Enable WebKit
2591         https://bugs.webkit.org/show_bug.cgi?id=205965
2592
2593         Reviewed by Ross Kirsling.
2594
2595         Add the CMake platform for PlayStation. Add stubs for platform specific bits.
2596         This gets us to linking through WebKit.
2597
2598         * Platform/unix/ModuleUnix.cpp: Added.
2599         (WebKit::Module::load):
2600         (WebKit::Module::unload):
2601         (WebKit::Module::platformFunctionPointer const):
2602         * PlatformPlayStation.cmake: Added.
2603         * UIProcess/Launcher/playstation/ProcessLauncherPlayStation.cpp: Added.
2604         (WebKit::ProcessLauncher::launchProcess):
2605         (WebKit::ProcessLauncher::terminateProcess):
2606         (WebKit::ProcessLauncher::platformInvalidate):
2607         * UIProcess/WebPageProxy.h:
2608         * UIProcess/WebsiteData/playstation/WebsiteDataStorePlayStation.cpp: Added.
2609         (WebKit::WebsiteDataStore::platformInitialize):
2610         (WebKit::WebsiteDataStore::platformDestroy):
2611         (WebKit::WebsiteDataStore::platformRemoveRecentSearches):
2612         (WebKit::WebsiteDataStore::defaultApplicationCacheDirectory):
2613         (WebKit::WebsiteDataStore::defaultCacheStorageDirectory):
2614         (WebKit::WebsiteDataStore::defaultNetworkCacheDirectory):
2615         (WebKit::WebsiteDataStore::defaultIndexedDBDatabaseDirectory):
2616         (WebKit::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
2617         (WebKit::WebsiteDataStore::defaultLocalStorageDirectory):
2618         (WebKit::WebsiteDataStore::defaultMediaKeysStorageDirectory):
2619         (WebKit::WebsiteDataStore::defaultWebSQLDatabaseDirectory):
2620         (WebKit::WebsiteDataStore::defaultResourceLoadStatisticsDirectory):
2621         (WebKit::WebsiteDataStore::cacheDirectoryFileSystemRepresentation):
2622         (WebKit::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation):
2623         * UIProcess/playstation/WebPageProxyPlayStation.cpp: Added.
2624         (WebKit::WebPageProxy::platformInitialize):
2625         (WebKit::WebPageProxy::viewBackend):
2626         (WebKit::WebPageProxy::standardUserAgent):
2627         (WebKit::WebPageProxy::saveRecentSearches):
2628         (WebKit::WebPageProxy::loadRecentSearches):
2629         (WebKit::WebPageProxy::updateEditorState):
2630         * UIProcess/playstation/WebProcessPoolPlayStation.cpp: Added.
2631         (WebKit::WebProcessPool::platformInitialize):
2632         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2633         (WebKit::WebProcessPool::platformInitializeWebProcess):
2634         (WebKit::WebProcessPool::platformInvalidateContext):
2635         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
2636         * WebProcess/InjectedBundle/playstation/InjectedBundlePlayStation.cpp: Added.
2637         (WebKit::InjectedBundle::initialize):
2638         (WebKit::InjectedBundle::setBundleParameter):
2639         (WebKit::InjectedBundle::setBundleParameters):
2640         * WebProcess/WebPage/playstation/WebPagePlayStation.cpp: Added.
2641         (WebKit::WebPage::platformInitialize):
2642         (WebKit::WebPage::platformReinitialize):
2643         (WebKit::WebPage::platformDetach):
2644         (WebKit::WebPage::performDefaultBehaviorForKeyEvent):
2645         (WebKit::WebPage::platformCanHandleRequest):
2646         (WebKit::WebPage::platformUserAgent const):
2647         (WebKit::WebPage::handleEditingKeyboardEvent):
2648         (WebKit::WebPage::platformEditorState const):
2649         * WebProcess/playstation/WebProcessPlayStation.cpp: Added.
2650         (WebKit::WebProcess::platformInitializeWebProcess):
2651         (WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
2652         (WebKit::WebProcess::platformTerminate):
2653         (WebKit::WebProcess::platformSetCacheModel):
2654
2655 2020-01-16  Chris Dumez  <cdumez@apple.com>
2656
2657         Regression(r253224) No longer able to prevent a tab from closing via the beforeunload prompt
2658         https://bugs.webkit.org/show_bug.cgi?id=206366
2659         <rdar://problem/58537467>
2660
2661         Reviewed by Geoffrey Garen.
2662
2663         Change is covered by new API test.
2664
2665         * UIProcess/API/Cocoa/WKWebView.mm:
2666         (-[WKWebView _tryClose]):
2667         (-[WKWebView _isClosed]):
2668         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2669         Add new _tryClose / _isClosed SPI on WKWebView in order to write an API test to cover
2670         the change.
2671
2672         * UIProcess/WebPageProxy.cpp:
2673         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
2674         In WebPageProxy::tryClose(), we start a timer before sending the TryClose async IPC to the
2675         WebProcess. We would then stop the timer when receiving the response to the TryClose IPC.
2676         If the timer fires, we would forcefully close the page. The issue was that before answering
2677         the TryClose IPC, the WebContent process would send a sync RunBeforeUnloadConfirmPanel IPC
2678         to the UIProcess to show the confirmation prompt, and this would fail to stop the timer.
2679         WebPageProxy::runBeforeUnloadConfirmPanel() would spin a nested run loop to show the prompt
2680         and we would time out while showing the prompt.
2681
2682 2020-01-16  Alex Christensen  <achristensen@webkit.org>
2683
2684         Add finite timeout when synchronously terminating a service worker
2685         https://bugs.webkit.org/show_bug.cgi?id=206325
2686         <rdar://problem/58183380>
2687
2688         Reviewed by Youenn Fablet.
2689
2690         When this message reply is never received, it hangs everything.
2691         If we haven't received verification that a service worker was terminated in 10 seconds, unhang everything
2692         and tell the UI process to terminate the hanging service worker process. Continue handling messages during
2693         these 10 seconds to hopefully turn a bad hang into no perceptible hang.
2694
2695         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2696         (WebKit::WebSWServerToContextConnection::syncTerminateWorker):
2697
2698 2020-01-16  Brady Eidson  <beidson@apple.com>
2699
2700         Make the callAsyncJavaScriptFunction function actually be async (so await works).
2701         <rdar://problem/58571682> and https://bugs.webkit.org/show_bug.cgi?id=206364
2702
2703         Reviewed by Geoffrey Garen.
2704
2705         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Update callAsyncJavaScriptFunction: header docs.
2706
2707 2020-01-16  Don Olmstead  <don.olmstead@sony.com>
2708
2709         Non-unified build fixes mid January 2020 edition
2710         https://bugs.webkit.org/show_bug.cgi?id=206363
2711
2712         Unreviewed build fix.
2713
2714         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
2715         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2716         * PlatformFTW.cmake:
2717         * PlatformWin.cmake:
2718         * UIProcess/API/APIContentWorld.cpp:
2719         * UIProcess/Automation/WebAutomationSession.cpp:
2720         * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
2721         * WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp: Removed.
2722
2723 2020-01-16  Brady Eidson  <beidson@apple.com>
2724
2725         REGRESSION: (r254668) [Mac Debug wk2] 21 http/tests/navigation/* tests are crashing with ASSERTION FAILED: world.first != 1.
2726         https://bugs.webkit.org/show_bug.cgi?id=206357
2727
2728         Unreviewed followup to r254668 to fix tests.
2729
2730         ASSERT is no longer valid.
2731         Also, having the magic constant "1" in code is mysterious. Make it properly named everywhere.
2732         
2733         * Shared/ContentWorldShared.h: Copied from Source/WebKit/UIProcess/API/APIUserContentWorld.cpp.
2734         * UIProcess/API/APIContentWorld.cpp:
2735         (API::ContentWorld::pageContentWorld):
2736         * UIProcess/API/APIUserContentWorld.cpp:
2737         (API::UserContentWorld::generateIdentifier):
2738         (API::UserContentWorld::UserContentWorld):
2739         * UIProcess/API/APIUserContentWorld.h:
2740         * WebKit.xcodeproj/project.pbxproj:
2741         * WebProcess/UserContent/WebUserContentController.cpp:
2742         (WebKit::WebUserContentController::addUserContentWorld):
2743
2744 2020-01-16  youenn fablet  <youenn@apple.com>
2745
2746         Add support for MediaStream video track rendering in GPUProcess
2747         https://bugs.webkit.org/show_bug.cgi?id=206286
2748
2749         Reviewed by Eric Carlson.
2750
2751         Implement WebProcess SampleBufferDisplayLayer and GPUProcess RemoteSampleBufferDisplayLayer.
2752         RemoteSampleBufferDisplayLayer is a wrapper around LocalSampleBufferDisplayLayer.
2753
2754         A synchronous IPC is used at creation time of the layer to make sure we have a shared layer synchronously.
2755         Future refactoring should allow to remove that constraint as done in regular video playing.
2756
2757         Override SampleBufferDisplayLayer create function pointer when rendering is to be done in GPUProcess.
2758
2759         * DerivedSources-input.xcfilelist:
2760         * DerivedSources-output.xcfilelist:
2761         * DerivedSources.make:
2762         * GPUProcess/GPUConnectionToWebProcess.cpp:
2763         (WebKit::GPUConnectionToWebProcess::sampleBufferDisplayLayerManager):
2764         (WebKit::GPUConnectionToWebProcess::didReceiveMessage):
2765         (WebKit::GPUConnectionToWebProcess::didReceiveSyncMessage):
2766         * GPUProcess/GPUConnectionToWebProcess.h:
2767         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp: Added.
2768         (WebKit::RemoteSampleBufferDisplayLayer::create):
2769         (WebKit::RemoteSampleBufferDisplayLayer::RemoteSampleBufferDisplayLayer):
2770         (WebKit::RemoteSampleBufferDisplayLayer::~RemoteSampleBufferDisplayLayer):
2771         (WebKit::RemoteSampleBufferDisplayLayer::contextID):
2772         (WebKit::RemoteSampleBufferDisplayLayer::bounds const):
2773         (WebKit::RemoteSampleBufferDisplayLayer::updateDisplayMode):
2774         (WebKit::RemoteSampleBufferDisplayLayer::updateAffineTransform):
2775         (WebKit::RemoteSampleBufferDisplayLayer::updateBoundsAndPosition):
2776         (WebKit::RemoteSampleBufferDisplayLayer::flush):
2777         (WebKit::RemoteSampleBufferDisplayLayer::flushAndRemoveImage):
2778         (WebKit::RemoteSampleBufferDisplayLayer::enqueueSample):
2779         (WebKit::RemoteSampleBufferDisplayLayer::clearEnqueuedSamples):
2780         (WebKit::RemoteSampleBufferDisplayLayer::messageSenderConnection const):
2781         (WebKit::RemoteSampleBufferDisplayLayer::sampleBufferDisplayLayerStatusDidChange):
2782         (WebKit::RemoteSampleBufferDisplayLayer::streamTime const):
2783         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h: Added.
2784         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.messages.in: Added.
2785         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp: Added.
2786         (WebKit::RemoteSampleBufferDisplayLayerManager::RemoteSampleBufferDisplayLayerManager):
2787         (WebKit::RemoteSampleBufferDisplayLayerManager::didReceiveLayerMessage):
2788         (WebKit::RemoteSampleBufferDisplayLayerManager::createLayer):
2789         (WebKit::RemoteSampleBufferDisplayLayerManager::releaseLayer):
2790         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h: Added.
2791         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.messages.in: Added.
2792         * Scripts/webkit/messages.py:
2793         * Shared/WebCoreArgumentCoders.h:
2794         * Shared/mac/WebCoreArgumentCodersMac.mm:
2795         (IPC::ArgumentCoder<CGRect>::encode):
2796         (IPC::ArgumentCoder<CGRect>::decode):
2797         (IPC::ArgumentCoder<CGSize>::encode):
2798         (IPC::ArgumentCoder<CGSize>::decode):
2799         (IPC::ArgumentCoder<CGPoint>::encode):
2800         (IPC::ArgumentCoder<CGPoint>::decode):
2801         (IPC::ArgumentCoder<CGAffineTransform>::encode):
2802         (IPC::ArgumentCoder<CGAffineTransform>::decode):
2803         * Sources.txt:
2804         * SourcesCocoa.txt:
2805         * WebKit.xcodeproj/project.pbxproj:
2806         * WebProcess/GPU/GPUProcessConnection.cpp:
2807         (WebKit::GPUProcessConnection::sampleBufferDisplayLayerManager):
2808         (WebKit::GPUProcessConnection::didReceiveMessage):
2809         * WebProcess/GPU/GPUProcessConnection.h:
2810         * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
2811         (WebKit::RemoteMediaPlayerManager::updatePreferences):
2812         * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp: Added.
2813         (WebKit::SampleBufferDisplayLayer::create):
2814         (WebKit::SampleBufferDisplayLayer::SampleBufferDisplayLayer):
2815         (WebKit::SampleBufferDisplayLayer::~SampleBufferDisplayLayer):
2816         (WebKit::SampleBufferDisplayLayer::didFail const):
2817         (WebKit::SampleBufferDisplayLayer::updateDisplayMode):
2818         (WebKit::SampleBufferDisplayLayer::bounds const):
2819         (WebKit::SampleBufferDisplayLayer::updateAffineTransform):
2820         (WebKit::SampleBufferDisplayLayer::updateBoundsAndPosition):
2821         (WebKit::SampleBufferDisplayLayer::flush):
2822         (WebKit::SampleBufferDisplayLayer::flushAndRemoveImage):
2823         (WebKit::SampleBufferDisplayLayer::enqueueSample):
2824         (WebKit::SampleBufferDisplayLayer::clearEnqueuedSamples):
2825         (WebKit::SampleBufferDisplayLayer::rootLayer):
2826         (WebKit::SampleBufferDisplayLayer::setDidFail):
2827         (WebKit::SampleBufferDisplayLayer::boundsChanged):
2828         * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h: Added.
2829         * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.messages.in: Added.
2830         * WebProcess/GPU/webrtc/SampleBufferDisplayLayerIdentifier.h: Added.
2831         * WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.cpp: Added.
2832         (WebKit::SampleBufferDisplayLayerManager::didReceiveLayerMessage):
2833         (WebKit::SampleBufferDisplayLayerManager::createLayer):
2834         (WebKit::SampleBufferDisplayLayerManager::addLayer):
2835         (WebKit::SampleBufferDisplayLayerManager::removeLayer):
2836         * WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.h: Added.
2837         * WebProcess/WebProcess.h:
2838
2839 2020-01-16  David Kilzer  <ddkilzer@apple.com>
2840
2841         Enable -Wconditional-uninitialized in WebInspectorUI, WebKitLegacy, WebKit projects
2842         <https://webkit.org/b/206270>
2843         <rdar://problem/58589767>
2844
2845         Reviewed by Tim Horton.
2846
2847         * Configurations/Base.xcconfig:
2848         (WARNING_CFLAGS): Add -Wconditional-uninitialized switch.
2849         * UIProcess/Automation/WebAutomationSession.cpp:
2850         (WebKit::WebAutomationSession::performInteractionSequence):
2851         Initialize `x`, `y` stack variables since the compiler can't
2852         reason about the behavior of JSON::Object::getInteger().
2853         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2854         (WebKit::getAllScriptsInPDFDocument): Initialize `length` stack
2855         variable.  Also add check that `length` is non-zero.
2856
2857 2020-01-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2858
2859         [GTK][WPE] Web process crash when IM tries to delete surrounding text
2860         https://bugs.webkit.org/show_bug.cgi?id=206352
2861
2862         Reviewed by Adrian Perez de Castro.
2863
2864         TextIterator::rangeFromLocationAndLength() can return nullptr when the start of the range can't be found.
2865
2866         * WebProcess/WebPage/WebPage.cpp:
2867         (WebKit::WebPage::deleteSurrounding): Return early if selectionRange is nullptr.
2868
2869 2020-01-16  Cathie Chen  <cathiechen@igalia.com>
2870
2871         Mapping HTML attributes width/height to the default aspect ratio of <img>
2872         https://bugs.webkit.org/show_bug.cgi?id=201641
2873
2874         Reviewed by Frédéric Wang
2875
2876         Add experimental flag: AspectRatioOfImgFromWidthAndHeightEnabled.
2877
2878         * Shared/WebPreferences.yaml:
2879
2880 2020-01-15  Brady Eidson  <beidson@apple.com>
2881
2882         Add WKContentWorld SPI, and use it in JavaScript execution.
2883         https://bugs.webkit.org/show_bug.cgi?id=206310
2884
2885         Reviewed by Alex Christensen.
2886
2887         Covered by API tests.
2888         
2889         _WKContentWorld is a UI Process wrapper for an InjectedBundleScriptWorld.
2890         Much like _WKUserContentWorld is. But different in that:
2891         - Its APIs are named different things
2892         - Only one unique instance per string name
2893         - It is used with evaluateJavascript: and callAsyncJavaScriptFunction: instead of WKUserContentController.
2894         
2895         But _WKContentWorld and _WKUserContentWorld do have to work together a little bit to avoid conflicts in the WebProcess.
2896         
2897         The new versions of evaluateJavascript: and callAsyncJavaScriptFunction: are also included, as well as API tests for all the new stuff.
2898
2899         * Shared/API/APIObject.h:
2900         * Shared/Cocoa/APIObject.mm:
2901         (API::Object::newObject):
2902
2903         * UIProcess/API/APIContentWorld.cpp: Copied from Source/WebKit/UIProcess/API/APIUserContentWorld.cpp.
2904         (API::ContentWorld::sharedWorldWithName):
2905         (API::ContentWorld::pageContentWorld):
2906         (API::ContentWorld::defaultClientWorld):
2907         (API::ContentWorld::ContentWorld):
2908         (API::ContentWorld::~ContentWorld):
2909         * UIProcess/API/APIContentWorld.h: Copied from Source/WebKit/UIProcess/API/APIUserContentWorld.h.
2910
2911         * UIProcess/API/APIUserContentWorld.cpp:
2912         (API::UserContentWorld::generateIdentifier):
2913         (API::UserContentWorld::UserContentWorld):
2914         (API::generateIdentifier): Deleted.
2915         * UIProcess/API/APIUserContentWorld.h:
2916
2917         * UIProcess/API/Cocoa/WKWebView.mm:
2918         (-[WKWebView evaluateJavaScript:completionHandler:]):
2919         (-[WKWebView _evaluateJavaScript:asAsyncFunction:withArguments:forceUserGesture:completionHandler:inWorld:]):
2920         (-[WKWebView _callAsyncJavaScriptFunction:withArguments:inWorld:completionHandler:]):
2921         (-[WKWebView _evaluateJavaScript:inWorld:completionHandler:]):
2922         (-[WKWebView _evaluateJavaScriptWithoutUserGesture:completionHandler:]):
2923         (-[WKWebView _evaluateJavaScript:asAsyncFunction:withArguments:forceUserGesture:completionHandler:]): Deleted.
2924         (-[WKWebView _callAsyncFunction:withArguments:completionHandler:]): Deleted.
2925         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2926
2927         * UIProcess/API/Cocoa/_WKContentWorld.h: Added.
2928         * UIProcess/API/Cocoa/_WKContentWorld.mm: Copied from Source/WebKit/UIProcess/API/APIUserContentWorld.h.
2929         (+[_WKContentWorld pageContentWorld]):
2930         (+[_WKContentWorld defaultClientWorld]):
2931         (+[_WKContentWorld worldWithName:]):
2932         (-[_WKContentWorld dealloc]):
2933         (-[_WKContentWorld name]):
2934         (-[_WKContentWorld _apiObject]):
2935         * UIProcess/API/Cocoa/_WKContentWorldInternal.h: Copied from Source/WebKit/UIProcess/API/APIUserContentWorld.h.
2936
2937         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2938         * UIProcess/UserContent/WebUserContentControllerProxy.h:
2939
2940         * UIProcess/WebPageProxy.cpp:
2941         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
2942         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
2943         * UIProcess/WebPageProxy.h:
2944
2945         * WebProcess/UserContent/WebUserContentController.cpp:
2946         (WebKit::worldMap):
2947         (WebKit::WebUserContentController::worldForIdentifier):
2948         (WebKit::WebUserContentController::addUserContentWorld):
2949         (WebKit::WebUserContentController::addUserContentWorlds):
2950         * WebProcess/UserContent/WebUserContentController.h:
2951
2952         * WebProcess/WebPage/WebPage.cpp:
2953         (WebKit::WebPage::runJavaScript):
2954         (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld):
2955         (WebKit::WebPage::runJavaScriptInFrame):
2956         * WebProcess/WebPage/WebPage.h:
2957         * WebProcess/WebPage/WebPage.messages.in:
2958
2959         * Sources.txt:
2960         * WebKit.xcodeproj/project.pbxproj:
2961
2962 2020-01-15  Ross Kirsling  <ross.kirsling@sony.com>
2963
2964         [PlayStation] Add stubs for WebContextMenuClient
2965         https://bugs.webkit.org/show_bug.cgi?id=206324
2966
2967         Reviewed by Don Olmstead.
2968
2969         * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
2970         (WebKit::WebContextMenuClient::lookUpInDictionary):
2971         (WebKit::WebContextMenuClient::isSpeaking):
2972         (WebKit::WebContextMenuClient::speak):
2973         (WebKit::WebContextMenuClient::stopSpeaking):
2974         * WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp:
2975         (WebKit::WebContextMenuClient::lookUpInDictionary): Deleted.
2976         (WebKit::WebContextMenuClient::isSpeaking): Deleted.
2977         (WebKit::WebContextMenuClient::speak): Deleted.
2978         (WebKit::WebContextMenuClient::stopSpeaking): Deleted.
2979         Bring GTK/WPE stubs down for broader use.
2980
2981 2020-01-15  Ross Kirsling  <ross.kirsling@sony.com>
2982
2983         [PlayStation] Add stub for WebPopupMenu::setUpPlatformData
2984         https://bugs.webkit.org/show_bug.cgi?id=206323
2985
2986         Reviewed by Don Olmstead.
2987
2988         * SourcesGTK.txt:
2989         * SourcesWPE.txt:
2990         * WebProcess/WebCoreSupport/WebPopupMenu.cpp:
2991         (WebKit::WebPopupMenu::setUpPlatformData):
2992         * WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp: Removed.
2993         * WebProcess/WebCoreSupport/wpe/WebPopupMenuWPE.cpp: Removed.
2994         Bring GTK/WPE stub down for broader use.
2995
2996 2020-01-15  Ross Kirsling  <ross.kirsling@sony.com>
2997
2998         [PlayStation] Add stubs for WebEditorClient
2999         https://bugs.webkit.org/show_bug.cgi?id=206320
3000
3001         Reviewed by Don Olmstead.
3002
3003         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
3004
3005 2020-01-15  Don Olmstead  <don.olmstead@sony.com>
3006
3007         Share WebInspector stubs for ports without local inspection
3008         https://bugs.webkit.org/show_bug.cgi?id=206267
3009
3010         Reviewed by Alex Christensen.
3011
3012         No new tests. No change in behavior.
3013
3014         Ports that do no allow local inspection of a web page can share a number of stubs
3015         around the Web Inspector. This is the case for iOS, WPE and the PlayStation port.
3016         Make the platform guards specific to actual implementations.
3017
3018         * SourcesWPE.txt:
3019         * UIProcess/RemoteWebInspectorProxy.cpp:
3020         * UIProcess/WebInspectorProxy.cpp:
3021         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
3022         * UIProcess/wpe/WebInspectorProxyWPE.cpp: Removed.
3023         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
3024         (WebKit::RemoteWebInspectorUI::localizedStringsURL const):
3025         * WebProcess/WebPage/WebInspectorUI.cpp:
3026         (WebKit::WebInspectorUI::canSave):
3027         (WebKit::WebInspectorUI::localizedStringsURL const):
3028         * WebProcess/WebPage/mac/WebInspectorUIMac.mm:
3029         * WebProcess/WebPage/wpe/WebInspectorUIWPE.cpp: Removed.
3030         * WebProcess/WebPage/wpe/WebInspectorWPE.cpp: Removed.
3031
3032 2020-01-15  David Kilzer  <ddkilzer@apple.com>
3033
3034         [Cocoa] Create a simulated crash log when the UI Process receives an invalid CoreIPC message
3035         <https://webkit.org/b/205368>
3036         <rdar://problem/58024593>
3037
3038         Reviewed by Chris Dumez.
3039
3040         * UIProcess/AuxiliaryProcessProxy.cpp:
3041         (WebKit::AuxiliaryProcessProxy::logInvalidMessage):
3042         - Extract common logging code to new method that calls
3043           RELEASE_LOG_FAULT().
3044         * UIProcess/AuxiliaryProcessProxy.h:
3045         (WebKit::AuxiliaryProcessProxy::logInvalidMessage):
3046         (WebKit::AuxiliaryProcessProxy::processName):
3047         - Add method declarations.
3048
3049         * UIProcess/GPU/GPUProcessProxy.cpp:
3050         (WebKit::GPUProcessProxy::didReceiveInvalidMessage):
3051         - Use new AuxiliaryProcessProxy::logInvalidMessage().
3052         * UIProcess/GPU/GPUProcessProxy.h:
3053         (WebKit::GPUProcessProxy::processName const):
3054         - Add implementation.
3055
3056         * UIProcess/Network/NetworkProcessProxy.cpp:
3057         (WebKit::NetworkProcessProxy::didReceiveInvalidMessage):
3058         - Use new AuxiliaryProcessProxy::logInvalidMessage().
3059         * UIProcess/Network/NetworkProcessProxy.h:
3060         (WebKit::NetworkProcessProxy::processName const):
3061         - Add implementation.
3062
3063         * UIProcess/Plugins/PluginProcessProxy.cpp:
3064         (WebKit::PluginProcessProxy::didReceiveInvalidMessage):
3065         - Use new AuxiliaryProcessProxy::logInvalidMessage().
3066         * UIProcess/Plugins/PluginProcessProxy.h:
3067         (WebKit::PluginProcessProxy::processName const):
3068         - Add implementation.
3069
3070         * UIProcess/WebProcessProxy.cpp:
3071         (WebKit::WebProcessProxy::didReceiveInvalidMessage):
3072         - Use new AuxiliaryProcessProxy::logInvalidMessage().
3073         * UIProcess/WebProcessProxy.h:
3074         (WebKit::WebProcessProxy::processName const):
3075         - Add implementation.
3076
3077 2020-01-15  youenn fablet  <youenn@apple.com>
3078
3079         Add support for MediaStream audio track rendering in GPUProcess
3080         https://bugs.webkit.org/show_bug.cgi?id=206175
3081
3082         Reviewed by Eric Carlson.
3083
3084         Implement an AudioMediaStreamTrackRenderer at WebKit level by creating a remote renderer in GPUProcess and sending IPC to pass
3085         audio data as well as orders (start/stop/setMuted).
3086
3087         Implement the remote renderer using WebCore audio track renderer.
3088
3089         Enable WebKit remote renderer F GPU process for media is enabled.
3090
3091         * DerivedSources-input.xcfilelist:
3092         * DerivedSources-output.xcfilelist:
3093         * DerivedSources.make:
3094         * GPUProcess/GPUConnectionToWebProcess.cpp:
3095         (WebKit::GPUConnectionToWebProcess::audioTrackRendererManager):
3096         (WebKit::GPUConnectionToWebProcess::didReceiveMessage):
3097         * GPUProcess/GPUConnectionToWebProcess.h:
3098         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp: Added.
3099         (WebKit::nextLogIdentifier):
3100         (WebKit::nullLogger):
3101         (WebKit::RemoteAudioMediaStreamTrackRenderer::RemoteAudioMediaStreamTrackRenderer):
3102         (WebKit::RemoteAudioMediaStreamTrackRenderer::~RemoteAudioMediaStreamTrackRenderer):
3103         (WebKit::RemoteAudioMediaStreamTrackRenderer::storage):
3104         (WebKit::RemoteAudioMediaStreamTrackRenderer::start):
3105         (WebKit::RemoteAudioMediaStreamTrackRenderer::stop):
3106         (WebKit::RemoteAudioMediaStreamTrackRenderer::clear):
3107         (WebKit::RemoteAudioMediaStreamTrackRenderer::setMuted):
3108         (WebKit::RemoteAudioMediaStreamTrackRenderer::setVolume):
3109         (WebKit::RemoteAudioMediaStreamTrackRenderer::audioSamplesStorageChanged):
3110         (WebKit::RemoteAudioMediaStreamTrackRenderer::audioSamplesAvailable):
3111         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.h: Added.
3112         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.messages.in: Added.
3113         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.cpp: Added.
3114         (WebKit::RemoteAudioMediaStreamTrackRendererManager::didReceiveRendererMessage):
3115         (WebKit::RemoteAudioMediaStreamTrackRendererManager::createRenderer):
3116         (WebKit::RemoteAudioMediaStreamTrackRendererManager::releaseRenderer):
3117         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.h: Added.
3118         (WebKit::RemoteAudioMediaStreamTrackRendererManager::didReceiveMessageFromWebProcess):
3119         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.messages.in: Added.
3120         * Scripts/webkit/messages.py:
3121         * Sources.txt:
3122         * SourcesCocoa.txt:
3123         * WebKit.xcodeproj/project.pbxproj:
3124         * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
3125         (WebKit::RemoteMediaPlayerManager::updatePreferences):
3126         * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp: Added.
3127         (WebKit::AudioMediaStreamTrackRenderer::create):
3128         (WebKit::AudioMediaStreamTrackRenderer::AudioMediaStreamTrackRenderer):
3129         (WebKit::AudioMediaStreamTrackRenderer::~AudioMediaStreamTrackRenderer):
3130         (WebKit::AudioMediaStreamTrackRenderer::start):
3131         (WebKit::AudioMediaStreamTrackRenderer::stop):
3132         (WebKit::AudioMediaStreamTrackRenderer::clear):
3133         (WebKit::AudioMediaStreamTrackRenderer::setMuted):
3134         (WebKit::AudioMediaStreamTrackRenderer::setVolume):
3135         (WebKit::AudioMediaStreamTrackRenderer::pushSamples):
3136         (WebKit::AudioMediaStreamTrackRenderer::storageChanged):
3137         * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.h: Added.
3138         (WebKit::AudioMediaStreamTrackRenderer::identifier const):
3139         * WebProcess/GPU/webrtc/AudioMediaStreamTrackRendererIdentifier.h: Added.
3140
3141 2020-01-14  Commit Queue  <commit-queue@webkit.org>
3142
3143         Unreviewed, rolling out r254548.
3144         https://bugs.webkit.org/show_bug.cgi?id=206279
3145
3146         Broke launching WebContent (Requested by ap_ on #webkit).
3147
3148         Reverted changeset:
3149
3150         "Expand WebContent process sandbox with additional syscall"
3151         https://bugs.webkit.org/show_bug.cgi?id=206260
3152         https://trac.webkit.org/changeset/254548
3153
3154 2020-01-14  Ryosuke Niwa  <rniwa@webkit.org>
3155
3156         Enable the offset assertion in HTMLTextFormControlElement::indexForPosition
3157         https://bugs.webkit.org/show_bug.cgi?id=205706
3158
3159         Reviewed by Darin Adler.
3160
3161         * WebProcess/WebPage/ios/WebPageIOS.mm:
3162         (WebKit::rangeNearPositionMatchesText):
3163
3164 2020-01-14  Chris Dumez  <cdumez@apple.com>
3165
3166         document.cookie should not do a sync IPC to the network process for iframes that do not have storage access
3167         https://bugs.webkit.org/show_bug.cgi?id=206108
3168
3169         Reviewed by Geoff Garen and John Wilander.
3170
3171         When ITP is enabled and ThirdPartyCookieBlockingMode::All mode is used (default in Safari), we can now detect
3172         that a third-party iframe does not have cookie access completely on the WebContent process side, instead of
3173         doing the check on the Network process side. The benefit is that this avoids doing a synchronous IPC every
3174         time a third-party iframe which does not have storage access tries to access document.cookie in JavaScript.
3175         Given that this should apply to a lot of iframes, this change is very beneficial to performance.
3176
3177         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3178         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
3179         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
3180         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
3181         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
3182         * NetworkProcess/NetworkConnectionToWebProcess.h:
3183         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3184         * NetworkProcess/NetworkResourceLoader.cpp:
3185         (WebKit::logCookieInformationInternal):
3186         * NetworkProcess/NetworkSessionCreationParameters.cpp:
3187         (WebKit::NetworkSessionCreationParameters::encode const):
3188         (WebKit::NetworkSessionCreationParameters::decode):
3189         * NetworkProcess/NetworkSessionCreationParameters.h:
3190         * Scripts/webkit/messages.py:
3191         * Shared/WebProcessDataStoreParameters.h:
3192         (WebKit::WebProcessDataStoreParameters::encode const):
3193         (WebKit::WebProcessDataStoreParameters::decode):
3194         * UIProcess/Network/NetworkProcessProxy.cpp:
3195         (WebKit::NetworkProcessProxy::setShouldBlockThirdPartyCookiesForTesting):
3196         * UIProcess/WebProcessPool.cpp:
3197         (WebKit::WebProcessPool::ensureNetworkProcess):
3198         (WebKit::WebProcessPool::webProcessDataStoreParameters):
3199         * UIProcess/WebProcessProxy.cpp:
3200         (WebKit::WebProcessProxy::setShouldBlockThirdPartyCookiesForTesting):
3201         * UIProcess/WebProcessProxy.h:
3202         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3203         (WebKit::WebsiteDataStore::thirdPartyCookieBlockingMode const):
3204         (WebKit::WebsiteDataStore::parameters):
3205         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3206         (WebKit::WebsiteDataStore::thirdPartyCookieBlockingMode const):
3207         (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting):
3208         * UIProcess/WebsiteData/WebsiteDataStore.h:
3209         * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
3210         (WebKit::WebResourceLoadObserver::requestStorageAccessUnderOpener):
3211         (WebKit::WebResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
3212         * WebProcess/WebCoreSupport/WebResourceLoadObserver.h:
3213         * WebProcess/WebPage/WebCookieJar.cpp:
3214         (WebKit::shouldBlockCookies):
3215         (WebKit::WebCookieJar::cookies const):
3216         (WebKit::WebCookieJar::setCookies):
3217         (WebKit::WebCookieJar::cookieRequestHeaderFieldValue const):
3218         (WebKit::WebCookieJar::getRawCookies const):
3219         * WebProcess/WebPage/WebPage.cpp:
3220         (WebKit::WebPage::addDomainWithPageLevelStorageAccess):
3221         (WebKit::WebPage::hasPageLevelStorageAccess const):
3222         * WebProcess/WebPage/WebPage.h:
3223         * WebProcess/WebProcess.cpp:
3224         (WebKit::WebProcess::setWebsiteDataStoreParameters):
3225         (WebKit::WebProcess::setShouldBlockThirdPartyCookiesForTesting):
3226         * WebProcess/WebProcess.h:
3227         (WebKit::WebProcess::thirdPartyCookieBlockingMode const):
3228         * WebProcess/WebProcess.messages.in:
3229
3230 2020-01-14  Peng Liu  <peng.liu6@apple.com>
3231
3232         [Media in GPU process] Implement the remote video layer support
3233         https://bugs.webkit.org/show_bug.cgi?id=206043
3234
3235         Reviewed by Youenn Fablet.
3236
3237         RemoteMediaPlayerProxy in the GPU process creates a LayerHostingContext with createForExternalHostingProcess()
3238         and share the context ID with the MediaPlayerPrivateRemote in the Web process.
3239         Then the MediaPlayerPrivateRemote creates a hosting layer with the context ID for rendering.
3240
3241         This patch updates RemoteMediaPlayerProxy::PrepareForPlayback to provide the initial video content box and scale
3242         for the VideoFullscreenLayerManagerObjC on the GPU process to create WebVideoContainerLayer.
3243         It adds XPC message RemoteMediaPlayerManager::FirstVideoFrameAvailable to notify the renderer on the Web process that the video layer is ready.
3244         RemoteMediaPlayerManagerProxy::SetSize message is removed to avoid the unnecessary XPC message
3245         because MediaPlayerPrivateAVFoundationObjC::setSize() does nothing.
3246
3247         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
3248         (WebKit::RemoteMediaPlayerProxy::prepareForPlayback):
3249         (WebKit::RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable):
3250         (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged):
3251         (WebKit::RemoteMediaPlayerProxy::mediaPlayerContentBoxRect const):
3252         (WebKit::RemoteMediaPlayerProxy::mediaPlayerContentsScale const):
3253         (WebKit::RemoteMediaPlayerProxy::setSize): Deleted.
3254         * GPUProcess/media/RemoteMediaPlayerProxy.h:
3255         * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
3256         * Platform/cocoa/LayerHostingContext.h: Renamed from Source/WebKit/Platform/mac/LayerHostingContext.h.
3257         * Platform/cocoa/LayerHostingContext.mm: Renamed from Source/WebKit/Platform/mac/LayerHostingContext.mm.
3258         (WebKit::LayerHostingContext::createPlatformLayerForHostingContext):
3259         * Platform/ios/PaymentAuthorizationController.mm:
3260         * PluginProcess/mac/PluginControllerProxyMac.mm:
3261         * SourcesCocoa.txt:
3262         * WebKit.xcodeproj/project.pbxproj:
3263         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
3264         (WebKit::MediaPlayerPrivateRemote::prepareForPlayback):
3265         (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote::load):
3266         (WebKit::MediaPlayerPrivateRemote::firstVideoFrameAvailable):
3267         (WebKit::MediaPlayerPrivateRemote::platformLayer const):
3268         (WebKit::MediaPlayerPrivateRemote::setSize): Deleted.
3269         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
3270         * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
3271         (WebKit::RemoteMediaPlayerManager::characteristicChanged):
3272         (WebKit::RemoteMediaPlayerManager::sizeChanged):
3273         (WebKit::RemoteMediaPlayerManager::addRemoteVideoTrack):
3274         (WebKit::RemoteMediaPlayerManager::removeRemoteVideoTrack):
3275         (WebKit::RemoteMediaPlayerManager::remoteVideoTrackConfigurationChanged):
3276         (WebKit::RemoteMediaPlayerManager::firstVideoFrameAvailable):
3277         * WebProcess/GPU/media/RemoteMediaPlayerManager.h:
3278         * WebProcess/GPU/media/RemoteMediaPlayerManager.messages.in:
3279         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
3280
3281 2020-01-10  Jiewen Tan  <jiewen_tan@apple.com>
3282
3283         [WebAuthn] Implement SPI to tell UI clients to select assertion responses
3284         https://bugs.webkit.org/show_bug.cgi?id=206112
3285         <rdar://problem/58495733>
3286
3287         Reviewed by Alex Christensen.
3288
3289         Covered by API tests.
3290
3291         This patch adds a new delegate method in _WKWebAuthenticationPanelDelegate to tell UI clients to
3292         select an assertion response when multiple are returned from an authenticator. Here is the SPI:
3293         @protocol _WKWebAuthenticationPanelDelegate <NSObject>
3294         @optional
3295         ...
3296         - (void)panel:(_WKWebAuthenticationPanel *)panel selectAssertionResponse:(NSArray < _WKWebAuthenticationAssertionResponse *> *)responses completionHandler:(void (^)(_WKWebAuthenticationAssertionResponse *))completionHandler;
3297         ...
3298         @end
3299
3300         A new interface is introduced to represent an authenticator assertion response:
3301         @interface _WKWebAuthenticationAssertionResponse : NSObject
3302         @property (nonatomic, readonly, copy) NSString *name;
3303         @property (nonatomic, readonly, copy) NSString *displayName;
3304         @property (nonatomic, readonly, copy) NSData *userHandle;
3305         @end
3306         Only members that can assist users to make a decision are exposed to UI clients.
3307
3308         * Shared/API/APIObject.h:
3309         * Shared/Cocoa/APIObject.mm:
3310         (API::Object::newObject):
3311         * Sources.txt:
3312         * SourcesCocoa.txt:
3313         * UIProcess/API/APIWebAuthenticationAssertionResponse.cpp: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h.
3314         (API::WebAuthenticationAssertionResponse::create):
3315         (API::WebAuthenticationAssertionResponse::WebAuthenticationAssertionResponse):
3316         * UIProcess/API/APIWebAuthenticationAssertionResponse.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h.
3317         * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponse.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h.
3318         * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponse.mm: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h.
3319         (-[_WKWebAuthenticationAssertionResponse dealloc]):
3320         (-[_WKWebAuthenticationAssertionResponse name]):
3321         (-[_WKWebAuthenticationAssertionResponse displayName]):
3322         (-[_WKWebAuthenticationAssertionResponse userHandle]):
3323         (-[_WKWebAuthenticationAssertionResponse _apiObject]):
3324         * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponseInternal.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h.
3325         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
3326         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
3327         * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h:
3328         * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm:
3329         (WebKit::WebAuthenticationPanelClient::WebAuthenticationPanelClient):
3330         (WebKit::WebAuthenticationPanelClient::selectAssertionResponses const):
3331         * WebKit.xcodeproj/project.pbxproj:
3332
3333 2020-01-14  Luming Yin  <luming_yin@apple.com>
3334
3335         Update API availability for autoplay event
3336         https://bugs.webkit.org/show_bug.cgi?id=202214
3337         <rdar://problem/55710395>
3338
3339         Reviewed by Tim Horton.
3340
3341         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3342         Make enums and WKUIDelegate method related to autoplay event available on iOS.
3343
3344         * UIProcess/Cocoa/UIDelegate.h:
3345         * UIProcess/Cocoa/UIDelegate.mm:
3346         (WebKit::UIDelegate::setDelegate):
3347         (WebKit::toWKAutoplayEventFlags):
3348         (WebKit::toWKAutoplayEvent):
3349         (WebKit::UIDelegate::UIClient::handleAutoplayEvent):
3350         Make delegate methods related to autoplay events available on iOS.
3351
3352 2020-01-14  Tim Horton  <timothy_horton@apple.com>
3353
3354         REGRESSION (r253394): After swiping back during a navigation, WKWebView gets stuck with the forward content, stops repainting
3355         https://bugs.webkit.org/show_bug.cgi?id=206268
3356         <rdar://problem/58536702>
3357
3358         Reviewed by Simon Fraser.
3359
3360         * UIProcess/ViewGestureController.cpp:
3361         (WebKit::ViewGestureController::endSwipeGesture):
3362         * UIProcess/ViewGestureController.h:
3363         * UIProcess/ios/ViewGestureControllerIOS.mm:
3364         (WebKit::ViewGestureController::beginSwipeGesture):
3365         (WebKit::ViewGestureController::endSwipeGesture):
3366         (WebKit::ViewGestureController::removeSwipeSnapshot):
3367         * UIProcess/mac/ViewGestureControllerMac.mm:
3368         (WebKit::ViewGestureController::beginSwipeGesture):
3369         (WebKit::ViewGestureController::removeSwipeSnapshot):
3370         After r253394, we start loading the destination page in willEndSwipeGesture,
3371         when we know the gesture will complete, instead of in endSwipeGesture,
3372         when it is actually done.
3373
3374         This means that if we decide that we should tear down the snapshot immediately,
3375         this can now happen in the window between willEndSwipeGesture and endSwipeGesture.
3376
3377         However, removeSwipeSnapshot has numerous dependencies on endSwipeGesture
3378         (especially on iOS, where there are /also/ dependencies in the other direction - 
3379         endSwipeGesture will never be called after removeSwipeSnapshot because
3380         of the gestureID mismatch).
3381
3382         Regardless, it does not make sense to remove the snapshot while the animation
3383         is still running. So, if something causes removeSwipeSnapshot to be called
3384         before endSwipeGesture, we just set a bit and call it inside endSwipeGesture instead.
3385
3386         This ends up putting the snapshot removal ordering back as it was before r253394.
3387
3388 2020-01-14  Per Arne Vollan  <pvollan@apple.com>
3389
3390         REGRESSION(iOS 13): createMediaElementSource not working
3391         https://bugs.webkit.org/show_bug.cgi?id=203435
3392
3393         Reviewed by David Kilzer.
3394
3395         The WebContent process is missing an entitlement according to logs.
3396
3397         * Scripts/process-entitlements.sh:
3398
3399 2020-01-14  Brent Fulgham  <bfulgham@apple.com>
3400
3401         Expand WebContent process sandbox with additional syscall
3402         https://bugs.webkit.org/show_bug.cgi?id=206260
3403         <rdar://problem/58580997>
3404
3405         Reviewed by Per Arne Vollan.
3406
3407         Testing shows that we will improve performance on some platforms by supporting an additional Syscall.
3408
3409         This patch revises our sandboxes so that WebKit can use this fast path if available.
3410
3411         No new tests. No change in test result behavior.
3412
3413         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3414         * WebProcess/com.apple.WebProcess.sb.in:
3415
3416 2020-01-14  Commit Queue  <commit-queue@webkit.org>
3417
3418         Unreviewed, rolling out r254533 and r254535.
3419         https://bugs.webkit.org/show_bug.cgi?id=206263