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