1468c319bf8f0ec74b7cfdfa9b12f28b79637405
[WebKit.git] / Source / WebKit / ChangeLog
1 2020-03-26  Per Arne Vollan  <pvollan@apple.com>
2
3         [iOS] Adopt ScreenProperties class.
4         https://bugs.webkit.org/show_bug.cgi?id=191767
5
6         Reviewed by Brent Fulgham.
7
8         Make relevent macOS platform code cross platform.
9
10         * Shared/WebProcessCreationParameters.cpp:
11         (WebKit::WebProcessCreationParameters::encode const):
12         (WebKit::WebProcessCreationParameters::decode):
13         * Shared/WebProcessCreationParameters.h:
14         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
15         (WebKit::WebProcessPool::platformInitializeWebProcess):
16         * WebProcess/WebProcess.cpp:
17         (WebKit::WebProcess::setScreenProperties):
18         * WebProcess/WebProcess.h:
19         * WebProcess/WebProcess.messages.in:
20
21 2020-03-26  David Kilzer  <ddkilzer@apple.com>
22
23         MESSAGE_CHECK base macros should use UNLIKELY()
24         <https://webkit.org/b/209581>
25         <rdar://problem/60901307>
26
27         Reviewed by Youenn Fablet.
28
29         * Platform/IPC/Connection.h:
30         (MESSAGE_CHECK_COMPLETION_BASE):
31         (MESSAGE_CHECK_WITH_RETURN_VALUE_BASE):
32         - Add UNLIKELY() macro since these code paths should not be
33           taken under normal conditions.
34         - Add curly braces to multi-line do-while loops per WebKit style
35           guidelines, and is required after moving the ASSERT().
36         - Move the ASSERT() outside the if statement since that's more
37           idomatic.
38
39 2020-03-26  Per Arne Vollan  <pvollan@apple.com>
40
41         [Cocoa] Fix incorrect rebase
42         https://bugs.webkit.org/show_bug.cgi?id=209600
43
44         Reviewed by Brent Fulgham.
45
46         A rebase went wrong in <https://bugs.webkit.org/show_bug.cgi?id=203214> and placed the method call to
47         enableRemoteInspectorIfNeeded() in the wrong method. It should be called in WebProcessProxy::didFinishLaunching.
48
49         * UIProcess/WebProcessProxy.cpp:
50         (WebKit::WebProcessProxy::mayBecomeUnresponsive):
51         (WebKit::WebProcessProxy::didFinishLaunching):
52
53 2020-03-26  Michael Catanzaro  <mcatanzaro@gnome.org>
54
55         [GTK] Crash in WebKit::LayerTreeHost::LayerTreeHost with bubblewrap sandbox enabled
56         https://bugs.webkit.org/show_bug.cgi?id=209106
57
58         Reviewed by Carlos Garcia Campos.
59
60         Don't bind the WaylandCompositor socket unless we're running under Wayland and it's actually
61         started successfully.
62
63         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
64         (WebKit::bindWayland):
65
66 2020-03-26  David Kilzer  <ddkilzer@apple.com>
67
68         VideoFullscreenManagerProxy::setupFullscreenWithID should message check videoLayerID
69         <https://webkit.org/b/209578>
70         <rdar://problem/60703503>
71
72         Reviewed by Eric Carlson.
73
74         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
75         (MESSAGE_CHECK): Define (and undef) new macro for assertions.
76         (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
77         Change ASSERT() to MESSAGE_CHECK().
78
79 2020-03-26  Michael Catanzaro  <mcatanzaro@gnome.org>
80
81         Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s) in IPC::Connection::sendOutgoingMessage
82         https://bugs.webkit.org/show_bug.cgi?id=146729
83
84         Reviewed by Carlos Garcia Campos.
85
86         The entire MessageInfo is passed to write(), so we have to zero the padding bytes to avoid
87         writing uninitialized memory.
88
89         * Platform/IPC/unix/UnixMessage.h:
90         (IPC::MessageInfo::MessageInfo):
91
92 2020-03-25  Timothy Horton  <timothy_horton@apple.com>
93
94         Unable to build WebKit with iOS 13.4 SDK
95         https://bugs.webkit.org/show_bug.cgi?id=209317
96
97         * Platform/spi/ios/UIKitSPI.h:
98         Address post-landing review comment; use SDK conditionals, not deployment
99         target conditionals, since SPI headers are mimicing SDK content.
100
101 2020-03-25  Ryosuke Niwa  <rniwa@webkit.org>
102
103         Mini browser immediately hit an assertion in debug build
104         https://bugs.webkit.org/show_bug.cgi?id=209575
105
106         Reviewed by Simon Fraser.
107
108         Use 1 instead of 0 as the desination ID to avoid hitting assertions.
109
110         * WebProcess/GPU/media/RemoteAudioSession.cpp:
111         (WebKit::RemoteAudioSession::RemoteAudioSession):
112         (WebKit::RemoteAudioSession::~RemoteAudioSession):
113
114 2020-03-25  Tim Horton  <timothy_horton@apple.com>
115
116         Unable to build WebKit with iOS 13.4 SDK
117         https://bugs.webkit.org/show_bug.cgi?id=209317
118
119         Reviewed by Megan Gardner.
120
121         * Platform/spi/ios/UIKitSPI.h:
122         Stop defining some UIKit SPI that is now API (hurray!).
123
124 2020-03-25  Per Arne Vollan  <pvollan@apple.com>
125
126         [macOS] Fix sandbox violations related to media playback
127         https://bugs.webkit.org/show_bug.cgi?id=209568
128         <rdar://problem/60262125>
129
130         Reviewed by Brent Fulgham.
131
132         Fix observed sandbox violations during media playback.
133
134         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
135         (WebKit::mediaRelatedMachServices):
136
137 2020-03-25  Daniel Bates  <dabates@apple.com>
138
139         Element context character rects may be in wrong coordinate system
140         https://bugs.webkit.org/show_bug.cgi?id=209493
141         <rdar://problem/60840261>
142
143         Reviewed by Wenson Hsieh.
144
145         Convert the character rects from content view coordinates to root view coordinates
146         as that is the coordinate system callers of -requestDocumentContext expect.
147
148         * WebProcess/WebPage/ios/WebPageIOS.mm:
149         (WebKit::WebPage::requestDocumentEditingContext):
150
151 2020-03-25  Wenson Hsieh  <wenson_hsieh@apple.com>
152
153         Rename "data interaction pasteboard" to "drag and drop pasteboard"
154         https://bugs.webkit.org/show_bug.cgi?id=209556
155
156         Reviewed by Tim Horton.
157
158         Adopt Pasteboard::nameOfDragPasteboard instead of the literal string "data interaction pasteboard".
159
160         * UIProcess/ios/WKContentViewInteraction.mm:
161         (-[WKContentView dropInteraction:sessionDidEnter:]):
162         (-[WKContentView dropInteraction:sessionDidUpdate:]):
163         (-[WKContentView dropInteraction:sessionDidExit:]):
164         (-[WKContentView dropInteraction:performDrop:]):
165
166 2020-03-25  Brady Eidson  <beidson@apple.com>
167
168         Some WKWebView.h header doc cleanup.
169         https://bugs.webkit.org/show_bug.cgi?id=209549
170
171         Reviewed by Simon Fraser.
172
173         * UIProcess/API/Cocoa/WKWebView.h:
174
175 2020-03-25  Daniel Bates  <dabates@apple.com>
176
177         Remove newline that I accidentally added in r258989.
178
179         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
180
181 2020-03-25  Brent Fulgham  <bfulgham@apple.com>
182
183         Avoid logging sensitive information for all network sessions
184         https://bugs.webkit.org/show_bug.cgi?id=209522
185         <rdar://problem/54807157>
186
187         Reviewed by Alex Christensen.
188
189         We avoid logging sensitive information (such as visited URLs) on production builds and for ephemeral sessions.
190
191         We should also avoid such logging for engineering and prerelease builds to reduce the possibility of any
192         personally identifiable information being retained in logs.
193
194         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
195         (WebKit::configurationForSessionID): Deny senstive logging for all sessions.
196
197 2020-03-24  Daniel Bates  <dabates@apple.com>
198
199         [iOS] ASSERTION FAILURE: !isMissingPostLayoutData in WebKit::EditorState::postLayoutData()
200         https://bugs.webkit.org/show_bug.cgi?id=199960
201         <rdar://problem/53323966>
202
203         Reviewed by Simon Fraser.
204
205         Refactor the computation of editor state so that we can request that a layout be performed
206         each time we compute the editor state as part of asking the UI process to interpret a key
207         event. The full (read: after layout) editor state is needed for UIKit to perform a deletion
208         because UIKit wants to know how many characters are before the selection. Otherwise, we hit
209         an assert due to the fact the last editor state sent (when the Web process asked the UI process
210         to interpret the key) is missing layout data.
211
212         The refactoring also moves the Cocoa-common code out of the platform-independent WebPage.cpp
213         file into WebPageCocoa.mm.
214
215         One side effect of the refactoring is that we no longer allow the platformEditorState() function
216         to override the isMissingPostLayoutData bit. Currently it can even though the calling code, the
217         platform independent code (PIE) in WebPage, may have attached layout data. Now the PIE code sets
218         this bit if it attached layout data and the platformEditorState() function only attaches more
219         layout data if that bit is set. platformEditorState() never unsets that bit (i.e. sets isMissingPostLayoutData
220         to true).
221
222         The patch also removes m_isEditorStateMissingPostLayoutData in WebPage.h. This instance variable
223         has been unused since <https://trac.webkit.org/changeset/221064/webkit>. Also we haven't been using
224         IncludePostLayoutDataHint::No since the last reference to it was removed in <https://trac.webkit.org/changeset/244494/webkit>.
225
226         I also renamed platformEditorState() to getPlatformEditorState() since it has an out argument.
227
228         Test: editing/deleting/ios/backspace-last-character.html
229
230         * Shared/EditorState.h:
231         * UIProcess/API/glib/WebKitEditorState.cpp:
232         (webkitEditorStateCreate): Initialize _WebKitEditorStatePrivate::typingAttributes to WEBKIT_EDITOR_TYPING_ATTRIBUTE_NONE.
233         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
234         (WebKit::WebPage::getPlatformEditorStateCommon const): Added. Moved Cocoa-common code from WebPage.cpp to here.
235         * WebProcess/WebPage/WebPage.cpp:
236         (WebKit::WebPage::editorState const): Move Cocoa-common code to WebPageCocoa.mm. Change enum to
237         track whether a layout should be performed. Keep the current behavior of only including post layout
238         data if the frame view does not need a layout. This behavior is encoded in the enumerator ShouldPerformLayout::Default.
239         which is the default argument value for the argument shouldPerformLayout.
240         * WebProcess/WebPage/WebPage.h:
241         (WebKit::WebPage::platformNeedsLayoutForEditorState const): Added. Non-Cocoa port implementation
242         that returns false.
243         * WebProcess/WebPage/glib/WebPageGLib.cpp:
244         (WebKit::WebPage::getPlatformEditorState const): Early return if isMissingPostLayoutData is true.
245         (WebKit::WebPage::platformEditorState const): Deleted.
246         * WebProcess/WebPage/ios/WebPageIOS.mm:
247         (WebKit::WebPage::platformNeedsLayoutForEditorState const): Added. Keep the current behavior of
248         performing a layout if we have a composition or a hardware keyboard is attached.
249         (WebKit::WebPage::getPlatformEditorState const): Call platformEditorStateCommon(). Bail out early
250         if isMissingPostLayoutData is true.
251         (WebKit::WebPage::handleEditingKeyboardEvent): The important part of this patch. Request a layout
252         when computing the editor state that we will send to the UI process.
253         (WebKit::WebPage::platformEditorState const): Deleted.
254         * WebProcess/WebPage/mac/WebPageMac.mm:
255         (WebKit::WebPage::getPlatformEditorState const): Call platformEditorStateCommon(). Bail out early
256         if isMissingPostLayoutData is true.
257         (WebKit::WebPage::platformEditorState const): Deleted.
258         * WebProcess/WebPage/playstation/WebPagePlayStation.cpp:
259         (WebKit::WebPage::getPlatformEditorState const): Update as needed.
260         (WebKit::WebPage::platformEditorState const): Deleted.
261         * WebProcess/WebPage/win/WebPageWin.cpp:
262         (WebKit::WebPage::getPlatformEditorState const): Update as needed.
263         (WebKit::WebPage::platformEditorState const): Deleted.
264
265 2020-03-25  Kate Cheney  <katherine_cheney@apple.com>
266
267         App-bound domain checks should provide more debugging details at script evaluation sites
268         https://bugs.webkit.org/show_bug.cgi?id=209521
269         <rdar://problem/60837954>
270
271         Reviewed by Chris Dumez.
272
273         Return an exception because that option is available here, and also add
274         console and release logging for consistency across app-bound domain checks.
275
276         * WebProcess/WebPage/WebPage.cpp:
277         (WebKit::WebPage::runJavaScript):
278
279 2020-03-25  Wenson Hsieh  <wenson_hsieh@apple.com>
280
281         Avoid querying pasteboard strings while dragging content over a potential drop target
282         https://bugs.webkit.org/show_bug.cgi?id=209531
283
284         Reviewed by Tim Horton and Ryosuke Niwa.
285
286         Add PasteboardStrategy and WebPasteboardProxy (IPC) plumbing; see WebCore for more details.
287
288         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
289         (WebKit::WebPasteboardProxy::containsStringSafeForDOMToReadForType):
290         * UIProcess/WebPasteboardProxy.cpp:
291         (WebKit::WebPasteboardProxy::containsStringSafeForDOMToReadForType):
292         * UIProcess/WebPasteboardProxy.h:
293         * UIProcess/WebPasteboardProxy.messages.in:
294         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
295         (WebKit::WebPlatformStrategies::containsStringSafeForDOMToReadForType):
296         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
297
298 2020-03-24  Daniel Bates  <dabates@apple.com>
299
300         Unreviewed, reverting r258945.
301
302         Revert change that broke API tests while I investigate
303         offline.
304
305         Reverted changeset:
306
307         "Element context character rects may be in wrong coordinate
308         system"
309         https://bugs.webkit.org/show_bug.cgi?id=209493
310         https://trac.webkit.org/changeset/258945
311
312 2020-03-24  John Wilander  <wilander@apple.com>
313
314         Refactor ResourceLoadStatisticsStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor() to return a struct instead of a Vector of pairs
315         https://bugs.webkit.org/show_bug.cgi?id=209463
316         <rdar://problem/60808759>
317
318         Reviewed by Alex Christensen.
319
320         This change does three things:
321
322         1. Replaces the Vector<std::pair<RegistrableDomain, WebsiteDataToRemove>> with a new struct called
323         RegistrableDomainsToDeleteOrRestrictWebsiteDataFor for sending around which domains to delete website data for.
324
325         2. Removes the enum WebsiteDataToRemove, replacing its structure with the members of the above mentioned struct:
326         - domainsToDeleteAllCookiesFor
327         - domainsToDeleteAllButHttpOnlyCookiesFor
328         - domainsToDeleteAllNonCookieWebsiteDataFor
329
330         3. Consistently renames "domainsToDeleteFor" to "domainsToDeleteOrRestrictFor" in preparation for website data
331         policies that are not about deletion, see for instance recently landed https://trac.webkit.org/changeset/258884.
332
333         No new tests. No changed functionality. This code is covered by several existing tests.
334
335         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
336         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
337         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
338         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor):
339         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor): Deleted.
340         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
341         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
342         (WebKit::domainsToString):
343         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
344         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
345         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
346         (WebKit::WebResourceLoadStatisticsStore::deleteAndRestrictWebsiteDataForRegistrableDomains):
347         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomains): Deleted.
348         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
349         (WebKit::RegistrableDomainsToDeleteOrRestrictWebsiteDataFor::isolatedCopy const):
350         (WebKit::RegistrableDomainsToDeleteOrRestrictWebsiteDataFor::isEmpty const):
351         * NetworkProcess/NetworkProcess.cpp:
352         (WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains):
353         (WebKit::NetworkProcess::deleteCookiesForTesting):
354         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains): Deleted.
355         * NetworkProcess/NetworkProcess.h:
356         * NetworkProcess/NetworkSession.cpp:
357         (WebKit::NetworkSession::deleteAndRestrictWebsiteDataForRegistrableDomains):
358         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomains): Deleted.
359         * NetworkProcess/NetworkSession.h:
360
361 2020-03-24  Jiewen Tan  <jiewen_tan@apple.com>
362
363         [WebAuthn] Customize a bit more on the macOS LocalAuthentication prompt
364         https://bugs.webkit.org/show_bug.cgi?id=208703
365         <rdar://problem/60136974>
366
367         Reviewed by Brent Fulgham.
368
369         Part 2.
370
371         This patch adds a different LocalAuthentication prompt title for getAssertion.
372         It also polishes the text used for makeCredential.
373
374         Besides that, it also enhances the iOS title strings.
375
376         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
377         (WebKit::LocalAuthenticator::continueMakeCredentialAfterDecidePolicy):
378         (WebKit::LocalAuthenticator::continueGetAssertionAfterResponseSelected):
379         * UIProcess/WebAuthentication/Cocoa/LocalConnection.h:
380         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
381         (WebKit::LocalConnection::verifyUser const):
382         * UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
383         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
384         (WebKit::MockLocalConnection::verifyUser const):
385
386 2020-03-24  Kate Cheney  <katherine_cheney@apple.com>
387
388         Ignore in-app browser privacy checks for apps with com.apple.private.applemediaservices entitlement
389         https://bugs.webkit.org/show_bug.cgi?id=209509
390         <rdar://problem/60750956>
391
392         Reviewed by Brent Fulgham.
393
394         * UIProcess/WebPageProxy.cpp:
395         (WebKit::m_ignoresAppBoundDomains):
396         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
397         * UIProcess/WebPageProxy.h:
398
399 2020-03-24  Per Arne Vollan  <pvollan@apple.com>
400
401         [Cocoa] Fix launch time regression with CF prefs direct mode enabled
402         https://bugs.webkit.org/show_bug.cgi?id=209244
403         <rdar://problem/60542149>
404
405         Reviewed by Darin Adler.
406
407         When CF prefs direct mode was enabled in https://trac.webkit.org/changeset/258064/webkit, it introduced
408         a significant launch time regression. This patch addresses this regression. The number of observed domains
409         is reduced and domain observation is initiated later when Safari is first activated. Swizzling code is
410         removed, since that has a performance cost in the Objective-C runtime. Normal priority instead of
411         QOS_CLASS_BACKGROUND is used in the thread which starts the observing, since using a background priority
412         class can lead to priority inversion. Finally, a dictionary comparison is removed when a notification
413         about a preference change is received, since this check is redundant and doubles the cost of this method.
414
415         * UIProcess/Cocoa/PreferenceObserver.mm:
416         (-[WKPreferenceObserver init]):
417         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
418         (WebKit::WebProcessPool::platformInitialize):
419         (WebKit::WebProcessPool::registerNotificationObservers):
420         (WebKit::WebProcessPool::unregisterNotificationObservers):
421         * UIProcess/WebProcessPool.h:
422
423 2020-03-24  Daniel Bates  <dabates@apple.com>
424
425         Element context character rects may be in wrong coordinate system
426         https://bugs.webkit.org/show_bug.cgi?id=209493
427         <rdar://problem/60840261>
428
429         Reviewed by Wenson Hsieh.
430
431         Convert the character rects from content view coordinates to root view coordinates
432         as that is the coordinate system callers of -requestDocumentContext expect.
433
434         * WebProcess/WebPage/ios/WebPageIOS.mm:
435         (WebKit::WebPage::requestDocumentEditingContext):
436
437 2020-03-24  Daniel Bates  <dabates@apple.com>
438
439         Use SimpleRange in characterRectsForRange()
440         https://bugs.webkit.org/show_bug.cgi?id=209495
441
442         Reviewed by Darin Adler.
443
444         The function characterRectsForRange() is capable of working correctly with a SimpleRange
445         instead of a Range. Callers currently pass a Range. So, there is still a conversion, but
446         maybe someday they can pass a SimpleRange. This change is towards that future.
447
448         * WebProcess/WebPage/ios/WebPageIOS.mm:
449         (WebKit::WebPage::requestDocumentEditingContext):
450
451 2020-03-24  Chris Dumez  <cdumez@apple.com>
452
453         Unreviewed, reverting r258928.
454
455         Broke the build
456
457         Reverted changeset:
458
459         "Refactor
460         ResourceLoadStatisticsStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor()
461         to return a struct instead of a Vector of pairs"
462         https://bugs.webkit.org/show_bug.cgi?id=209463
463         https://trac.webkit.org/changeset/258928
464
465 2020-03-24  John Wilander  <wilander@apple.com>
466
467         Refactor ResourceLoadStatisticsStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor() to return a struct instead of a Vector of pairs
468         https://bugs.webkit.org/show_bug.cgi?id=209463
469         <rdar://problem/60808759>
470
471         Reviewed by Alex Christensen.
472
473         This change does three things:
474
475         1. Replaces the Vector<std::pair<RegistrableDomain, WebsiteDataToRemove>> with a new struct called
476         RegistrableDomainsToDeleteOrRestrictWebsiteDataFor for sending around which domains to delete website data for.
477
478         2. Removes the enum WebsiteDataToRemove, replacing its structure with the members of the above mentioned struct:
479         - domainsToDeleteAllCookiesFor
480         - domainsToDeleteAllButHttpOnlyCookiesFor
481         - domainsToDeleteAllNonCookieWebsiteDataFor
482
483         3. Consistently renames "domainsToDeleteFor" to "domainsToDeleteOrRestrictFor" in preparation for website data
484         policies that are not about deletion, see for instance recently landed https://trac.webkit.org/changeset/258884.
485
486         No new tests. No changed functionality. This code is covered by several existing tests.
487
488         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
489         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
490         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
491         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor):
492         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor): Deleted.
493         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
494         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
495         (WebKit::domainsToString):
496         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
497         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
498         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
499         (WebKit::WebResourceLoadStatisticsStore::deleteAndRestrictWebsiteDataForRegistrableDomains):
500         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomains): Deleted.
501         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
502         (WebKit::RegistrableDomainsToDeleteOrRestrictWebsiteDataFor::isolatedCopy const):
503         (WebKit::RegistrableDomainsToDeleteOrRestrictWebsiteDataFor::isEmpty const):
504         * NetworkProcess/NetworkProcess.cpp:
505         (WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains):
506         (WebKit::NetworkProcess::deleteCookiesForTesting):
507         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains): Deleted.
508         * NetworkProcess/NetworkProcess.h:
509         * NetworkProcess/NetworkSession.cpp:
510         (WebKit::NetworkSession::deleteAndRestrictWebsiteDataForRegistrableDomains):
511         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomains): Deleted.
512         * NetworkProcess/NetworkSession.h:
513
514 2020-03-24  Michael Catanzaro  <mcatanzaro@gnome.org>
515
516         [GTK] Crash in WebKit::LayerTreeHost::LayerTreeHost with bubblewrap sandbox enabled
517         https://bugs.webkit.org/show_bug.cgi?id=209106
518
519         Reviewed by Adrian Perez de Castro.
520
521         The bubblewrap sandbox is blocking access to WebKit's nested Wayland compositor. Apparently
522         nobody has ever tested the nested Wayland compositor with the sandbox enabled until now.
523
524         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
525         (WebKit::bindWayland):
526
527 2020-03-24  Daniel Bates  <dabates@apple.com>
528
529         Simplify characterRectsForRange() in WebPage::requestDocumentEditingContext()
530         https://bugs.webkit.org/show_bug.cgi?id=209462
531
532         Reviewed by Wenson Hsieh.
533
534         No need to allow by-reference capture by default. Update code to take a const
535         Range& and unsigned instead of non-const and uint64_t params. The former is
536         const correct for this code, which doesn't modify anything. The latter is
537         actually the max width data type callers pass. Simplify the inside of the loop
538         by using StringView::isEmpty(). Lastly add a constant for the stride length
539         to make the 1s less mysterious despite the name of the function alluding to
540         this stride.
541
542         * WebProcess/WebPage/ios/WebPageIOS.mm:
543         (WebKit::WebPage::requestDocumentEditingContext):
544
545 2020-03-24  Daniel Bates  <dabates@apple.com>
546
547         [iOS][WK2] Set text trait isSingleLineDocument
548         https://bugs.webkit.org/show_bug.cgi?id=209391
549         <rdar://problem/60705870>
550
551         Reviewed by Darin Adler.
552
553         Set the SPI text trait isSingleLineDocument to NO if the focused element is
554         a <textarea> or contenteditable element because these elements support multi-
555         line text. For all other elements, consider them single line text fields and
556         return YES.
557
558         Note that I chose to go with the above criterion because it is simple. In reality,
559         it is possible to make a <textarea> or contenteditable behave like a single-line
560         document, but it requires going out of your way to to do so and may involve
561         platform-specific heuristics. See <https://bugs.webkit.org/show_bug.cgi?id=209391#c9>
562         for more details. For now, let's try something simple.
563
564         * Platform/spi/ios/UIKitSPI.h: Expose more SPI.
565         * UIProcess/ios/WKContentViewInteraction.mm:
566         (-[WKContentView textInputTraits]):
567
568 2020-03-24  Diego Pino Garcia  <dpino@igalia.com>
569
570         REGRESSION(r258871): [GTK] test bot exiting early due to too many crashes
571         https://bugs.webkit.org/show_bug.cgi?id=209467
572
573         Reviewed by Darin Adler.
574
575         * WebProcess/WebPage/glib/WebPageGLib.cpp:
576         (WebKit::WebPage::platformEditorState const): Add a check to prevent start
577         and end position of selection range is not null.
578
579 2020-03-24  Per Arne Vollan  <pvollan@apple.com>
580
581         [Cocoa] Deny access to database mapping service
582         https://bugs.webkit.org/show_bug.cgi?id=209339
583         <rdar://problem/56966010>
584
585         Reviewed by Brent Fulgham.
586
587         In order for the WebContent process to not have permantent access to the database mapping service,
588         this patch creates an extension for the service in the UI process, sends it to the WebContent
589         process, where it is consumed. Then, an API call is made which will map the database, and next the
590         WebContent process will revoke the extension. The WebContent process has then mapped the database,
591         and access to the database mapping service is no longer needed.
592
593         Tested by: fast/sandbox/ios/sandbox-mach-lookup.html
594
595         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
596         * Shared/WebProcessCreationParameters.cpp:
597         (WebKit::WebProcessCreationParameters::encode const):
598         (WebKit::WebProcessCreationParameters::decode):
599         * Shared/WebProcessCreationParameters.h:
600         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
601         (WebKit::WebProcessPool::platformInitializeWebProcess):
602         * WebProcess/cocoa/WebProcessCocoa.mm:
603         (WebKit::WebProcess::platformInitializeWebProcess):
604         * WebProcess/com.apple.WebProcess.sb.in:
605
606 2020-03-24  Alex Christensen  <achristensen@webkit.org>
607
608         Unreviewed, reverting r258862.
609
610         SPI was not what was needed
611
612         Reverted changeset:
613
614         "Add SPI to move localStorage to a different domain"
615         https://bugs.webkit.org/show_bug.cgi?id=209260
616         https://trac.webkit.org/changeset/258862
617
618 2020-03-23  David Kilzer  <ddkilzer@apple.com>
619
620         IPC::Decoder::decodeFixedLengthData() should be marked WARN_UNUSED_RETURN
621         <https://webkit.org/b/209448>
622         <rdar://problem/60797998>
623
624         Reviewed by Chris Dumez.
625
626         * Platform/IPC/ArgumentCoders.h:
627         (struct VectorArgumentCoder::decode):
628         - Check the return value of Decoder::decodeFixedLengthData().
629         * Platform/IPC/Decoder.h:
630         (IPC::Decoder::decodeFixedLengthData): Add WARN_UNUSED_RETURN.
631
632 2020-03-23  Wenson Hsieh  <wenson_hsieh@apple.com>
633
634         Remove the unused method PasteboardStrategy::uniqueName()
635         https://bugs.webkit.org/show_bug.cgi?id=209452
636
637         Reviewed by Tim Horton.
638
639         See WebCore/ChangeLog for more detail.
640
641         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
642         (WebKit::WebPasteboardProxy::getPasteboardUniqueName): Deleted.
643         * UIProcess/WebPasteboardProxy.h:
644         * UIProcess/WebPasteboardProxy.messages.in:
645         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
646         (WebKit::WebPlatformStrategies::uniqueName): Deleted.
647         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
648
649 2020-03-23  Commit Queue  <commit-queue@webkit.org>
650
651         Unreviewed, reverting r258891.
652         https://bugs.webkit.org/show_bug.cgi?id=209459
653
654         Introduced layout test failures (Requested by perarne on
655         #webkit).
656
657         Reverted changeset:
658
659         "[Cocoa] Deny access to database mapping service"
660         https://bugs.webkit.org/show_bug.cgi?id=209339
661         https://trac.webkit.org/changeset/258891
662
663 2020-03-23  Per Arne Vollan  <pvollan@apple.com>
664
665         [Cocoa] Deny access to database mapping service
666         https://bugs.webkit.org/show_bug.cgi?id=209339
667         <rdar://problem/56966010>
668
669         Reviewed by Brent Fulgham.
670
671         In order for the WebContent process to not have permantent access to the database mapping service,
672         this patch creates an extension for the service in the UI process, sends it to the WebContent
673         process, where it is consumed. Then, an API call is made which will map the database, and next the
674         WebContent process will revoke the extension. The WebContent process has then mapped the database,
675         and access to the database mapping service is no longer needed.
676
677         Tested by: fast/sandbox/ios/sandbox-mach-lookup.html
678
679         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
680         * Shared/WebProcessCreationParameters.cpp:
681         (WebKit::WebProcessCreationParameters::encode const):
682         (WebKit::WebProcessCreationParameters::decode):
683         * Shared/WebProcessCreationParameters.h:
684         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
685         (WebKit::WebProcessPool::platformInitializeWebProcess):
686         * WebProcess/cocoa/WebProcessCocoa.mm:
687         (WebKit::WebProcess::platformInitializeWebProcess):
688         * WebProcess/com.apple.WebProcess.sb.in:
689
690 2020-03-23  Megan Gardner  <megan_gardner@apple.com>
691
692         Removed FIXME comment for work that had already been done.
693
694         * UIProcess/ios/WKSyntheticTapGestureRecognizer.mm:
695         (-[WKSyntheticTapGestureRecognizer touchesEnded:withEvent:]):
696
697 2020-03-23  John Wilander  <wilander@apple.com>
698
699         Add the capability to change all of a website's cookies to SameSite=Strict
700         https://bugs.webkit.org/show_bug.cgi?id=209369
701         <rdar://problem/60710690>
702
703         Reviewed by Alex Christensen and David Kilzer.
704
705         These changes add test infrastructure to run function
706         WebCore::NetworkStorageSession::setAllCookiesToSameSiteStrict() in the
707         network process.
708
709         * NetworkProcess/NetworkProcess.cpp:
710         (WebKit::NetworkProcess::setToSameSiteStrictCookiesForTesting):
711         * NetworkProcess/NetworkProcess.h:
712         * NetworkProcess/NetworkProcess.messages.in:
713         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
714         (WKWebsiteDataStoreSetResourceLoadStatisticsToSameSiteStrictCookiesForTesting):
715         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
716         * UIProcess/Network/NetworkProcessProxy.cpp:
717         (WebKit::NetworkProcessProxy::setToSameSiteStrictCookiesForTesting):
718         * UIProcess/Network/NetworkProcessProxy.h:
719         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
720         (WebKit::WebsiteDataStore::setResourceLoadStatisticsToSameSiteStrictCookiesForTesting):
721         * UIProcess/WebsiteData/WebsiteDataStore.h:
722
723 2020-03-23  Daniel Bates  <dabates@apple.com>
724
725         Support inserting text or dictation alternative by simulating keyboard input
726         https://bugs.webkit.org/show_bug.cgi?id=209380
727         <rdar://problem/59445102>
728
729         Reviewed by Darin Adler.
730
731         As a workaround for sites the implement their own editing system (e.g. facebook.com)
732         add a new insertion option that makes the insertion having a passing resemblance
733         of a person typing. The resemblance is achieved by dispatching DOM events with type
734         "keydown", "keyup", and "change".
735
736         * Shared/Cocoa/InsertTextOptions.cpp:
737         (IPC::ArgumentCoder<WebKit::InsertTextOptions>::encode):
738         (IPC::ArgumentCoder<WebKit::InsertTextOptions>::decode):
739         Encode and decode the new option.
740
741         * Shared/Cocoa/InsertTextOptions.h: Default the new option, shouldSimulateKeyboardInput,
742         to false to keep our current behavior.
743         * UIProcess/ios/WKContentViewInteraction.mm:
744         (-[WKContentView _shouldSimulateKeyboardInputOnTextInsertion]): Added. Returns NO when
745         building without USE(TEXT_INTERACTION_ADDITIONS) to keep the current behavior.
746
747         (-[WKContentView insertText:]):
748         (-[WKContentView insertText:alternatives:style:]):
749         Set the shouldSimulateKeyboardInput option.
750
751         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
752         (WebKit::WebPage::insertDictatedTextAsync):
753         * WebProcess/WebPage/WebPage.cpp:
754         (WebKit::WebPage::insertTextAsync):
755         If shouldSimulateKeyboardInput is false then do what we do now. Otherwise, dispatch a DOM event
756         of type "keydown" and perform the insertion. Then dispatch DOM events of type "keyup" and "change". 
757
758 2020-03-23  Darin Adler  <darin@apple.com>
759
760         Change TextIterator::rangeLength to not require a live range
761         https://bugs.webkit.org/show_bug.cgi?id=209207
762
763         Reviewed by Antti Koivisto.
764
765         * Shared/EditingRange.cpp:
766         (WebKit::EditingRange::toRange): Use characterCount.
767         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
768         (WebKit::insertionPointFromCurrentSelection): Changed return type to
769         CharacterCount and use characterCount.
770         (WebKit::WebEditorClient::supportsGlobalSelection): Tweaked #if.
771         * WebProcess/WebPage/WebPage.cpp:
772         (WebKit::targetFrameForEditing): Use characterCount.
773         * WebProcess/WebPage/glib/WebPageGLib.cpp:
774         (WebKit::WebPage::platformEditorState const): Ditto.
775         * WebProcess/WebPage/ios/WebPageIOS.mm:
776         (WebKit::rangeNearPositionMatchesText): Ditto.
777         * WebProcess/WebPage/mac/WebPageMac.mm:
778         (WebKit::WebPage::platformEditorState const): Ditto.
779
780 2020-03-23  youenn fablet  <youenn@apple.com>
781
782         Rename blankURL to aboutBlankURL
783         https://bugs.webkit.org/show_bug.cgi?id=209344
784
785         Reviewed by Darin Adler.
786
787         * UIProcess/API/C/WKPage.cpp:
788         (WKPageLoadPlainTextStringWithUserData):
789         * UIProcess/API/C/WKPageGroup.cpp:
790         (WKPageGroupAddUserStyleSheet):
791         (WKPageGroupAddUserScript):
792         * UIProcess/API/glib/WebKitWebView.cpp:
793         (webkit_web_view_load_plain_text):
794         * UIProcess/Inspector/WebPageDebuggable.cpp:
795         (WebKit::WebPageDebuggable::url const):
796         * UIProcess/WebPageProxy.cpp:
797         (WebKit::WebPageProxy::loadDataWithNavigationShared):
798         (WebKit::WebPageProxy::loadWebArchiveData):
799         * WebProcess/WebPage/WebPage.cpp:
800         (WebKit::WebPage::loadData):
801         (WebKit::WebPage::loadAlternateHTML):
802         (WebKit::WebPage::dumpHistoryForTesting):
803         (WebKit::WebPage::addUserScript):
804         (WebKit::WebPage::addUserStyleSheet):
805
806 2020-03-23  Alex Christensen  <achristensen@webkit.org>
807
808         Add SPI to move localStorage to a different domain
809         https://bugs.webkit.org/show_bug.cgi?id=209260
810         <rdar://problem/60285683>
811
812         Reviewed by Brady Eidson.
813
814         Covered by an API test.
815
816         * NetworkProcess/NetworkProcess.cpp:
817         (WebKit::NetworkProcess::renameDomainInWebsiteData):
818         (WebKit::NetworkProcess::getLocalStorageOriginDetails):
819         * NetworkProcess/NetworkProcess.h:
820         * NetworkProcess/NetworkProcess.messages.in:
821         * NetworkProcess/WebStorage/LocalStorageNamespace.cpp:
822         (WebKit::LocalStorageNamespace::renameDomain):
823         * NetworkProcess/WebStorage/LocalStorageNamespace.h:
824         * NetworkProcess/WebStorage/StorageArea.cpp:
825         (WebKit::StorageArea::close):
826         * NetworkProcess/WebStorage/StorageArea.h:
827         * NetworkProcess/WebStorage/StorageManager.cpp:
828         (WebKit::StorageManager::renameDomain):
829         * NetworkProcess/WebStorage/StorageManager.h:
830         * NetworkProcess/WebStorage/StorageManagerSet.cpp:
831         (WebKit::StorageManagerSet::renameDomain):
832         * NetworkProcess/WebStorage/StorageManagerSet.h:
833         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
834         (-[WKWebsiteDataStore _renameDomain:to:forDataOfTypes:completionHandler:]):
835         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
836         * UIProcess/Network/NetworkProcessProxy.cpp:
837         (WebKit::NetworkProcessProxy::renameDomainInWebsiteData):
838         * UIProcess/Network/NetworkProcessProxy.h:
839         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
840         (WebKit::WebsiteDataStore::renameDomainInWebsiteData):
841         * UIProcess/WebsiteData/WebsiteDataStore.h:
842
843 2020-03-23  Per Arne Vollan  <pvollan@apple.com>
844
845         [iOS] Deny mach lookup access to icon services
846         https://bugs.webkit.org/show_bug.cgi?id=209340
847
848         Reviewed by Brent Fulgham.
849
850         Tested by fast/sandbox/ios/sandbox-mach-lookup.html
851
852         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
853
854 2020-03-23  Jacob Uphoff  <jacob_uphoff@apple.com>
855
856         Unreviewed, reverting r258803.
857
858         This revision caused many layout tests and 10 API tests to
859         start failing/crashing
860
861         Reverted changeset:
862
863         "[Cocoa] Deny access to database mapping service"
864         https://bugs.webkit.org/show_bug.cgi?id=209339
865         https://trac.webkit.org/changeset/258803
866
867 2020-03-23  Youenn Fablet  <youenn@apple.com>
868
869         RemoteAudioSession should listen to GPUProcess messages
870         https://bugs.webkit.org/show_bug.cgi?id=209422
871
872         Reviewed by Eric Carlson.
873
874         Make sure RemoteAudioSession is registered as a listener to GPUProcess messages.
875
876         * WebProcess/GPU/media/RemoteAudioSession.cpp:
877         (WebKit::RemoteAudioSession::RemoteAudioSession):
878         (WebKit::RemoteAudioSession::~RemoteAudioSession):
879
880 2020-03-23  Pablo Saavedra  <psaavedra@igalia.com>
881
882         [GTK][WPE] Check the cgroups memory limits (v1 and v2) to calculate the systemMemoryUsedAsPercentage() in the MemoryPressureMonitor
883         https://bugs.webkit.org/show_bug.cgi?id=209186
884
885         Reviewed by Carlos Alberto Lopez Perez.
886
887         Modifies the systemMemoryUsedAsPercentage() function adding the logic
888         to read the memory limits and the current memory used in the cgroup
889         associated to the WebKit process:
890
891         - memory.memsw.usage_in_bytes (or memory.memsw.max in cgroupV2):
892           current usage for memory+Swap
893         - memory.limit_in_bytes (or memory.current in cgroupV2):
894           limit of memory usage
895         - memory.memsw.limit_in_bytes (or memory.max in cgroupV2):
896           limit of memory+Swap usage
897
898         In case of the WK processes are associated to a cgroup with memory
899         controller, the function reads the memory.limit_in_bytes or
900         the memory.memsw.limit_in_bytes and the and memory.usage_in_bytes
901         from the cgroup mount point and calculates the percentage of
902         memory used.
903
904         In other cases (no cgroup memory controller associated or limits
905         higher than the real memory available), the function will return the
906         percentage based on the real memory available and real total memory
907         in the system.
908
909         The logic supports supports both cgroupV1 and cgroupV2
910
911         * UIProcess/linux/MemoryPressureMonitor.cpp:
912         (WebKit::getMemoryTotalWithCgroup):
913         (WebKit::getMemoryUsageWithCgroup):
914         (WebKit::getCgroupController):
915         (WebKit::systemMemoryUsedAsPercentage):
916
917 2020-03-23  Chris Lord  <clord@igalia.com>
918
919         [WPE] AsyncScrolling: horizontal scrolling is inverted
920         https://bugs.webkit.org/show_bug.cgi?id=208638
921
922         Reviewed by Adrian Perez de Castro.
923
924         * UIProcess/API/wpe/ScrollGestureController.cpp:
925         (WebKit::ScrollGestureController::handleEvent):
926
927 2020-03-23  youenn fablet  <youenn@apple.com>
928
929         Explicitly activate the new DrawingAreaProxy on PSON navigation
930         https://bugs.webkit.org/show_bug.cgi?id=209232
931
932         Reviewed by Antti Koivisto.
933
934         Delay tree unfreezing for provisional pages until the main frame load is committed.
935         At that point, UIProcess is made aware and is doing the process swap.
936         We can thus unfreeze the tree so that UIProcess starts getting DrawAreaProxy messages.
937
938         This allows UIProcess to start listening to DrawAreaProxy messages at the time of doing process swapping in WebPageProxy.
939
940         * UIProcess/DrawingAreaProxy.cpp:
941         (WebKit::DrawingAreaProxy::DrawingAreaProxy):
942         (WebKit::DrawingAreaProxy::startReceivingMessages):
943         * UIProcess/DrawingAreaProxy.h:
944         * UIProcess/WebPageProxy.cpp:
945         (WebKit::WebPageProxy::setDrawingArea):
946         * WebProcess/WebPage/WebPage.cpp:
947         (WebKit::WebPage::didCompletePageTransition):
948         (WebKit::WebPage::didCommitLoad):
949
950 2020-03-22  Wenson Hsieh  <wenson_hsieh@apple.com>
951
952         Adopt -[UIWindowScene interfaceOrientation] when determining device orientation
953         https://bugs.webkit.org/show_bug.cgi?id=209372
954         <rdar://problem/60491857>
955
956         Reviewed by Darin Adler.
957
958         Currently, for WebKit clients that have adopted the UIScene lifecycle (and also do not set an interface
959         orientation override, like MobileSafari does), device orientation APIs will always report that the device is in
960         portrait mode, regardless of the actual device orientation. This is because our current mechanism for tracking
961         device orientation asks the shared UIApplication for its -statusBarOrientation. This is hard-coded to always
962         return UIInterfaceOrientationPortrait for apps that adopt the UIScene lifecycle, and will additionally trigger a
963         simulated crash, explaining that it is invalid for any scene-based app to call -statusBarOrientation.
964
965         To fix this, we adjust the `deviceOrientation` helper in WKWebViewIOS.mm to work for scene-based apps. See below
966         for more details.
967
968         * Platform/spi/ios/UIKitSPI.h:
969         * UIProcess/API/ios/WKWebViewIOS.h:
970         * UIProcess/API/ios/WKWebViewIOS.mm:
971         (-[WKWebView _setupScrollAndContentViews]):
972
973         Change call sites of `deviceOrientation()` to be `[self _deviceOrientation]` instead.
974
975         (-[WKWebView _deviceOrientation]):
976
977         Replace `deviceOrientation()` with a `_deviceOrientation` helper method on `WKWebView`. For non-scene-based
978         apps, this new helper method does not change any behavior, and continues to go through UIApplication. However,
979         for scene-based apps, we instead ask the web view's window's `UIWindowScene` for its interface orientation.
980
981         Importantly, this means that if a WKWebView is not parented, it doesn't have a valid device orientation (i.e.
982         the orientation is UIInterfaceOrientationUnknown). As such, a newly created WKWebView that is unparented will
983         start out with no orientation; it's only upon moving the view into a window that it is able to determine the
984         device orientation. To ensure this, we add logic to -didMoveToWindow to recompute device orientation and
985         dispatch an update if needed.
986
987         To avoid sending unnecessary updates, if a WKWebView is unparented, we wait until it's parented again to send
988         the new device orientation.
989
990         (-[WKWebView didMoveToWindow]):
991         (-[WKWebView _windowDidRotate:]):
992         (deviceOrientation): Deleted.
993
994         See -[WKWebView _deviceOrientation] above.
995
996 2020-03-21  David Kilzer  <ddkilzer@apple.com>
997
998         decodeSharedBuffer() in WebCoreArgumentCoders.cpp should validate `bufferSize`
999         <https://webkit.org/b/209373>
1000         <rdar://problem/60610919>
1001
1002         Reviewed by Darin Adler.
1003
1004         * Shared/WebCoreArgumentCoders.cpp:
1005         (IPC::decodeSharedBuffer):
1006         - Return early if `bufferSize` is too big.
1007
1008 2020-03-20  Wenson Hsieh  <wenson_hsieh@apple.com>
1009
1010         [iPadOS] Yahoo! search results are sometimes zoomed in a little
1011         https://bugs.webkit.org/show_bug.cgi?id=209356
1012         <rdar://problem/60563952>
1013
1014         Reviewed by Tim Horton.
1015
1016         When the web content process uses `WebPage::scalePage()` to modify the viewport scale (e.g. after a viewport
1017         configuration change) on iOS, it's possible for this new scale to be replaced by a previous scale when
1018         dispatching the next visible content rect update. Consider the following scenario:
1019
1020         1. A remote layer tree transaction is sent to the UI process containing scale `a`.
1021         2. `WebPage::scalePage` is called with a scale `b`.
1022         3. A visible content rect update with scale `a` is scheduled, sent to the web process and dispatched.
1023         4. The page scale reverts to `a`.
1024
1025         This bug exercises the above scenario: the Yahoo search results page specifies a responsive viewport
1026         (device-width and scale=1), but proceeds to lay out outside of the bounds of the device width. As such, after
1027         the document finishes parsing, we attempt to shrink the page to fit; however, if this shrinking happens after
1028         a remote layer tree transaction with the old scale but before the next visible content rect update containing
1029         that old scale, we will end up reverting to this old scale instead of the scale after shrinking to fit. This
1030         same bug is present when using `setViewScale`, which was exercised by the flaky test below, since the new scale
1031         after the viewport configuration change may be overridden by an incoming visible content rect update.
1032
1033         To fix this, we add a mechanism to detect when the page scale has been changed by the web process (e.g. after a
1034         viewport change) and remember the last committed layer tree identifier at that moment. Later, if we get a
1035         visible content rect update with a layer tree commit identifier equal to (or older than) the layer tree commit
1036         identifier when we changed the page scale, don't set the page scale factor using this incoming scale; instead,
1037         wait for the next visible content rect update (which will contain the new scale).
1038
1039         Fixes an existing flaky test: fast/viewport/ios/device-width-viewport-after-changing-view-scale.html
1040
1041         * WebProcess/WebPage/WebPage.cpp:
1042         (WebKit::WebPage::close):
1043         (WebKit::WebPage::scalePage):
1044         (WebKit::WebPage::platformDidScalePage):
1045
1046         Add a platform hook that is invoked after scaling the page via `scalePage`. See below for the iOS version.
1047
1048         (WebKit::WebPage::didCommitLoad):
1049         (WebKit::WebPage::didFinishDocumentLoad):
1050         (WebKit::WebPage::didFinishLoad):
1051
1052         Drive-by fix: remove an unnecessary `UNUSED_PARAM`. Also, replace calls to schedule the shrink to fit content
1053         timer with a call to `shrinkToFitContent` instead.
1054
1055         * WebProcess/WebPage/WebPage.h:
1056
1057         Add a member variable to remember the last sent layer tree commit ID and page scale, when we last changed the
1058         page scale via the web process. This is set in `platformDidScalePage` below.
1059
1060         * WebProcess/WebPage/ios/WebPageIOS.mm:
1061         (WebKit::WebPage::dynamicViewportSizeUpdate):
1062         (WebKit::WebPage::shrinkToFitContent):
1063
1064         Refactor this to not return a bool, but instead call `viewportConfigurationChanged` at the end if the viewport
1065         actually changed.
1066
1067         (WebKit::WebPage::updateVisibleContentRects):
1068
1069         Ignore the incoming page scale when updating visible content rects if it:
1070         1. Is the same as the last page scale we sent via layer tree commit.
1071         2. After sending the above scale, we've since adjusted the page scale such that it is no longer the same.
1072
1073         (WebKit::WebPage::platformDidScalePage):
1074
1075         Update `m_lastLayerTreeTransactionIdAndPageScaleBeforeScalingPage`.
1076
1077         (WebKit::WebPage::scheduleShrinkToFitContent): Deleted.
1078         (WebKit::WebPage::shrinkToFitContentTimerFired): Deleted.
1079
1080         Remove the zero-delay timer before running the shrink-to-fit heuristic, and just call `shrinkToFitContent`
1081         directly. This was a source of flakiness when trying to reproduce the bug, and doesn't seem to serve any
1082         purpose since we shrink-to-fit after dispatching the "DOMContentLoaded" and "load" events anyways.
1083
1084         (WebKit::WebPage::immediatelyShrinkToFitContent): Deleted.
1085
1086 2020-03-20  Per Arne Vollan  <pvollan@apple.com>
1087
1088         [Cocoa] Deny access to database mapping service
1089         https://bugs.webkit.org/show_bug.cgi?id=209339
1090         <rdar://problem/56966010>
1091
1092         Reviewed by Brent Fulgham.
1093
1094         In order for the WebContent process to not have permantent access to the database mapping service,
1095         this patch creates an extension for the service in the UI process, sends it to the WebContent
1096         process, where it is consumed. Then, an API call is made which will map the database, and next the
1097         WebContent process will revoke the extension. The WebContent process has then mapped the database,
1098         and access to the database mapping service is no longer needed.
1099
1100         Tested by: fast/sandbox/ios/sandbox-mach-lookup.html
1101
1102         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1103         * Shared/WebProcessCreationParameters.cpp:
1104         (WebKit::WebProcessCreationParameters::encode const):
1105         (WebKit::WebProcessCreationParameters::decode):
1106         * Shared/WebProcessCreationParameters.h:
1107         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1108         (WebKit::WebProcessPool::platformInitializeWebProcess):
1109         * WebProcess/cocoa/WebProcessCocoa.mm:
1110         (WebKit::WebProcess::platformInitializeWebProcess):
1111         * WebProcess/com.apple.WebProcess.sb.in:
1112
1113 2020-03-20  Per Arne Vollan  <pvollan@apple.com>
1114
1115         [iOS] Add telemetry for message filtering
1116         https://bugs.webkit.org/show_bug.cgi?id=209003
1117         <rdar://problem/60376722>
1118
1119         Reviewed by Brent Fulgham.
1120
1121         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1122
1123 2020-03-20  Daniel Bates  <dabates@apple.com>
1124
1125         Have insertDictatedTextAsync() take an InsertTextOptions
1126         https://bugs.webkit.org/show_bug.cgi?id=209308
1127         <rdar://problem/60652838>
1128
1129         Reviewed by Darin Adler.
1130
1131         This will provide future extensibility, which I plan to make use of in a subsequent patch,
1132         in addition to making the interface for insertDictatedTextAsync() more like insertTextAsync().
1133
1134         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1135         (WebKit::WebPageProxy::insertDictatedTextAsync): Pass the options through. The caller is now
1136         responsible for setting the registerUndoGroup insertion option.
1137         * UIProcess/Cocoa/WebViewImpl.mm:
1138         (WebKit::WebViewImpl::insertText): Stack-allocate a InsertTextOptions setting its registerUndoGroup
1139         field and pass this object through.
1140         * UIProcess/WebPageProxy.h:
1141         * UIProcess/ios/WKContentViewInteraction.mm:
1142         (-[WKContentView insertText:alternatives:style:]): Pass the default constructed InsertTextOptions,
1143         which defaults registerUndoGroup to false to keep the current behavior.
1144         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1145         (WebKit::WebPage::insertDictatedTextAsync): Write in terms of InsertTextOptions.registerUndoGroup.
1146         * WebProcess/WebPage/WebPage.h:
1147         * WebProcess/WebPage/WebPage.messages.in:
1148
1149 2020-03-20  Daniel Bates  <dabates@apple.com>
1150
1151         Replace "deferred element focus" functionality with alternative solution
1152         https://bugs.webkit.org/show_bug.cgi?id=201608
1153
1154         Reviewed by Wenson Hsieh.
1155
1156         This is a partial revert of r190278. Have the web process perform a layout, if needed, when
1157         computing focus element information and send an editor state update immediately. If layout is
1158         not needed then explicitly schedule a full editor state update.
1159
1160         Currently, fetching focus element information neither sends an editor state update nor
1161         schedules one. As a result, when the web process tells the UI process to focus an element the
1162         UI process may need to defer doing so if the last received update did not include details
1163         that require up-to-date layout (e.g. the bounding rect of the focused element, which is used
1164         to scroll and zoom to center the focused element). The UI process then schedules an async message
1165         to the web process to fetch the full editor state, which will arrive in a layer tree commit message
1166         from the web process. (Note that the UI process schedules this request to ensure the web process
1167         knows that it is waiting for a layer tree commit. The web process can use this info to expedite
1168         a layer tree commit, if needed). This deferral mechanism complicates the element focusing and
1169         defocusing logic in the UI process and prevents fixing <https://bugs.webkit.org/show_bug.cgi?id=199960>.
1170         Instead remove this deferral concept and have the web process ensure that a full editor state
1171         update is sent or will be sent when computing the focus element information.
1172
1173         * UIProcess/WebPageProxy.cpp:
1174         (WebKit::WebPageProxy::resetStateAfterProcessExited):
1175         * UIProcess/WebPageProxy.h:
1176         * UIProcess/ios/WebPageProxyIOS.mm:
1177         (WebKit::WebPageProxy::didCommitLayerTree):
1178         (WebKit::WebPageProxy::elementDidFocus):
1179         (WebKit::WebPageProxy::elementDidBlur):
1180         Remove bookkeeping code to track a deferred focus event or to perform the deferred event
1181         on layer tree commit.
1182
1183         * WebProcess/WebPage/WebPage.cpp:
1184         (WebKit::WebPage::elementDidFocus):
1185         * WebProcess/WebPage/ios/WebPageIOS.mm:
1186         (WebKit::WebPage::getFocusedElementInformation): Save off whether a layout is needed then
1187         tell the page to layout if needed. If a layout was needed then send an editor state update
1188         immediately (it's an async message): this update will be a "full editor state" update that
1189         includes up-to-date layout details. Otherwise, schedule a full editor state update. While I
1190         am here, I updated the code to take out a ref on the focused frame's document before performing
1191         a layout because layout can cause arbitrary JavaScript execution that could detach the document
1192         from its frame view as part of destroying the document. Document destruction is detected by
1193         checking whether the document has been detached from its frame view. If this happens then
1194         bail out as there is no need to get focus element info.
1195
1196 2020-03-20  Don Olmstead  <don.olmstead@sony.com>
1197
1198         [GPUP] Add PlatformLayerContainer to hold pointer to PlatformLayer
1199         https://bugs.webkit.org/show_bug.cgi?id=208963
1200
1201         Reviewed by Eric Carlson.
1202
1203         Use PlatformLayerContainer since RetainPtr is a Cocoa only construct. This
1204         allows non-Cocoa ports to get further with compiling out the GPU Process.
1205
1206         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
1207         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
1208         * WebProcess/GPU/media/VideoLayerRemote.h:
1209         * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm:
1210         (WebKit::MediaPlayerPrivateRemote::createVideoFullscreenLayer):
1211         * WebProcess/GPU/media/cocoa/VideoLayerRemoteCocoa.mm:
1212         (WebKit::createVideoLayerRemote):
1213         * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h:
1214
1215 2020-03-20  Tim Horton  <timothy_horton@apple.com>
1216
1217         Upstream a variety of Cocoa-platform HAVE and ENABLE macros
1218         https://bugs.webkit.org/show_bug.cgi?id=209307
1219
1220         Reviewed by Andy Estes.
1221
1222         * Configurations/FeatureDefines.xcconfig:
1223         * Platform/spi/ios/PDFKitSPI.h:
1224         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1225         (WebKit::createRemoteView):
1226         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1227         * UIProcess/ios/WKPDFView.mm:
1228         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
1229
1230 2020-03-20  Alex Christensen  <achristensen@webkit.org>
1231
1232         Use same syntax for ComputePagesForPrintingAndDrawToPDF message as other messages
1233         https://bugs.webkit.org/show_bug.cgi?id=209310
1234         <rdar://problem/60648013>
1235
1236         Reviewed by Sam Weinig.
1237
1238         This makes it easier for scripts to find which messages are unused.
1239
1240         * UIProcess/ios/WebPageProxyIOS.mm:
1241         (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
1242
1243 2020-03-20  youenn fablet  <youenn@apple.com>
1244
1245         Add routines to check about:blank and about:srcdoc URLs
1246         https://bugs.webkit.org/show_bug.cgi?id=209174
1247
1248         Reviewed by Alex Christensen.
1249
1250         * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
1251         (WebKit::WebResourceLoadObserver::requestStorageAccessUnderOpener):
1252
1253 2020-03-20  Chris Dumez  <cdumez@apple.com>
1254
1255         [iOS] Articles on NYTimes.com get truncated when switching between MobileSafari and another app
1256         https://bugs.webkit.org/show_bug.cgi?id=209321
1257         <rdar://problem/59763843>
1258
1259         Reviewed by Tim Horton.
1260
1261         Articles on NYTimes.com get truncated when switching between MobileSafari and another app
1262         (multitasking). The reason is that when you home out of MobileSafari, snapshots of the 
1263         web view are taken at various sizes and we were firing 5 resizes events at the page as a
1264         result. Those resize events were confusing the logic on NYTimes.com and causing it to
1265         truncate the article.
1266
1267         To address the issue, we stop firing resize events at the page if the resize is happening
1268         during the snapshotting sequence.
1269
1270         * Platform/spi/ios/UIKitSPI.h:
1271         * UIProcess/ApplicationStateTracker.h:
1272         * UIProcess/ApplicationStateTracker.mm:
1273         (WebKit::ApplicationStateTracker::ApplicationStateTracker):
1274         (WebKit::ApplicationStateTracker::~ApplicationStateTracker):
1275         (WebKit::ApplicationStateTracker::willBeginSnapshotSequence):
1276         (WebKit::ApplicationStateTracker::didCompleteSnapshotSequence):
1277         * UIProcess/WebPageProxy.cpp:
1278         * UIProcess/WebPageProxy.h:
1279         * UIProcess/ios/WKApplicationStateTrackingView.mm:
1280         (-[WKApplicationStateTrackingView didMoveToWindow]):
1281         (-[WKApplicationStateTrackingView _willBeginSnapshotSequence]):
1282         (-[WKApplicationStateTrackingView _didCompleteSnapshotSequence]):
1283         * WebProcess/WebPage/WebPage.cpp:
1284         (WebKit::WebPage::setShouldFireResizeEvents):
1285         * WebProcess/WebPage/WebPage.h:
1286         * WebProcess/WebPage/WebPage.messages.in:
1287
1288 2020-03-20  Jacob Uphoff  <jacob_uphoff@apple.com>
1289
1290         Unreviewed, reverting r258748.
1291
1292         This commit broke the Catalina build
1293
1294         Reverted changeset:
1295
1296         "Upstream a variety of Cocoa-platform HAVE and ENABLE macros"
1297         https://bugs.webkit.org/show_bug.cgi?id=209307
1298         https://trac.webkit.org/changeset/258748
1299
1300 2020-03-19  David Kilzer  <ddkilzer@apple.com>
1301
1302         SharedMemory::allocate() should initialize `address`
1303         <https://webkit.org/b/209315>
1304         <rdar://problem/60606720>
1305
1306         Reviewed by Geoffrey Garen.
1307
1308         * Platform/cocoa/SharedMemoryCocoa.cpp:
1309         (WebKit::SharedMemory::allocate): Initialize `address` to zero.
1310
1311 2020-03-19  Tim Horton  <timothy_horton@apple.com>
1312
1313         Unable to build WebKit with iOS 13.4 SDK
1314         https://bugs.webkit.org/show_bug.cgi?id=209317
1315
1316         Reviewed by Simon Fraser.
1317
1318         * Platform/spi/ios/UIKitSPI.h:
1319         * UIProcess/ios/WKMouseGestureRecognizer.mm:
1320
1321 2020-03-19  Brent Fulgham  <bfulgham@apple.com>
1322
1323         [macoOS] Remove access to 'apple-extension-services' from the WebContent sandbox
1324         https://bugs.webkit.org/show_bug.cgi?id=209324
1325         <rdar://problem/58089661>
1326
1327         Reviewed by Per Arne Vollan.
1328
1329         Remove the last of permissions for the unused 'apple-extension-services' mach service.
1330
1331         * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
1332         * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
1333         * WebProcess/com.apple.WebProcess.sb.in:
1334
1335 2020-03-19  Tim Horton  <timothy_horton@apple.com>
1336
1337         Upstream a variety of Cocoa-platform HAVE and ENABLE macros
1338         https://bugs.webkit.org/show_bug.cgi?id=209307
1339
1340         Reviewed by Andy Estes.
1341
1342         * Configurations/FeatureDefines.xcconfig:
1343         * Platform/spi/ios/PDFKitSPI.h:
1344         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1345         (WebKit::createRemoteView):
1346         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1347         * UIProcess/ios/WKPDFView.mm:
1348         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
1349
1350 2020-03-19  Alex Christensen  <achristensen@webkit.org>
1351
1352         Sanitize suggested download filename received from web process
1353         https://bugs.webkit.org/show_bug.cgi?id=209300
1354         <rdar://problem/59487723>
1355
1356         Reviewed by Chris Dumez.
1357
1358         * UIProcess/Downloads/DownloadProxy.cpp:
1359         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):
1360
1361 2020-03-19  Kate Cheney  <katherine_cheney@apple.com>
1362
1363         Handle failed ITP Database insert attempts
1364         https://bugs.webkit.org/show_bug.cgi?id=209253
1365         <rdar://problem/58886756>
1366
1367         Reviewed by David Kilzer.
1368
1369         A first step toward handling I/O errors in the database. Adds checks
1370         so that in the case where a domain insert fails, we don't execute
1371         code which relies on this domain being in the database.
1372
1373         Future steps will be figuring out a way to schedule failed queries
1374         to execute when the database is accepting inputs in the future.
1375
1376         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1377         (WebKit::ResourceLoadStatisticsDatabaseStore::ensureResourceStatisticsForRegistrableDomain):
1378         Check if the query to insert a domain failed. If so, return
1379         WTF::nullopt in place of the domain ID to indicate the failure.
1380
1381         (WebKit::ResourceLoadStatisticsDatabaseStore::ensureAndMakeDomainList):
1382         The simplest solution here was to only append strings to this list
1383         if they are already in the database, or are successfully inserted,
1384         because insertDomainRelationshipList() relies on these being in the database.
1385
1386         (WebKit::ResourceLoadStatisticsDatabaseStore::hasStorageAccess):
1387         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
1388         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
1389         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
1390         (WebKit::ResourceLoadStatisticsDatabaseStore::grandfatherDataForDomains):
1391         (WebKit::ResourceLoadStatisticsDatabaseStore::ensurePrevalentResourcesForDebugMode):
1392         (WebKit::ResourceLoadStatisticsDatabaseStore::logFrameNavigation):
1393         (WebKit::ResourceLoadStatisticsDatabaseStore::logCrossSiteLoadWithLinkDecoration):
1394         (WebKit::ResourceLoadStatisticsDatabaseStore::logUserInteraction):
1395         (WebKit::ResourceLoadStatisticsDatabaseStore::clearUserInteraction):
1396         (WebKit::ResourceLoadStatisticsDatabaseStore::clearPrevalentResource):
1397         (WebKit::ResourceLoadStatisticsDatabaseStore::setGrandfathered):
1398         (WebKit::ResourceLoadStatisticsDatabaseStore::setIsScheduledForAllButCookieDataRemoval):
1399         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubframeUnderTopFrameDomain):
1400         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUnderTopFrameDomain):
1401         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectTo):
1402         (WebKit::ResourceLoadStatisticsDatabaseStore::setSubresourceUniqueRedirectFrom):
1403         (WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectTo):
1404         (WebKit::ResourceLoadStatisticsDatabaseStore::setTopFrameUniqueRedirectFrom):
1405         (WebKit::ResourceLoadStatisticsDatabaseStore::setLastSeen):
1406         (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
1407         (WebKit::ResourceLoadStatisticsDatabaseStore::setVeryPrevalentResource):
1408         Every call to ensureResourceStatisticsForRegistrableDomain should
1409         check the result to make sure the domain was inserted before
1410         continuing, and return early (or return a value that does not further
1411         rely on the database information, like an empty vector). Log these
1412         errors but don't add a debug assert because there already is one in
1413         ensureResourceStatisticsForRegistrableDomain.
1414
1415         * (WebKit::ResourceLoadStatisticsDatabaseStore::populateFromMemoryStore):
1416         * (WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistics):
1417         The simplest thing to do in this case is to return early if any domain
1418         inserts fail before inserting domain relationships as a best-effort
1419         approach. A future step could be maintaining a vector of statistics
1420         which successfully inserted, and only adding those relationships.
1421
1422         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
1423         ensureResourceStatisticsForRegistrableDomain should return an
1424         Optional domain ID to account for failed inserts.
1425
1426 2020-03-19  Tim Horton  <timothy_horton@apple.com>
1427
1428         Upstream the definition of HAVE_READ_ONLY_SYSTEM_VOLUME
1429         https://bugs.webkit.org/show_bug.cgi?id=209305
1430
1431         Reviewed by Andy Estes.
1432
1433         * Shared/mac/AuxiliaryProcessMac.mm:
1434         (WebKit::AuxiliaryProcess::isSystemWebKit):
1435
1436 2020-03-19  Brent Fulgham  <bfulgham@apple.com>
1437
1438         Remove Mobile Asset access from the WebContent process
1439         https://bugs.webkit.org/show_bug.cgi?id=209302
1440         <rdar://problem/56305023>
1441
1442         Reviewed by Per Arne Vollan.
1443
1444         Tested by fast/sandbox/ios/sandbox-mach-lookup.html
1445
1446         * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
1447         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1448
1449 2020-03-19  Alex Christensen  <achristensen@webkit.org>
1450
1451         Remove unused WebProcessPool::didGetStatistics
1452         https://bugs.webkit.org/show_bug.cgi?id=209303
1453         <rdar://problem/60648454>
1454
1455         Reviewed by Geoffrey Garen.
1456
1457         * UIProcess/WebProcessPool.cpp:
1458         (WebKit::WebProcessPool::didGetStatistics): Deleted.
1459         * UIProcess/WebProcessPool.h:
1460         * UIProcess/WebProcessPool.messages.in:
1461
1462 2020-03-19  Takashi Komori  <Takashi.Komori@sony.com>
1463
1464         [Curl] Add an API returns description of verification errors.
1465         https://bugs.webkit.org/show_bug.cgi?id=208913
1466
1467         Reviewed by Fujii Hironori.
1468
1469         WKCertificateInfoCopyVerificationErrorDescription returns the description of SSL verification error as human readable string.
1470         Browser can display more precise error information with this API.
1471
1472         API Test: Curl.CertificateAPI
1473
1474         * Shared/API/c/curl/WKCertificateInfoCurl.cpp:
1475         (WKCertificateInfoCopyVerificationErrorDescription):
1476         * Shared/API/c/curl/WKCertificateInfoCurl.h:
1477
1478 2020-03-19  Per Arne Vollan  <pvollan@apple.com>
1479
1480         [iOS] Deny mach lookup access to power service
1481         https://bugs.webkit.org/show_bug.cgi?id=208460
1482         <rdar://problem/57026325>
1483
1484         Reviewed by Darin Adler.
1485
1486         On iOS, deny mach lookup access to the power service in the WebContent process.
1487         
1488         Test: fast/sandbox/ios/sandbox-mach-lookup.html
1489
1490         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1491
1492 2020-03-19  Tim Horton  <timothy_horton@apple.com>
1493
1494         Implement support for cursor interactions on iPad
1495         https://bugs.webkit.org/show_bug.cgi?id=209268
1496
1497         Reviewed by Darin Adler.
1498
1499         * Platform/spi/ios/UIKitSPI.h:
1500         * UIProcess/Cocoa/VersionChecks.h:
1501         * UIProcess/ios/WKContentViewInteraction.h:
1502         * UIProcess/ios/WKContentViewInteraction.mm:
1503         (-[WKContentView setupInteraction]):
1504         (-[WKContentView cleanupInteraction]):
1505         (-[WKContentView _removeDefaultGestureRecognizers]):
1506         (-[WKContentView _addDefaultGestureRecognizers]):
1507         (-[WKContentView gestureRecognizer:shouldReceiveTouch:]):
1508         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
1509         (-[WKContentView _showShareSheet:inRect:completionHandler:]):
1510         (-[WKContentView setupDragAndDropInteractions]):
1511         (-[WKContentView shouldUseMouseGestureRecognizer]):
1512         (-[WKContentView setupMouseGestureRecognizer]):
1513         (-[WKContentView mouseGestureRecognizerChanged:]):
1514         (-[WKContentView setupCursorInteraction]):
1515         (-[WKContentView _cursorInteraction:regionForLocation:defaultRegion:completion:]):
1516         (-[WKContentView cursorRegionForPositionInformation:point:]):
1517         (-[WKContentView cursorInteraction:styleForRegion:modifiers:]):
1518         (-[WKContentView _mouseGestureRecognizerChanged:]): Deleted.
1519         * UIProcess/ios/WKMouseGestureRecognizer.h:
1520         * UIProcess/ios/WKMouseGestureRecognizer.mm:
1521         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
1522         (WebKit::WebChromeClient::shouldUseMouseEventForSelection):
1523
1524 2020-03-19  Per Arne Vollan  <pvollan@apple.com>
1525
1526         [iOS] Add telemetry for message filtering
1527         https://bugs.webkit.org/show_bug.cgi?id=208925
1528         <rdar://problem/58885485>
1529
1530         Reviewed by Darin Adler.
1531
1532         On iOS, add telemetry for message filtering in the WebContent process' sandbox.
1533
1534         No new tests, no behavior change.
1535
1536         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1537
1538 2020-03-19  Charlie Turner  <cturner@igalia.com>
1539
1540         Fix many warnings with Clang 7.0 on GTK x86-64 in Debug.
1541         https://bugs.webkit.org/show_bug.cgi?id=209146
1542
1543         Reviewed by Darin Adler.
1544
1545         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
1546         (WebKit::NetworkHTTPSUpgradeChecker::query):
1547         * NetworkProcess/NetworkLoadChecker.cpp: The m_isHTTPSUpgradeEnabled
1548         ivar is only used on Cocoa platforms, on GTK it is causing warning
1549         spam.
1550         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
1551         * NetworkProcess/NetworkLoadChecker.h:
1552         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1553         (WebKit::CoordinatedGraphicsScene::updateSceneState):
1554         *
1555         Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1556         m_inForceRepaint is not being used anymore.
1557         (WebKit::ThreadedCompositor::forceRepaint):
1558         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
1559         * UIProcess/API/glib/WebKitNavigationClient.cpp:
1560         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
1561         (WebKit::RemoteInspectorProtocolHandler::RemoteInspectorProtocolHandler):
1562         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.h:
1563
1564 2020-03-19  youenn fablet  <youenn@apple.com>
1565
1566         Make URL::path() return a StringView
1567         https://bugs.webkit.org/show_bug.cgi?id=209173
1568
1569         Reviewed by Alex Christensen.
1570
1571         Update code according new path return type.
1572
1573         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1574         (WebKit::NetworkDataTaskSoup::didSendRequest):
1575         * Shared/API/APIURL.h:
1576         (API::URL::path const):
1577         * UIProcess/API/glib/WebKitURISchemeRequest.cpp:
1578         (webkitURISchemeRequestReadCallback):
1579         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1580         (WebKit::WebFrameLoaderClient::objectContentType):
1581         * WebProcess/WebPage/WebPage.cpp:
1582         (WebKit::WebPage::createPlugin):
1583
1584 2020-03-19  Megan Gardner  <megan_gardner@apple.com>
1585
1586         Correctly set up context for Data Detectors
1587         https://bugs.webkit.org/show_bug.cgi?id=209258
1588         <rdar://problem/60612327>
1589
1590         Reviewed by Tim Horton.
1591
1592         Stop passing in a nil context. This is OK now, but won't be in the near future.
1593         Also, call -updateContext:withSourceRect: so that DataDetectors can populate the context appropriately.
1594
1595         * UIProcess/ios/WKActionSheetAssistant.mm:
1596         (-[WKActionSheetAssistant contextMenuInteraction:configurationForMenuAtLocation:]):
1597         * UIProcess/ios/WKContentViewInteraction.mm:
1598         (-[WKContentView dataDetectionContextForPositionInformation:]):
1599
1600 2020-03-18  Simon Fraser  <simon.fraser@apple.com>
1601
1602         eventSender.monitorWheelEvents() is very fragile
1603         https://bugs.webkit.org/show_bug.cgi?id=197819
1604         <rdar://problem/51319456>
1605
1606         Reviewed by Tim Horton.
1607
1608         Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness,
1609         adding back changes from r257844 that were reverted in r258558.
1610         
1611         First, have EventSendingController keep track of whether it's seen then "end" event
1612         for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which
1613         now waits until it sees these, which prevents premature triggering which was a common cause of
1614         failure before.
1615         
1616         Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test
1617         for completion in a callout from the end of Page::updateRendering(), which makes it test
1618         and fire at a more consistent time.
1619         
1620         Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral
1621         can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch()
1622         used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed,
1623         also resulting in a premature trigger.
1624
1625         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1626         (WKBundlePageRegisterScrollOperationCompletionCallback):
1627         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
1628
1629 2020-03-18  Alex Christensen  <achristensen@webkit.org>
1630
1631         Add HTTP3 as an experimental feature
1632         https://bugs.webkit.org/show_bug.cgi?id=209267
1633         <rdar://problem/60245262> and <rdar://problem/60245168>
1634
1635         Reviewed by Brent Fulgham.
1636
1637         Manually verified this sets the CFNetwork SPI as expected.
1638
1639         * NetworkProcess/NetworkSessionCreationParameters.cpp:
1640         (WebKit::NetworkSessionCreationParameters::encode const):
1641         (WebKit::NetworkSessionCreationParameters::decode):
1642         * NetworkProcess/NetworkSessionCreationParameters.h:
1643         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1644         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1645         * Shared/WebPreferences.yaml:
1646         * UIProcess/WebProcessPool.cpp:
1647         (WebKit::WebProcessPool::ensureNetworkProcess):
1648         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1649         (WebKit::WebsiteDataStore::parameters):
1650         (WebKit::WebsiteDataStore::http3Enabled):
1651         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1652         (WebKit::WebsiteDataStore::http3Enabled):
1653         * UIProcess/WebsiteData/WebsiteDataStore.h:
1654
1655 2020-03-18  Saam Barati  <sbarati@apple.com>
1656
1657         SharedMemory::Handle::decode shouldn't check rounded size
1658         https://bugs.webkit.org/show_bug.cgi?id=209263
1659
1660         Reviewed by Sam Weinig.
1661
1662         * Platform/cocoa/SharedMemoryCocoa.cpp:
1663         (WebKit::SharedMemory::Handle::decode):
1664         (WebKit::SharedMemory::map):
1665
1666 2020-03-18  Fujii Hironori  <Hironori.Fujii@sony.com>
1667
1668         WebCoreArgumentCoders should check bufferIsLargeEnoughToContain before allocating buffers
1669         https://bugs.webkit.org/show_bug.cgi?id=209219
1670
1671         Reviewed by Darin Adler.
1672
1673         * Shared/WebCoreArgumentCoders.cpp:
1674         (IPC::decodeSharedBuffer): Added checking of bufferIsLargeEnoughToContain.
1675         (IPC::decodeTypesAndData): Don't allocate a buffer with the
1676         decoded size. bufferIsLargeEnoughToContain can't be used in this
1677         case because SharedBuffer is encoded as variable length data.
1678         Instead, append items one-by-one.
1679
1680 2020-03-18  John Wilander  <wilander@apple.com>
1681
1682         WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener() should call its ephemeral counterpart when appropriate
1683         https://bugs.webkit.org/show_bug.cgi?id=209245
1684         <rdar://problem/60511121>
1685
1686         Reviewed by Chris Dumez.
1687
1688         This change makes sure that WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener()
1689         calls WebResourceLoadStatisticsStore::requestStorageAccessUnderOpenerEphemeral() for ephemeral
1690         sessions.
1691
1692         Tests: http/tests/storageAccess/deny-storage-access-under-opener-ephemeral.html
1693                http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss-ephemeral.html
1694                http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-ephemeral.html
1695
1696         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1697         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
1698
1699 2020-03-18  Brent Fulgham  <bfulgham@apple.com>
1700
1701         Avoid calling 'notifyThisWebProcessPoolWasCreated' inside the constructor
1702         https://bugs.webkit.org/show_bug.cgi?id=209254
1703         <rdar://problem/60564526>
1704
1705         Reviewed by Alex Christensen and Chris Dumez.
1706
1707         Enqueue calls to 'notifyThisWebProcessPoolWasCreated' so they are not invoked until
1708         after the process pool is finished with its constructor.
1709
1710         Behavior covered by existing tests.
1711
1712         * UIProcess/WebProcessPool.cpp:
1713         (WebKit::WebProcessPool::WebProcessPool):
1714
1715 2020-03-18  Ross Kirsling  <ross.kirsling@sony.com>
1716
1717         Unreviewed WinCairo build fix following r258665.
1718
1719         * NetworkProcess/curl/NetworkProcessCurl.cpp:
1720         (WebKit::NetworkProcess::clearCacheForAllOrigins): Deleted.
1721
1722 2020-03-18  Kate Cheney  <katherine_cheney@apple.com>
1723
1724         Pass isNavigatingToAppBoundDomain for speculative loads, preconnect tasks and downloads
1725         https://bugs.webkit.org/show_bug.cgi?id=209246
1726         <rdar://problem/60552712>
1727
1728         Reviewed by Alex Christensen.
1729
1730         Pass isNavigatingToAppBoundDomain in 4 new places:
1731
1732         1) Speculative Loads
1733         2) Preconnect Tasks
1734         3) Downloads
1735         4) CORS preflight checker
1736
1737         These loads should happen in an app-bound session if isNavigatingToAppBoundDomain
1738         is true.
1739
1740         * NetworkProcess/Downloads/DownloadManager.cpp:
1741         (WebKit::DownloadManager::startDownload):
1742         * NetworkProcess/Downloads/DownloadManager.h:
1743         (WebKit::DownloadManager::startDownload):
1744         * NetworkProcess/Downloads/PendingDownload.cpp:
1745         (WebKit::PendingDownload::PendingDownload):
1746         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1747         (WebKit::NetworkConnectionToWebProcess::startDownload):
1748         (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
1749         * NetworkProcess/NetworkConnectionToWebProcess.h:
1750         (WebKit::NetworkConnectionToWebProcess::startDownload):
1751         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1752         * NetworkProcess/NetworkProcess.cpp:
1753         (WebKit::NetworkProcess::preconnectTo):
1754         (WebKit::NetworkProcess::downloadRequest):
1755         * NetworkProcess/NetworkProcess.h:
1756         * NetworkProcess/NetworkProcess.messages.in:
1757         * NetworkProcess/NetworkResourceLoader.cpp:
1758         (WebKit::NetworkResourceLoader::start):
1759         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1760         (WebKit::NetworkResourceLoader::convertToDownload):
1761         * NetworkProcess/PreconnectTask.cpp:
1762         * NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp:
1763         (WebKit::ServiceWorkerSoftUpdateLoader::ServiceWorkerSoftUpdateLoader):
1764         The service worker script should be considered an app-bound load.
1765
1766         * NetworkProcess/cache/AsyncRevalidation.cpp:
1767         (WebKit::NetworkCache::AsyncRevalidation::AsyncRevalidation):
1768         * NetworkProcess/cache/AsyncRevalidation.h:
1769         * NetworkProcess/cache/NetworkCache.cpp:
1770         (WebKit::NetworkCache::Cache::startAsyncRevalidationIfNeeded):
1771         (WebKit::NetworkCache::Cache::retrieve):
1772         * NetworkProcess/cache/NetworkCache.h:
1773         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
1774         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
1775         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
1776         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
1777         (WebKit::NetworkCache::SpeculativeLoadManager::registerLoad):
1778         (WebKit::NetworkCache::SpeculativeLoadManager::preconnectForSubresource):
1779         (WebKit::NetworkCache::SpeculativeLoadManager::revalidateSubresource):
1780         (WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
1781         (WebKit::NetworkCache::SpeculativeLoadManager::startSpeculativeRevalidation):
1782         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
1783         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1784         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1785         (WebKit::NetworkSessionCocoa::sessionWrapperForTask):
1786         * Shared/NavigatingToAppBoundDomain.h:
1787         Separates NavigatingToAppBoundDomain to its own file to allow for
1788         sending over IPC.
1789
1790         * Shared/PolicyDecision.h:
1791         * UIProcess/Network/NetworkProcessProxy.cpp:
1792         (WebKit::NetworkProcessProxy::preconnectTo):
1793         * UIProcess/Network/NetworkProcessProxy.h:
1794         * UIProcess/WebPageProxy.cpp:
1795         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
1796         (WebKit::WebPageProxy::preconnectTo):
1797         * UIProcess/WebPageProxy.h:
1798         (WebKit::WebPageProxy::isNavigatingToAppBoundDomain const):
1799         * UIProcess/WebProcessPool.cpp:
1800         (WebKit::WebProcessPool::download):
1801         * WebKit.xcodeproj/project.pbxproj:
1802         * WebProcess/Network/WebLoaderStrategy.cpp:
1803         (WebKit::WebLoaderStrategy::preconnectTo):
1804         * WebProcess/WebPage/WebFrame.cpp:
1805         (WebKit::WebFrame::startDownload):
1806         (WebKit::WebFrame::convertMainResourceLoadToDownload):
1807
1808 2020-03-18  Sihui Liu  <sihui_liu@apple.com>
1809
1810         Remove unused IPC message NetworkProcess::ClearCacheForAllOrigins
1811         https://bugs.webkit.org/show_bug.cgi?id=209152
1812         <rdar://problem/59681717>
1813
1814         Reviewed by Chris Dumez.
1815
1816         * NetworkProcess/NetworkProcess.h:
1817         * NetworkProcess/NetworkProcess.messages.in:
1818         * NetworkProcess/ios/NetworkProcessIOS.mm:
1819         (WebKit::NetworkProcess::clearCacheForAllOrigins): Deleted.
1820         * NetworkProcess/mac/NetworkProcessMac.mm:
1821         (WebKit::NetworkProcess::clearCacheForAllOrigins): Deleted.
1822         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1823         (WebKit::NetworkProcess::clearCacheForAllOrigins): Deleted.
1824         * Shared/ResourceCachesToClear.h: Removed.
1825         * UIProcess/API/C/WKAPICast.h:
1826         (WebKit::toResourceCachesToClear): Deleted.
1827         * WebKit.xcodeproj/project.pbxproj:
1828         * WebProcess/WebProcess.cpp:
1829         (WebKit::WebProcess::clearResourceCaches): Deleted.
1830         * WebProcess/WebProcess.h:
1831
1832 2020-03-18  youenn fablet  <youenn@apple.com>
1833
1834         WebPage should own a Ref<WebFrame>
1835         https://bugs.webkit.org/show_bug.cgi?id=209235
1836
1837         Reviewed by Geoffrey Garen.
1838
1839         Update code since m_mainFrame is now a Ref and no longer a RefPtr.
1840
1841         Update WebPage constructor to set its m_mainFrame very early.
1842         We update WebPage::didCompletePageTransition to compute whether this is initialization or not using the frame state machine state
1843         instead of m_mainFrame being null.
1844
1845         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1846         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
1847         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
1848         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
1849         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
1850         (WebKit::WebAutomationSessionProxy::resolveParentFrame):
1851         (WebKit::WebAutomationSessionProxy::focusFrame):
1852         (WebKit::WebAutomationSessionProxy::computeElementLayout):
1853         (WebKit::WebAutomationSessionProxy::selectOptionElement):
1854         (WebKit::WebAutomationSessionProxy::setFilesForInputFileUpload):
1855         (WebKit::WebAutomationSessionProxy::takeScreenshot):
1856         (WebKit::WebAutomationSessionProxy::snapshotRectForScreenshot):
1857         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
1858         (WebKit::WebAutomationSessionProxy::deleteCookie):
1859         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1860         (WKBundlePageGetMainFrame):
1861         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1862         (WebKit::findLargestFrameInFrameSet):
1863         (WebKit::WebChromeClient::closeWindowSoon):
1864         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1865         (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
1866         (WebKit::WebFrameLoaderClient::dispatchDidLayout):
1867         (WebKit::WebFrameLoaderClient::restoreViewState):
1868         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
1869         (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
1870         (WebKit::ViewGestureGeometryCollector::collectGeometryForMagnificationGesture):
1871         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
1872         (WebKit::WebBackForwardListProxy::goToItem):
1873         * WebProcess/WebPage/WebPage.cpp:
1874         (WebKit::WebPage::WebPage):
1875         (WebKit::m_processDisplayName):
1876         (WebKit::WebPage::close):
1877         (WebKit::WebPage::suspendForProcessSwap):
1878         (WebKit::WebPage::loadDataInFrame):
1879         (WebKit::WebPage::loadRequest):
1880         (WebKit::WebPage::reload):
1881         (WebKit::WebPage::didCompletePageTransition):
1882         (WebKit::WebPage::runJavaScriptInFrameInScriptWorld):
1883         (WebKit::WebPage::setIsSuspended):
1884         (WebKit::WebPage::didLoadFromRegistrableDomain):
1885         * WebProcess/WebPage/WebPage.h:
1886         (WebKit::WebPage::mainWebFrame const):
1887         * WebProcess/WebPage/ios/WebPageIOS.mm:
1888         (WebKit::WebPage::cancelPotentialTap):
1889         * WebProcess/cocoa/WebProcessCocoa.mm:
1890         (WebKit::origin):
1891
1892 2020-03-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1893
1894         REGRESSION (r257214): Targeted preview animates to the wrong place when dropping in editable content
1895         https://bugs.webkit.org/show_bug.cgi?id=209218
1896         <rdar://problem/60560831>
1897
1898         Reviewed by Tim Horton.
1899
1900         In r257214, we split out the context menu hint preview container view into two views: one for drag and drop, and
1901         another for the context menu hint. The container view used for both drag and drop previews was removed under
1902         -cleanUpDragSourceSessionState, which is invoked after both drag and drop sessions have ended; however, in the
1903         case of a drop in editable content where the drop preview is delayed, the drop animation can end up finishing
1904         after -cleanUpDragSourceSessionState is invoked. This means we end up prematurely unparenting the preview
1905         container, which results in a broken drop animation.
1906
1907         To fix this, split the drag and drop container views further, into separate container views for dragging and for
1908         dropping. The drag preview container will continue to be removed under -cleanUpDragSourceSessionState, and the
1909         drop preview container will now be removed under the delegate call to -dropInteraction:concludeDrop:, which is
1910         invoked by UIKit after all drop previews are finished animating.
1911
1912         Covered by adding additional test assertions while running existing API tests (see Tools/ChangeLog for more
1913         details).
1914
1915         * UIProcess/ios/WKContentViewInteraction.h:
1916         * UIProcess/ios/WKContentViewInteraction.mm:
1917         (-[WKContentView _createPreviewContainerWithLayerName:]):
1918
1919         Pull out common logic for creating and setting up a preview container view into a helper method. This is used by
1920         the three methods below, which ensure container views for each of the types of previews we create when showing
1921         the context menu, dragging an element, and dropping.
1922
1923         (-[WKContentView containerForDropPreviews]):
1924         (-[WKContentView containerForDragPreviews]):
1925         (-[WKContentView containerForContextMenuHintPreviews]):
1926
1927         Add a third preview container view for drop previews, and factor duplicated code in these three methods into a
1928         common helper (see above).
1929
1930         (-[WKContentView _hideTargetedPreviewContainerViews]):
1931         (-[WKContentView _deliverDelayedDropPreviewIfPossible:]):
1932
1933         Instead of using the container for drag previews, use the container for drop previews.
1934
1935         (-[WKContentView dropInteraction:concludeDrop:]):
1936
1937         Remove the drop preview container after the drop has concluded (i.e. all animations are complete).
1938
1939 2020-03-18  Chris Dumez  <cdumez@apple.com>
1940
1941         Unreviewed, fix iOS build with recent SDKs.
1942
1943         * Platform/cocoa/PaymentAuthorizationViewController.mm:
1944
1945 2020-03-18  Megan Gardner  <megan_gardner@apple.com>
1946
1947         Remove unneeded and incorrect respondsToSelector checks.
1948         https://bugs.webkit.org/show_bug.cgi?id=209208
1949         <rdar://problem/60512470>
1950
1951         Reviewed by Tim Horton.
1952
1953         No behaviour change, no tests needed.
1954
1955         * UIProcess/ios/WKContentViewInteraction.mm:
1956         (-[WKContentView continueContextMenuInteractionWithDataDetectors:]):
1957
1958 2020-03-18  Brent Fulgham  <bfulgham@apple.com>
1959
1960         Switch from debug ASSERT to RELEASE_ASSERT in toNPObjectProxy
1961         https://bugs.webkit.org/show_bug.cgi?id=209212
1962         <rdar://problem/59595502>
1963
1964         Reviewed by Alex Christensen.
1965
1966         * Shared/Plugins/NPObjectProxy.h:
1967         (WebKit::NPObjectProxy::toNPObjectProxy):
1968
1969 2020-03-18  Brent Fulgham  <bfulgham@apple.com>
1970
1971         Switch to release asserts for MediaDeviceSandboxExtension class
1972         https://bugs.webkit.org/show_bug.cgi?id=209211
1973         <rdar://problem/59595299>
1974
1975         Reviewed by Eric Carlson.
1976
1977         Switch from debug ASSERT to RELEASE_ASSERT.
1978
1979         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp:
1980         (WebKit::MediaDeviceSandboxExtensions::MediaDeviceSandboxExtensions):
1981         (WebKit::MediaDeviceSandboxExtensions::operator[]):
1982
1983 2020-03-18  Brent Fulgham  <bfulgham@apple.com>
1984
1985         Switch from debug ASSERT to RELEASE_ASSERT in PluginQuirks.h
1986         https://bugs.webkit.org/show_bug.cgi?id=209213
1987         <rdar://problem/59595834>
1988
1989         Reviewed by Alex Christensen.
1990
1991         * Shared/Plugins/PluginQuirks.h:
1992         (WebKit::PluginQuirks::add):
1993
1994 2020-03-18  youenn fablet  <youenn@apple.com>
1995
1996         REGRESSION (r257472): Can't start old Safari with new WebKit (dyld: Symbol not found: _WKContextConfigurationSetShouldCaptureAudioInUIProcess)
1997         https://bugs.webkit.org/show_bug.cgi?id=209155
1998
1999         Reviewed by Eric Carlson.
2000
2001         Add a no-op WKContextConfigurationSetShouldCaptureAudioInUIProcess to allow latest WebKit being run on older Safari.
2002
2003         * UIProcess/API/C/WKContextConfigurationRef.cpp:
2004         (WKContextConfigurationSetShouldCaptureAudioInUIProcess):
2005         * UIProcess/API/C/WKContextConfigurationRef.h:
2006
2007 2020-03-18  youenn fablet  <youenn@apple.com>
2008
2009         FrameLoader should own its FrameLoaderClient
2010         https://bugs.webkit.org/show_bug.cgi?id=208918
2011
2012         Reviewed by Geoff Garen.
2013
2014         Pass a UniqueRef to the PageConfiguration.
2015         Update WebFrameLoaderClient according updated FrameLoaderClient interface.
2016
2017         WebFrame no longer needs to ref/unref itself to keep the loader client alive.
2018         Update WebFrame construction to not need a static_cast at initialization of the main frame.
2019
2020         The ownership is now that a WebCore::FrameLoader owns a FrameLoaderClient who owns a WebFrame.
2021
2022         * WebProcess/Network/WebLoaderStrategy.cpp:
2023         (WebKit::WebLoaderStrategy::tryLoadingUsingURLSchemeHandler):
2024         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2025         (WebKit::WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler):
2026         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
2027         (WebKit::WebLoaderStrategy::startPingLoad):
2028         (WebKit::WebLoaderStrategy::preconnectTo):
2029         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2030         (WebKit::WebSWContextManagerConnection::installServiceWorker):
2031         * WebProcess/Storage/WebSWContextManagerConnection.h:
2032         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2033         (WebKit::WebFrameLoaderClient::WebFrameLoaderClient):
2034         (WebKit::WebFrameLoaderClient::~WebFrameLoaderClient):
2035         (WebKit::WebFrameLoaderClient::webPageProxyID const):
2036         (WebKit::WebFrameLoaderClient::pageID const):
2037         (WebKit::WebFrameLoaderClient::frameID const):
2038         (WebKit::WebFrameLoaderClient::detachedFromParent2):
2039         (WebKit::WebFrameLoaderClient::assignIdentifierToInitialRequest):
2040         (WebKit::WebFrameLoaderClient::dispatchWillSendRequest):
2041         (WebKit::WebFrameLoaderClient::shouldUseCredentialStorage):
2042         (WebKit::WebFrameLoaderClient::dispatchDidReceiveResponse):
2043         (WebKit::WebFrameLoaderClient::dispatchDidReceiveContentLength):
2044         (WebKit::WebFrameLoaderClient::dispatchDidFinishLoading):
2045         (WebKit::WebFrameLoaderClient::dispatchDidFailLoading):
2046         (WebKit::WebFrameLoaderClient::dispatchDidDispatchOnloadEvents):
2047         (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
2048         (WebKit::WebFrameLoaderClient::dispatchDidCancelClientRedirect):
2049         (WebKit::WebFrameLoaderClient::dispatchWillPerformClientRedirect):
2050         (WebKit::WebFrameLoaderClient::dispatchDidChangeLocationWithinPage):
2051         (WebKit::WebFrameLoaderClient::dispatchDidPushStateWithinPage):
2052         (WebKit::WebFrameLoaderClient::dispatchDidReplaceStateWithinPage):
2053         (WebKit::WebFrameLoaderClient::dispatchDidPopStateWithinPage):
2054         (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad):
2055         (WebKit::WebFrameLoaderClient::dispatchDidReceiveTitle):
2056         (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
2057         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
2058         (WebKit::WebFrameLoaderClient::dispatchDidFailLoad):
2059         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad):
2060         (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad):
2061         (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
2062         (WebKit::WebFrameLoaderClient::dispatchDidLayout):
2063         (WebKit::WebFrameLoaderClient::dispatchShow):
2064         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2065         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
2066         (WebKit::WebFrameLoaderClient::applyToDocumentLoader):
2067         (WebKit::WebFrameLoaderClient::allowsContentJavaScriptFromMostRecentNavigation const):
2068         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2069         (WebKit::WebFrameLoaderClient::dispatchUnableToImplementPolicy):
2070         (WebKit::WebFrameLoaderClient::dispatchWillSendSubmitEvent):
2071         (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
2072         (WebKit::WebFrameLoaderClient::willReplaceMultipartContent):
2073         (WebKit::WebFrameLoaderClient::didReplaceMultipartContent):
2074         (WebKit::WebFrameLoaderClient::didDisplayInsecureContent):
2075         (WebKit::WebFrameLoaderClient::didRunInsecureContent):
2076         (WebKit::WebFrameLoaderClient::didDetectXSS):
2077         (WebKit::WebFrameLoaderClient::cancelledError const):
2078         (WebKit::WebFrameLoaderClient::blockedError const):
2079         (WebKit::WebFrameLoaderClient::blockedByContentBlockerError const):
2080         (WebKit::WebFrameLoaderClient::cannotShowURLError const):
2081         (WebKit::WebFrameLoaderClient::interruptedForPolicyChangeError const):
2082         (WebKit::WebFrameLoaderClient::blockedByContentFilterError const):
2083         (WebKit::WebFrameLoaderClient::cannotShowMIMETypeError const):
2084         (WebKit::WebFrameLoaderClient::fileDoesNotExistError const):
2085         (WebKit::WebFrameLoaderClient::pluginWillHandleLoadError const):
2086         (WebKit::WebFrameLoaderClient::shouldFallBack const):
2087         (WebKit::WebFrameLoaderClient::restoreViewState):
2088         (WebKit::WebFrameLoaderClient::didFinishLoad):
2089         (WebKit::WebFrameLoaderClient::userAgent const):
2090         (WebKit::WebFrameLoaderClient::createPlugin):
2091         (WebKit::WebFrameLoaderClient::webGLPolicyForURL const):
2092         (WebKit::WebFrameLoaderClient::resolveWebGLPolicyForURL const):
2093         (WebKit::WebFrameLoaderClient::objectContentType):
2094         (WebKit::WebFrameLoaderClient::overrideMediaType const):
2095         (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld):
2096         (WebKit::WebFrameLoaderClient::dispatchGlobalObjectAvailable):
2097         (WebKit::WebFrameLoaderClient::willInjectUserScript):
2098         (WebKit::WebFrameLoaderClient::willCacheResponse const):
2099         (WebKit::WebFrameLoaderClient::createNetworkingContext):
2100         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2101         * WebProcess/WebPage/WebFrame.cpp:
2102         (WebKit::WebFrame::initWithCoreMainFrame):
2103         (WebKit::WebFrame::createSubframe):
2104         (WebKit::WebFrame::WebFrame):
2105         (WebKit::WebFrame::frameLoaderClient const):
2106         (WebKit::WebFrame::fromCoreFrame):
2107         (WebKit::WebFrame::didReceivePolicyDecision):
2108         * WebProcess/WebPage/WebFrame.h:
2109         (WebKit::WebFrame::create):
2110         * WebProcess/WebPage/WebPage.cpp:
2111         (WebKit::m_processDisplayName):
2112
2113 2020-03-17  David Kilzer  <ddkilzer@apple.com>
2114
2115         SharedMemory::Handle::m_size should be more consistent
2116         <https://webkit.org/b/209007>
2117         <rdar://problem/60340890>
2118
2119         Reviewed by Darin Adler.
2120
2121         * Platform/cocoa/SharedMemoryCocoa.cpp:
2122         (WebKit::SharedMemory::Handle::decode):
2123         - Return early if an invalid `size` is decoded.
2124         (WebKit::SharedMemory::map):
2125         - Drive-by fix to change '0' to 'nullptr'.
2126         - Since all known methods of creating a SharedMemory::Handle()
2127           set SharedMemory::Handle::m_size to a value of round_page(),
2128           this means we can also change `round_page(handle.m_size)` to
2129           `handle.m_size` in the call to mach_vm_map() since we know
2130           they're equal.
2131
2132 2020-03-17  Commit Queue  <commit-queue@webkit.org>
2133
2134         Unreviewed, reverting r258496.
2135         https://bugs.webkit.org/show_bug.cgi?id=209217
2136
2137         Introduced sandbox regression (Requested by perarne on
2138         #webkit).
2139
2140         Reverted changeset:
2141
2142         "[iOS] Add telemetry for message filtering"
2143         https://bugs.webkit.org/show_bug.cgi?id=208925
2144         https://trac.webkit.org/changeset/258496
2145
2146 2020-03-17  Kate Cheney  <katherine_cheney@apple.com>
2147
2148         Expand In-App-Browser-Privacy testing
2149         https://bugs.webkit.org/show_bug.cgi?id=209142
2150         <rdar://problem/60496618>
2151
2152         Reviewed by Darin Adler.
2153
2154         Adds a testing API to check whether a navigation was classified as
2155         app-bound.
2156
2157         * UIProcess/API/Cocoa/WKWebView.mm:
2158         (-[WKWebView _isNavigatingToAppBoundDomain:]):
2159         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2160         * UIProcess/WebPageProxy.cpp:
2161         (WebKit::WebPageProxy::isNavigatingToAppBoundDomainTesting):
2162         * UIProcess/WebPageProxy.h:
2163
2164 2020-03-17  Alex Christensen  <achristensen@webkit.org>
2165
2166         Fix API tests after r258574
2167         https://bugs.webkit.org/show_bug.cgi?id=209192
2168
2169         * UIProcess/WebPageProxy.cpp:
2170         (WebKit::WebPageProxy::printFrame):
2171         I forgot to call the CompletionHandler from the IPC call.
2172
2173 2020-03-17  Jiewen Tan  <jiewen_tan@apple.com>
2174
2175         WebKit::LocalAuthenticator::deleteDuplicateCredential() should check buffer size before memcmp
2176         https://bugs.webkit.org/show_bug.cgi?id=209156
2177         <rdar://problem/60444655>
2178
2179         Reviewed by Alex Christensen.
2180
2181         Covered by existing tests.
2182
2183         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
2184         (WebKit::LocalAuthenticator::deleteDuplicateCredential const):
2185
2186 2020-03-17  Kate Cheney  <katherine_cheney@apple.com>
2187
2188        Add internal debugging when initializing an app-bound session
2189        https://bugs.webkit.org/show_bug.cgi?id=209190
2190        <rdar://problem/60371620>
2191
2192         Reviewed by Brent Fulgham.
2193
2194         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2195         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2196         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
2197         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2198         (WebKit::SessionWrapper::initialize):
2199         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2200         (WebKit::NetworkSessionCocoa::initializeEphemeralStatelessSession):
2201         (WebKit::NetworkSessionCocoa::sessionWrapperForTask):
2202         (WebKit::NetworkSessionCocoa::appBoundSession):
2203         (WebKit::NetworkSessionCocoa::isolatedSession):
2204
2205 2020-03-17  John Wilander  <wilander@apple.com>
2206
2207         Add quirk for cookie blocking latch mode ymail.com redirecting to yahoo.com under yahoo.com
2208         https://bugs.webkit.org/show_bug.cgi?id=209193
2209         <rdar://problem/60089022>
2210
2211         Reviewed by Brent Fulgham.
2212
2213         No new tests. Site-specific quirk tested manually on the site in question.
2214
2215         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2216         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2217         (WebKit::NetworkDataTaskCocoa::unblockCookies):
2218         (WebKit::NetworkDataTaskCocoa::needsFirstPartyCookieBlockingLatchModeQuirk const):
2219         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
2220
2221 2020-03-17  Brian Burg  <bburg@apple.com>
2222
2223         REGRESSION(r256882): WebDriver commands that run before initial navigation do not complete
2224         https://bugs.webkit.org/show_bug.cgi?id=209185
2225         <rdar://problem/60010248>
2226
2227         Reviewed by Brian Weinstein.
2228
2229         No new tests, covered by w3c/webdriver/tests/back/back.py.
2230
2231         * UIProcess/Automation/WebAutomationSession.cpp:
2232         (WebKit::WebAutomationSession::createBrowsingContext):
2233         Force eager creation of WebProcess when a browsing context is created. This allows
2234         all subsequent commands that use WebProcess IPC to proceed instead of hanging.
2235
2236 2020-03-17  Alex Christensen  <achristensen@webkit.org>
2237
2238         Fix GTK build.
2239         https://bugs.webkit.org/show_bug.cgi?id=209192
2240
2241         * UIProcess/API/glib/WebKitUIClient.cpp:
2242         I committed r258574 too fast.
2243
2244 2020-03-17  Alex Christensen  <achristensen@webkit.org>
2245
2246         Add WKUIDelegatePrivate SPI _webView:printFrame:completionHandler:
2247         https://bugs.webkit.org/show_bug.cgi?id=209192
2248         <rdar://problem/51313336>
2249
2250         Reviewed by Geoff Garen.
2251
2252         This is just like the existing _webView:printFrame: but you tell it when you're done instead of just returning.
2253         Covered by API tests.
2254
2255         * UIProcess/API/APIUIClient.h:
2256         (API::UIClient::printFrame):
2257         * UIProcess/API/C/WKPage.cpp:
2258         (WKPageSetPageUIClient):
2259         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2260         * UIProcess/Cocoa/UIDelegate.h:
2261         * UIProcess/Cocoa/UIDelegate.mm:
2262         (WebKit::UIDelegate::setDelegate):
2263         (WebKit::UIDelegate::UIClient::printFrame):
2264         * UIProcess/WebPageProxy.cpp:
2265         (WebKit::WebPageProxy::printFrame):
2266
2267 2020-03-17  David Kilzer  <ddkilzer@apple.com>
2268
2269         REGRESSION (r258334): WebPasteboardProxy::setPasteboardBufferForType should allow zero-size buffers
2270         <https://webkit.org/b/209167>
2271         <rdar://problem/60516302>
2272
2273         Reviewed by Geoffrey Garen.
2274
2275         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
2276         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
2277         - Remove check for zero-size buffer to match
2278           WebPageProxy::dataSelectionForPasteboard().
2279
2280 2020-03-17  Brent Fulgham  <bfulgham@apple.com>
2281
2282         Terminate the WebContent process when receiving invalid IPC from a WebInspector session
2283         https://bugs.webkit.org/show_bug.cgi?id=209157
2284         <rdar://problem/58961055>
2285
2286         Reviewed by Chris Dumez.
2287
2288         * UIProcess/WebPageProxy.cpp:
2289         (WebKit::WebPageProxy::backForwardGoToItemShared): Add a message check that we are not receiving
2290         the request from a WebInspector page.
2291         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle): Switch to a release assert.
2292
2293 2020-03-17  Per Arne Vollan  <pvollan@apple.com>
2294
2295         [Cocoa] Disable CF prefs direct mode
2296         https://bugs.webkit.org/show_bug.cgi?id=209166
2297         <rdar://problem/60517387>
2298
2299         Reviewed by Brent Fulgham.
2300
2301         Revert <https://trac.webkit.org/changeset/258064> by disabling the CF prefs direct mode feature,
2302         since it caused performance regressions.
2303
2304         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2305         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
2306         (WebKit::XPCServiceMain):
2307         * UIProcess/Cocoa/PreferenceObserver.mm:
2308         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2309         (WebKit::WebPageProxy::grantAccessToPreferenceService):
2310         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2311         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2312         * UIProcess/WebProcessPool.h:
2313         * UIProcess/WebProcessProxy.h:
2314         * WebProcess/WebProcess.h:
2315         * WebProcess/WebProcess.messages.in:
2316
2317 2020-03-17  Commit Queue  <commit-queue@webkit.org>
2318
2319         Unreviewed, reverting r258339.
2320         https://bugs.webkit.org/show_bug.cgi?id=209179
2321
2322         "Is it sometimes breaking rendering" (Requested by youenn on
2323         #webkit).
2324
2325         Reverted changeset:
2326
2327         "FrameLoader should own its FrameLoaderClient"
2328         https://bugs.webkit.org/show_bug.cgi?id=208918
2329         https://trac.webkit.org/changeset/258339
2330
2331 2020-03-16  Simon Fraser  <simon.fraser@apple.com>
2332
2333         Add a bit more UIHitTesting logging, and make it possible to dump EventRegions from WebKit
2334         https://bugs.webkit.org/show_bug.cgi?id=209058
2335
2336         Reviewed by Antti Koivisto.
2337
2338         Add a UIHitTesting log.
2339
2340         * UIProcess/ios/WKContentViewInteraction.mm:
2341         (-[WKContentView gestureRecognizer:shouldReceiveTouch:]):
2342
2343 2020-03-16  Chris Dumez  <cdumez@apple.com>
2344
2345         Crash under WebCookieCache::clearForHost()
2346         https://bugs.webkit.org/show_bug.cgi?id=209149
2347         <rdar://problem/60453086>
2348
2349         Reviewed by Darin Adler.
2350
2351         Alternative fix for Bug 209149 based on comments from Darin.
2352
2353         * WebProcess/WebPage/WebCookieCache.cpp:
2354         (WebKit::WebCookieCache::clearForHost):
2355         (WebKit::WebCookieCache::pruneCacheIfNecessary):
2356
2357 2020-03-16  Tim Horton  <timothy_horton@apple.com>
2358
2359         Fix the macCatalyst build after r258525
2360
2361         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
2362         (WebKit::TextCheckingControllerProxy::annotatedSubstringBetweenPositions):
2363
2364 2020-03-15  Darin Adler  <darin@apple.com>
2365
2366         Move most of TextIterator off of live ranges
2367         https://bugs.webkit.org/show_bug.cgi?id=209129
2368
2369         Reviewed by Antti Koivisto.
2370
2371         * WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm:
2372         (-[WKDOMTextIterator initWithRange:]): Leave _textIterator as a nullptr
2373         if the passed-in range is nil since we no longer offer a way to create
2374         an empty TextIterator; other clients don't seem to need one.
2375         (-[WKDOMTextIterator advance]): Add a null check.
2376         (-[WKDOMTextIterator atEnd]): Ditto.
2377         (-[WKDOMTextIterator currentRange]): Ditto.
2378         (-[WKDOMTextIterator currentTextPointer]): Ditto.
2379         (-[WKDOMTextIterator currentTextLength]): Ditto.
2380
2381         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm: Removed include.
2382
2383         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
2384         (WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales): Pass
2385         a reference to a range known not to be null.
2386
2387         * WebProcess/WebPage/WebPage.cpp: Removed an include.
2388
2389         * WebProcess/WebPage/ios/WebPageIOS.mm: Removed a "using naemsapce WebCore".
2390         Added two local functions
2391         (WebKit::plainTextForContext): Added. Helper for just this file where calling
2392         plainTextReplacingNoBreakSpace on a possibly null Range is common.
2393         (WebKit::plainTextForDisplay): Ditto. This one passes true for isDisplayString.
2394         Not entirely clear how carefully we chose which of the two to call, or if there
2395         is sufficient test coverage.
2396         (WebKit::WebPage::platformEditorState const): Use plainTextForContext
2397         and plainTextForDisplay.
2398         (WebKit::WebPage::getSelectionContext): Ditto.
2399         (WebKit::WebPage::getRectsAtSelectionOffsetWithText): Use plainTextForDisplay.
2400         (WebKit::WebPage::requestDictationContext): Use plainTextForContext.
2401         (WebKit::WebPage::replaceSelectedText): Ditto.
2402         (WebKit::WebPage::replaceDictatedText): Ditto.
2403         (WebKit::WebPage::requestAutocorrectionData): Ditto.
2404         (WebKit::WebPage::applyAutocorrectionInternal): Ditto.
2405         (WebKit::WebPage::autocorrectionContext): Ditto.
2406         (WebKit::dataDetectorLinkPositionInformation): Use plainTextForDisplay.
2407         (WebKit::WebPage::requestDocumentEditingContext): Use RetainPtr instead of
2408         autorelease. Use makeBoundaryPoint to convert Position objects to SimpleRange.
2409
2410 2020-03-16  Chris Dumez  <cdumez@apple.com>
2411
2412         Crash under WebCookieCache::clearForHost()
2413         https://bugs.webkit.org/show_bug.cgi?id=209149
2414         <rdar://problem/60453086>
2415
2416         Reviewed by Alex Christensen.
2417
2418         Make sure WebCookieCache::pruneCacheIfNecessary() keeps alive the host String it is passing
2419         to WebCookieCache::clearForHost(). Previously, it was merely deferencing a HashSet iterator
2420         and passing that to clearForHost(). However, clearForHost() would then drop the String from
2421         the HashSet and the host would no longer be valid.
2422
2423         Change covered by new API test.
2424
2425         * WebProcess/WebPage/WebCookieCache.cpp:
2426         (WebKit::WebCookieCache::pruneCacheIfNecessary):
2427
2428 2020-03-16  Per Arne Vollan  <pvollan@apple.com>
2429
2430         [macOS] Accessibility sandbox regressions
2431         https://bugs.webkit.org/show_bug.cgi?id=209065
2432         <rdar://problem/60202450>
2433
2434         Reviewed by Brent Fulgham.
2435
2436         When Accessibility is enabled, the WebContent process needs access to the preference service, since Accessibility
2437         is relying on some advanced features of the service. Also, when CF prefs direct mode is enabled, the WebContent
2438         sandbox needs to explicitly allow reading of the various plist files.
2439
2440         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2441         (WebKit::WebProcessPool::registerNotificationObservers):
2442         * WebProcess/com.apple.WebProcess.sb.in:
2443
2444 2020-03-16  Per Arne Vollan  <pvollan@apple.com>
2445
2446         [Cocoa] Crash under -[WKPreferenceObserver init]
2447         https://bugs.webkit.org/show_bug.cgi?id=209145
2448
2449         Reviewed by Darin Adler.
2450
2451         Handle the case when calling [NSUserDefaults initWithSuiteName:] did not succeed.
2452
2453         No new tests, since I have not been able to reproduce.
2454
2455         * UIProcess/Cocoa/PreferenceObserver.mm:
2456         (-[WKPreferenceObserver init]):
2457
2458 2020-03-16  Brent Fulgham  <bfulgham@apple.com>
2459
2460         Remove unused IPC messages from DrawingAreaProxy
2461         https://bugs.webkit.org/show_bug.cgi?id=209090
2462         <rdar://problem/60333300>
2463
2464         Reviewed by Wenson Hsieh.
2465
2466         Do not compile the following three unused messages in DrawingAreaProxy when
2467         building for a Cocoa platform target.
2468
2469         DrawingAreaProxy::Update
2470         DrawingAreaProxy::DidUpdateBackingStoreState
2471         DrawingAreaProxy::ExitAcceleratedCompositingMode
2472
2473         * UIProcess/DrawingAreaProxy.h:
2474         (WebKit::DrawingAreaProxy::enterAcceleratedCompositingMode):
2475         (WebKit::DrawingAreaProxy::update):
2476         (WebKit::DrawingAreaProxy::didUpdateBackingStoreState):
2477         (WebKit::DrawingAreaProxy::exitAcceleratedCompositingMode):
2478         * UIProcess/DrawingAreaProxy.messages.in:
2479         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
2480         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
2481         (WebKit::TiledCoreAnimationDrawingAreaProxy::exitAcceleratedCompositingMode): Deleted.
2482
2483 2020-03-16  Per Arne Vollan  <pvollan@apple.com>
2484
2485         [Cocoa] Only set CF prefs direct mode for the WebContent process
2486         https://bugs.webkit.org/show_bug.cgi?id=209091
2487         <rdar://problem/60337842>
2488
2489         Reviewed by Brent Fulgham.
2490
2491         Currently, we enable CF prefs direct mode in XPCServiceMain. This is incorrect, it should only be enabled
2492         for the WebContent process.
2493
2494         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
2495         (WebKit::XPCServiceMain):
2496
2497 2020-03-16  David Kilzer  <ddkilzer@apple.com>
2498
2499         WebPage::GetDataSelectionForPasteboard should validate its `size` variable
2500         <https://webkit.org/b/209092>
2501         <rdar://problem/60181345>
2502
2503         Reviewed by Brent Fulgham.
2504
2505         * Platform/IPC/Connection.h:
2506         (MESSAGE_CHECK_WITH_RETURN_VALUE_BASE): Add.
2507         - Variant of MESSAGE_CHECK_BASE() that takes a return value.
2508         * UIProcess/mac/WebPageProxyMac.mm:
2509         (MESSAGE_CHECK_WITH_RETURN_VALUE): Add.
2510         (WebKit::WebPageProxy::dataSelectionForPasteboard):
2511         - Use new MESSAGE_CHECK_WITH_RETURN_VALUE() macro to update
2512           check for handle.isNull() and to add check for `size`
2513           variable.
2514         - Add static_cast<size_t>() to `size` variable to denote type
2515           change.
2516
2517 2020-03-16  Youenn Fablet  <youenn@apple.com>
2518
2519         Apply rotation at source level if WebRTC sink ask so
2520         https://bugs.webkit.org/show_bug.cgi?id=205645
2521
2522         Reviewed by Eric Carlson.
2523
2524         Implement RealtimeMediaSource setShouldApplyRotation by sending IPC to capture process.
2525         In capture process, if rotation should be applied, use an ImageRotationSessionVT session to apply it before sending the video frame.
2526         This allows WebProcess to no longer need an ImageRotationSessionVT for WebRTC.
2527
2528         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2529         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::setShouldApplyRotation):
2530         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::rotatePixelBuffer):
2531         (WebKit::UserMediaCaptureManagerProxy::setShouldApplyRotation):
2532         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
2533         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
2534         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2535         (WebKit::UserMediaCaptureManager::Source::setShouldApplyRotation):
2536
2537         * WebProcess/WebPage/mac/WebPageMac.mm: Removed an include.
2538
2539 2020-03-13  Sergio Villar Senin  <svillar@igalia.com>
2540
2541         [WebXR] IDLs, stubs and build configuration for WPE
2542         https://bugs.webkit.org/show_bug.cgi?id=208702
2543
2544         Reviewed by Dean Jackson.
2545
2546         Added WebXR to the list of experimental features.
2547
2548         * Configurations/FeatureDefines.xcconfig: Added ENABLE_WEBXR off by default.
2549         * Shared/WebPreferences.yaml: Added WebXR feature.
2550         * Shared/WebPreferencesDefaultValues.cpp:
2551         (WebKit::defaultWebXREnabled): Set WebXR to off by default unless HAVE_SYSTEM_FEATURE_FLAGS.
2552         * Shared/WebPreferencesDefaultValues.h:
2553         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2554         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2555
2556 2020-03-16  Per Arne Vollan  <pvollan@apple.com>
2557
2558         [iOS] Add telemetry for message filtering
2559         https://bugs.webkit.org/show_bug.cgi?id=208925
2560         <rdar://problem/58885485>
2561
2562         Reviewed by Darin Adler.
2563
2564         On iOS, add telemetry for message filtering in the WebContent process' sandbox.
2565
2566         No new tests, no behavior change.
2567
2568         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2569
2570 2020-03-16  Per Arne Vollan  <pvollan@apple.com>
2571
2572         [Cocoa] Limit set of classes that can be decoded when a preference has changed
2573         https://bugs.webkit.org/show_bug.cgi?id=208012
2574
2575         Reviewed by Brent Fulgham.
2576
2577         As a hardening measure, limit the set of ObjectiveC classes that can be decoded in the WebContent process
2578         as a result of a preference change.
2579
2580         API tests: WebKit.PreferenceChangesDictionary
2581                    WebKit.PreferenceChangesData
2582                    WebKit.PreferenceChangesDate
2583
2584         * WebProcess/cocoa/WebProcessCocoa.mm:
2585         (WebKit::WebProcess::notifyPreferencesChanged):
2586
2587 2020-03-16  youenn fablet  <youenn@apple.com>
2588
2589         Unique origins should not be Potentially Trustworthy
2590         https://bugs.webkit.org/show_bug.cgi?id=209049
2591
2592         Reviewed by Darin Adler.
2593
2594         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2595         (WebKit::WebFrameLoaderClient::hasNavigatedAwayFromAppBoundDomain):
2596         We should only check this for the main frame since this is tied to the page.
2597
2598 2020-03-16  Rob Buis  <rbuis@igalia.com>
2599
2600         Simplify ChromeClient.createWindow
2601         https://bugs.webkit.org/show_bug.cgi?id=209123
2602
2603         Reviewed by Darin Adler.
2604
2605         Adapt to API change.
2606
2607         * WebProcess/Inspector/WebInspector.cpp:
2608         (WebKit::WebInspector::openInNewTab):
2609         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2610         (WebKit::WebChromeClient::createWindow):
2611         * WebProcess/WebCoreSupport/WebChromeClient.h:
2612         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2613         (WebKit::WebFrameLoaderClient::dispatchCreatePage):
2614
2615 2020-03-15  Yusuke Suzuki  <ysuzuki@apple.com>
2616
2617         Should not use variable-length-array (VLA)
2618         https://bugs.webkit.org/show_bug.cgi?id=209043
2619
2620         Reviewed by Mark Lam.
2621
2622         * Configurations/Base.xcconfig:
2623         * UIProcess/_WKTouchEventGenerator.mm:
2624         (-[_WKTouchEventGenerator touchDown:touchCount:]):
2625         (-[_WKTouchEventGenerator liftUp:touchCount:]):
2626         (-[_WKTouchEventGenerator moveToPoints:touchCount:duration:]):
2627
2628 2020-03-14  Brady Eidson  <beidson@apple.com>
2629
2630         Fix the "deliver cached ranges" logic in PDFPlugin (and other small cleanups)
2631         https://bugs.webkit.org/show_bug.cgi?id=209097
2632
2633         Reviewed by Tim Hatcher.
2634
2635         Streaming in data always appended to the buffer instead of first growing the buffer.
2636         This wasn't noticed earlier because we often did not grow the buffer for successful range request completion.
2637         But now we often do!
2638         
2639         So this cleans that all up.
2640         
2641         At the same time it revealed other interactions with PDFKit that force us to handle data requests on the main
2642         thread after the document load is complete - Which is fine!
2643
2644         * WebProcess/Plugins/PDF/PDFPlugin.h:
2645         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2646         (WebKit::dataProviderGetBytesAtPositionCallback): If on the main thread (and the document load is complete)
2647           handle the request directly!
2648         (WebKit::PDFPlugin::getResourceBytesAtPositionMainThread):
2649         (WebKit::PDFPlugin::ByteRangeRequest::completeWithAccumulatedData):
2650         (WebKit::PDFPlugin::ensureDataBufferLength):
2651         (WebKit::PDFPlugin::didFail):
2652         (WebKit::PDFPlugin::maybeClearHighLatencyDataProviderFlag):
2653         (WebKit::PDFPlugin::documentDataDidFinishLoading):
2654         (WebKit::PDFPlugin::installPDFDocument):
2655         (WebKit::PDFPlugin::manualStreamDidReceiveData): Grow the buffer instead of append.
2656
2657
2658 2020-03-14  Brent Fulgham  <bfulgham@apple.com>
2659
2660         Add missing checks needed for AppBound Quirk
2661         https://bugs.webkit.org/show_bug.cgi?id=209117
2662         <rdar://problem/60460097>
2663
2664         Reviewed by John Wilander.
2665
2666         The checks for the 'NeedsInAppBrowserPrivacyQuirks' flag added in r258101 was incomplete.
2667         These changes let the WebFrameLoaderClient report the quirk state to WebCore code. 
2668
2669         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2670         (WebKit::WebFrameLoaderClient::needsInAppBrowserPrivacyQuirks): Added.
2671         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2672         * WebProcess/WebPage/WebPage.h:
2673         (WebKit::WebPage::needsInAppBrowserPrivacyQuirks const): Added.
2674
2675 2020-03-10  Darin Adler  <darin@apple.com>
2676
2677         Change all return values in TextIterator header from live ranges to SimpleRange
2678         https://bugs.webkit.org/show_bug.cgi?id=208906
2679
2680         Reviewed by Antti Koivisto.
2681
2682         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: Removed unneeded include of
2683         TextIterator.h.
2684
2685         * WebProcess/WebPage/ios/WebPageIOS.mm:
2686         (WebKit::rangeNearPositionMatchesText): Removed unused originalRange argument,
2687         changed return type to Optional<SimpleRange> since findClosestPlainText now
2688         returns a SimpleRange.
2689         (WebKit::WebPage::getRectsAtSelectionOffsetWithText): Updated since
2690         rangeNearPositionMatchesText now returns Optional<SimpleRange>, use createLiveRange.
2691         (WebKit::WebPage::requestDocumentEditingContext): Updated since
2692         CharacterIterator::range returns SimpleRange, use createLiveRange.
2693
2694 2020-03-14  Brady Eidson  <beidson@apple.com>
2695
2696         Gather PDF scripts to run on a background thread.
2697         https://bugs.webkit.org/show_bug.cgi?id=209063
2698
2699         Reviewed by Geoff Garen.
2700         
2701         In incremental loading mode, gathering document scripts will sometimes require PDFKit/CG
2702         to lock and wait on data loads from our data provider.
2703         
2704         So if we gather them on the main thread, we will hang the main thread and therefore deadlock
2705         with our data provider thread/queue.
2706         
2707         So let's gather those scripts on a background thread!
2708
2709         * WebProcess/Plugins/PDF/PDFPlugin.h:
2710         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2711         (WebKit::PDFPlugin::threadEntry):
2712         (WebKit::PDFPlugin::ByteRangeRequest::completeWithAccumulatedData):
2713         (WebKit::PDFPlugin::documentDataDidFinishLoading):
2714         (WebKit::PDFPlugin::installPDFDocument):
2715         (WebKit::PDFPlugin::streamDidFinishLoading):
2716         (WebKit::PDFPlugin::manualStreamDidFinishLoading):
2717         (WebKit::PDFPlugin::tryRunScriptsInPDFDocument): Only actually gathers scripts to execute if there
2718           is a m_pdfDocument and the entire document data finished loading.
2719         (WebKit::PDFPlugin::pdfDocumentDidLoad): Deleted.
2720         (WebKit::PDFPlugin::runScriptsInPDFDocument): Deleted.
2721
2722 2020-03-13  Alex Christensen  <achristensen@webkit.org>
2723
2724         WKWebView._negotiatedLegacyTLS should be correct after back/forward navigations
2725         https://bugs.webkit.org/show_bug.cgi?id=209011
2726         <rdar://problem/59370588>
2727
2728         Reviewed by Youenn Fablet.
2729
2730         * NetworkProcess/NetworkDataTask.cpp:
2731         (WebKit::NetworkDataTask::didReceiveResponse):
2732         * NetworkProcess/NetworkLoad.cpp:
2733         (WebKit::NetworkLoad::notifyDidReceiveResponse):
2734         * UIProcess/WebPageProxy.cpp:
2735         (WebKit::WebPageProxy::usedLegacyTLS): Deleted.
2736         * UIProcess/WebPageProxy.h:
2737         * UIProcess/WebPageProxy.messages.in:
2738         * WebProcess/Network/WebResourceLoader.cpp:
2739         (WebKit::WebResourceLoader::didReceiveResponse):
2740         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2741         (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame):
2742
2743 2020-03-13  Wenson Hsieh  <wenson_hsieh@apple.com>
2744
2745         [watchOS] Don’t display empty text suggestions in Quickboard when editing input fields
2746         https://bugs.webkit.org/show_bug.cgi?id=209089
2747
2748         Reviewed by Tim Horton.
2749
2750         Handle text suggestions that lack `displayText` gracefully in Quickboard by not showing them as AutoFill
2751         candidates. Currently, they are presented as blank collection view cells in Quickboard, which leads to a
2752         confusing user experience.
2753
2754         Test: WKWebViewAutoFillTests.DoNotShowBlankTextSuggestions
2755
2756         * UIProcess/ios/forms/WKFocusedFormControlView.mm:
2757         (-[WKFocusedFormControlView setSuggestions:]):
2758
2759 2020-03-13  Brent Fulgham  <bfulgham@apple.com>
2760
2761         Clean up sandbox violations found during testing
2762         https://bugs.webkit.org/show_bug.cgi?id=209096
2763         <rdar://problem/59931477>
2764
2765         Reviewed by Geoffrey Garen.
2766
2767         Remove telemetry from some items, and allow access to some IOKit properties
2768         needed for media playback on macOS and iOS.
2769
2770         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2771         * WebProcess/com.apple.WebProcess.sb.in:
2772
2773 2020-03-13  Chris Dumez  <cdumez@apple.com>
2774
2775         Unreviewed, drop unused variable in WebPageProxy::backForwardGoToItem().
2776
2777         * UIProcess/WebPageProxy.cpp:
2778
2779 2020-03-13  John Wilander  <wilander@apple.com>
2780
2781         Remove unused code related to removePrevalentDomains()
2782         https://bugs.webkit.org/show_bug.cgi?id=209078
2783         <rdar://problem/59681984>
2784
2785         Reviewed by Brent Fulgham.
2786
2787         The various removePrevalentDomains() functions and its IPC endpoint are unused and should be removed.
2788
2789         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
2790         (WebKit::ResourceLoadStatisticsStore::clearBlockingStateForDomains): Deleted.
2791         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2792         (WebKit::WebResourceLoadStatisticsStore::removePrevalentDomains): Deleted.
2793         (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler): Deleted.
2794         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2795         * NetworkProcess/NetworkProcess.cpp:
2796         (WebKit::NetworkProcess::removePrevalentDomains): Deleted.
2797         * NetworkProcess/NetworkProcess.h:
2798         * NetworkProcess/NetworkProcess.messages.in:
2799
2800 2020-03-13  Myles C. Maxfield  <mmaxfield@apple.com>
2801
2802         [Cocoa] Push applicationSDKVersion() down from WebCore into WTF
2803         https://bugs.webkit.org/show_bug.cgi?id=209030
2804
2805         Reviewed by Simon Fraser.
2806
2807         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2808         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2809         * Shared/WebPreferencesDefaultValues.cpp:
2810         (WebKit::defaultCSSOMViewScrollingAPIEnabled):
2811         * WebProcess/cocoa/WebProcessCocoa.mm:
2812         (WebKit::WebProcess::platformInitializeWebProcess):
2813
2814 2020-03-13  Brent Fulgham  <bfulgham@apple.com>
2815
2816         Remove unused IPC function UserMediaCaptureManagerProxy::SetMuted
2817         https://bugs.webkit.org/show_bug.cgi?id=209087
2818         <rdar://problem/59658963>
2819
2820         Reviewed by Eric Carlson.
2821
2822         Remove the unused UserMediaCaptureManagerProxy message 'SetMuted'.
2823
2824         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2825         (WebKit::UserMediaCaptureManagerProxy::setMuted): Deleted.
2826         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
2827         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
2828
2829 2020-03-13  Brent Fulgham  <bfulgham@apple.com>
2830
2831         Remove unused GetNetworkLoadInformationRequest call
2832         https://bugs.webkit.org/show_bug.cgi?id=209081
2833         <rdar://problem/59659064>
2834
2835         Reviewed by Geoffrey Garen.
2836
2837         Remove dead code associated with an unused IPC message.
2838
2839         * NetworkProcess/NetworkConnectionToWebProcess.h:
2840         (WebKit::NetworkConnectionToWebProcess::getNetworkLoadInformationRequest): Deleted.
2841         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2842
2843 2020-03-13  Jiewen Tan  <jiewen_tan@apple.com>
2844
2845         [WebAuthn] Customize a bit more on the macOS LocalAuthentication prompt
2846         https://bugs.webkit.org/show_bug.cgi?id=208703
2847         <rdar://problem/60136974>
2848
2849         Reviewed by Darin Adler.
2850
2851         On macOS, LocalAuthentication prompt can be shown anywhere that is probably not on top of
2852         our UI clients. Therefore, add a RP ID to the dialog to help users to identify what has
2853         happened. In addition, it removes the password fallback button.
2854
2855         * Platform/spi/Cocoa/LocalAuthenticationSPI.h:
2856         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
2857         (WebKit::LocalAuthenticator::continueMakeCredentialAfterDecidePolicy):
2858         (WebKit::LocalAuthenticator::continueGetAssertionAfterResponseSelected):
2859         * UIProcess/WebAuthentication/Cocoa/LocalConnection.h:
2860         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
2861         (WebKit::LocalConnection::verifyUser const):
2862         * UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
2863         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
2864         (WebKit::MockLocalConnection::verifyUser const):
2865
2866 2020-03-13  Brent Fulgham  <bfulgham@apple.com>
2867
2868         Remove Unused IPC message PlaybackSessionManagerProxy::PictureInPictureActiveChanged
2869         https://bugs.webkit.org/show_bug.cgi?id=209085
2870         <rdar://problem/59658916>
2871
2872         Reviewed by Geoffrey Garen.
2873
2874         Remove the unused PlaybackSessionManagerProxy message 'PictureInPictureActiveChanged'.
2875
2876         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
2877         * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
2878         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
2879         (WebKit::PlaybackSessionManagerProxy::pictureInPictureActiveChanged): Deleted.
2880
2881 2020-03-13  Kate Cheney  <katherine_cheney@apple.com>
2882
2883         [ iOS and Mac wk2 ] http/tests/in-app-browser-privacy/ tests failing
2884         https://bugs.webkit.org/show_bug.cgi?id=209016
2885         <rdar://problem/60329530> 
2886
2887         Reviewed by Chris Dumez.
2888
2889         This patch adds a function to re-initialize app bound domains for
2890         in-app-browser-privacy tests, since they are only initialized once
2891         when the WebsiteDataStore is created. This causes issues if the tests
2892         are run in parallel with other tests with different app-bound domains.
2893
2894         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2895         (WKWebsiteDataStoreReinitializeAppBoundDomains):
2896         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2897         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2898         (WebKit::WebsiteDataStore::clearAppBoundDomains):
2899         (WebKit::WebsiteDataStore::reinitializeAppBoundDomains):
2900         * UIProcess/WebsiteData/WebsiteDataStore.h:
2901
2902 2020-03-13  Ryan Haddad  <ryanhaddad@apple.com>
2903
2904         Unreviewed, reverting r258391.
2905
2906         Breaks internal builds.
2907
2908         Reverted changeset:
2909
2910         "Apply rotation at source level if WebRTC sink ask so"
2911         https://bugs.webkit.org/show_bug.cgi?id=205645
2912         https://trac.webkit.org/changeset/258391
2913
2914 2020-03-13  Kate Cheney  <katherine_cheney@apple.com>
2915
2916         Report all third party loads on a per-page basis
2917         https://bugs.webkit.org/show_bug.cgi?id=209032
2918         <rdar://problem/60397323>
2919
2920         Reviewed by Chris Dumez.
2921
2922         Test: http/tests/resourceLoadStatistics/loaded-registrable-domains-get-reported.html
2923
2924         Removed IPC to the Network Process asking if a resource load is from
2925         a prevalent domain. This now stores and sends all loaded registrable
2926         domains. This patch is mostly updating naming to reflect this and
2927         deleting the unnecessary code to communicate with the
2928         ResourceLoadStatisticsStore.
2929
2930         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2931         (WebKit::NetworkConnectionToWebProcess::requestStorageAccessUnderOpener):
2932         (WebKit::NetworkConnectionToWebProcess::isPrevalentSubresourceLoad): Deleted.
2933         * NetworkProcess/NetworkConnectionToWebProcess.h:
2934         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2935         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2936         (-[WKWebsiteDataStore _loadedThirdPartyDomainsFor:completionHandler:]):
2937         (-[WKWebsiteDataStore _clearLoadedThirdPartyDomainsFor:]):
2938         (-[WKWebsiteDataStore _getPrevalentDomainsFor:completionHandler:]): Deleted.
2939         (-[WKWebsiteDataStore _clearPrevalentDomainsFor:]): Deleted.
2940         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2941         * UIProcess/WebPageProxy.cpp:
2942         * UIProcess/WebPageProxy.h:
2943         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2944         (WebKit::WebFrameLoaderClient::didLoadFromRegistrableDomain):
2945         (WebKit::WebFrameLoaderClient::addLoadedRegistrableDomain): Deleted.
2946         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2947         * WebProcess/WebPage/WebPage.cpp:
2948         (WebKit::WebPage::didCommitLoad):
2949         (WebKit::WebPage::didLoadFromRegistrableDomain):
2950         Add a check that this is a third party by comparing the target domain
2951         to the main frame domain.
2952
2953         (WebKit::WebPage::loadedThirdPartyDomains):
2954         (WebKit::WebPage::clearLoadedThirdPartyDomains):
2955         (WebKit::WebPage::addLoadedRegistrableDomain): Deleted.
2956         (WebKit::WebPage::getPrevalentDomains): Deleted.
2957         (WebKit::WebPage::clearPrevalentDomains): Deleted.
2958         * WebProcess/WebPage/WebPage.h:
2959         * WebProcess/WebPage/WebPage.messages.in:
2960
2961 2020-03-13  Brent Fulgham  <bfulgham@apple.com>
2962
2963         Remove unused SmartMagnificationController Magnify message
2964         https://bugs.webkit.org/show_bug.cgi?id=209036
2965         <rdar://problem/59678060>
2966
2967         Reviewed by Tim Horton.
2968
2969         Remove the unused Magnify message from the SmartMagnificationController, since this is dead code.
2970
2971         * UIProcess/ios/SmartMagnificationController.h:
2972         * UIProcess/ios/SmartMagnificationController.messages.in:
2973         * UIProcess/ios/SmartMagnificationController.mm:
2974         (WebKit::SmartMagnificationController::magnify): Deleted.
2975
2976 2020-03-13  David Kilzer  <ddkilzer@apple.com>
2977
2978         WebPageProxy::SetPromisedDataForImage should validate its `imageSize` and `archiveSize` parameters
2979         <https://webkit.org/b/209029>
2980         <rdar://problem/60181394>
2981
2982         Reviewed by Youenn Fablet.
2983
2984         * UIProcess/mac/WebPageProxyMac.mm:
2985         (WebKit::WebPageProxy::setPromisedDataForImage):
2986         - Validate `imageSize` and `archiveSize` using MESSAGE_CHECK().
2987         - Add static_cast<size_t>() to `imageSize` and `archiveSize`
2988           parameters to denote type change.
2989         - Add nullptr check for SharedMemory::map() result with
2990           `archiveHandle`.
2991
2992 2020-03-13  Carlos Garcia Campos  <cgarcia@igalia.com>
2993
2994         [SOUP] Notify web process about WebSocket handshake request and response
2995         https://bugs.webkit.org/show_bug.cgi?id=208994
2996
2997         Reviewed by Youenn Fablet.
2998
2999         This makes WebSockets appear again in web inspector.
3000
3001         * NetworkProcess/soup/WebSocketTaskSoup.cpp:
3002         (WebKit::WebSocketTask::WebSocketTask): Save the handshake message and notify the channel when the request is sent.
3003         (WebKit::WebSocketTask::didConnect): Notify the channel that handshake response has been received.
3004         (WebKit::WebSocketTask::didFail): Notify the channel that handshake response has been received if handshake
3005         failed.
3006         * NetworkProcess/soup/WebSocketTaskSoup.h:
3007
3008 2020-03-13  Youenn Fablet  <youenn@apple.com>
3009
3010         Apply rotation at source level if WebRTC sink ask so
3011         https://bugs.webkit.org/show_bug.cgi?id=205645
3012
3013         Reviewed by Eric Carlson.
3014
3015         Implement RealtimeMediaSource setShouldApplyRotation by sending IPC to capture process.
3016         In capture process, if rotation should be applied, use an ImageRotationSessionVT session to apply it before sending the video frame.
3017         This allows WebProcess to no longer need an ImageRotationSessionVT for WebRTC.
3018
3019         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
3020         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::setShouldApplyRotation):
3021         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::rotatePixelBuffer):
3022         (WebKit::UserMediaCaptureManagerProxy::setShouldApplyRotation):
3023         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
3024         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
3025         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
3026         (WebKit::UserMediaCaptureManager::Source::setShouldApplyRotation):
3027
3028 2020-03-13  youenn fablet  <youenn@apple.com>
3029
3030         Remove use of PlatformMediaSession types in AudioSession
3031         https://bugs.webkit.org/show_bug.cgi?id=208995
3032
3033         Reviewed by Eric Carlson.
3034
3035         Update code according WebCore API changes.
3036         Make use of AudioSession current code path to make RemoteAudioSession notify its observers.
3037
3038         * GPUProcess/media/RemoteAudioSessionProxy.cpp:
3039         (WebKit::RemoteAudioSessionProxy::setCategory):
3040         (WebKit::RemoteAudioSessionProxy::beginInterruption):
3041         (WebKit::RemoteAudioSessionProxy::endInterruption):
3042         * GPUProcess/media/RemoteAudioSessionProxy.h:
3043         * GPUProcess/media/RemoteAudioSessionProxyManager.cpp:
3044         (WebKit::RemoteAudioSessionProxyManager::tryToSetActiveForProcess):
3045         (WebKit::RemoteAudioSessionProxyManager::beginAudioSessionInterruption):
3046         (WebKit::RemoteAudioSessionProxyManager::endAudioSessionInterruption):
3047         * GPUProcess/media/RemoteAudioSessionProxyManager.h:
3048         * WebProcess/GPU/media/RemoteAudioSession.cpp:
3049         (WebKit::RemoteAudioSession::beginInterruption): Deleted.
3050         (WebKit::RemoteAudioSession::endInterruption): Deleted.
3051         * WebProcess/GPU/media/RemoteAudioSession.h:
3052         * WebProcess/GPU/media/RemoteAudioSession.messages.in:
3053
3054 2020-03-13  Ryosuke Niwa  <rniwa@webkit.org>
3055
3056         Release build fix after r258384.
3057
3058         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3059         (WebKit::PDFPlugin::threadEntry):
3060         (WebKit::PDFPlugin::ByteRangeRequest::maybeComplete):
3061
3062 2020-03-12  Brady Eidson  <beidson@apple.com>
3063
3064         Add a very verbose logging mode for incremental PDF loading
3065         https://bugs.webkit.org/show_bug.cgi?id=208975
3066
3067         Reviewed by Simon Fraser.
3068
3069         Adds a verbose logging channel that includes a full dump of the PDFPlugin's loading status
3070         for each logging message.
3071         
3072         * Platform/Logging.h:
3073
3074         * WebProcess/Plugins/PDF/PDFPlugin.h:
3075         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3076         (WebKit::PDFPlugin::pdfLog):
3077         (WebKit::PDFPlugin::logStreamLoader):
3078         (WebKit::PDFPlugin::verboseLog):
3079         (WebKit::dataProviderGetBytesAtPositionCallback):
3080         (WebKit::dataProviderGetByteRangesCallback):
3081         (WebKit::PDFPlugin::getResourceBytesAtPosition):
3082         (WebKit::PDFPlugin::adoptBackgroundThreadDocument):
3083         (WebKit::PDFPlugin::ByteRangeRequest::completeWithBytes):
3084         (WebKit::PDFPlugin::ByteRangeRequest::completeWithAccumulatedData):
3085         (WebKit::PDFPlugin::forgetLoader):
3086
3087 2020-03-12  Brent Fulgham  <bfulgham@apple.com>
3088
3089         Correct preference handling and naming conventions in AppBound browsing preferences
3090         https://bugs.webkit.org/show_bug.cgi?id=209031
3091         <rdar://problem/60396298>
3092
3093         Reviewed by John Wilander.
3094
3095         I made a mistake in the handling of preferences related to the IsInAppBrowserPrivacyEnabled
3096         and the quirk flag, which led to some code not executing when expected.
3097
3098         This patch does the following:
3099
3100         1. Uses the correct naming scheme for WebKit Internal Debug flags. They should be
3101            'WebKitDebug', not 'WebKitInternal' or 'WebKitInternalDebug'.
3102         2. Updates the local quirk state in WebPage when page settings change.
3103
3104         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3105         (WebKit::WebsiteDataStore::parameters):
3106         * WebProcess/WebPage/WebPage.cpp:
3107         (WebKit::WebPage::updatePreferences):
3108
3109 2020-03-12  David Kilzer  <ddkilzer@apple.com>
3110
3111         WebPageProxy::SaveImageToLibrary should validate its `imageSize` parameter
3112         <https://webkit.org/b/209012>
3113         <rdar://problem/60181295>
3114
3115         Reviewed by Chris Dumez.
3116
3117         * UIProcess/ios/WebPageProxyIOS.mm:
3118         (WebKit::WebPageProxy::saveImageToLibrary):
3119         - Validate upper bound of `imageSize` parameter.
3120         - Add static_cast<size_t>() to `imageSize` parameter to denote
3121           type change.
3122
3123 2020-03-12  Chris Dumez  <cdumez@apple.com>
3124
3125         Check for overflows in MachMessage::messageSize()
3126         https://bugs.webkit.org/show_bug.cgi?id=209020
3127         <rdar://problem/58264215>
3128
3129         Reviewed by Alex Christensen.
3130
3131         * Platform/IPC/cocoa/ConnectionCocoa.mm:
3132         (IPC::Connection::sendOutgoingMessage):
3133         * Platform/IPC/cocoa/MachMessage.cpp:
3134         (IPC::MachMessage::messageSize):
3135         * Platform/IPC/cocoa/MachMessage.h:
3136
3137 2020-03-12  Per Arne Vollan  <pvollan@apple.com>
3138
3139         [macOS] _AXSApplicationAccessibilityEnabled should not be called
3140         https://bugs.webkit.org/show_bug.cgi?id=208953
3141
3142         Reviewed by Brent Fulgham.
3143
3144         On macOS, stop using the function _AXSApplicationAccessibilityEnabled and listening to the notification
3145         kAXSApplicationAccessibilityEnabledNotification, since they do not have the same behavior as on iOS.
3146
3147         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3148         (WebKit::WebProcessPool::platformInitializeWebProcess):
3149         (WebKit::WebProcessPool::registerNotificationObservers):
3150         (WebKit::WebProcessPool::unregisterNotificationObservers):
3151         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
3152         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
3153         * WebProcess/cocoa/WebProcessCocoa.mm:
3154         (WebKit::WebProcess::platformInitializeProcess):
3155         (WebKit::WebProcess::unblockAccessibilityServer):
3156
3157 2020-03-12  Kate Cheney  <katherine_cheney@apple.com>
3158
3159         Resource load statistics data summary should return all third party data
3160         https://bugs.webkit.org/show_bug.cgi?id=209000
3161         <rdar://problem/60348306>
3162
3163         Reviewed by John Wilander.
3164
3165         No new tests, this patch adjusts old tests to test this new behavior
3166
3167         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3168         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3169         (-[WKWebsiteDataStore _setThirdPartyCookieBlockingMode:onlyOnSitesWithoutUserInteraction:completionHandler:]):
3170         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3171         Added new function _setThirdPartyCookieBlockingMode so API tests can
3172         set this parameter.
3173
3174 2020-03-12  Alex Christensen  <achristensen@webkit.org>
3175
3176         WKWebView.hasOnlySecureContent should be correct after back/forward navigations
3177         https://bugs.webkit.org/show_bug.cgi?id=207609
3178
3179         Reviewed by Ryosuke Niwa.
3180
3181         * UIProcess/WebPageProxy.cpp:
3182         (WebKit::WebPageProxy::usedLegacyTLS):
3183         (WebKit::WebPageProxy::hasInsecureContent): Deleted.
3184         * UIProcess/WebPageProxy.h:
3185         * UIProcess/WebPageProxy.messages.in:
3186         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3187         (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame):
3188
3189 2020-03-12  Chris Dumez  <cdumez@apple.com>
3190
3191         Drop unused WebProcess::UpdateActivePages IPC
3192         https://bugs.webkit.org/show_bug.cgi?id=209002
3193         <rdar://problem/59682658>
3194
3195         Reviewed by Geoffrey Garen.
3196
3197         * WebProcess/WebProcess.messages.in:
3198
3199 2020-03-12  youenn fablet  <youenn@apple.com>
3200
3201         FrameLoader should own its FrameLoaderClient
3202         https://bugs.webkit.org/show_bug.cgi?id=208918
3203
3204         Reviewed by Geoffrey Garen.
3205
3206         Pass a UniqueRef to the PageConfiguration.
3207         Update WebFrameLoaderClient according updated FrameLoaderClient interface.
3208
3209         WebFrame no longer needs to ref/unref itself to keep the loader client alive.
3210         Update WebFrame construction to not need a static_cast at initialization of the main frame.
3211
3212         The ownership is now that a WebCore::FrameLoader owns a FrameLoaderClient who owns a WebFrame.
3213
3214         * WebProcess/Network/WebLoaderStrategy.cpp:
3215         (WebKit::WebLoaderStrategy::tryLoadingUsingURLSchemeHandler):
3216         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3217         (WebKit::WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler):
3218         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
3219         (WebKit::WebLoaderStrategy::startPingLoad):
3220         (WebKit::WebLoaderStrategy::preconnectTo):
3221         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3222         (WebKit::WebSWContextManagerConnection::installServiceWorker):
3223         * WebProcess/Storage/WebSWContextManagerConnection.h:
3224         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3225         (WebKit::WebFrameLoaderClient::WebFrameLoaderClient):
3226         (WebKit::WebFrameLoaderClient::~WebFrameLoaderClient):
3227         (WebKit::WebFrameLoaderClient::webPageProxyID const):
3228         (WebKit::WebFrameLoaderClient::pageID const):
3229         (WebKit::WebFrameLoaderClient::frameID const):
3230         (WebKit::WebFrameLoaderClient::detachedFromParent2):
3231         (WebKit::WebFrameLoaderClient::assignIdentifierToInitialRequest):
3232         (WebKit::WebFrameLoaderClient::dispatchWillSendRequest):
3233         (WebKit::WebFrameLoaderClient::shouldUseCredentialStorage):
3234         (WebKit::WebFrameLoaderClient::dispatchDidReceiveResponse):
3235         (WebKit::WebFrameLoaderClient::dispatchDidReceiveContentLength):
3236         (WebKit::WebFrameLoaderClient::dispatchDidFinishLoading):
3237         (WebKit::WebFrameLoaderClient::dispatchDidFailLoading):
3238         (WebKit::WebFrameLoaderClient::dispatchDidDispatchOnloadEvents):
3239         (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
3240         (WebKit::WebFrameLoaderClient::dispatchDidCancelClientRedirect):
3241         (WebKit::WebFrameLoaderClient::dispatchWillPerformClientRedirect):
3242         (WebKit::WebFrameLoaderClient::dispatchDidChangeLocationWithinPage):
3243         (WebKit::WebFrameLoaderClient::dispatchDidPushStateWithinPage):
3244         (WebKit::WebFrameLoaderClient::dispatchDidReplaceStateWithinPage):
3245         (WebKit::WebFrameLoaderClient::dispatchDidPopStateWithinPage):
3246         (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad):
3247         (WebKit::WebFrameLoaderClient::dispatchDidReceiveTitle):
3248         (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
3249         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
3250         (WebKit::WebFrameLoaderClient::dispatchDidFailLoad):
3251         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad):
3252         (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad):
3253         (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
3254         (WebKit::WebFrameLoaderClient::dispatchDidLayout):
3255         (WebKit::WebFrameLoaderClient::dispatchShow):
3256         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
3257         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
3258         (WebKit::WebFrameLoaderClient::applyToDocumentLoader):
3259         (WebKit::WebFrameLoaderClient::allowsContentJavaScriptFromMostRecentNavigation const):
3260         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3261         (WebKit::WebFrameLoaderClient::dispatchUnableToImplementPolicy):
3262         (WebKit::WebFrameLoaderClient::dispatchWillSendSubmitEvent):
3263         (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
3264         (WebKit::WebFrameLoaderClient::willReplaceMultipartContent):
3265         (WebKit::WebFrameLoaderClient::didReplaceMultipartContent):
3266         (WebKit::WebFrameLoaderClient::didDisplayInsecureContent):
3267         (WebKit::WebFrameLoaderClient::didRunInsecureContent):
3268         (WebKit::WebFrameLoaderClient::didDetectXSS):
3269         (WebKit::WebFrameLoaderClient::cancelledError const):
3270         (WebKit::WebFrameLoaderClient::blockedError const):
3271         (WebKit::WebFrameLoaderClient::blockedByContentBlockerError const):
3272         (WebKit::WebFrameLoaderClient::cannotShowURLError const):
3273         (WebKit::WebFrameLoaderClient::interruptedForPolicyChangeError const):
3274         (WebKit::WebFrameLoaderClient::blockedByContentFilterError const):
3275         (WebKit::WebFrameLoaderClient::cannotShowMIMETypeError const):
3276         (WebKit::WebFrameLoaderClient::fileDoesNotExistError const):
3277         (WebKit::WebFrameLoaderClient::pluginWillHandleLoadError const):
3278         (WebKit::WebFrameLoaderClient::shouldFallBack const):
3279         (WebKit::WebFrameLoaderClient::restoreViewState):
3280         (WebKit::WebFrameLoaderClient::didFinishLoad):
3281         (WebKit::WebFrameLoaderClient::userAgent const):
3282         (WebKit::WebFrameLoaderClient::createPlugin):
3283         (WebKit::WebFrameLoaderClient::webGLPolicyForURL const):
3284         (WebKit::WebFrameLoaderClient::resolveWebGLPolicyForURL const):
3285         (WebKit::WebFrameLoaderClient::objectContentType):
3286         (WebKit::WebFrameLoaderClient::overrideMediaType const):
3287         (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld):
3288         (WebKit::WebFrameLoaderClient::dispatchGlobalObjectAvailable):
3289         (WebKit::WebFrameLoaderClient::willInjectUserScript):
3290         (WebKit::WebFrameLoaderClient::willCacheResponse const):
3291         (WebKit::WebFrameLoaderClient::createNetworkingContext):
3292         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3293         * WebProcess/WebPage/WebFrame.cpp:
3294         (WebKit::WebFrame::initWithCoreMainFrame):
3295         (WebKit::WebFrame::createSubframe):
3296         (WebKit::WebFrame::WebFrame):
3297         (WebKit::WebFrame::frameLoaderClient const):
3298         (WebKit::WebFrame::fromCoreFrame):
3299         (WebKit::WebFrame::didReceivePolicyDecision):
3300         * WebProcess/WebPage/WebFrame.h:
3301         (WebKit::WebFrame::create):
3302         * WebProcess/WebPage/WebPage.cpp:
3303         (WebKit::m_processDisplayName):
3304
3305 2020-03-12  Brent Fulgham  <bfulgham@apple.com>
3306
3307         Drop unused LogGlobalDiagnosticMessageWithValue IPC message
3308         https://bugs.webkit.org/show_bug.cgi?id=208974
3309         <rdar://problem/59682189>
3310
3311         Reviewed by Chris Dumez.
3312
3313         I added these messages for ITP, but we later switched to tracking network sessions
3314         individually and no longer need this "global" message.
3315
3316         * UIProcess/Network/NetworkProcessProxy.cpp:
3317         (WebKit::NetworkProcessProxy::logGlobalDiagnosticMessageWithValue): Deleted.
3318         * UIProcess/Network/NetworkProcessProxy.h:
3319         * UIProcess/Network/NetworkProcessProxy.messages.in:
3320
3321 2020-03-12  Chris Dumez  <cdumez@apple.com>
3322
3323         Networking process should kill the WebContent process if an invalid IPC message is received from it
3324         https://bugs.webkit.org/show_bug.cgi?id=208999
3325
3326         Reviewed by Geoffrey Garen.
3327
3328         If the NetworkProcess receives a bad IPC from a WebProcess, it now sends an IPC to the UIProcess
3329         asking for said WebProcess to be terminated.
3330
3331         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3332         (WebKit::NetworkConnectionToWebProcess::didReceiveInvalidMessage):
3333
3334         * Platform/IPC/HandleMessage.h:
3335         (IPC::handleMessage):
3336         (IPC::handleMessageSynchronous):
3337         (IPC::handleMessageSynchronousWantsConnection):
3338         (IPC::handleMessageAsync):
3339         I noticed when testing this patch that the decoder was sometimes not marked as invalid even though
3340         decoding failed (verified this by not decoding enough data or decoding too much data). As a result,
3341         the IPC message would get ignored but didReceiveInvalidMessage() would not get called. To address
3342         this, I know mark the decoder as invalid anytime decoding fails, instead of asserting that it is
3343         already invalid.
3344
3345         * Shared/ProcessTerminationReason.h:
3346         * UIProcess/API/C/WKAPICast.h:
3347         (WebKit::toAPI):
3348         * UIProcess/Cocoa/NavigationState.mm:
3349         (WebKit::wkProcessTerminationReason):
3350         * UIProcess/Network/NetworkProcessProxy.cpp:
3351         (WebKit::NetworkProcessProxy::terminateWebProcess):
3352         * UIProcess/Network/NetworkProcessProxy.h:
3353         * UIProcess/Network/NetworkProcessProxy.messages.in:
3354         * UIProcess/WebPageProxy.cpp:
3355         * UIProcess/WebProcessProxy.cpp:
3356         (WebKit::WebProcessProxy::requestTermination):
3357
3358 2020-03-12  Alex Christensen  <achristensen@webkit.org>
3359
3360         Remove unused GetWebCoreStatistics message
3361         https://bugs.webkit.org/show_bug.cgi?id=209001
3362         <rdar://problem/59682747>
3363
3364         Reviewed by Chris Dumez.
3365
3366         * WebProcess/WebProcess.cpp:
3367         (WebKit::fromCountedSetToHashMap): Deleted.
3368         (WebKit::getWebCoreMemoryCacheStatistics): Deleted.
3369         (WebKit::WebProcess::getWebCoreStatistics): Deleted.
3370         * WebProcess/WebProcess.h:
3371         * WebProcess/WebProcess.messages.in:
3372
3373 2020-03-12  David Kilzer  <ddkilzer@apple.com>
3374
3375         WebPasteboardProxy::SetPasteboardBufferForType should validate its `size` parameter
3376         <https://webkit.org/b/208902>
3377         <rdar://problem/60181117>
3378
3379         Reviewed by Chris Dumez.
3380
3381         * Platform/IPC/Connection.h:
3382         (MESSAGE_CHECK_BASE):
3383         - Define in terms of MESSAGE_CHECK_COMPLETION_BASE() with a
3384           no-op completion handler.
3385         (MESSAGE_CHECK_COMPLETION_BASE):
3386         - Rename from MESSAGE_CHECK_BASE() and add completion handler
3387           parameter.
3388
3389         * Platform/SharedMemory.h:
3390         (WebKit::SharedMemory::Handle::size const): Add.
3391
3392         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
3393         (MESSAGE_CHECK):
3394         - Define macro to use in
3395           WebPasteboardProxy::setPasteboardBufferForType().
3396         - Undefine macro at end of source file due to unified sources.
3397         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
3398         - Add IPC::Connection& parameter after change to
3399           WebPasteboardProxy.messages.in.  Use with MESSAGE_CHECK().
3400         - Validate `size` parameter using MESSAGE_CHECK().  Because
3401           SharedMemory::Handle::size() returns a size_t value, we do not
3402           need to check `size <= std::numeric_limits<size_t>::max()`.
3403         - Add static_cast<size_t>() to size parameter to denote type
3404           change.
3405         * UIProcess/WebPasteboardProxy.h:
3406         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
3407         - Add IPC::Connection& parameter after change to
3408           WebPasteboardProxy.messages.in.
3409         * UIProcess/WebPasteboardProxy.messages.in:
3410         (SetPasteboardBufferForType):
3411         - Add 'WantsConnection' attribute to add IPC::Connection&
3412           parameter to WebPasteboardProxy::setPasteboardBufferForType().
3413
3414 2020-03-12  Youenn Fablet  <youenn@apple.com>
3415
3416         Provide orientation to GPUProcess when it will start to capture
3417         https://bugs.webkit.org/show_bug.cgi?id=208911
3418
3419         Reviewed by Eric Carlson.
3420
3421         Provide orientation to GPUProcess whenever starting to capture.
3422         This fixes the case of spinning the GPUProcess/starting capture in landscape mode.
3423         Do not send orientation to GPUProcess if it is not yet started as an optimization.
3424
3425         Manually tested.
3426
3427         * UIProcess/WebPageProxy.cpp:
3428
3429 2020-03-12  Eric Carlson  <eric.carlson@apple.com>
3430
3431         Remove TextTrackPrivateRemote.messages.in
3432         https://bugs.webkit.org/show_bug.cgi?id=208935
3433
3434         Reviewed by Don Olmstead.
3435
3436         No new tests, no functional change.
3437
3438         * CMakeLists.txt:
3439         * DerivedSources-input.xcfilelist:
3440         * WebKit.xcodeproj/project.pbxproj:
3441         * WebProcess/GPU/media/TextTrackPrivateRemote.messages.in: Removed.
3442
3443 2020-03-12  youenn fablet  <youenn@apple.com>
3444
3445         Move AudioSession interruption listener code to AudioSession
3446         https://bugs.webkit.org/show_bug.cgi?id=208714
3447
3448         Reviewed by Jer Noble.
3449
3450         Make RemoteAudioSessionProxyManager an observer for AudioSession interruptions.
3451         When being interrupted, notify all WebProcesses and trigger begin/end interruption mechanisms.
3452         We only send interruption to sessions that are active in RemoteAudioSessionProxyManager.
3453         Minor refactorting to move manager proxies from a map to a weak hash set.
3454
3455         * GPUProcess/GPUConnectionToWebProcess.cpp:
3456         (WebKit::GPUConnectionToWebProcess::didClose):
3457         (WebKit::GPUConnectionToWebProcess::audioSessionProxy):
3458         * GPUProcess/media/RemoteAudioSessionProxy.cpp:
3459         (WebKit::RemoteAudioSessionProxy::setCategory):
3460         (WebKit::RemoteAudioSessionProxy::setPreferredBufferSize):
3461         (WebKit::RemoteAudioSessionProxy::tryToSetActive):
3462         * GPUProcess/media/RemoteAudioSessionProxyManager.cpp:
3463         (WebKit::RemoteAudioSessionProxyManager::RemoteAudioSessionProxyManager):
3464         (WebKit::RemoteAudioSessionProxyManager::~RemoteAudioSessionProxyManager):
3465         (WebKit::RemoteAudioSessionProxyManager::addProxy):
3466         (WebKit::RemoteAudioSessionProxyManager::removeProxy):
3467         (WebKit::RemoteAudioSessionProxyManager::setCategoryForProcess):
3468         (WebKit::RemoteAudioSessionProxyManager::setPreferredBufferSizeForProcess):
3469         (WebKit::RemoteAudioSessionProxyManager::tryToSetActiveForProcess):
3470         (WebKit::RemoteAudioSessionProxyManager::beginAudioSessionInterruption):
3471         (WebKit::RemoteAudioSessionProxyManager::endAudioSessionInterruption):
3472         * GPUProcess/media/RemoteAudioSessionProxyManager.h:
3473         * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp:
3474         * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.h:
3475         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp:
3476         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.h:
3477         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.messages.in:
3478
3479 2020-03-12  Don Olmstead  <don.olmstead@sony.com>
3480
3481         [GPUP] Use standard int type in RemoteMediaPlayerState
3482         https://bugs.webkit.org/show_bug.cgi?id=208962
3483
3484         Reviewed by Eric Carlson.
3485
3486         An unsigned long long is at least 64-bits so use uint64_t instead. This issue
3487         was found when compiling out the GPU Process. No specialization of unsigned long
3488         long was found which resulted in errors. This appears to be a non-Cocoa problem.
3489
3490         * WebProcess/GPU/media/RemoteMediaPlayerState.h:
3491         (WebKit::RemoteMediaPlayerState::decode):
3492
3493 2020-03-12  youenn fablet  <youenn@apple.com>
3494
3495         GPUProcess should ensure UIProcess granted capture access to a WebProcess making a capture request
3496         https://bugs.webkit.org/show_bug.cgi?id=208910
3497
3498         Reviewed by Eric Carlson.
3499
3500         When UIProcess receives a getUserMedia request, it will send to GPUProcess a notification of what is allowed.
3501         GPUProcess stores for each connection to web process whether microphone, camera and/or display are allowed.
3502         We do not disable access for a given process for now.
3503         A future refactoring should probably streamline the implementation so that, in case capture happens in GPUProcess,
3504         GPUProcess receives the getUserMedia request, asks permission to UIProcess and, upon granted permission, creates directly the sources.
3505
3506         Covered by existing tests.
3507
3508         * GPUProcess/GPUConnectionToWebProcess.cpp:
3509         (WebKit::GPUConnectionToWebProcess::updateCaptureAccess):
3510         * GPUProcess/GPUConnectionToWebProcess.h:
3511         (WebKit::GPUConnectionToWebProcess::allowsAudioCapture const):
3512         (WebKit::GPUConnectionToWebProcess::allowsVideoCapture const):
3513         (WebKit::GPUConnectionToWebProcess::allowsDisplayCapture const):
3514         * GPUProcess/GPUProcess.cpp:
3515         (WebKit::GPUProcess::createGPUConnectionToWebProcess):
3516         (WebKit::GPUProcess::updateCaptureAccess):
3517         * GPUProcess/GPUProcess.h:
3518         * GPUProcess/GPUProcess.messages.in:
3519         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
3520         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
3521         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
3522         * UIProcess/GPU/GPUProcessProxy.cpp:
3523         (WebKit::GPUProcessProxy::updateCaptureAccess):
3524         * UIProcess/GPU/GPUProcessProxy.h:
3525         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3526         (WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest):
3527         * UIProcess/WebPageProxy.cpp:
3528         * UIProcess/WebPageProxy.h:
3529         * UIProcess/WebProcessProxy.cpp:
3530
3531 2020-03-12  Brent Fulgham  <bfulgham@apple.com>
3532
3533         Drop unused EnableEnumeratingAllNetworkInterfaces / DisableEnumeratingAllNetworkInterfaces IPC messages
3534         https://bugs.webkit.org/show_bug.cgi?id=208973
3535         <rdar://problem/59683940>
3536
3537         Reviewed by Youenn Fablet.
3538
3539         Remove two unused IPC messages.
3540
3541         * WebProcess/WebPage/WebPage.cpp:
3542         (WebKit::WebPage::disableEnumeratingAllNetworkInterfaces): Deleted.
3543         (WebKit::WebPage::enableEnumeratingAllNetworkInterfaces): Deleted.
3544         * WebProcess/WebPage/WebPage.h:
3545         * WebProcess/WebPage/WebPage.messages.in:
3546
3547 2020-03-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
3548
3549         [GPU Process] encodeNativeImage() should pass imageSize to GraphicsContext::drawNativeImage()
3550         https://bugs.webkit.org/show_bug.cgi?id=208936
3551
3552         Reviewed by Myles C. Maxfield.
3553
3554         Passing an empty FloatSize makes drawNativeImage() draws nothing to
3555         the ShareableBitmap
3556
3557         * Shared/WebCoreArgumentCoders.cpp:
3558         (IPC::encodeNativeImage):
3559
3560 2020-03-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
3561
3562         RemoteImageBuffer::getImageData() has to clear its DisplayList after calling flushDrawingContext()
3563         https://bugs.webkit.org/show_bug.cgi?id=208931
3564
3565         Reviewed by Myles C. Maxfield.
3566
3567         Instead of letting every caller to flushDrawingContextAndWaitCommit() or
3568         flushDrawingContext() be responsible of clearing the DisplayList, we can
3569         make these functions take this responsibility.
3570
3571         * WebProcess/GPU/graphics/RemoteImageBuffer.h:
3572         * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp:
3573         (WebKit::RemoteImageBufferMessageHandler::flushDrawingContext):
3574         (WebKit::RemoteImageBufferMessageHandler::flushDrawingContextAndWaitCommit):
3575         * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h:
3576
3577 2020-03-11  Don Olmstead  <don.olmstead@sony.com>
3578
3579         Non-unified build fixes early March 2020 edition Take 2
3580         https://bugs.webkit.org/show_bug.cgi?id=208968
3581
3582         Unreviewed build fix.
3583
3584         * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp:
3585         * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
3586         (WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer):
3587
3588 2020-03-11  Don Olmstead  <don.olmstead@sony.com>
3589
3590         [GPUP] Add entry points for non-Cocoa ports
3591         https://bugs.webkit.org/show_bug.cgi?id=208965
3592
3593         Reviewed by Michael Catanzaro.
3594
3595         Add a CMake target for the GPU Process that is optionally defined based on
3596         whether the process is enabled.
3597
3598         Add an entry point for the GPU Process for unix and windows ports. Use this
3599         as the source for the GPU Process by specifying it in the Platform CMake file.
3600
3601         Add in hooks for both Windows and GLib to launch the GPU Process if it is
3602         enabled in the port.
3603
3604         * CMakeLists.txt:
3605         * GPUProcess/EntryPoint/unix/GPUProcessMain.cpp: Added.
3606         (main):
3607         * GPUProcess/EntryPoint/win/GPUProcessMain.cpp: Added.
3608         (main):
3609         * GPUProcess/GPUProcessMain.h: Added.
3610         * PlatformFTW.cmake:
3611         * PlatformGTK.cmake:
3612         * PlatformMac.cmake:
3613         * PlatformPlayStation.cmake:
3614         * PlatformWPE.cmake:
3615         * PlatformWin.cmake:
3616         * Shared/ProcessExecutablePath.h:
3617         * Shared/glib/ProcessExecutablePathGLib.cpp:
3618         (WebKit::executablePathOfGPUProcess):
3619         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
3620         (WebKit::ProcessLauncher::launchProcess):
3621         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
3622         (WebKit::processName):
3623
3624 2020-03-11  Don Olmstead  <don.olmstead@sony.com>
3625
3626         [GPUP] Add special handling of MediaTime within message generator
3627         https://bugs.webkit.org/show_bug.cgi?id=208958
3628
3629         Reviewed by Eric Carlson.
3630
3631         When compiling the GPU Process sources without unified sources there were
3632         numerous compilation errors around MediaTime. Only GPU Process .messages.in
3633         files reference this type so there was no special handling within messages.py.
3634         Adding explicit references to MediaTime so the proper header is used and all
3635         sources compile.
3636
3637         * Scripts/webkit/messages.py:
3638
3639 2020-03-11  Per Arne Vollan  <pvollan@apple.com>
3640
3641         [macOS] Register with accessibility when the WebContent process starts
3642         https://bugs.webkit.org/show_bug.cgi?id=208960
3643
3644         Reviewed by Brent Fulgham.
3645
3646         When we reenabled CF prefs direct mode in <https://bugs.webkit.org/show_bug.cgi?id=208690>, we started to register
3647         with accessibility when we received a message to do so from the UI process. This would typically happen when the user
3648         enabled accessibility. On macOS, this notification does not work the same way as on iOS, and it is assumed that
3649         accessibility should always be enabled. Therefore we should go back to registering with accessibility on startup of
3650         the WebContent process on macOS.
3651
3652         * WebProcess/cocoa/WebProcessCocoa.mm:
3653         (WebKit::WebProcess::platformInitializeProcess):
3654         (WebKit::WebProcess::unblockAccessibilityServer):
3655
3656 2020-03-11  Don Olmstead  <don.olmstead@sony.com>
3657
3658         [GPUP] RemoteAudioDestination classes should require ENABLE(WEB_AUDIO)
3659         https://bugs.webkit.org/show_bug.cgi?id=208956
3660
3661         Reviewed by Dean Jackson.
3662
3663         RemoteAudioDestinationProxy uses AudioBus directly. For ports that don't 
3664         ENABLE(WEB_AUDIO) there is no implementation and linker errors will occur after
3665         building with ENABLE(GPU_PROCESS).
3666
3667         Add guards for ENABLE(WEB_AUDIO) around relevant implementations.
3668
3669         * GPUProcess/GPUConnectionToWebProcess.cpp:
3670         (WebKit::GPUConnectionToWebProcess::dispatchMessage):
3671         (WebKit::GPUConnectionToWebProcess::dispatchSyncMessage):
3672         * GPUProcess/GPUConnectionToWebProcess.h:
3673         * GPUProcess/media/RemoteAudioDestinationManager.cpp:
3674         * GPUProcess/media/RemoteAudioDestinationManager.h:
3675         * GPUProcess/media/RemoteAudioDestinationManager.messages.in:
3676         * WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp:
3677         * WebProcess/GPU/media/RemoteAudioDestinationProxy.h:
3678         * WebProcess/GPU/media/RemoteAudioDestinationProxy.messages.in:
3679
3680 2020-03-11  Commit Queue  <commit-queue@webkit.org>
3681
3682         Unreviewed, reverting r258294.
3683         https://bugs.webkit.org/show_bug.cgi?id=208957
3684
3685         Introduced API failure (Requested by perarne on #webkit).
3686
3687         Reverted changeset:
3688
3689         "[macOS] _AXSApplicationAccessibilityEnabled should not be
3690         called"
3691         https://bugs.webkit.org/show_bug.cgi?id=208953
3692         https://trac.webkit.org/changeset/258294
3693
3694 2020-03-11  Kate Cheney  <katherine_cheney@apple.com>
3695
3696         Add a parameter to allow ignoring app-bound domain categorization
3697         https://bugs.webkit.org/show_bug.cgi?id=208949
3698         <rdar://problem/60239187>
3699
3700         Reviewed by Brent Fulgham.
3701
3702         Introduce a new parameter to ignore app-bound domain categorization
3703         for specific WebViews.
3704
3705         * UIProcess/API/APIPageConfiguration.h:
3706         (API::PageConfiguration::ignoresAppBoundDomains const):
3707         (API::PageConfiguration::setIgnoresAppBoundDomains):
3708         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3709         (-[WKWebViewConfiguration _ignoresAppBoundDomains]):
3710         (-[WKWebViewConfiguration _setIgnoresAppBoundDomains:]):
3711         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
3712         * UIProcess/WebPageProxy.cpp:
3713         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
3714
3715 2020-03-11  Per Arne Vollan  <pvollan@apple.com>
3716
3717         [macOS] _AXSApplicationAccessibilityEnabled should not be called
3718         https://bugs.webkit.org/show_bug.cgi?id=208953
3719
3720         Reviewed by Brent Fulgham.
3721
3722         This function should only be called on iOS, not on macOS.
3723
3724         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3725         (WebKit::WebProcessPool::platformInitializeWebProcess):
3726         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
3727         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
3728
3729 2020-03-11  Jiewen Tan  <jiewen_tan@apple.com>
3730
3731         [WebAuthn] Formalize the Keychain schema
3732         https://bugs.webkit.org/show_bug.cgi?id=183533
3733         <rdar://problem/43347926>
3734
3735         Reviewed by Brent Fulgham.
3736
3737         This patch formalizes the schema for the Keychain as follows:
3738         kSecAttrLabel: RP ID
3739         kSecAttrApplicationLabel: Credential ID (auto-gen by Keychain)
3740         kSecAttrApplicationTag: { "id": UserEntity.id, "name": UserEntity.name } (CBOR encoded)
3741         Noted, the vale of kSecAttrApplicationLabel is automatically generated by the Keychain, which is a SHA-1 hash of
3742         the public key.
3743
3744         According to the Step 7. from https://www.w3.org/TR/webauthn/#op-make-cred, the following fields are mandatory
3745         1. rpId (rpEntity.id);
3746         2. userHandle (userEntity.id), this is required for authenticators that support resident keys;
3747         3. credentialId.
3748
3749         Some other optional fields are:
3750         (from https://www.w3.org/TR/webauthn/#dictdef-publickeycredentialrpentity)
3751         1. rpEntity.name;
3752         2. rpEnitty.icon;
3753         (from https://www.w3.org/TR/webauthn/#dictdef-publickeycredentialuserentity)
3754         3. userEntity.displayName;
3755         4. userEntity.name;
3756         5. userEntity.icon;
3757         (from https://www.w3.org/TR/webauthn/#sign-counter)
3758         6. signature counter.
3759
3760         Among the six possible fields, only 4. is chosen to store. Here is why:
3761         For rpEntity, rpEntity.id which is either the domain or the eTLD + 1 of the website is
3762         sufficient enough to either classify the credential or serving the UI. Also, this is the only
3763         trustworthy information that the UserAgent produce. Others could potentially be used by
3764         malicious websites for attacking the Keychain or spoofing/phishing users when being displayed
3765         in the UI. Also, rpEnitty.icon is a URL to the website's favicon, which if not implemented
3766         correctly can be used for tracking.
3767
3768         For userEntity, userEntity.name is the human readable version of userEntity.id, and therefore
3769         is chosen to store such that later on WebKit can pass it to UI client to help users disambiguate
3770         different credentials. And it is necessary as userEntity.id is not guaranteed to be human
3771         readable. Others are abandoned for the very same reason as above.
3772
3773         We hard code a zero value for 'signature counter'. While this is a theoretically interesting
3774         technique for a RP to detect private key cloning, it is unlikely to be useful in practice.
3775         We store the private keys in our SEP. This counter would only be a meaningful protection if
3776         adversaries were able to extract private key data from the SEP without Apple noticing, but
3777         were not able to manipulate this counter to fool the RP.
3778
3779         In terms of the schema,
3780         1) RP ID is needed to query all credentials related, and therefore it needs a column and kSecAttrLabel
3781         is supposed to be human readable;
3782         2) kSecAttrApplicationLabel is the auto generated programmatical identifier for a SecItem, and
3783         therefore is suitable as the credential ID. Given the input to the SHA-1 is generated by us, and
3784         it is only needed to be powerful enough to be unique across the keychain within a device, and potentially
3785         to be unique across different other credential ID for the same user. The SHA-1 collision attack
3786         doesn't seem valid here.
3787         3) kSecAttrApplicationTag is the only other column Keychain allows applications to modify. Therefore,
3788         UserEntity.id and UserEntity.name is bundled to use this slot. The reason to use CBOR here is that
3789         it is more friendly then JSON to encode binaries, and it is used widely in WebAuthn.
3790
3791         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h:
3792         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
3793         (WebKit::LocalAuthenticatorInternal::toArrayBuffer):
3794         (WebKit::LocalAuthenticatorInternal::getExistingCredentials):
3795         (WebKit::LocalAuthenticator::makeCredential):
3796         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification):
3797         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
3798         (WebKit::LocalAuthenticator::getAssertion):
3799         (WebKit::LocalAuthenticator::deleteDuplicateCredential const):
3800         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
3801         (WebKit::MockLocalConnection::filterResponses const):
3802
3803 2020-03-11  Per Arne Vollan  <pvollan@apple.com>
3804
3805         [macOS] Crash under WebKit::WebProcessPool::platformInitialize()
3806         https://bugs.webkit.org/show_bug.cgi?id=208945
3807
3808         Unreviewed temporary compile fix.
3809
3810         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
3811         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
3812
3813 2020-03-11  Per Arne Vollan  <pvollan@apple.com>
3814
3815         [macOS] Crash under WebKit::WebProcessPool::platformInitialize()
3816         https://bugs.webkit.org/show_bug.cgi?id=208945
3817
3818         Reviewed by Tim Horton.
3819
3820         Check that accessibility library is present before attempting to call functions in it.
3821
3822         No new tests, since I am not able to reproduce.
3823
3824         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3825         (WebKit::WebProcessPool::platformInitializeWebProcess):
3826         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
3827         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
3828
3829 2020-03-11  Per Arne Vollan  <pvollan@apple.com>
3830
3831         [macOS] Crash under WebKit::WebProcessPool::platformInitialize()
3832         https://bugs.webkit.org/show_bug.cgi?id=208945
3833         <rdar://problem/60330751>
3834         
3835         Reviewed by Brent Fulgham.
3836
3837         Check that accessibility library is present before attempting to use constants from it.
3838
3839         No new tests, since I am unable to reproduce.
3840
3841         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3842         (WebKit::WebProcessPool::registerNotificationObservers):
3843         (WebKit::WebProcessPool::unregisterNotificationObservers):
3844
3845 2020-03-11  Alex Christensen  <achristensen@webkit.org>
3846
3847         Enable safe browsing warnings in Mac Catalyst WebKit
3848         https://bugs.webkit.org/show_bug.cgi?id=208944
3849         <rdar://problem/58854302>
3850
3851         Reviewed by Tim Horton.
3852
3853         I manually verified using the steps in the radar that it works as one would hope.
3854
3855         * Configurations/WebKit.xcconfig:
3856
3857 2020-03-11  Alex Christensen  <achristensen@webkit.org>
3858
3859         Fix the macCatalyst build after r258250
3860
3861         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
3862         (WebKit::TextCheckingControllerProxy::annotatedSubstringBetweenPositions):
3863
3864 2020-03-11  Chris Dumez  <cdumez@apple.com>
3865
3866         Terminate the Network / Plugin processes when receiving invalid IPC from them
3867         https://bugs.webkit.org/show_bug.cgi?id=208933
3868         <rdar://problem/58026473>
3869
3870         Reviewed by Geoffrey Garen.
3871
3872         * UIProcess/Network/NetworkProcessProxy.cpp:
3873         (WebKit::NetworkProcessProxy::didReceiveInvalidMessage):
3874         * UIProcess/Plugins/PluginProcessProxy.cpp:
3875         (WebKit::PluginProcessProxy::didReceiveInvalidMessage):
3876
3877 2020-03-11  Timothy Horton  <timothy_horton@apple.com>
3878
3879         Fix the macCatalyst build after r258250
3880
3881         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
3882
3883 2020-03-11  Chris Dumez  <cdumez@apple.com>
3884
3885         Assertion hit under WebPageProxy::suspendCurrentPageIfPossible() when bypassing certificate warning page
3886         https://bugs.webkit.org/show_bug.cgi?id=208927
3887         <rdar://problem/55448331>
3888
3889         Reviewed by Alex Christensen.
3890
3891         When suspending a previous page after a process-swap, we refuse to do the suspension if the currently
3892         committed URL does not match the url of the current back/forward list item. This makes sense since we
3893         will store the suspended page on the back/forward list item and restore that back when navigating back
3894         to that item. I had a debug assertion in there to help me figure out how this could happen. It turns
3895         out that calling loadAlternateHTML on the view will replace the content of the view with the provided
3896         HTML string, update the committed URL but not create a new back/forward list item. This is so that
3897         if you reload or go/back to this back/forward list item, we will attempt to load the original URL
3898         again. This would however trip my assertion. I am therefore removing my debug assertion and adding API
3899         test coverage.
3900
3901         * UIProcess/WebPageProxy.cpp:
3902         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
3903
3904 2020-03-11  Alex Christensen  <achristensen@webkit.org>
3905
3906         Introduce ResourceLoadStatisticsParameters and move members from NetworkSessionCreationParameters
3907         https://bugs.webkit.org/show_bug.cgi?id=208895
3908
3909         Reviewed by Youenn Fablet.
3910
3911         No change in behavior yet, but this will help us organize things better.
3912
3913         * NetworkProcess/NetworkProcess.cpp:
3914         (WebKit::NetworkProcess::initializeNetworkProcess):
3915         * NetworkProcess/NetworkSession.cpp:
3916         (WebKit::NetworkSession::NetworkSession):
3917         * NetworkProcess/NetworkSessionCreationParameters.cpp:
3918         (WebKit::NetworkSessionCreationParameters::encode const):
3919         (WebKit::NetworkSessionCreationParameters::decode):
3920         * NetworkProcess/NetworkSessionCreationParameters.h:
3921         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3922         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3923         * Shared/ResourceLoadStatisticsParameters.h: Added.
3924         (WebKit::ResourceLoadStatisticsParameters::encode const):
3925         (WebKit::ResourceLoadStatisticsParameters::decode):
3926         * UIProcess/WebProcessPool.cpp:
3927         (WebKit::WebProcessPool::ensureNetworkProcess):
3928         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3929         (WebKit::WebsiteDataStore::parameters):
3930         * WebKit.xcodeproj/project.pbxproj:
3931
3932 2020-03-11  Chris Dumez  <cdumez@apple.com>
3933
3934         Defer async scripts until DOMContentLoaded or first paint, whichever comes first
3935         https://bugs.webkit.org/show_bug.cgi?id=208896
3936
3937         Reviewed by Darin Adler.
3938
3939         Defer async scripts until DOMContentLoaded or first paint, whichever comes first. In
3940         Bug 207698, we deferred them until DOMContentLoaded, as a first-paint optimization.
3941         However, this seems overly aggressive on pages like wikipedia and it is sufficient
3942         to defer those scripts until first-paint to get the performance win.
3943
3944         * Shared/WebPreferences.yaml:
3945         * UIProcess/API/Cocoa/WKWebView.mm:
3946         (-[WKWebView _setupPageConfiguration:]):
3947
3948 2020-03-11  Commit Queue  <commit-queue@webkit.org>
3949
3950         Unreviewed, reverting r258263.
3951         https://bugs.webkit.org/show_bug.cgi?id=208922
3952
3953         it is breaking internal builds (Requested by youenn on
3954         #webkit).
3955
3956         Reverted changeset:
3957
3958         "Move AudioSession interruption listener code to AudioSession"
3959         https://bugs.webkit.org/show_bug.cgi?id=208714
3960         https://trac.webkit.org/changeset/258263
3961
3962 2020-03-11  youenn fablet  <youenn@apple.com>
3963
3964         Move AudioSession interruption listener code to AudioSession
3965         https://bugs.webkit.org/show_bug.cgi?id=208714
3966
3967         Reviewed by Jer Noble.
3968
3969         Make RemoteAudioSessionProxyManager an observer for AudioSession interruptions.
3970         When being interrupted, notify all WebProcesses and trigger begin/end interruption mechanisms.
3971         We only send interruption to sessions that are active in RemoteAudioSessionProxyManager.
3972         Minor refactorting to move manager proxies from a map to a weak hash set.
3973
3974         * GPUProcess/GPUConnectionToWebProcess.cpp:
3975         (WebKit::GPUConnectionToWebProcess::didClose):
3976         (WebKit::GPUConnectionToWebProcess::audioSessionProxy):
3977         * GPUProcess/media/RemoteAudioSessionProxy.cpp:
3978         (WebKit::RemoteAudioSessionProxy::setCategory):
3979         (WebKit::RemoteAudioSessionProxy::setPreferredBufferSize):
3980         (WebKit::RemoteAudioSessionProxy::tryToSetActive):
3981         * GPUProcess/media/RemoteAudioSessionProxyManager.cpp:
3982         (WebKit::RemoteAudioSessionProxyManager::RemoteAudioSessionProxyManager):
3983         (WebKit::RemoteAudioSessionProxyManager::~RemoteAudioSessionProxyManager):
3984         (WebKit::RemoteAudioSessionProxyManager::addProxy):
3985         (WebKit::RemoteAudioSessionProxyManager::removeProxy):
3986         (WebKit::RemoteAudioSessionProxyManager::setCategoryForProcess):
3987         (WebKit::RemoteAudioSessionProxyManager::setPreferredBufferSizeForProcess):
3988         (WebKit::RemoteAudioSessionProxyManager::tryToSetActiveForProcess):
3989         (WebKit::RemoteAudioSessionProxyManager::beginAudioSessionInterruption):
3990         (WebKit::RemoteAudioSessionProxyManager::endAudioSessionInterruption):
3991         * GPUProcess/media/RemoteAudioSessionProxyManager.h:
3992         * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp:
3993         * GPUProcess/media/ios/RemoteMediaSessionHelperProxy.h:
3994         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp:
3995         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.h:
3996         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.messages.in:
3997
3998 2020-03-10  Don Olmstead  <don.olmstead@sony.com>
3999
4000         [GPU Process] Work towards compiling out on non-Cocoa ports
4001         https://bugs.webkit.org/show_bug.cgi?id=208899
4002
4003         Reviewed by Darin Adler.
4004
4005         Work through some compilation issues on non-Cocoa ports when attempting to build
4006         out the GPU Process. Fix platform guards for some methods. Fix compilation issues
4007         for non-unified builds.
4008
4009         Add in CMake listing of messages.in and include directories required for building
4010         with ENABLE_GPU_PROCESS.
4011
4012         * CMakeLists.txt:
4013         * GPUProcess/GPUConnectionToWebProcess.cpp:
4014         (WebKit::GPUConnectionToWebProcess::didClose):
4015         * GPUProcess/GPUConnectionToWebProcess.messages.in:
4016         * GPUProcess/GPUProcess.cpp:
4017         * GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.h:
4018         * GPUProcess/graphics/RemoteImageBufferProxy.h:
4019         (WebKit::RemoteImageBufferProxy::create):
4020         * GPUProcess/graphics/RemoteRenderingBackendProxy.cpp:
4021         * GPUProcess/graphics/RemoteRenderingBackendProxy.h:
4022         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
4023         (WebKit::RemoteMediaPlayerProxy::getConfiguration):
4024         (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenGravity):
4025         (WebKit::RemoteMediaPlayerProxy::updateVideoFullscreenInlineImage):
4026         (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenMode):
4027         (WebKit::RemoteMediaPlayerProxy::videoFullscreenStandbyChanged):
4028         (WebKit::RemoteMediaPlayerProxy::mediaPlayerReadyStateChanged):
4029         (WebKit::RemoteMediaPlayerProxy::notifyTrackModeChanged):
4030         * GPUProcess/media/RemoteMediaPlayerProxy.h:
4031         * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
4032         * UIProcess/GPU/GPUProcessProxy.h:
4033         * WebProcess/GPU/GPUProcessConnection.cpp:
4034         * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
4035         * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h:
4036         * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h:
4037         * WebProcess/GPU/graphics/RemoteRenderingBackend.cpp:
4038         * WebProcess/GPU/media/AudioTrackPrivateRemote.h:
4039         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
4040         * WebProcess/GPU/media/TextTrackPrivateRemote.h:
4041
4042 2020-03-10  Per Arne Vollan  <pvollan@apple.com>
4043
4044         [iOS] A syscall is denied by the sandbox
4045         https://bugs.webkit.org/show_bug.cgi?id=208892
4046         <rdar://problem/60294880>
4047
4048         Reviewed by Brent Fulgham.
4049
4050         Add denied syscall to sandbox on iOS.
4051
4052         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
4053
4054 2020-03-08  Darin Adler  <darin@apple.com>
4055
4056         Make TextIterator::range return a SimpleRange
4057         https://bugs.webkit.org/show_bug.cgi?id=208797
4058
4059         Reviewed by Don Olmstead.
4060
4061         * WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm:
4062         (-[WKDOMTextIterator currentRange]): Use createLiveRange.
4063
4064         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: Added includes.
4065
4066 2020-03-10  Don Olmstead  <don.olmstead@sony.com>
4067
4068         Non-unified build fixes early March 2020 edition
4069         https://bugs.webkit.org/show_bug.cgi?id=208897
4070
4071         Unreviewed build fix.
4072
4073         * NetworkProcess/NetworkLoadChecker.h:
4074
4075 2020-03-10  Kate Cheney  <katherine_cheney@apple.com>
4076
4077         Some common domains should always be App-bound domains
4078         https://bugs.webkit.org/show_bug.cgi?id=208893
4079          <rdar://problem/60280943>
4080
4081         Reviewed by Brent Fulgham.
4082
4083         Some domains, like about:blank and pages loaded from files should
4084         always be considered app-bound.
4085
4086         * UIProcess/WebPageProxy.cpp:
4087         (WebKit::shouldBeTreatedAsAppBound):
4088         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
4089
4090 2020-03-10  Devin Rousso  <drousso@apple.com>
4091
4092         Web Inspector: make `WebKit::WebInspectorProxy::m_isOpening` GTK only
4093         https://bugs.webkit.org/show_bug.cgi?id=208831
4094         <rdar://problem/57720692>
4095
4096         Reviewed by Brian Burg.
4097
4098         * UIProcess/Inspector/WebInspectorProxy.h:
4099         * UIProcess/Inspector/WebInspectorProxy.cpp:
4100         (WebKit::WebInspectorProxy::open):
4101
4102 2020-03-10  David Kilzer  <ddkilzer@apple.com>
4103
4104         [CoreIPC] WebPasteboardProxy::SetPasteboardBufferForType uses "0" for both uint64_t and a pointer value
4105         <https://webkit.org/b/208879>
4106         <rdar://problem/60165624>
4107
4108         Reviewed by Wenson Hsieh.
4109
4110         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
4111         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
4112         - Change 0 to nullptr to make code easier to read.
4113
4114 2020-03-10  Andres Gonzalez  <andresg_22@apple.com>
4115
4116         Enable accessibility IsolatedTree in WebKit.
4117         https://bugs.webkit.org/show_bug.cgi?id=208881
4118
4119         Reviewed by Chris Fleizach.
4120
4121         Sets the default value of accessibility IsolatedTree support to true.
4122
4123         * Shared/WebPreferences.yaml:
4124
4125 2020-03-10  Megan Gardner  <megan_gardner@apple.com>
4126
4127         File upload cancels before files can be uploaded.
4128         https://bugs.webkit.org/show_bug.cgi?id=208846
4129         <rdar://problem/60244249>
4130
4131         Reviewed by Tim Horton.
4132
4133         With the new UIContextMenus, we needed to cancel in order for everything to be 
4134         reset correctly in WebCore. But this can only be done in the animation completion
4135         handler, but we only want to cancel if we aren't presenting a different picker.
4136
4137         * UIProcess/ios/forms/WKFileUploadPanel.mm:
4138         (-[WKFileUploadPanel contextMenuInteraction:configurationForMenuAtLocation:]):
4139         (-[WKFileUploadPanel contextMenuInteraction:willEndForConfiguration:animator:]):
4140         (-[WKFileUploadPanel ensureContextMenuInteraction]):
4141
4142 2020-03-10  youenn fablet  <youenn@apple.com>
4143
4144         Make sure that ServiceWorkerFrameLoaderClient lifetime exceeds its frame lifetime
4145         https://bugs.webkit.org/show_bug.cgi?id=208855
4146         <rdar://problem/60187332>
4147
4148         Reviewed by Geoffrey Garen.
4149
4150         In case connection is destroyed, for instance due to network process crashing,
4151         we destroy all service worker frame loader clients.
4152         This is too soon as service worker thread proxy is refcounted and can last longer.
4153         For that reason, we now let the SWContextManager handle the lifetime of the frame loader clients.
4154         Drive-by fix: generate a new frame identifier instead of using an internal counter which can be wrong in case of new connection
4155         and might clash with other frame identifiers now that service workers can run in process with pages.
4156
4157         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
4158         (WebKit::ServiceWorkerFrameLoaderCl