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