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