UI↔Web deadlock when printing with a JavaScript alert visible
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-04-17  Tim Horton  <timothy_horton@apple.com>
2
3         UI↔Web deadlock when printing with a JavaScript alert visible
4         https://bugs.webkit.org/show_bug.cgi?id=196839
5         <rdar://problem/49157642>
6
7         Reviewed by Andy Estes.
8
9         * Platform/IPC/Connection.cpp:
10         (IPC::Connection::dispatchWorkQueueMessageReceiverMessage):
11         (IPC::Connection::sendSyncReply):
12         (IPC::Connection::dispatchSyncMessage):
13         * Platform/IPC/Connection.h:
14         (IPC::Connection::hasOutstandingOutgoingSynchronousReplies const):
15         Keep track of whether we owe the other side of the connection any
16         delayed sync replies.
17
18         * UIProcess/API/Cocoa/WKWebView.mm:
19         (-[WKWebView _webViewPrintFormatter]):
20         Most actions one can take with a _WKWebViewPrintFormatter involve
21         synchronously messaging the Web Content process with an infinite timeout.
22         Doing so while the Web Content process is awaiting a reply to a deferred-reply
23         synchronous message (like, say, an alert()) results in an app-destroying deadlock.
24         Instead of that, return a nil _WKWebViewPrintFormatter, indicating to the client
25         that we can't print right now.
26
27         * UIProcess/ios/WKContentView.mm:
28         (-[WKContentView _wk_pageCountForPrintFormatter:]):
29         (-[WKContentView _wk_printedDocument]):
30         The above isn't sufficient, though, because a sync message could arrive and
31         be handled between creation and use of the _WKWebViewPrintFormatter.
32         So, we also bail with a zero page count and null CGPDFDocument immediately
33         before we would send a sync message to the Web Content process. Clients
34         handle this less gracefully (e.g. showing a zero page PDF), but it is
35         very rare compared to the above case.
36
37 2019-04-17  Zalan Bujtas  <zalan@apple.com>
38
39         [ContentChangeObserver] Use aria role as a hint whether a tap should result in a synthetic click
40         https://bugs.webkit.org/show_bug.cgi?id=196988
41         <rdar://problem/49955328>
42
43         Reviewed by Simon Fraser.
44
45         Tapping on elements with cretain aria role attributes should trigger synthetic click the same way it does on form control elements. 
46
47         * WebProcess/WebPage/ios/WebPageIOS.mm:
48         (WebKit::isAriaRoleForImmediateClick):
49         (WebKit::nodeAlwaysRequiresClick):
50         (WebKit::WebPage::handleSyntheticClick):
51
52 2019-04-17  Alex Christensen  <achristensen@webkit.org>
53
54         WKRetainPtr's adoption constructor should be private
55         https://bugs.webkit.org/show_bug.cgi?id=197019
56
57         Reviewed by Tim Horton.
58
59         RefPtr and RetainPtr have already done this.  It makes us use nicer syntax.
60
61         * UIProcess/API/C/WKContext.cpp:
62         (WKContextSetDownloadClient):
63         * UIProcess/API/cpp/WKRetainPtr.h:
64         (WebKit::WKRetainPtr::WKRetainPtr):
65         (WebKit::adoptWK):
66
67 2019-04-17  Alex Christensen  <achristensen@webkit.org>
68
69         Fix crash during teardown of PingLoad
70         https://bugs.webkit.org/show_bug.cgi?id=197024
71         <rdar://problem/49973077>
72
73         Reviewed by Jer Noble.
74
75         * NetworkProcess/PingLoad.cpp:
76         (WebKit::PingLoad::initialize):
77         Early return if weakThis is null.
78
79 2019-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
80
81         REGRESSION (r243926): [iOS] Release assertion when computing editor state during an overflow scroll triggered by layout
82         https://bugs.webkit.org/show_bug.cgi?id=197012
83         <rdar://problem/49908848>
84
85         Reviewed by Simon Fraser.
86
87         We hit the release assertion due to the following sequence of events:
88         - Dispatch a queued event (in this case, a scroll event)
89         - Invoke the scroll event listener, which modifies layout in some way
90         - This scrolls an overflow scrollable container under the scope of layout
91         - Overflow scrolling then calls didChangeSelection and triggers an editor state update, which updates layout
92
93         In the case where the selection is in the main frame, we bail early due to the check for recursive layout (i.e.
94         frameView->layoutContext().isInRenderTreeLayout()). However, in the case where the selection is inside a
95         subframe, we end up skipping past this check, since the subframe's FrameView isn't currently laying out, and so
96         we end up hitting the release assertion underneath the early return.
97
98         To fix this, simply defer editor state updates due to overflow scrolling until the next remote layer tree commit
99         instead of computing and sending the information immediately. While this only defers editor state updates during
100         overflow scrolling, <rdar://problem/47258878> tracks making editor state updates deferred in the general case.
101
102         Test: editing/selection/overflow-scroll-while-selecting-text.html
103
104         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
105         (WebKit::WebEditorClient::overflowScrollPositionChanged):
106         * WebProcess/WebPage/WebPage.cpp:
107         (WebKit::WebPage::didChangeOverflowScrollPosition):
108         (WebKit::WebPage::didChangeSelection):
109         (WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition):
110         * WebProcess/WebPage/WebPage.h:
111
112 2019-04-17  Chris Dumez  <cdumez@apple.com>
113
114         Remember device orientation permission for the duration of the browsing session
115         https://bugs.webkit.org/show_bug.cgi?id=196992
116         <rdar://problem/49946067>
117
118         Reviewed by Alex Christensen.
119
120         Implement caching of device orientation permission decisions on the WebDeviceOrientationAndMotionAccessController,
121         which is owned by the WebsiteDataStore. This way, if we already prompted the user of a given origin, we will
122         remember the previous decision for the duration of the session and not prompt again.
123
124         * Shared/WebsitePoliciesData.cpp:
125         (WebKit::WebsitePoliciesData::encode const):
126         (WebKit::WebsitePoliciesData::decode):
127         * Shared/WebsitePoliciesData.h:
128         * UIProcess/API/APIWebsitePolicies.cpp:
129         (API::WebsitePolicies::copy const):
130         (API::WebsitePolicies::data):
131         * UIProcess/API/APIWebsitePolicies.h:
132         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
133         (toDeviceOrientationOrMotionPermissionState):
134         (-[WKWebpagePreferences _setDeviceOrientationAndMotionAccessPolicy:]):
135         (toWKWebsiteDeviceOrientationAndMotionAccessPolicy):
136         (-[WKWebpagePreferences _deviceOrientationAndMotionAccessPolicy]):
137         * UIProcess/WebPageProxy.cpp:
138         (WebKit::WebPageProxy::shouldAllowDeviceOrientationAndMotionAccess):
139         * UIProcess/WebPageProxy.h:
140         * UIProcess/WebPageProxy.messages.in:
141         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.cpp: Added.
142         (WebKit::WebDeviceOrientationAndMotionAccessController::shouldAllowDeviceOrientationAndMotionAccess):
143         (WebKit::WebDeviceOrientationAndMotionAccessController::deviceOrientationPermission const):
144         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.h: Copied from Source/WebCore/dom/DeviceOrientationAndMotionAccessController.h.
145         * UIProcess/WebsiteData/WebsiteDataStore.h:
146         (WebKit::WebsiteDataStore::deviceOrientationAndMotionAccessController):
147         * WebKit.xcodeproj/project.pbxproj:
148         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
149         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
150         * WebProcess/WebCoreSupport/WebChromeClient.h:
151         * WebProcess/WebPage/WebPage.cpp:
152         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
153         * WebProcess/WebPage/WebPage.h:
154
155 2019-04-16  Andy Estes  <aestes@apple.com>
156
157         [iOSMac] Use UIDocumentPickerViewController for picking files
158         https://bugs.webkit.org/show_bug.cgi?id=196999
159         <rdar://problem/49961414>
160
161         Reviewed by Tim Horton.
162
163         * UIProcess/ios/forms/WKFileUploadPanel.mm:
164         (-[WKFileUploadPanel _showDocumentPickerMenu]):
165         Changed to present a UIDocumentPickerViewController on iOSMac.
166
167         (-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]):
168         (-[WKFileUploadPanel documentPicker:didPickDocumentAtURL:]):
169         Replaced a deprecated delegate method implementation.
170
171 2019-04-16  Wenson Hsieh  <wenson_hsieh@apple.com>
172
173         [iOS] [WebKit2] Add support for honoring -[UIMenuItem dontDismiss]
174         https://bugs.webkit.org/show_bug.cgi?id=196919
175         <rdar://problem/41630459>
176
177         Reviewed by Tim Horton.
178
179         Adds modern WebKit support for -dontDismiss by implementing a couple of new platform hooks. Covered by a new
180         layout test: editing/selection/ios/selection-after-changing-text-with-callout-menu.html.
181
182         * Platform/spi/ios/UIKitSPI.h:
183
184         Declare the private -dontDismiss property of UIMenuItem.
185
186         * UIProcess/API/Cocoa/WKWebView.mm:
187         (-[WKWebView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
188
189         Additionally teach the web view (not just the content view) to respond to the hook. This matters in the case
190         where the WebKit client (most notably, Mail) overrides WKWebView methods to define custom actions in the menu
191         controller. This scenario is exercised by the new layout test.
192
193         * UIProcess/ios/WKContentViewInteraction.h:
194         * UIProcess/ios/WKContentViewInteraction.mm:
195         (-[WKContentView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
196
197         If an action was performed where callout bar fading was ignored, then in WebKit, don't allow selection changes
198         to fade the callout bar until after the next remote layer tree commit.
199
200         (-[WKContentView _updateChangedSelection:]):
201
202         Stop suppressing selection updates when showing B/I/U controls, now that we can properly honor the -dontDismiss
203         property. This was originally introduced in <rdar://problem/15199925>, presumably to ensure that B/I/U buttons
204         (which have -dontDismiss set to YES) don't trigger selection change and end up dismissing themselves; however,
205         if triggering B/I/U actually changes the selection rects, this also means that the selection rects on-screen
206         would be stale after triggering these actions. This effect is most noticeable when bolding text.
207
208         (-[WKContentView shouldAllowHidingSelectionCommands]):
209
210 2019-04-16  Ross Kirsling  <ross.kirsling@sony.com>
211
212         Unreviewed non-unified build fix after r244307.
213
214         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
215
216 2019-04-16  Megan Gardner  <megan_gardner@apple.com>
217
218         Allow sharing from imageSheet on an image document
219         https://bugs.webkit.org/show_bug.cgi?id=196891
220         <rdar://problem/25377386>
221
222         Reviewed by Tim Horton.
223
224         Allow sharing from an image sheet generated from an image document
225         by storing the image URL and using it as a fallback for the URL.
226         Store it as an image on WKElementAction to not accidentally trigger
227         any actions that should actually be associated with pure URLs.
228
229         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
230         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
231         (-[_WKActivatedElementInfo _initWithInteractionInformationAtPosition:]):
232         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:]):
233         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:userInfo:]):
234         (-[_WKActivatedElementInfo imageURL]):
235         (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:]): Deleted.
236         (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:userInfo:]): Deleted.
237         * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
238         * UIProcess/API/Cocoa/_WKElementAction.mm:
239         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
240         * UIProcess/ios/WKActionSheetAssistant.mm:
241         (-[WKActionSheetAssistant showImageSheet]):
242         (-[WKActionSheetAssistant defaultActionsForImageSheet:]):
243         (-[WKActionSheetAssistant showLinkSheet]):
244         * UIProcess/ios/WKContentViewInteraction.mm:
245         (-[WKContentView _showAttachmentSheet]):
246         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
247         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
248
249 2019-04-16  Wenson Hsieh  <wenson_hsieh@apple.com>
250
251         [Cocoa] Add a way for Apple-internal clients to opt into recommended compatibility mode
252         https://bugs.webkit.org/show_bug.cgi?id=196977
253         <rdar://problem/49871194>
254
255         Reviewed by Tim Horton.
256
257         Add a helper method to query whether the navigation client should bypass policy safeguards when determining the
258         recommended compatibility mode. We bypass policy safeguards in Cocoa platforms if the navigation delegate
259         implements the new navigation delegate API.
260
261         * UIProcess/API/APINavigationClient.h:
262         (API::NavigationClient::shouldBypassCompatibilityModeSafeguards const):
263         * UIProcess/Cocoa/NavigationState.h:
264         * UIProcess/Cocoa/NavigationState.mm:
265         (WebKit::NavigationState::NavigationClient::shouldBypassCompatibilityModeSafeguards const):
266
267 2019-04-16  Per Arne Vollan  <pvollan@apple.com>
268
269         -[WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:] never returns _WKWebsiteDataTypeCredentials
270         https://bugs.webkit.org/show_bug.cgi?id=196991
271         <rdar://problem/45507423>
272
273         Reviewed by Brent Fulgham.
274
275         The credentials are stored in the Network process. To enable fetching credentials from the Network process,
276         a proper process access type needs to be set for the credential Website data type.
277
278         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
279         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
280
281 2019-04-16  Alex Christensen  <achristensen@webkit.org>
282
283         REGRESSION(r244162) Clearing website data from ephemeral WKWebsiteDataStore should finish instead of asserting or hanging
284         https://bugs.webkit.org/show_bug.cgi?id=196995
285
286         Reviewed by Brady Eidson.
287
288         Always call CompletionHandlers.  Otherwise things hang or assert.
289         I added an API test that asserts without this change so we don't regress this again.
290
291         * NetworkProcess/cache/CacheStorageEngine.cpp:
292         (WebKit::CacheStorage::Engine::clearAllCaches):
293         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
294
295 2019-04-16  Chris Dumez  <cdumez@apple.com>
296
297         URL set by document.open() is not communicated to the UIProcess
298         https://bugs.webkit.org/show_bug.cgi?id=196941
299         <rdar://problem/49237544>
300
301         Reviewed by Geoff Garen.
302
303         Whenever the UIProcess is notified of an explicit document.open() call, update the
304         PageLoadState to make sure the URL is up-to-date. Also make sure the page / process
305         knows it committed a load (i.e. It is no longer showing the initially empty document).
306
307         * UIProcess/PageLoadState.cpp:
308         (WebKit::PageLoadState::didExplicitOpen):
309         * UIProcess/PageLoadState.h:
310         * UIProcess/WebPageProxy.cpp:
311         (WebKit::WebPageProxy::didExplicitOpenForFrame):
312         * UIProcess/WebPageProxy.h:
313         * UIProcess/WebPageProxy.messages.in:
314         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
315         (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen):
316         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
317
318 2019-04-16  Chris Dumez  <cdumez@apple.com>
319
320         Show prompt for device orientation access if the client does not implement the corresponding API delegate
321         https://bugs.webkit.org/show_bug.cgi?id=196971
322         <rdar://problem/49945840>
323
324         Reviewed by Alex Christensen.
325
326         Show prompt for device orientation access if the client does not implement the corresponding
327         API delegate, instead of rejecting access by default.
328
329         * UIProcess/Cocoa/UIDelegate.mm:
330         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
331         * UIProcess/Cocoa/WKOrientationAccessAlert.h: Added.
332         * UIProcess/Cocoa/WKOrientationAccessAlert.mm: Added.
333         (WebKit::presentOrientationAccessAlert):
334         * WebKit.xcodeproj/project.pbxproj:
335
336 2019-04-16  Zalan Bujtas  <zalan@apple.com>
337
338         REGRESSION(r243557)[ContentChangeObserver] Need to double tap text formatting elements in MS Word web app
339         https://bugs.webkit.org/show_bug.cgi?id=196975
340         <rdar://problem/49489849>
341
342         Reviewed by Simon Fraser.
343
344         This patch ensures that we always proceed with synthetic click on form elements.
345
346         Covered by existing tests.
347
348         * WebProcess/WebPage/ios/WebPageIOS.mm:
349         (WebKit::WebPage::handleSyntheticClick):
350
351 2019-04-16  Timothy Hatcher  <timothy@apple.com>
352
353         FrameView base background color always starts white.
354         https://bugs.webkit.org/show_bug.cgi?id=196976
355
356         Reviewed by Beth Dakin.
357
358         * WebProcess/WebPage/WebPage.cpp:
359         (WebKit::WebPage::WebPage): Set m_backgroundColor before calling
360         WebFrame::createWithCoreMainFrame so the call to create the FrameView
361         for the empty page in transitionToCommittedForNewPage() gets
362         the correct color from WebPage.
363
364 2019-04-16  Ryan Haddad  <ryanhaddad@apple.com>
365
366         Unreviewed, fix the build with recent SDKs.
367
368         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
369         (WebKit::WKWebViewState::store):
370
371 2019-04-16  Commit Queue  <commit-queue@webkit.org>
372
373         Unreviewed, rolling out r244321.
374         https://bugs.webkit.org/show_bug.cgi?id=196968
375
376         Causing all WK2 Debug builds to exit early after Assertion
377         failures. (Requested by ShawnRoberts on #webkit).
378
379         Reverted changeset:
380
381         "URL set by document.open() is not communicated to the
382         UIProcess"
383         https://bugs.webkit.org/show_bug.cgi?id=196941
384         https://trac.webkit.org/changeset/244321
385
386 2019-04-15  Joseph Pecoraro  <pecoraro@apple.com>
387
388         Web Inspector: CRASH when reopening tab with docked inspector on crashed page
389         https://bugs.webkit.org/show_bug.cgi?id=196954
390         <rdar://problem/48716433>
391
392         Reviewed by Ryosuke Niwa.
393
394         * UIProcess/mac/WebInspectorProxyMac.mm:
395         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
396
397 2019-04-15  Chris Dumez  <cdumez@apple.com>
398
399         URL set by document.open() is not communicated to the UIProcess
400         https://bugs.webkit.org/show_bug.cgi?id=196941
401         <rdar://problem/49237544>
402
403         Reviewed by Geoffrey Garen.
404
405         Whenever the UIProcess is notified of an explicit document.open() call, update the
406         PageLoadState to make sure the URL is up-to-date. Also make sure the page / process
407         knows it committed a load (i.e. It is no longer showing the initially empty document).
408
409         * UIProcess/PageLoadState.cpp:
410         (WebKit::PageLoadState::didExplicitOpen):
411         * UIProcess/PageLoadState.h:
412         * UIProcess/WebPageProxy.cpp:
413         (WebKit::WebPageProxy::didExplicitOpenForFrame):
414         * UIProcess/WebPageProxy.h:
415         * UIProcess/WebPageProxy.messages.in:
416         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
417         (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen):
418         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
419
420 2019-04-15  Alex Christensen  <achristensen@webkit.org>
421
422         Stop using hyphenationFactor
423         https://bugs.webkit.org/show_bug.cgi?id=196949
424         <rdar://problem/49779594>
425
426         Reviewed by Geoffrey Garen.
427
428         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
429         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
430         I added this use of hyphenationFactor in r241124 but the other changes in that revision make the use of hyphenationFactor redundant.
431         There is a reason to remove it in the radar.
432
433 2019-04-15  Alex Christensen  <achristensen@webkit.org>
434
435         Forward declare WKWebView in _WKDiagnosticLoggingDelegate.h
436
437         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
438         This fixes builds where _WKDiagnosticLoggingDelegate.h is the only WebKit header included, such as my work on rdar://problem/35175989
439
440 2019-04-15  Jer Noble  <jer.noble@apple.com>
441
442         Add a DiagnosticLogging method taking an arbitrary dictionary of values.
443         https://bugs.webkit.org/show_bug.cgi?id=196773
444
445         Reviewed by Alex Christensen.
446
447         In addition to adding the new logging delegate method (and piping everything into it), 
448         add a new APIObject class to represent a signed integer.
449
450         * Shared/API/APINumber.h:
451         * Shared/API/APIObject.h:
452         * Shared/Cocoa/APIObject.mm:
453         (API::Object::newObject):
454         * Shared/Cocoa/WKNSNumber.mm:
455         (-[WKNSNumber dealloc]):
456         (-[WKNSNumber objCType]):
457         (-[WKNSNumber getValue:]):
458         (-[WKNSNumber longLongValue]):
459         (-[WKNSNumber _apiObject]):
460         * Shared/UserData.cpp:
461         (WebKit::UserData::encode):
462         (WebKit::UserData::decode):
463         * UIProcess/API/APIDiagnosticLoggingClient.h:
464         * UIProcess/API/C/WKPageDiagnosticLoggingClient.h:
465         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
466         * UIProcess/Cocoa/DiagnosticLoggingClient.h:
467         * UIProcess/Cocoa/DiagnosticLoggingClient.mm:
468         (WebKit::DiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
469         * UIProcess/ProvisionalPageProxy.cpp:
470         (WebKit::ProvisionalPageProxy::didReceiveMessage):
471         * UIProcess/WebPageDiagnosticLoggingClient.cpp:
472         (WebKit::WebPageDiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
473         * UIProcess/WebPageDiagnosticLoggingClient.h:
474         * UIProcess/WebPageProxy.cpp:
475         (WebKit::WebPageProxy::logDiagnosticMessageWithValueDictionary):
476         * UIProcess/WebPageProxy.h:
477         * UIProcess/WebPageProxy.messages.in:
478         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
479         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
480         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
481
482 2019-04-15  Dean Jackson  <dino@apple.com>
483
484         Provide option to not create a longpress gesture recognizer
485         https://bugs.webkit.org/show_bug.cgi?id=196937
486         <rdar://problem/49918278>
487
488         Build fix for iOS platforms that don't have link preview.
489
490         * UIProcess/ios/WKContentViewInteraction.mm:
491         (-[WKContentView setupInteraction]):
492
493 2019-04-15  Brent Fulgham  <bfulgham@apple.com>
494
495         InjectedBundle parameters often need initialization function called before unarchiving
496         https://bugs.webkit.org/show_bug.cgi?id=189709
497         <rdar://problem/44573653>
498
499         Reviewed by Ryosuke Niwa.
500
501         Handle the case where the InjectedBundle parameters do not successfully decode because they contain
502         an unexpected class from the embedding program. If this happens, try decoding the bundle parameters
503         after the bundle initialiation function runs, which gives the embedding program the opportunity to
504         register additional classes that are safe for serialization.
505
506         Extend WKWebProcessPlugIn with a method that returns the names of any custom classes that need
507         to be serialized by the InjectedBundle.
508         
509         Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'.
510         Revise 'initialize' to call this new method.
511
512         * WebProcess/InjectedBundle/InjectedBundle.h:
513         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
514         (WebKit::InjectedBundle::initialize): Use the new method.
515         (WebKit::InjectedBundle::decodeBundleParameters): Added.
516         (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete
517         'classesForCoder' method to unarchive the passed bundle parameters, rather than the
518         NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the
519         NSDictionary object may itself hold other kinds of objects.
520         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
521         (WebKit::WKWebProcessPlugIn::additionalClassesForParameterCoder): Added.
522
523 2019-04-15  Dean Jackson  <dino@apple.com>
524
525         Provide option to not create a longpress gesture recognizer
526         https://bugs.webkit.org/show_bug.cgi?id=196937
527         <rdar://problem/49918278>
528
529         Reviewed by Antoine Quint.
530
531         A WebKitAdditions file has changed name to WKContentViewInteractionWKInteraction.mm.
532
533         Add a property to toggle if we should add a long press gesture
534         recognizer.
535
536         * UIProcess/ios/WKContentViewInteraction.h:
537         * UIProcess/ios/WKContentViewInteraction.mm:
538         (-[WKContentView setupInteraction]):
539         (shouldUsePreviewForLongPress):
540         (-[WKContentView shouldUsePreviewForLongPress]):
541
542 2019-04-15  Don Olmstead  <don.olmstead@sony.com>
543
544         [CMake] WebCore derived sources should only be referenced inside WebCore
545         https://bugs.webkit.org/show_bug.cgi?id=196904
546
547         Reviewed by Konstantin Tokarev.
548
549         Remove reference to DERIVED_SOURCES_WEBCORE_DIR in PlatformMac.cmake.
550
551         * PlatformMac.cmake:
552
553 2019-04-15  Zalan Bujtas  <zalan@apple.com>
554
555         DrawingArea should only capture painting related milestones
556         https://bugs.webkit.org/show_bug.cgi?id=196926
557         <rdar://problem/48003845>
558
559         Reviewed by Tim Horton.
560
561         While dispatching layout milestones (mixture of layout and painting items), the associated drawing areas should only capture the painting related milestones.
562         These captured milestones get dispatched later in the commit handler to ensure that they are not forwarded prematurely.
563         However the truly layout related milestones (e.g. DidFirstVisuallyNonEmptyLayout) should be dispatched right away with no delay.
564
565         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
566         (WebKit::RemoteLayerTreeTransaction::newlyReachedPaintingMilestones const):
567         (WebKit::RemoteLayerTreeTransaction::setNewlyReachedPaintingMilestones):
568         (WebKit::RemoteLayerTreeTransaction::newlyReachedLayoutMilestones const): Deleted.
569         (WebKit::RemoteLayerTreeTransaction::setNewlyReachedLayoutMilestones): Deleted.
570         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
571         (WebKit::RemoteLayerTreeTransaction::encode const):
572         (WebKit::RemoteLayerTreeTransaction::decode):
573         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
574         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
575         * WebProcess/WebPage/DrawingArea.h:
576         (WebKit::DrawingArea::addMilestonesToDispatch):
577         (WebKit::DrawingArea::dispatchDidReachLayoutMilestone): Deleted.
578         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
579         (WebKit::RemoteLayerTreeDrawingArea::addMilestonesToDispatch):
580         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
581         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
582         (WebKit::RemoteLayerTreeDrawingArea::dispatchDidReachLayoutMilestone): Deleted.
583         * WebProcess/WebPage/WebPage.cpp:
584         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
585         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
586         (WebKit::TiledCoreAnimationDrawingArea::addMilestonesToDispatch):
587         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
588         (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedPaintingMilestones):
589         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
590         (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones): Deleted.
591         (WebKit::TiledCoreAnimationDrawingArea::dispatchDidReachLayoutMilestone): Deleted.
592
593 2019-04-15  John Wilander  <wilander@apple.com>
594
595         Send delayed Ad Click Attribution conversion requests to the click source
596         https://bugs.webkit.org/show_bug.cgi?id=196838
597         <rdar://problem/47650157>
598
599         Reviewed by Chris Dumez and Youenn Fablet.
600
601         This patch schedules a conversion request with appropriate data going to the
602         click source as a result of an ad click conversion.
603
604         WebKit::AdClickAttributionManager makes use of existing WebKit::PingLoad
605         infrastructure to make the request. This will probably be reworked into a
606         dedicated load class further on.
607
608         New test infrastructure allows for an override of both the conversion URL
609         and the 24-48 hour timer.
610
611         * NetworkProcess/AdClickAttributionManager.cpp: Added.
612         (WebKit::AdClickAttributionManager::ensureDestinationMapForSource):
613         (WebKit::AdClickAttributionManager::store):
614         (WebKit::AdClickAttributionManager::startTimer):
615             Convenience function to support test override.
616         (WebKit::AdClickAttributionManager::convert):
617             This function now sets the timer.
618         (WebKit::AdClickAttributionManager::fireConversionRequest):
619             Fire an individual request.
620         (WebKit::AdClickAttributionManager::firePendingConversionRequests):
621             This is the timer function that iterates over all pending attributions.
622         (WebKit::AdClickAttributionManager::clear):
623             Now clears the two new test settings members.
624         (WebKit::AdClickAttributionManager::toString const):
625         * NetworkProcess/AdClickAttributionManager.h: Renamed from Source/WebKit/NetworkProcess/NetworkAdClickAttribution.h.
626         (WebKit::AdClickAttributionManager::AdClickAttributionManager):
627         (WebKit::AdClickAttributionManager::setPingLoadFunction):
628         (WebKit::AdClickAttributionManager::setOverrideTimerForTesting):
629         (WebKit::AdClickAttributionManager::setConversionURLForTesting):
630         * NetworkProcess/NetworkAdClickAttribution.cpp: Renamed from Source/WebKit/NetworkProcess/NetworkAdClickAttribution.cpp.
631         * NetworkProcess/NetworkProcess.cpp:
632         (WebKit::NetworkProcess::storeAdClickAttribution):
633         (WebKit::NetworkProcess::dumpAdClickAttribution):
634         (WebKit::NetworkProcess::clearAdClickAttribution):
635         (WebKit::NetworkProcess::setAdClickAttributionOverrideTimerForTesting):
636         (WebKit::NetworkProcess::setAdClickAttributionConversionURLForTesting):
637         * NetworkProcess/NetworkProcess.h:
638         * NetworkProcess/NetworkProcess.messages.in:
639         * NetworkProcess/NetworkSession.cpp:
640         (WebKit::NetworkSession::NetworkSession):
641         (WebKit::NetworkSession::setAdClickAttributionOverrideTimerForTesting):
642         (WebKit::NetworkSession::setAdClickAttributionConversionURLForTesting):
643         * NetworkProcess/NetworkSession.h:
644         * NetworkProcess/PingLoad.cpp:
645         (WebKit::PingLoad::PingLoad):
646         (WebKit::m_blobFiles):
647         (WebKit::PingLoad::initialize):
648             The PingLoad constructor is now split in two to allow for construction
649             without a WebKit::NetworkConnectionToWebProcess object. The body of
650             the constructor was moved into the new initialize() function which is
651             shared between constructors.
652         * NetworkProcess/PingLoad.h:
653         * Sources.txt:
654             Removed NetworkProcess/NetworkAdClickAttribution.cpp and added
655             NetworkProcess/NetworkAdClickAttribution.cpp.
656         * UIProcess/API/C/WKPage.cpp:
657         (WKPageSetAdClickAttributionOverrideTimerForTesting):
658         (WKPageSetAdClickAttributionConversionURLForTesting):
659         * UIProcess/API/C/WKPagePrivate.h:
660         * UIProcess/Network/NetworkProcessProxy.cpp:
661         (WebKit::NetworkProcessProxy::dumpAdClickAttribution): Deleted.
662         (WebKit::NetworkProcessProxy::clearAdClickAttribution): Deleted.
663         * UIProcess/Network/NetworkProcessProxy.h:
664         * UIProcess/WebPageProxy.cpp:
665         (WebKit::WebPageProxy::dumpAdClickAttribution):
666         (WebKit::WebPageProxy::clearAdClickAttribution):
667         (WebKit::WebPageProxy::setAdClickAttributionOverrideTimerForTesting):
668         (WebKit::WebPageProxy::setAdClickAttributionConversionURLForTesting):
669         * UIProcess/WebPageProxy.h:
670         * UIProcess/WebProcessPool.cpp:
671         (WebKit::WebProcessPool::dumpAdClickAttribution): Deleted.
672         (WebKit::WebProcessPool::clearAdClickAttribution): Deleted.
673         * UIProcess/WebProcessPool.h:
674         * WebKit.xcodeproj/project.pbxproj:
675
676 2019-04-15  Devin Rousso  <drousso@apple.com>
677
678         WebDriver: Set Cookie endpoint does not correctly set subdomain cookies
679         https://bugs.webkit.org/show_bug.cgi?id=196872
680         <rdar://problem/49233240>
681
682         Reviewed by Joseph Pecoraro.
683
684         * UIProcess/Automation/WebAutomationSession.cpp:
685         (WebKit::WebAutomationSession::addSingleCookie):
686         Rather than try to "force" the cookie to be set on the current active URL, use the cookie
687         itself to figure out which domain it should be set on.
688
689 2019-04-15  Philippe Normand  <pnormand@igalia.com>
690
691         [GTK][WPE] Add enable-media websetting
692         https://bugs.webkit.org/show_bug.cgi?id=196863
693
694         Reviewed by Michael Catanzaro.
695
696         It can be useful for headless browsers, for instance. The setting is enabled by default.
697
698         * Shared/WebPreferences.yaml:
699         * UIProcess/API/glib/WebKitSettings.cpp:
700         (webKitSettingsSetProperty):
701         (webKitSettingsGetProperty):
702         (webkit_settings_class_init):
703         (webkit_settings_get_enable_media):
704         (webkit_settings_set_enable_media):
705         * UIProcess/API/gtk/WebKitSettings.h:
706         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
707         * UIProcess/API/wpe/WebKitSettings.h:
708         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
709
710 2019-04-14  Rob Buis  <rbuis@igalia.com>
711
712         Link prefetch not useful for top-level navigation
713         https://bugs.webkit.org/show_bug.cgi?id=195623
714
715         Reviewed by Youenn Fablet.
716
717         Cache cross-domain top-level prefetches in a dedicated cache. When a navigation
718         to the same url is done within a threshold (5 seconds), reuse the
719         prefetch cache entry, move it to the disk cache and navigate to
720         the url, meaning no extra network trip is needed. When not used within
721         the threshold period, the prefetch entry will be erased using a timer.
722
723         * NetworkProcess/NetworkProcess.cpp:
724         (WebKit::NetworkProcess::lowMemoryHandler):
725         * NetworkProcess/NetworkProcess.h:
726         (WebKit::NetworkProcess::prefetchCache):
727         * NetworkProcess/NetworkResourceLoader.cpp:
728         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
729         (WebKit::NetworkResourceLoader::didReceiveResponse):
730         (WebKit::NetworkResourceLoader::didReceiveBuffer):
731         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
732         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const):
733         * NetworkProcess/NetworkResourceLoader.h:
734         * NetworkProcess/cache/PrefetchCache.cpp: Added.
735         (WebKit::PrefetchCache::Entry::Entry):
736         (WebKit::PrefetchCache::PrefetchCache):
737         (WebKit::PrefetchCache::~PrefetchCache):
738         (WebKit::PrefetchCache::clear):
739         (WebKit::PrefetchCache::take):
740         (WebKit::PrefetchCache::store):
741         (WebKit::PrefetchCache::sessionPrefetchMap const):
742         (WebKit::PrefetchCache::clearExpiredEntries):
743         * NetworkProcess/cache/PrefetchCache.h: Added.
744         (WebKit::PrefetchCache::Entry::response const):
745         (WebKit::PrefetchCache::Entry::releaseBuffer):
746         * Shared/WebPreferences.yaml:
747         * Sources.txt:
748         * WebKit.xcodeproj/project.pbxproj:
749
750 2019-04-14  Andy Estes  <aestes@apple.com>
751
752         [Cocoa] WKCustomProtocolLoader should store a WeakPtr to its LegacyCustomProtocolManagerProxy
753         https://bugs.webkit.org/show_bug.cgi?id=196893
754         <rdar://problem/48318983>
755
756         Reviewed by Anders Carlsson.
757
758         In addition to manually invalidating each WKCustomProtocolLoader's _customProtocolManagerProxy
759         pointer when the LegacyCustomProtocolManagerClient is invalidated, use a WeakPtr in case the
760         LegacyCustomProtocolManagerProxy is ever destroyed without first invalidating the client.
761         Also add null pointer checks to NSURLConnectionDelegate methods, which might be called after
762         the LegacyCustomProtocolManagerProxy has been destroyed.
763
764         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
765         (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]):
766         (-[WKCustomProtocolLoader cancel]):
767         (-[WKCustomProtocolLoader connection:didFailWithError:]):
768         (-[WKCustomProtocolLoader connection:didReceiveResponse:]):
769         (-[WKCustomProtocolLoader connection:didReceiveData:]):
770         (-[WKCustomProtocolLoader connection:willSendRequest:redirectResponse:]):
771         (-[WKCustomProtocolLoader connectionDidFinishLoading:]):
772         (WebKit::LegacyCustomProtocolManagerClient::startLoading):
773         (WebKit::LegacyCustomProtocolManagerClient::invalidate):
774         (-[WKCustomProtocolLoader customProtocolManagerProxyDestroyed]): Deleted.
775         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h:
776
777 2019-04-14  Don Olmstead  <don.olmstead@sony.com>
778
779         [CMake] JavaScriptCore derived sources should only be referenced inside JavaScriptCore
780         https://bugs.webkit.org/show_bug.cgi?id=196742
781
782         Reviewed by Konstantin Tokarev.
783
784         Don't set JavaScriptCore_SCRIPTS_DIR now that it is set within WebKitFS.
785
786         * CMakeLists.txt:
787         * PlatformWin.cmake:
788         
789         Remove use of DERIVED_SOURCES_JAVASCRIPTCORE_DIR.
790
791 2019-04-13  Chris Dumez  <cdumez@apple.com>
792
793         [ Mac Debug ] TestWebKitAPI.ProcessSwap.ReuseSuspendedProcessForRegularNavigationRetainBundlePage is a flaky crash
794         https://bugs.webkit.org/show_bug.cgi?id=196548
795         <rdar://problem/49567254>
796
797         Reviewed by Darin Adler.
798
799         Update ProvisionalPageProxy methods to more consistently ignore unexpected IPC from the process. Previously,
800         some of the methods were doing this, but some other like didFailProvisionalLoadForFrame() weren't and this
801         was leading to this flaky crash. The issue is that if we do the load in an existing process that was recently
802         doing, there may be leftover IPC for the same pageID and this IPC gets received by the ProvisionalPageProxy
803         even though it is from a previous navigation. For this reason, the ProvisionalPageProxy should ignore all
804         incoming IPC that is not for its associated navigation.
805
806         * UIProcess/ProvisionalPageProxy.cpp:
807         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
808         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
809         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
810         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
811         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
812         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
813         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
814         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
815         (WebKit::ProvisionalPageProxy::didPerformServerRedirect):
816         (WebKit::ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
817         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync):
818
819 2019-04-13  Wenson Hsieh  <wenson_hsieh@apple.com>
820
821         Unreviewed, try to fix the internal build after r244239
822
823         Force the bots to regenerate WKWebpagePreferences.h by touching the file. Adds a `Foundation/Foundation.h`
824         import that was missing anyways.
825
826         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
827
828 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
829
830         Enable modern compatibility mode by default in WKWebView on some devices
831         https://bugs.webkit.org/show_bug.cgi?id=196883
832         <rdar://problem/49864527>
833
834         Reviewed by Tim Horton.
835
836         Make some minor adjustments to new API.
837
838         * Shared/WebCompatibilityMode.h:
839
840         Rename WebCompatibilityMode::Default to WebCompatibilityMode::Recommended.
841
842         * Shared/WebPreferences.yaml:
843         * Shared/WebPreferencesDefaultValues.h:
844
845         Now that the role of the UseModernCompatibilityModeByDefault debug preference is limited to bypassing linked-on-
846         or-after and app bundle compatibility hacks, we no longer make this default to true in iOSMac.
847
848         * UIProcess/API/APIWebsitePolicies.h:
849         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
850
851         Rename the withPreferences: label to just preferences:.
852
853         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
854         * UIProcess/Cocoa/NavigationState.mm:
855         (WebKit::NavigationState::setNavigationDelegate):
856         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
857         * UIProcess/Cocoa/VersionChecks.h:
858         * UIProcess/ios/WebPageProxyIOS.mm:
859
860 2019-04-12  Brian Burg  <bburg@apple.com>
861
862         WebDriver: fix typo in EnterFullscreen.js in error-handling code
863         https://bugs.webkit.org/show_bug.cgi?id=196882
864         <rdar://problem/49867122>
865
866         Reviewed by Devin Rousso.
867
868         * UIProcess/Automation/atoms/EnterFullscreen.js:
869         (enterFullscreen):
870
871 2019-04-12  Ross Kirsling  <ross.kirsling@sony.com>
872
873         Unreviewed fix for non-unified build.
874
875         * Shared/PrintInfo.cpp:
876         Add missing include from r244202.
877
878 2019-04-12  Saam barati  <sbarati@apple.com>
879
880         Sometimes we need to user fewer CPUs in our threading calculations
881         https://bugs.webkit.org/show_bug.cgi?id=196794
882         <rdar://problem/49389497>
883
884         Reviewed by Yusuke Suzuki.
885
886         * WebProcess/com.apple.WebProcess.sb.in:
887
888 2019-04-12  Devin Rousso  <drousso@apple.com>
889
890         WebDriver: evaluating javascript shouldn't fail if a dialog is shown
891         https://bugs.webkit.org/show_bug.cgi?id=196847
892         <rdar://problem/49609396>
893
894         Reviewed by Brian Burg.
895
896         * UIProcess/Automation/WebAutomationSession.cpp:
897         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
898
899 2019-04-12  Ross Kirsling  <ross.kirsling@sony.com>
900
901         WebKit should build successfully even with -DENABLE_UNIFIED_BUILDS=OFF
902         https://bugs.webkit.org/show_bug.cgi?id=196845
903
904         Reviewed by Ryosuke Niwa.
905
906         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
907         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
908         * NetworkProcess/NetworkDataTask.cpp:
909         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
910         * NetworkProcess/NetworkHTTPSUpgradeChecker.h: Include wtf/Forward.h for String and CompletionHandler fwd decls.
911         * NetworkProcess/NetworkProcess.cpp:
912         * NetworkProcess/NetworkResourceLoadMap.cpp:
913         * NetworkProcess/NetworkResourceLoadMap.h:
914         * NetworkProcess/NetworkResourceLoader.cpp:
915         * NetworkProcess/PingLoad.h:
916         * Shared/WebCompiledContentRuleListData.cpp:
917         * Shared/gtk/WebEventFactory.cpp:
918         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
919         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
920         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
921         (WKWebsiteDataStoreStatisticsResetToConsistentState):
922         * UIProcess/Downloads/DownloadProxyMap.cpp:
923         * UIProcess/InspectorTargetProxy.cpp:
924         * UIProcess/PageClient.h:
925         * UIProcess/ProcessAssertion.cpp:
926         * UIProcess/ProvisionalPageProxy.h:
927         * UIProcess/WebPageInspectorTargetAgent.h:
928         * UIProcess/geoclue/GeoclueGeolocationProvider.cpp:
929         * WebProcess/Cache/WebCacheStorageConnection.cpp:
930         (WebKit::WebCacheStorageConnection::updateQuotaBasedOnSpaceUsage):
931         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
932         (WKBundleSetDatabaseQuota):
933         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
934         Add missing includes / forward declarations to address compiler errors on GTK / WinCairo.
935
936 2019-04-12  Eric Carlson  <eric.carlson@apple.com>
937
938         Update AudioSession route sharing policy
939         https://bugs.webkit.org/show_bug.cgi?id=196776
940         <rdar://problem/46501611>
941
942         Reviewed by Jer Noble.
943
944         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
945         (-[WKAirPlayRoutePicker showFromView:routeSharingPolicy:routingContextUID:hasVideo:]):
946
947 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
948
949         WebsitePolicies doesn't copy its media source policy in WebsitePolicies::copy
950         https://bugs.webkit.org/show_bug.cgi?id=196862
951
952         Reviewed by Darin Adler.
953
954         Add a missing bit of code to copy m_mediaSourcePolicy over when making a copy of WebsitePolicies. This doesn't
955         have any observable effect, since m_mediaSourcePolicy isn't currently exposed as SPI on WKWebpagePreferences.
956
957         * UIProcess/API/APIWebsitePolicies.cpp:
958         (API::WebsitePolicies::copy const):
959
960 2019-04-12  Simon Fraser  <simon.fraser@apple.com>
961
962         [iOS WK2] Make -webkit-overflow-scrolling be a no-op
963         https://bugs.webkit.org/show_bug.cgi?id=196803
964         rdar://problem/49078202
965
966         Reviewed by Antti Koivisto.
967
968         Flip LegacyOverflowScrollingTouchEnabled to false.
969
970         * Shared/WebPreferences.yaml:
971
972 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
973
974         [iOS] Software keyboard is shown too frequently on some websites
975         https://bugs.webkit.org/show_bug.cgi?id=195856
976         <rdar://problem/49191395>
977
978         Reviewed by Darin Adler.
979
980         On some websites, hidden editable elements are very frequently focused upon user interaction. Currently, this
981         causes the software keyboard to pop in and out unexpectedly; luckily, these same sites also apply
982         inputmode="none" to the hidden editable element, which ought to ensure that the software keyboard doesn't appear
983         when the element is focused.
984
985         However, since we disabled support for inputmode="none" in r240497, the software keyboard is no longer
986         suppressed, and becomes a big nuissance. r240497 removed support for this feature because, when using a hardware
987         keyboard, pressing the globe key no longer showed UI for switching languages. However, support for inputmode
988         none makes a much larger impact when a software keyboard is used (since the entire software keyboard animates in
989         and out), whereas a hardware keyboard only displays an input accessory view. For this reason, we can mitigate
990         this bug without reintroducing <rdar://problem/47406553> by re-enabling inputmode="none", but only when a
991         hardware keyboard is not attached.
992
993         * UIProcess/API/Cocoa/WKWebView.mm:
994         (hardwareKeyboardAvailabilityChangedCallback):
995         * UIProcess/ios/WKContentViewInteraction.h:
996         * UIProcess/ios/WKContentViewInteraction.mm:
997         (-[WKContentView shouldShowAutomaticKeyboardUI]):
998
999         Don't show the keyboard if inputmode is none and a hardware keyboard is not attached.
1000
1001         (-[WKContentView _hardwareKeyboardAvailabilityChanged]):
1002
1003         Reload input views if the inputmode is none to ensure that if a hardware keyboard is attached while editing an
1004         element with inputmode="none", we'll show the input accessory view once again.
1005
1006 2019-04-12  Antoine Quint  <graouts@apple.com>
1007
1008         Opt some websites into the simulated mouse events dispatch quirk when in modern compatibility mode
1009         https://bugs.webkit.org/show_bug.cgi?id=196830
1010         <rdar://problem/49124313>
1011
1012         Reviewed by Wenson Hsieh.
1013
1014         We add a new policy to determine whether simulated mouse events dispatch are allowed.
1015
1016         * Shared/WebsitePoliciesData.cpp:
1017         (WebKit::WebsitePoliciesData::encode const):
1018         (WebKit::WebsitePoliciesData::decode):
1019         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
1020         * Shared/WebsitePoliciesData.h:
1021         * Shared/WebsiteSimulatedMouseEventsDispatchPolicy.h: Added.
1022         * UIProcess/API/APIWebsitePolicies.cpp:
1023         (API::WebsitePolicies::copy const):
1024         (API::WebsitePolicies::data):
1025         * UIProcess/API/APIWebsitePolicies.h:
1026         * WebKit.xcodeproj/project.pbxproj:
1027
1028 2019-04-12  Chris Dumez  <cdumez@apple.com>
1029
1030         [iOS Sim Debug] ASSERTION FAILED: m_downloads.isEmpty() Layout Test http/tests/websocket/tests/hybi/network-process-crash-error.html is a flaky crash
1031         https://bugs.webkit.org/show_bug.cgi?id=196781
1032         <rdar://problem/49789381>
1033
1034         Reviewed by Darin Adler.
1035
1036         When the network process gets terminated by the client, the NetworkProcessProxy object (and thus its DownloadProxyMap member) get
1037         destroyed right away, before we get a call to didClose(IPC::Connection&). As a result, if there are ongoing downloads at the time
1038         of the termination, we will hit the assertion above. To address the issue, update the NetworkProcessProxy destructor to invalidate
1039         its DownloadProxyMap member, similator to what it does in didClose(IPC::Connection&).
1040
1041         * UIProcess/Downloads/DownloadProxyMap.cpp:
1042         (WebKit::DownloadProxyMap::invalidate):
1043         (WebKit::DownloadProxyMap::processDidClose): Deleted.
1044         * UIProcess/Downloads/DownloadProxyMap.h:
1045         * UIProcess/Network/NetworkProcessProxy.cpp:
1046         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
1047         (WebKit::NetworkProcessProxy::didClose):
1048
1049 2019-04-11  Carlos Garcia Campos  <cgarcia@igalia.com>
1050
1051         [GTK] REGRESSION(r243860): Many tests failing
1052         https://bugs.webkit.org/show_bug.cgi?id=196791
1053
1054         Reviewed by Joanmarie Diggs.
1055
1056         Calling updateAccessibilityTree() on document loaded was causing a re-layout because of the backing store update
1057         that confused all those tests. We shouldn't need to update the accessibility tree on document load, it should
1058         happen automatically when root object is attached/detached. This patch emits children-changed::add when the root
1059         object wrapper is attached and children-changed::remove when the root object is detached. That way ATs are
1060         notified of the changes in the accessibility tree.
1061
1062         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1063         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad): Remove call to WebPage::updateAccessibilityTree().
1064         * WebProcess/WebPage/WebPage.h: Remove updateAccessibilityTree().
1065         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
1066         (coreRootObjectWrapperDetachedCallback): Emit children-changed::remove.
1067         (rootWebAreaWrapper): Helper to get the root WebArea wrapper.
1068         (accessibilityRootObjectWrapper): Set the parent here when root object is created and emit children-changed::add.
1069         (webkitWebPageAccessibilityObjectRefChild): Dot no set the parent here, it's now set when the root object is created.
1070         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h: Remove webkitWebPageAccessibilityObjectRefresh().
1071         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
1072
1073 2019-04-11  Megan Gardner  <megan_gardner@apple.com>
1074
1075         Update 'Save Image' to more clear instructions
1076         https://bugs.webkit.org/show_bug.cgi?id=196833
1077         <rdar://problem/47446845>
1078
1079         Reviewed by Wenson Hsieh.
1080
1081         Just updating to a new string.
1082
1083         * UIProcess/API/Cocoa/_WKElementAction.mm:
1084         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
1085
1086 2019-04-11  Chris Dumez  <cdumez@apple.com>
1087
1088         Unable to run system Safari with trunk WebKit
1089         https://bugs.webkit.org/show_bug.cgi?id=196777
1090         <rdar://problem/49784574>
1091
1092         Reviewed by Alex Christensen.
1093
1094         * UIProcess/API/Cocoa/WKWebView.mm:
1095         (-[WKWebView _initializeWithConfiguration:]):
1096         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
1097         data store only happens for apps rebuilt using recent SDK.
1098
1099         * UIProcess/Cocoa/VersionChecks.h:
1100         * UIProcess/Cocoa/VersionChecks.mm:
1101         (WebKit::linkedOnOrAfter):
1102         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
1103           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
1104           be controlled by the caller.
1105         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
1106           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
1107           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
1108           0 value for sdkVersion.
1109
1110 2019-04-11  Zalan Bujtas  <zalan@apple.com>
1111
1112         Add @page margin support
1113         https://bugs.webkit.org/show_bug.cgi?id=196680
1114         <rdar://problem/45217707>
1115
1116         Reviewed by Tim Horton.
1117
1118         * Shared/PrintInfo.cpp:
1119         (WebKit::PrintInfo::encode const):
1120         (WebKit::PrintInfo::decode):
1121         * Shared/PrintInfo.h:
1122         * Shared/WebPreferences.yaml:
1123         * Shared/gtk/PrintInfoGtk.cpp:
1124         (WebKit::PrintInfo::PrintInfo):
1125         * Shared/mac/PrintInfoMac.mm:
1126         (WebKit::PrintInfo::PrintInfo):
1127         * UIProcess/API/C/WKPage.cpp:
1128         (WKPageComputePagesForPrinting):
1129         * UIProcess/API/C/WKPreferences.cpp:
1130         (WKPreferencesSetPageAtRuleSupportEnabled):
1131         (WKPreferencesGetPageAtRuleSupportEnabled):
1132         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1133         * UIProcess/GenericCallback.h:
1134         * UIProcess/WebPageProxy.cpp:
1135         (WebKit::WebPageProxy::computedPagesCallback):
1136         * UIProcess/WebPageProxy.h:
1137         * UIProcess/WebPageProxy.messages.in:
1138         * UIProcess/mac/WKPrintingView.mm:
1139         (pageDidComputePageRects):
1140         (-[WKPrintingView _askPageToComputePageRects]):
1141         * WebProcess/WebPage/WebPage.cpp:
1142         (WebKit::WebPage::beginPrinting):
1143         (WebKit::WebPage::computePagesForPrinting):
1144         (WebKit::WebPage::computePagesForPrintingImpl):
1145         * WebProcess/WebPage/WebPage.h:
1146         * WebProcess/WebPage/ios/WebPageIOS.mm:
1147         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
1148
1149 2019-04-11  Dean Jackson  <dino@apple.com>
1150
1151         Extract UTI mapping and allow for additions
1152         https://bugs.webkit.org/show_bug.cgi?id=196822
1153         <rdar://problem/49822339>
1154
1155         Reviewed by Tim Horton.
1156
1157         Use the new helper to map MIME type to UTI.
1158
1159         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
1160         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
1161         * UIProcess/ios/WKSystemPreviewView.mm:
1162         (getUTIForSystemPreviewMIMEType):
1163
1164
1165 2019-04-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
1166
1167         REGRESSION (r244182): RemoteLayerTreeDrawingArea::flushLayers() should not be reentrant
1168         https://bugs.webkit.org/show_bug.cgi?id=196825
1169
1170         Reviewed by Simon Fraser.
1171
1172         Ensure the layer transactions IDs are sequential. So bail out of
1173         RemoteLayerTreeDrawingArea::flushLayers() if reentrancy is detected.
1174
1175         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
1176         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1177         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
1178
1179 2019-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1180
1181         Allow the MediaSource API to be enabled via website policy
1182         https://bugs.webkit.org/show_bug.cgi?id=196429
1183         <rdar://problem/48774333>
1184
1185         Reviewed by Tim Horton.
1186
1187         Adds support for using WebsitePolicies to determine whether to enable the MediaSource API.
1188
1189         * Shared/WebPreferences.yaml:
1190
1191         Disengage the mediaSourceEnabled internal preference from the corresponding WebCore setting; to ensure that
1192         setting the preference to `true` still results in enabling the MediaSource API, we instead make it such that
1193         turning on mediaSourceEnabled causes WebsitePolicies to set its WebsiteMediaSourcePolicy to Enable.
1194
1195         In the future, we should deprecate and remove this preference, in favor of simply setting preferred
1196         compatibility mode on WKWebpagePreferences.
1197
1198         * Shared/WebPreferences.yaml:
1199         * Shared/WebsiteMediaSourcePolicy.h: Copied from Source/WebKit/Shared/WebsitePoliciesData.h.
1200         * Shared/WebsitePoliciesData.cpp:
1201         (WebKit::WebsitePoliciesData::encode const):
1202         (WebKit::WebsitePoliciesData::decode):
1203
1204         Add plumbing for m_mediaSourcePolicy in the set of website policies.
1205
1206         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
1207
1208         Update the document loader with the given media source policy. There are two possibilities when applying the set
1209         of policies to the document loader; either the document loader is already attached to a Frame, or the document
1210         loader is yet to be attached to a Frame.
1211
1212         In the first case, we update Frame's settings on the spot, by calling the new applyPoliciesToSettings helper
1213         method. In the second scenario, we stash the policy state on DocumentLoader; when the DocumentLoader is attached
1214         to a Frame, we'll then update the Frame's settings using DocumentLoader's policy.
1215
1216         * Shared/WebsitePoliciesData.h:
1217         * UIProcess/API/APIWebsitePolicies.cpp:
1218         (API::WebsitePolicies::data):
1219         * UIProcess/API/APIWebsitePolicies.h:
1220         * UIProcess/API/C/WKPage.cpp:
1221         (WKPageSetPageNavigationClient):
1222         * UIProcess/Cocoa/NavigationState.mm:
1223         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1224
1225         Move code that adjusts website policies after deciding policies for the navigation action from NavigationClient
1226         ::decidePolicyForNavigationAction to the completion handler of the policy listener. This allows us to respect
1227         default website policies on the web view configuration, even when using the C API to set the navigation client,
1228         and also allows us to have a single call site for adjustPoliciesForCompatibilityMode. This also enables our
1229         layout tests to opt into modern compatibility mode by default, when specifying modern compatibility mode on
1230         webpage preferences.
1231
1232         * UIProcess/WebPageProxy.cpp:
1233         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1234         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode):
1235         * UIProcess/WebPageProxy.h:
1236         * WebKit.xcodeproj/project.pbxproj:
1237
1238 2019-04-11  Antti Koivisto  <antti@apple.com>
1239
1240         REGRESSION: changing iPad orientation on blogger.com crashes under RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations()
1241         https://bugs.webkit.org/show_bug.cgi?id=196813
1242         <rdar://problem/49393264>
1243
1244         Reviewed by Simon Fraser.
1245
1246         No test, can't repro.
1247
1248         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1249         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
1250
1251         Null check the nodes.
1252
1253 2019-04-10  Chris Dumez  <cdumez@apple.com>
1254
1255         Regression(r244144) ProcessSwap.ReuseSuspendedProcessLoadHTMLString API test is flaky
1256         https://bugs.webkit.org/show_bug.cgi?id=196784
1257
1258         Reviewed by Antti Koivisto.
1259
1260         When we enter accelerated compositing mode in the new process, we supposed to *close* the last
1261         SuspendedPageProxy, not destroy it. This was causing flakiness in the test because it was testing
1262         that we were using the SuspendedPageProxy's process for a cross-site link navigation, which is
1263         an optimization. This optimization was partly broken by r244144 as the SuspendedPageProxy would
1264         not sometimes be gone by the time we need it.
1265
1266         * UIProcess/SuspendedPageProxy.cpp:
1267         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
1268
1269 2019-04-10  Alex Christensen  <achristensen@webkit.org>
1270
1271         WKNavigationResponse._downloadAttribute should be nil when no download attribute is present
1272         https://bugs.webkit.org/show_bug.cgi?id=196809
1273         <rdar://49800762>
1274
1275         Reviewed by Brady Eidson.
1276
1277         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
1278         (-[WKNavigationResponse _downloadAttribute]):
1279
1280 2019-04-10  Tim Horton  <timothy_horton@apple.com>
1281
1282         REGRESSION (r241734): ⌥⌘↑ and ⌥⌘↓ no longer navigate to previous/next Reading List article
1283         https://bugs.webkit.org/show_bug.cgi?id=196797
1284         <rdar://problem/48484715>
1285
1286         Reviewed by Simon Fraser.
1287
1288         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
1289         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
1290         Validate the set of modifier keys pressed when handling a key event for scrolling:
1291         Ignore key events with multiple modifier keys pressed.
1292         Ignore key events with an invalid modifier key pressed for a given primary key.
1293
1294 2019-04-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
1295
1296         requestAnimationFrame should execute before the next frame
1297         https://bugs.webkit.org/show_bug.cgi?id=177484
1298
1299         Reviewed by Simon Fraser.
1300
1301         Replace the calls to Page::layoutIfNeeded() and willDisplayPage() by
1302         a single call to Page::updateRendering(). This new function implements 
1303         "Update the rendering" step of the HTML Event Loop specification
1304         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
1305
1306         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
1307         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
1308         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
1309         (WebKit::DrawingAreaCoordinatedGraphics::display):
1310         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
1311         (WebKit::LayerTreeHost::layerFlushTimerFired):
1312
1313         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1314         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
1315         -- Call Page::updateRendering() to make sure that "Update the rendering"
1316            happens immediately before updating the page.
1317
1318         -- Move the call to RemoteLayerBackingStoreCollection::willFlushLayers()
1319            to be exactly before flushing the layers. This fixes the assertion
1320            ASSERT(m_inLayerFlush) which was firing when running a layout test.
1321            RemoteLayerTreeDrawingArea::flushLayers() now can call itself through
1322            TestRunner::notifyDone(). flushLayers() was calling willFlushLayers()
1323            twice before calling didFlushLayers().
1324
1325         * WebProcess/WebPage/WebPage.cpp:
1326         (WebKit::WebPage::layoutIfNeeded):
1327         (WebKit::WebPage::updateRendering):
1328         (WebKit::WebPage::willDisplayPage): Deleted.
1329         * WebProcess/WebPage/WebPage.h:
1330         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1331         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1332
1333 2019-04-10  Devin Rousso  <drousso@apple.com>
1334
1335         Web Inspector: save sheet should be anchored underneath the tab bar when detached
1336         https://bugs.webkit.org/show_bug.cgi?id=196722
1337         <rdar://problem/49613280>
1338
1339         Reviewed by Timothy Hatcher.
1340
1341         * WebProcess/WebPage/WebInspectorUI.h:
1342         * WebProcess/WebPage/WebInspectorUI.cpp:
1343         (WebKit::WebInspectorUI::changeSheetRect): Added.
1344         * UIProcess/WebInspectorProxy.messages.in:
1345         * UIProcess/WebInspectorProxy.h:
1346         (WebKit::WebInspectorProxy::sheetRect const): Added.
1347         * UIProcess/WebInspectorProxy.cpp:
1348         (WebKit::WebInspectorProxy::setSheetRect): Added.
1349         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
1350         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
1351         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
1352         * UIProcess/mac/WebInspectorProxyMac.mm:
1353         (-[WKWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
1354         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
1355         * UIProcess/win/WebInspectorProxyWin.cpp:
1356         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
1357         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
1358         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
1359
1360         * WebProcess/WebPage/RemoteWebInspectorUI.h:
1361         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
1362         (WebKit::RemoteWebInspectorUI::changeSheetRect): Added.
1363         * UIProcess/RemoteWebInspectorProxy.messages.in:
1364         * UIProcess/RemoteWebInspectorProxy.h:
1365         (WebKit::RemoteWebInspectorProxy::sheetRect const): Added.
1366         * UIProcess/RemoteWebInspectorProxy.cpp:
1367         (WebKit::RemoteWebInspectorProxy::setSheetRect): Added.
1368         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
1369         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
1370         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
1371         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
1372         (-[WKRemoteWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
1373         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
1374         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
1375
1376 2019-04-10  Andy Estes  <aestes@apple.com>
1377
1378         [iOS] Let PDFHostViewController specify the background color to use for WKPDFView
1379         https://bugs.webkit.org/show_bug.cgi?id=196785
1380         <rdar://problem/48240051>
1381
1382         Reviewed by Tim Horton.
1383
1384         * UIProcess/ios/WKPDFView.mm:
1385         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
1386
1387 2019-04-10  Chris Dumez  <cdumez@apple.com>
1388
1389         Unreviewed, rolling out r244146.
1390
1391         Caused a few DeviceOrientation API test failures on iOS
1392
1393         Reverted changeset:
1394
1395         "Unable to run system Safari with trunk WebKit"
1396         https://bugs.webkit.org/show_bug.cgi?id=196777
1397         https://trac.webkit.org/changeset/244146
1398
1399 2019-04-10  Devin Rousso  <drousso@apple.com>
1400
1401         Web Inspector: REGRESSION: lazy agents used outside of frontend/instrumentation can be accessed before being created
1402         https://bugs.webkit.org/show_bug.cgi?id=196725
1403         <rdar://problem/49669810>
1404
1405         Reviewed by Timothy Hatcher.
1406
1407         * WebProcess/WebPage/WebInspector.cpp:
1408         (WebKit::WebInspector::showMainResourceForFrame):
1409
1410 2019-04-10  Youenn Fablet  <youenn@apple.com>
1411
1412         Clear Cache Storage structures before removing all related files
1413         https://bugs.webkit.org/show_bug.cgi?id=196650
1414
1415         Reviewed by Alex Christensen.
1416
1417         Previously, we were clearing files in parallel to clearing the internal CacheStorage structures.
1418         To make things more deterministic, clear files/folders directly
1419         after CachesStorage structures have finished being cleared.
1420
1421         * NetworkProcess/cache/CacheStorageEngine.cpp:
1422         (WebKit::CacheStorage::Engine::clearAllCaches):
1423         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
1424
1425 2019-04-10  Alex Christensen  <achristensen@webkit.org>
1426
1427         Add SPI WKNavigationResponse._downloadAttribute
1428         https://bugs.webkit.org/show_bug.cgi?id=196755
1429         <rdar://49587365>
1430
1431         Reviewed by Brady Eidson.
1432
1433         * UIProcess/API/APINavigationResponse.h:
1434         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
1435         (-[WKNavigationResponse _downloadAttribute]):
1436         * UIProcess/API/Cocoa/WKNavigationResponsePrivate.h:
1437         * UIProcess/ProvisionalPageProxy.cpp:
1438         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
1439         * UIProcess/ProvisionalPageProxy.h:
1440         * UIProcess/WebPageProxy.cpp:
1441         (WebKit::WebPageProxy::decidePolicyForResponse):
1442         (WebKit::WebPageProxy::decidePolicyForResponseShared):
1443         * UIProcess/WebPageProxy.h:
1444         * UIProcess/WebPageProxy.messages.in:
1445         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1446         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
1447         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1448
1449 2019-04-10  Youenn Fablet  <youenn@apple.com>
1450
1451         SWClientConnection should not double hop to fire some events
1452         https://bugs.webkit.org/show_bug.cgi?id=196735
1453
1454         Reviewed by Alex Christensen.
1455
1456         Removed unnecessary method.
1457
1458         * WebProcess/Storage/WebSWClientConnection.cpp:
1459         * WebProcess/Storage/WebSWClientConnection.h:
1460
1461 2019-04-10  Per Arne Vollan  <pvollan@apple.com>
1462
1463         [iOS] Fix iokit-get-properties sandbox violations
1464         https://bugs.webkit.org/show_bug.cgi?id=196782
1465         <rdar://problem/49497720>
1466
1467         Reviewed by Brent Fulgham.
1468
1469         Add iokit properties to the WebContent sandbox on iOS.
1470
1471         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1472
1473 2019-04-10  Tim Horton  <timothy_horton@apple.com>
1474
1475         Add modern API for overriding the page's specified viewport configuration
1476         https://bugs.webkit.org/show_bug.cgi?id=167734
1477         <rdar://problem/30331795>
1478
1479         Reviewed by Simon Fraser.
1480
1481         * Shared/WebPageCreationParameters.cpp:
1482         (WebKit::WebPageCreationParameters::encode const):
1483         (WebKit::WebPageCreationParameters::decode):
1484         * Shared/WebPageCreationParameters.h:
1485         Plumb overrideViewportArguments in WebPageCreationParameters, so that
1486         if the process crashes (or swaps) they are maintained.
1487
1488         * UIProcess/API/Cocoa/WKWebView.mm:
1489         (viewportArgumentsFromDictionary):
1490         (-[WKWebView _overrideViewportWithArguments:]):
1491         Add SPI to set override viewport arguments. Parse them into a ViewportArguments
1492         object and use the existing (now improved) overrideViewportArguments mechanism
1493         to take over the page's viewport arguments.
1494
1495         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1496         * UIProcess/WebPageProxy.cpp:
1497         (WebKit::WebPageProxy::creationParameters):
1498         * UIProcess/WebPageProxy.h:
1499         * UIProcess/ios/WebPageProxyIOS.mm:
1500         (WebKit::WebPageProxy::setOverrideViewportArguments):
1501         * WebProcess/WebPage/WebPage.cpp:
1502         Plumb overrideViewportArguments around more.
1503
1504 2019-04-10  Jiewen Tan  <jiewen_tan@apple.com>
1505
1506         Add runJavaScriptInFrame for WebPageProxy/WebPage
1507         https://bugs.webkit.org/show_bug.cgi?id=196750
1508         <rdar://problem/49755738>
1509
1510         Reviewed by Youenn Fablet.
1511
1512         Tests of the new method will be covered by the internal counterpart.
1513
1514         * UIProcess/WebFrameProxy.cpp:
1515         (WebKit::WebFrameProxy::loadData):
1516         * UIProcess/WebFrameProxy.h:
1517         Add a comment.
1518         * UIProcess/WebPageProxy.cpp:
1519         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
1520         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
1521         Merge the above two runJavaScriptInMainFrame*.
1522         (WebKit::WebPageProxy::runJavaScriptInFrame):
1523         * UIProcess/WebPageProxy.h:
1524         * WebProcess/WebPage/WebPage.cpp:
1525         (WebKit::WebPage::loadDataInFrame):
1526         Add an assertion.
1527         (WebKit::WebPage::runJavaScript):
1528         (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld):
1529         (WebKit::WebPage::runJavaScriptInFrame):
1530         (WebKit::WebPage::runJavaScriptInMainFrame): Deleted.
1531         * WebProcess/WebPage/WebPage.h:
1532         * WebProcess/WebPage/WebPage.messages.in:
1533
1534 2019-04-10  Chris Dumez  <cdumez@apple.com>
1535
1536         Unable to run system Safari with trunk WebKit
1537         https://bugs.webkit.org/show_bug.cgi?id=196777
1538         <rdar://problem/49784574>
1539
1540         Reviewed by Alex Christensen.
1541
1542         * UIProcess/API/Cocoa/WKWebView.mm:
1543         (-[WKWebView _initializeWithConfiguration:]):
1544         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
1545         data store only happens for apps rebuilt using recent SDK.
1546
1547         * UIProcess/Cocoa/VersionChecks.h:
1548         * UIProcess/Cocoa/VersionChecks.mm:
1549         (WebKit::linkedOnOrAfter):
1550         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
1551           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
1552           be controlled by the caller.
1553         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
1554           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
1555           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
1556           0 value for sdkVersion.
1557
1558 2019-04-10  Chris Dumez  <cdumez@apple.com>
1559
1560         Regression(r240562) Audio sometimes keeps playing in previous process after a process-swap
1561         https://bugs.webkit.org/show_bug.cgi?id=196774
1562         <rdar://problem/49460572>
1563
1564         Reviewed by Alex Christensen.
1565
1566         r240562 added logic to prevent flashing on navigation. When we receive the DidFailToSuspendAfterProcessSwap
1567         IPC from the previous process, we would delay closing the WebPage in that process until EnterAcceleratedCompositingMode
1568         IPC is received from the new process. The issue is that this was racy as we would receive the EnterAcceleratedCompositingMode
1569         IPC from the new process *before* receiving the DidFailToSuspendAfterProcessSwap IPC from the previous process, which which
1570         case we would fail to close the WebPage and audio could keep playing.
1571
1572         To address the issue, the WebPageProxy keeps track of its last suspended page and notifies it whenever it receives the
1573         EnterAcceleratedCompositingMode IPC. If the suspended page already received the DidFailToSuspendAfterProcessSwap IPC, it
1574         will close the page. Otherwise, it will set a boolean data member indicating that we should not delay page closing when
1575         the DidFailToSuspendAfterProcessSwap is eventually received.
1576
1577         * UIProcess/SuspendedPageProxy.cpp:
1578         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
1579         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
1580         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
1581         * UIProcess/SuspendedPageProxy.h:
1582         * UIProcess/WebPageProxy.cpp:
1583         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
1584         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
1585         * UIProcess/WebPageProxy.h:
1586         * UIProcess/WebProcessPool.cpp:
1587         * UIProcess/WebProcessPool.h:
1588
1589 2019-04-10  Timothy Hatcher  <timothy@apple.com>
1590
1591         WKScrollView background color does not match WKWebView before content is loaded.
1592         https://bugs.webkit.org/show_bug.cgi?id=196745
1593         rdar://problem/49750810
1594
1595         Reviewed by Megan Gardner.
1596
1597         * UIProcess/API/Cocoa/WKWebView.mm:
1598         (scrollViewBackgroundColor): Default to _contentView.backgroundColor on invalid base color.
1599         (-[WKWebView _processDidExit]): Reset to _contentView.backgroundColor.
1600         (-[WKWebView setBackgroundColor:]): Call _updateScrollViewBackground since it can use
1601         _contentView.backgroundColor and it has changed.
1602
1603 2019-04-10  Megan Gardner  <megan_gardner@apple.com>
1604
1605         Fix text autoscrolling when typing in modern webkit
1606         https://bugs.webkit.org/show_bug.cgi?id=196718
1607         <rdar://problem/49225507>
1608
1609         Reviewed by Tim Horton.
1610
1611         For staging only. We need to turn off UIKit's scrolling behavior to land
1612         the changes we are making. To keep from the build ever breaking,
1613         I am temporarily circumventing the changes in UIKit. This will be removed
1614         once the next UIKit submission happens.
1615
1616         * UIProcess/ios/WKContentViewInteraction.mm:
1617         (-[WKUIWKTextInteractionAssistant scrollSelectionToVisible]):
1618         (-[WKContentView setUpTextSelectionAssistant]):
1619
1620 2019-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1621
1622         [iOSMac] Opt into modern compatibility mode by default
1623         https://bugs.webkit.org/show_bug.cgi?id=196763
1624         <rdar://problem/49038732>
1625
1626         Reviewed by Tim Horton.
1627
1628         Achieve this by limiting legacy compatibility mode by default to non-iOSMac iOS only.
1629
1630         * Shared/WebPreferences.yaml:
1631         * Shared/WebPreferencesDefaultValues.h:
1632
1633 2019-04-10  Alex Christensen  <achristensen@webkit.org>
1634
1635         RemoteObjectRegistry message receiver should be removed when WebPage::close is called instead of waiting until dealloc
1636         https://bugs.webkit.org/show_bug.cgi?id=196744
1637         <rdar://49415309>
1638
1639         Reviewed by Chris Dumez.
1640
1641         This is a similar problem to the one I fixed in r241306 so I piggy-backed on the same test.
1642         When you do a cross site navigation but the previous page is in a suspended process then you navigate back,
1643         you can get two WebPage objects in the same process with the same IDs.  WebPage::close has been called
1644         on the old one which is supposed to make it so all the message receivers associated with it have been removed
1645         so we don't have any loss of communication, but we missed the RemoteObjectRegistry messages, which are owned
1646         by the ObjC bundle object wrapping the WebPage (which can keep it alive if a strong reference to it is held).
1647         To fix the assertion that happens in this case and the resulting communication breakage, teach the WebPage about
1648         these messages so it can tear down the message receiver with the others it removes at close time.
1649
1650         * Shared/API/Cocoa/RemoteObjectRegistry.h:
1651         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1652         (-[WKWebProcessPlugInBrowserContextController dealloc]):
1653         (-[WKWebProcessPlugInBrowserContextController _remoteObjectRegistry]):
1654         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1655         (WebKit::WebPage::addRemoteObjectRegistry):
1656         * WebProcess/WebPage/WebPage.cpp:
1657         (WebKit::WebPage::close):
1658         * WebProcess/WebPage/WebPage.h:
1659
1660 2019-04-10  Chris Dumez  <cdumez@apple.com>
1661
1662         Unreviewed, drop SuspendedPageProxy data member that is unused after r244075.
1663
1664         * UIProcess/SuspendedPageProxy.h:
1665
1666 2019-04-10  Antoine Quint  <graouts@apple.com>
1667
1668         Enable Pointer Events on watchOS
1669         https://bugs.webkit.org/show_bug.cgi?id=196771
1670         <rdar://problem/49040909>
1671
1672         Reviewed by Dean Jackson.
1673
1674         * Configurations/FeatureDefines.xcconfig:
1675
1676 2019-04-10  Brady Eidson  <beidson@apple.com>
1677
1678         Background tabs are not fully reactivated after a link is opened from an external application.
1679         <rdar://problem/49533278> and https://bugs.webkit.org/show_bug.cgi?id=196705
1680
1681         Reviewed by Chris Dumez.
1682
1683         If an app unparents a WKWebView right after activation but before the "applicationWillEnterForeground" notification
1684         is dispatched, then that WKWebView is in a broken state with a frozen layer tree.
1685
1686         The WKApplicationStateTrackingView logic needs to be a little more resilient.
1687
1688         * UIProcess/ios/WKApplicationStateTrackingView.mm:
1689         (-[WKApplicationStateTrackingView willMoveToWindow:]): When clearing the window, remember the current background state.
1690         (-[WKApplicationStateTrackingView didMoveToWindow]): If our last observed background state doesn't match the current
1691           background state then fake the relevant notification.
1692         (-[WKApplicationStateTrackingView _applicationDidEnterBackground]): Remember that we've observed a backgrounding.
1693         (-[WKApplicationStateTrackingView _applicationWillEnterForeground]): Remember that we've observed a foregrounding.
1694
1695 2019-04-10  Diego Pino Garcia  <dpino@igalia.com>
1696
1697         Unreviewed, build fix for r244097
1698
1699         * NetworkProcess/NetworkProcess.cpp:
1700         (WebKit::NetworkProcess::actualPrepareToSuspend):
1701         (WebKit::NetworkProcess::resume):
1702         Added guards for ENABLE(SERVICE_WORKER)
1703
1704 2019-04-09  Keith Rollin  <krollin@apple.com>
1705
1706         Unreviewed build maintenance -- update .xcfilelists.
1707
1708         * DerivedSources-input.xcfilelist:
1709         * DerivedSources-output.xcfilelist:
1710
1711 2019-04-09  Zalan Bujtas  <zalan@apple.com>
1712
1713         [AutoSizing] Avoid making text paragraphs scroll horizontally when there is a wide table
1714         https://bugs.webkit.org/show_bug.cgi?id=196743
1715         <rdar://problem/43897551>
1716
1717         Reviewed by Tim Horton.
1718
1719         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1720         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
1721         * WebProcess/WebPage/WebPage.cpp:
1722         (WebKit::WebPage::setViewLayoutSize):
1723
1724 2019-04-09  Youenn Fablet  <youenn@apple.com>
1725
1726         Close service worker database on network process suspension
1727         https://bugs.webkit.org/show_bug.cgi?id=196623
1728         <rdar://problem/48930869>
1729
1730         Reviewed by Alex Christensen.
1731
1732         Close service worker database when preparing to suspend.
1733         On resume, push changes if any is needed.
1734
1735         * NetworkProcess/NetworkProcess.cpp:
1736         (WebKit::NetworkProcess::actualPrepareToSuspend):
1737         (WebKit::NetworkProcess::cancelPrepareToSuspend):
1738         (WebKit::NetworkProcess::processDidResume):
1739         * UIProcess/API/Cocoa/WKProcessPool.mm:
1740         (-[WKProcessPool _sendNetworkProcessWillSuspendImminently]):
1741         (-[WKProcessPool _sendNetworkProcessDidResume]):
1742         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1743         * UIProcess/Network/NetworkProcessProxy.h:
1744         * UIProcess/WebProcessPool.cpp:
1745         (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminently):
1746         (WebKit::WebProcessPool::sendNetworkProcessDidResume):
1747         * UIProcess/WebProcessPool.h:
1748
1749 2019-04-09  Daniel Bates  <dabates@apple.com>
1750
1751         [iPad] Should open popover when the spacebar is pressed
1752         https://bugs.webkit.org/show_bug.cgi?id=196360
1753         <rdar://problem/49389129>
1754
1755         Reviewed by Brent Fulgham.
1756
1757         Pressing the spacebar should open the popover for a focused popup button (e.g. <select>) on iOS
1758         just like it does on the Mac.
1759
1760         For now, we keep the iPhone behavior of blurring the element when the Done button is pressed and
1761         hence pressing spacebar does nothing (because there is no focused element).
1762
1763         * UIProcess/ios/WKContentViewInteraction.h:
1764         * UIProcess/ios/WKContentViewInteraction.mm:
1765         (-[WKContentView accessoryOpen]): Added. Extracted the logic from -_elementDidFocus to scroll to
1766         the focused element, update the accessory and then tell the accessory to begin editing.
1767         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1768         Write in terms of -accessoryOpen.
1769         * UIProcess/ios/forms/WKFormPeripheralBase.mm:
1770         (-[WKFormPeripheralBase handleKeyEvent:]): Interpret the spacebar when the peripheral is closed (!_editing)
1771         and call -accessoryOpen to ultimately call back to this peripheral to tell it to begin editing,
1772         which will cause the popover to appear again.
1773
1774 2019-04-09  Chris Dumez  <cdumez@apple.com>
1775
1776         Unreviewed, fix webkitpy failure after r244085.
1777
1778         Use a list instead of a set for header includes so that the order is
1779         maintained.
1780
1781         * Scripts/webkit/messages.py:
1782
1783 2019-04-09  Andy Estes  <aestes@apple.com>
1784
1785         [Apple Pay] Add release logging to PaymentCoordinator
1786         https://bugs.webkit.org/show_bug.cgi?id=196738
1787
1788         Reviewed by Alex Christensen.
1789
1790         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
1791         (WebKit::WebPaymentCoordinator::isAlwaysOnLoggingAllowed const):
1792         * WebProcess/ApplePay/WebPaymentCoordinator.h:
1793
1794 2019-04-09  Jer Noble  <jer.noble@apple.com>
1795
1796         [Cocoa] Awaken UIProcess if WebContent process is awakened from suspensions unexpectedly.
1797         https://bugs.webkit.org/show_bug.cgi?id=196659
1798
1799         Reviewed by Chris Dumez.
1800
1801         * Platform/IPC/Connection.h:
1802         (IPC::Connection::sendWithAsyncReply):
1803         * Platform/spi/ios/AssertionServicesSPI.h:
1804         * Shared/Cocoa/ProcessTaskStateObserver.h: Added.
1805         (WebKit::ProcessTaskStateObserver::setClient):
1806         (WebKit::ProcessTaskStateObserver::client):
1807         (WebKit::ProcessTaskStateObserver::taskState const):
1808         * Shared/Cocoa/ProcessTaskStateObserver.mm: Added.
1809         (-[WKProcessTaskStateObserverDelegate process:taskStateDidChange:]):
1810         (WebKit::toProcessTaskStateObserverTaskState):
1811         (WebKit::ProcessTaskStateObserver::ProcessTaskStateObserver):
1812         (WebKit::ProcessTaskStateObserver::~ProcessTaskStateObserver):
1813         (WebKit::ProcessTaskStateObserver::setTaskState):
1814         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
1815         (WebKit::WebProcessProxy::processWasUnexpectedlyUnsuspended):
1816         * UIProcess/ProcessAssertion.h:
1817         * UIProcess/ProcessThrottler.cpp:
1818         (WebKit::ProcessThrottler::updateAssertion):
1819         * UIProcess/ProcessThrottler.h:
1820         (WebKit::ProcessThrottler::shouldBeRunnable const):
1821         * UIProcess/WebProcessProxy.h:
1822         * UIProcess/WebProcessProxy.messages.in:
1823         * UIProcess/ios/ProcessAssertionIOS.mm:
1824         (WebKit::reasonForState):
1825         (WebKit::toBKSProcessAssertionReason):
1826         (WebKit::ProcessAssertion::ProcessAssertion):
1827         * WebKit.xcodeproj/project.pbxproj:
1828         * WebProcess/WebProcess.cpp:
1829         (WebKit::WebProcess::actualPrepareToSuspend):
1830         (WebKit::WebProcess::cancelPrepareToSuspend):
1831         (WebKit::WebProcess::processDidResume):
1832         * WebProcess/WebProcess.h:
1833         * WebProcess/cocoa/WebProcessCocoa.mm:
1834         (WebKit::WebProcess::processTaskStateDidChange):
1835
1836 2019-04-09  Alex Christensen  <achristensen@webkit.org>
1837
1838         Clicking "Go Back" from a safe browsing warning from an iframe should navigate the WKWebView back to the previous page
1839         https://bugs.webkit.org/show_bug.cgi?id=196665
1840         <rdar://45115669>
1841
1842         Reviewed by Geoff Garen.
1843
1844         It is insufficient to just not navigate the subframe.  We must leave the page that contained it.
1845
1846         * UIProcess/API/Cocoa/WKWebView.mm:
1847         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
1848         * UIProcess/Cocoa/WebViewImpl.mm:
1849         (WebKit::WebViewImpl::showSafeBrowsingWarning):
1850
1851 2019-04-09  John Wilander  <wilander@apple.com>
1852
1853         Pick up Ad Click Attribution conversions in NetworkResourceLoader::willSendRedirectedRequest()
1854         https://bugs.webkit.org/show_bug.cgi?id=196558
1855         <rdar://problem/47650245>
1856
1857         Reviewed by Youenn Fablet.
1858
1859         So called pixel requests have traditionally been used to send ad click
1860         attribution data to click sources. The privacy implications of such
1861         pixel requests are severe which is in part why browsers have started to
1862         block cookies from being sent in such third-party requests.
1863
1864         To allow for a smooth transition to more privacy-friendly ad click
1865         attribution, we should allow servers to make a redirect to
1866         https://click-source.example/.well-known/ad-click-attribution/ to
1867         trigger a so called conversion.
1868
1869         This patch checks for the well-known location in the path component of
1870         the redirect URL. If the request indeed goes to the well-known location,
1871         we parse the conversion data and send it to the storage in the network
1872         session.
1873
1874         * NetworkProcess/NetworkAdClickAttribution.cpp:
1875         (WebKit::NetworkAdClickAttribution::convert):
1876             Reporting function.
1877         * NetworkProcess/NetworkAdClickAttribution.h:
1878         * NetworkProcess/NetworkResourceLoader.cpp:
1879         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1880             Now checks for the well-known location through a call to
1881             WebCore::AdClickAttribution::parseConversionRequest().
1882         * NetworkProcess/NetworkSession.cpp:
1883         (WebKit::NetworkSession::convertAdClickAttribution):
1884             Piping to WebKit::NetworkAdClickAttribution::convert().
1885         * NetworkProcess/NetworkSession.h:
1886
1887 2019-04-09  Chris Dumez  <cdumez@apple.com>
1888
1889         [iOS] WebContent processes should be marked as "Foreground Running" when their view is visible
1890         https://bugs.webkit.org/show_bug.cgi?id=196695
1891         <rdar://problem/48073787>
1892
1893         Reviewed by Tim Horton.
1894
1895         In order for WebContent processes to get marked as "Foreground Running" when their view
1896         is visible on iOS, we now construct a _UILayerHostView in the UIProcess and add it as
1897         a subview of the WKContentView. The _UILayerHostView's visibility target is the
1898         WebContent process currently associated with the view.
1899
1900         * Platform/spi/ios/UIKitSPI.h:
1901         * UIProcess/PageClient.h:
1902         (WebKit::PageClient::didCreateContextForVisibilityPropagation):
1903         * UIProcess/WebPageProxy.h:
1904         * UIProcess/WebProcessProxy.h:
1905         (WebKit::WebProcessProxy::contextIDForVisibilityPropagation):
1906         * UIProcess/WebProcessProxy.messages.in:
1907         * UIProcess/ios/PageClientImplIOS.h:
1908         * UIProcess/ios/PageClientImplIOS.mm:
1909         (WebKit::PageClientImpl::didCreateContextForVisibilityPropagation):
1910         * UIProcess/ios/WKContentView.h:
1911         * UIProcess/ios/WKContentView.mm:
1912         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
1913         (-[WKContentView _setupVisibilityPropagationView]):
1914         (-[WKContentView _processDidExit]):
1915         (-[WKContentView _didRelaunchProcess]):
1916         (-[WKContentView _processDidCreateContextForVisibilityPropagation]):
1917         * UIProcess/ios/WebPageProxyIOS.mm:
1918         (WebKit::WebPageProxy::didCreateContextForVisibilityPropagation):
1919         * UIProcess/ios/WebProcessProxyIOS.mm:
1920         (WebKit::WebProcessProxy::didCreateContextForVisibilityPropagation):
1921         * WebProcess/WebProcess.h:
1922         * WebProcess/cocoa/WebProcessCocoa.mm:
1923         (WebKit::WebProcess::platformInitializeWebProcess):
1924
1925 2019-04-09  Sihui Liu  <sihui_liu@apple.com>
1926
1927         Remove unnecessary network process assertion for IDB close
1928         https://bugs.webkit.org/show_bug.cgi?id=196693
1929
1930         Reviewed by Geoffrey Garen.
1931
1932         * NetworkProcess/NetworkProcess.cpp:
1933         (WebKit::NetworkProcess::createIDBServer):
1934         (WebKit::NetworkProcess::notifyHoldingLockedFiles): Deleted.
1935         * NetworkProcess/NetworkProcess.h:
1936         * UIProcess/Network/NetworkProcessProxy.cpp:
1937         (WebKit::NetworkProcessProxy::didClose):
1938         (WebKit::NetworkProcessProxy::setIsIDBDatabaseHoldingLockedFiles): Deleted.
1939         * UIProcess/Network/NetworkProcessProxy.h:
1940         * UIProcess/Network/NetworkProcessProxy.messages.in:
1941
1942 2019-04-09  Chris Dumez  <cdumez@apple.com>
1943
1944         Loads using loadHTMLString() cause flashing when process-swapping
1945         https://bugs.webkit.org/show_bug.cgi?id=196714
1946         <rdar://problem/49637354>
1947
1948         Reviewed by Antti Koivisto.
1949
1950         Our logic to decide if we should construct a SuspendedPageProxy on process-swap was assuming
1951         a SuspendedPageProxy is only useful for PageCache and would therefore not create one if PageCache
1952         is disabled or if there is no associated WebBackForwardListItem. However, constructing a
1953         SuspendedPageProxy is also useful to prevent flashing when process-swapping as we need to keep
1954         displaying the layer of the previous process until there is something meaningful to show in the
1955         new process.
1956
1957         This patch makes it so that we now construct a SuspendedPageProxy on process-swap, even if
1958         PageCache is disabled or if there is no associated WebBackForwardListItem. The process in
1959         question will not be useful for PageCache but it will avoid flashing. The SuspendedPageProxy's
1960         process may also get used for future navigations to the same site (as demonstrated by the
1961         API test) which is beneficial for performance.
1962
1963         * UIProcess/SuspendedPageProxy.cpp:
1964         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
1965         * UIProcess/SuspendedPageProxy.h:
1966         * UIProcess/WebPageProxy.cpp:
1967         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
1968         * UIProcess/WebProcessPool.cpp:
1969         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
1970
1971 2019-04-08  Don Olmstead  <don.olmstead@sony.com>
1972
1973         [CMake][WinCairo] Separate copied headers into different directories
1974         https://bugs.webkit.org/show_bug.cgi?id=196655
1975
1976         Reviewed by Michael Catanzaro.
1977
1978         * CMakeLists.txt:
1979         * PlatformWin.cmake:
1980
1981 2019-04-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1982
1983         [iOS] Do not allow starting selection drags when selection views are not visible
1984         https://bugs.webkit.org/show_bug.cgi?id=196686
1985         <rdar://problem/49399192>
1986
1987         Reviewed by Tim Horton.
1988
1989         Currently, on iOS, it's possible to start dragging selected text in a web view even if the selection itself is
1990         not visible. This can happen if the user selects some text, focuses a native text field, and then long presses
1991         the previously selected text. This is because the text is still selected in the document since we don't clear
1992         the selection when resigning first responder on iOS, despite the fact that the native selection view is no
1993         longer present.
1994
1995         To fix this, we add plumbing to specify the set of allowed drag source actions when requesting drag start; this
1996         set of allowed drag source actions only includes DragSourceActionSelection if the selection view can be visible
1997         (i.e. the content view is first responder, and isn't suppressing text interactions). We then update WebPage's
1998         allowed drag source actions with this given set of actions, while sending "dragstart" to the page.
1999
2000         * UIProcess/WebPageProxy.h:
2001         * UIProcess/ios/WKContentViewInteraction.mm:
2002         (-[WKContentView hasSelectablePositionAtPoint:]):
2003         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
2004
2005         Only bail out of text selection in text that is already selected if the web view allows dragging text selections
2006         (i.e. the web view is first responder, and is not suppressing text interactions).
2007
2008         (-[WKContentView _allowedDragSourceActions]):
2009         (-[WKContentView _dragInteraction:itemsForAddingToSession:withTouchAtPoint:completion:]):
2010         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
2011
2012         Pass the set of allowed drag source actions when requesting a drag start or adding items to an existing session.
2013
2014         * UIProcess/ios/WebPageProxyIOS.mm:
2015         (WebKit::WebPageProxy::requestDragStart):
2016         (WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
2017
2018         Plumb the allowed drag source actions from the UI process (WKContentView) over to the web process (WebPage).
2019
2020         * WebProcess/WebCoreSupport/WebDragClient.cpp:
2021         (WebKit::WebDragClient::dragSourceActionMaskForPoint):
2022
2023         Instead of always returning Any, consult WebPage's allowed drag source actions.
2024
2025         * WebProcess/WebPage/WebPage.h:
2026         (WebKit::WebPage::allowedDragSourceActions const):
2027         * WebProcess/WebPage/WebPage.messages.in:
2028         * WebProcess/WebPage/ios/WebPageIOS.mm:
2029         (WebKit::WebPage::requestDragStart):
2030         (WebKit::WebPage::requestAdditionalItemsForDragSession):
2031
2032         Set WebPage's allowed drag source actions to the given set of actions when sending a drag start to the page.
2033
2034 2019-04-08  Justin Fan  <justin_fan@apple.com>
2035
2036         [Web GPU] Fix Web GPU experimental feature on iOS
2037         https://bugs.webkit.org/show_bug.cgi?id=196632
2038
2039         Reviewed by Myles C. Maxfield.
2040
2041         Add feature conditionals for iOS 11.
2042         Properly make Web GPU available on iOS 11+.
2043
2044         * Configurations/FeatureDefines.xcconfig:
2045         * Configurations/WebKitTargetConditionals.xcconfig:
2046
2047 2019-04-08  Alex Christensen  <achristensen@webkit.org>
2048
2049         Fix selector name after r243834
2050         https://bugs.webkit.org/show_bug.cgi?id=196549
2051
2052         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2053         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2054         I forgot the colon in the setter's name.
2055
2056 2019-04-08  Antti Koivisto  <antti@apple.com>
2057
2058         Compute touch actions for touch point from remote layer tree regions
2059         https://bugs.webkit.org/show_bug.cgi?id=196701
2060
2061         Reviewed by Simon Fraser.
2062
2063         Add a function for finding the right layer and getting the touch actions in UI process side.
2064
2065         The code is not used yet.
2066
2067         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
2068         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
2069         (WebKit::touchActionsForPoint):
2070
2071         Use the same code as overlap hit testing for collecting the candidate layers for the touch point,
2072         taking event regions into account.
2073         Return the touch actions from the deepest event sensitive layer hit.
2074
2075         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
2076
2077         Modernize.
2078
2079 2019-04-08  Brent Fulgham  <bfulgham@apple.com>
2080
2081         Make HSTS list handling more robust against unexpected content 
2082         https://bugs.webkit.org/show_bug.cgi?id=196552
2083         <rdar://problem/43403817>
2084
2085         Reviewed by Chris Dumez.
2086
2087         Crash logs indicate we sometimes encounter null key values during processing.
2088         This patch adds some debug assertions to catch this in test environments, and
2089         allows the code to skip the bad entries if encountered.
2090
2091         It also avoids calling CFDictionaryApplyFunction when the HSTS policies returned
2092         by _CFNetworkCopyHSTSPolicies is nullptr, which is a possible return value.
2093
2094         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2095         (WebKit::filterPreloadHSTSEntry):
2096         (WebKit::NetworkProcess::getHostNamesWithHSTSCache):
2097
2098 2019-04-05  Brian Burg  <bburg@apple.com>
2099
2100         Web Automation: clean up some WebAutomationSession methods to use modern async IPC
2101         https://bugs.webkit.org/show_bug.cgi?id=196168
2102
2103         Reviewed by Devin Rousso.
2104
2105         Modern WebKit IPC is capable of providing completion handlers and can track callback IDs.
2106         So, most messages between WebAutomationSession and its proxy can use this facility and stop
2107         keeping track of callback IDs manually. This makes most code easier to read on both the
2108         sender and receiver side.
2109
2110         There are two cases that could not be converted:
2111         - For evaluateJavaScript, we cannot use async IPC because WebAutomationSession expects to
2112         be able to cancel all pending replies when a page navigates away, the web process crashes,
2113         or when handling an alert.
2114         - For takeScreenshot, there is not currently support in the modern async IPC code paths for
2115         sending the result back. ShareableBitmap and friends lack a modern decoder implementation.
2116
2117         * UIProcess/Automation/WebAutomationSession.cpp:
2118         (WebKit::WebAutomationSession::resolveChildFrameHandle):
2119         (WebKit::WebAutomationSession::resolveParentFrameHandle):
2120         (WebKit::WebAutomationSession::computeElementLayout):
2121         (WebKit::WebAutomationSession::selectOptionElement):
2122         (WebKit::WebAutomationSession::getAllCookies):
2123         (WebKit::WebAutomationSession::deleteSingleCookie):
2124         (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement):
2125         (WebKit::WebAutomationSession::didResolveChildFrame): Deleted.
2126         (WebKit::WebAutomationSession::didResolveParentFrame): Deleted.
2127         (WebKit::WebAutomationSession::didComputeElementLayout): Deleted.
2128         (WebKit::WebAutomationSession::didSelectOptionElement): Deleted.
2129         (WebKit::WebAutomationSession::didGetCookiesForFrame): Deleted.
2130         (WebKit::WebAutomationSession::didDeleteCookie): Deleted.
2131         * UIProcess/Automation/WebAutomationSession.h:
2132         * UIProcess/Automation/WebAutomationSession.messages.in:
2133         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2134         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
2135         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
2136         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
2137         (WebKit::WebAutomationSessionProxy::resolveParentFrame):
2138         (WebKit::WebAutomationSessionProxy::computeElementLayout):
2139         (WebKit::WebAutomationSessionProxy::selectOptionElement):
2140         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
2141         (WebKit::WebAutomationSessionProxy::deleteCookie):
2142         * WebProcess/Automation/WebAutomationSessionProxy.h:
2143         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
2144
2145 2019-04-08  Alex Christensen  <achristensen@webkit.org>
2146
2147         REGRESSION(236463) DownloadManager can call a null CompletionHandler
2148         https://bugs.webkit.org/show_bug.cgi?id=196414
2149         <rdar://problem/48389434>
2150
2151         Reviewed by Geoff Garen.
2152
2153         * NetworkProcess/NetworkResourceLoader.cpp:
2154         (WebKit::NetworkResourceLoader::convertToDownload):
2155         DownloadManager::continueDecidePendingDownloadDestination is being called when there is no completion handler.
2156         r236463 introduced an unchecked code path that can allow this to happen.
2157
2158 2019-04-07  Commit Queue  <commit-queue@webkit.org>
2159
2160         Unreviewed, rolling out r243956.
2161         https://bugs.webkit.org/show_bug.cgi?id=196688
2162
2163         Broke API Test SafeBrowsing.WKWebViewGoBackIFrame (Requested
2164         by aakashjain on #webkit).
2165
2166         Reverted changeset:
2167
2168         "Clicking "Go Back" from a safe browsing warning from an
2169         iframe should navigate the WKWebView back to the previous
2170         page"
2171         https://bugs.webkit.org/show_bug.cgi?id=196665
2172         https://trac.webkit.org/changeset/243956
2173
2174 2019-04-07  Geoffrey Garen  <ggaren@apple.com>
2175
2176         Remove stray byte added by r241131
2177         https://bugs.webkit.org/show_bug.cgi?id=196682
2178
2179         Reviewed by Alexey Proskuryakov.
2180
2181         Sublime Text thinks WKWebView.mm is binary instead of text.
2182
2183         According to online documentation and bisecting, this is because r241131
2184         introduced a stray byte (probably a null byte?) into the file.
2185
2186         I fixed this with Cmd-C Cmd-V.
2187
2188         * UIProcess/API/Cocoa/WKWebView.mm:
2189         (-[WKWebView _initializeWithConfiguration:]):
2190
2191 2019-04-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2192
2193         Hide next and previous form control buttons when WKWebView is editable
2194         https://bugs.webkit.org/show_bug.cgi?id=196672
2195         <rdar://problem/35625321>
2196
2197         Reviewed by Tim Horton.
2198
2199         Adopt new UIKit SPI to hide or show next and previous controls in the form accessory view when changing
2200         editability.
2201
2202         Test: KeyboardInputTests.FormNavigationAssistantBarButtonItems
2203
2204         * Platform/spi/ios/UIKitSPI.h:
2205         * UIProcess/API/Cocoa/WKWebView.mm:
2206         (-[WKWebView _setEditable:]):
2207         * UIProcess/ios/WKContentViewInteraction.h:
2208         * UIProcess/ios/WKContentViewInteraction.mm:
2209         (-[WKContentView _updateAccessory]):
2210         (-[WKContentView _didChangeWebViewEditability]):
2211
2212 2019-04-06  Antti Koivisto  <antti@apple.com>
2213
2214         Combine event and touch action regions into a single class
2215         https://bugs.webkit.org/show_bug.cgi?id=196644
2216         <rdar://problem/49643614>
2217
2218         Reviewed by Darin Adler.
2219
2220         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
2221         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
2222         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
2223         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
2224         (WebKit::RemoteLayerTreeNode::eventRegion const):
2225         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
2226         (WebKit::RemoteLayerTreeNode::setEventRegion):
2227         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
2228         (WebKit::PlatformCALayerRemote::setEventRegion):
2229         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
2230
2231 2019-04-05  Yongjun Zhang  <yongjun_zhang@apple.com>
2232
2233         We should pass minimumEffectiveDeviceWidth to web process on new page creation.
2234         https://bugs.webkit.org/show_bug.cgi?id=196077
2235         <rdar://problem/49108202>
2236
2237         Reviewed by Chris Dumez.
2238
2239         When a new web view is created, it is possible we don't have the web content process till a load
2240         is requested. This patch stashes minimumEffectiveDeviceWidth in WebPageProxy.cpp and passes that
2241         value down to web process via WebPageCreationParameters when a new process is created, just like
2242         we did for other values like viewportConfigurationLayoutSizeScaleFactor or viewportConfigurationViewLayoutSize.
2243
2244         * Shared/WebPageCreationParameters.cpp:
2245         (WebKit::WebPageCreationParameters::encode const): Encode viewportConfigurationMinimumEffectiveDeviceWidth value.
2246         (WebKit::WebPageCreationParameters::decode): Decode viewportConfigurationMinimumEffectiveDeviceWidth value.
2247         * Shared/WebPageCreationParameters.h:
2248         * UIProcess/API/Cocoa/WKWebView.mm: Now that we stash the minimumEffectiveDeviceWidth value in WebPageProxy, we
2249             don't need the iVar in WKWebView any more.
2250         (-[WKWebView _dispatchSetViewLayoutSize:]): Use _page->minimumEffectiveDeviceWidth().
2251         (-[WKWebView _setViewScale:]): Ditto.
2252         (-[WKWebView _setMinimumEffectiveDeviceWidth:]): Ditto.
2253         (-[WKWebView _minimumEffectiveDeviceWidth]): Ditto.
2254         * UIProcess/WebPageProxy.cpp:
2255         (WebKit::WebPageProxy::creationParameters): Also add viewportConfigurationMinimumEffectiveDeviceWidth to
2256             web process creation parameter.
2257         * UIProcess/WebPageProxy.h:
2258         (WebKit::WebPageProxy::minimumEffectiveDeviceWidth const): Returns m_viewportConfigurationMinimumEffectiveDeviceWidth.
2259         * UIProcess/ios/WebPageProxyIOS.mm:
2260         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize): Pass parameters.viewportConfigurationMinimumEffectiveDeviceWidth
2261             to web process.
2262         * WebProcess/WebPage/WebPage.cpp:
2263         (WebKit::WebPage::WebPage): Take viewportConfigurationMinimumEffectiveDeviceWidth value from the parameter and
2264             set that to viewport configuration.
2265
2266 2019-04-05  Jer Noble  <jer.noble@apple.com>
2267
2268         [Cocoa] Deactivate the audio session before the WebProcess suspends.
2269         https://bugs.webkit.org/show_bug.cgi?id=196658
2270
2271         Reviewed by Eric Carlson.
2272
2273         Notify the PlatformMediaSessionManager when the process suspends or resumes.
2274
2275         * WebProcess/WebProcess.cpp:
2276         (WebKit::WebProcess::actualPrepareToSuspend):
2277         (WebKit::WebProcess::cancelPrepareToSuspend):
2278         (WebKit::WebProcess::processDidResume):
2279
2280 2019-04-05  Sihui Liu  <sihui_liu@apple.com>
2281
2282         [iOS] Web process gets suspended while holding locked database files
2283         https://bugs.webkit.org/show_bug.cgi?id=196519
2284         <rdar://problem/49531797>
2285
2286         Reviewed by Chris Dumez.
2287
2288         * WebProcess/WebProcess.cpp:
2289         (WebKit::WebProcess::actualPrepareToSuspend):
2290
2291 2019-04-05  Alex Christensen  <achristensen@webkit.org>
2292
2293         Clicking "Go Back" from a safe browsing warning from an iframe should navigate the WKWebView back to the previous page
2294         https://bugs.webkit.org/show_bug.cgi?id=196665
2295         <rdar://45115669>
2296
2297         Reviewed by Geoff Garen.
2298
2299         It is insufficient to just not navigate the subframe.  We must leave the page that contained it.
2300
2301         * UIProcess/API/Cocoa/WKWebView.mm:
2302         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
2303         * UIProcess/Cocoa/WebViewImpl.mm:
2304         (WebKit::WebViewImpl::showSafeBrowsingWarning):
2305
2306 2019-04-05  Alex Christensen  <achristensen@webkit.org>
2307
2308         Undeprecate WKNavigationData
2309         https://bugs.webkit.org/show_bug.cgi?id=196559
2310         <rdar://44927425>
2311
2312         Reviewed by Geoff Garen.
2313
2314         * UIProcess/API/Cocoa/WKNavigationData.h:
2315         It is used to communicate information from FrameLoaderClient::updateGlobalHistory() to the application.
2316         This use in WKBrowsingContextHistoryDelegate is definitely still deprecated, but its use in
2317         WKHistoryDelegatePrivate does not have an adequate replacement yet, so it must remain undeprecated SPI.
2318
2319 2019-04-05  Sihui Liu  <sihui_liu@apple.com>
2320
2321         [iOS] Web process gets suspended while holding locked database files
2322         https://bugs.webkit.org/show_bug.cgi?id=196519
2323         <rdar://problem/49531797>
2324
2325         Reviewed by Chris Dumez.
2326
2327         * Shared/WebSQLiteDatabaseTracker.cpp:
2328         (WebKit::WebSQLiteDatabaseTracker::~WebSQLiteDatabaseTracker):
2329         * Shared/WebSQLiteDatabaseTracker.h:
2330         * WebProcess/WebProcess.cpp:
2331         (WebKit::m_webSQLiteDatabaseTracker):
2332         (WebKit::WebProcess::actualPrepareToSuspend):
2333         (WebKit::WebProcess::processWillSuspendImminently):
2334         (WebKit::WebProcess::cancelPrepareToSuspend):
2335         (WebKit::WebProcess::processDidResume):
2336         * WebProcess/WebProcess.h:
2337
2338 2019-04-05  Commit Queue  <commit-queue@webkit.org>
2339
2340         Unreviewed, rolling out r243833.
2341         https://bugs.webkit.org/show_bug.cgi?id=196645
2342
2343         This change breaks build of WPE and GTK ports (Requested by
2344         annulen on #webkit).
2345
2346         Reverted changeset:
2347
2348         "[CMake][WTF] Mirror XCode header directories"
2349         https://bugs.webkit.org/show_bug.cgi?id=191662
2350         https://trac.webkit.org/changeset/243833
2351
2352 2019-04-05  David Kilzer  <ddkilzer@apple.com>
2353
2354         REGRESSION(r240685): Remove duplicate Headers entry for _WKInspectorWindow.h in Xcode project
2355         <https://bugs.webkit.org/show_bug.cgi?id=193951>
2356         <rdar://problem/47621366>
2357
2358         Fixes the following build warnings:
2359             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_installhdrs/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
2360             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_installapi/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
2361             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_install/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
2362
2363         * WebKit.xcodeproj/project.pbxproj: Remove duplicate entry for
2364         _WKInspectorWindow.h.  In r240685, a second Headers entry was
2365         added, but the first one was never removed.
2366
2367 2019-04-05  Carlos Garcia Campos  <cgarcia@igalia.com>
2368
2369         [ATK] Use a smart pointer for AccessibilityObject wrapper and remove GTK specific code
2370         https://bugs.webkit.org/show_bug.cgi?id=196593
2371         <rdar://problem/49599153>
2372
2373         Reviewed by Michael Catanzaro.
2374
2375         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
2376         (accessibilityRootObjectWrapper): Cast wrapper() as AtkObject.
2377
2378 2019-04-04  Simon Fraser  <simon.fraser@apple.com>
2379
2380         Simple iframe scrolling test fails to get a composited scrolling frame in WebKitTestRunnerApp
2381         https://bugs.webkit.org/show_bug.cgi?id=196635
2382
2383         Reviewed by Antti Koivisto.
2384
2385         Remove WKBundleSetAsyncFrameScrollingEnabled().
2386
2387         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
2388         (WKBundleSetAsyncFrameScrollingEnabled): Deleted.
2389         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
2390
2391 2019-04-04  Simon Fraser  <simon.fraser@apple.com>
2392
2393         [iOS WK2] REGRESSION (r242687): Programmatic scroll of overflow scroll results in bad rendering
2394         https://bugs.webkit.org/show_bug.cgi?id=195584
2395
2396         Reviewed by Zalan Bujtas.
2397
2398         Push data to the scrolling tree about whether an overflow:scroll scroll was programmatic, by having
2399         RenderLayer::scrollToOffset() call into AsyncScrollingCoordinator::requestScrollPositionUpdate(),
2400         just as we do for frames.
2401
2402         AsyncScrollingCoordinator::requestScrollPositionUpdate() is generalized to take any ScrollableArea.
2403
2404         Fix an assumption in the ScrollingTree that we only care about programmatic scrolls on the root node.
2405         ScrollingTree::commitTreeState() no longer sets isHandlingProgrammaticScroll; instead,
2406         callers of ScrollingTreeScrollingNode::scrollTo() pass a ScrollType. Commit functions pass
2407         ScrollType::Programmatic when handling RequestedScrollPosition changes as necessary.
2408
2409         Programmatic scrolls need to get to the scrolling tree in the UI process so that we update
2410         the tree's notion of scroll position, and trigger actual UIScrollView scrolls (layers may have
2411         already been put in the right locations, but the UI process needs to know that a scroll happened).
2412         However, we need to prevent notifications from programmatic scrolls getting back to the
2413         web process, because this causes jumpiness. This is done via an early return in
2414         RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll().
2415
2416         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2417         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
2418         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
2419         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren): Subframe nodes have
2420         a delegate, and that will take care of the requestedScrollPosition update.
2421         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
2422         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
2423         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren):
2424         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
2425         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
2426
2427 2019-04-04  Ryan Haddad  <ryanhaddad@apple.com>
2428
2429         Unreviewed, rolling out r243888.
2430
2431         Introduced layout test crashes.
2432
2433         Reverted changeset:
2434
2435         "[macOS][iOS] Add filter to syscall sandbox rule"
2436         https://bugs.webkit.org/show_bug.cgi?id=196613
2437         https://trac.webkit.org/changeset/243888
2438
2439 2019-04-04  Youenn Fablet  <youenn@apple.com>
2440
2441         Pass storage quota parameters from UIProcess to NetworkProcess as part of WebsiteDataStore parameters
2442         https://bugs.webkit.org/show_bug.cgi?id=196543
2443
2444         Reviewed by Alex Christensen.
2445
2446         Renamed methods used to set cache storage quota to be storage generic
2447         since they will apply to all storage.
2448
2449         Pass quota parameters as part of WebsiteDataStoreParameters from UIProcess
2450         to NetworkProcess (start-up time and new WebsiteDataStore time).
2451
2452         Compute on UIProcess the quota for third party origins using the default rule of dividing by 10.
2453
2454         * NetworkProcess/NetworkProcess.cpp:
2455         (WebKit::NetworkProcess::initializeNetworkProcess):
2456         (WebKit::NetworkProcess::addWebsiteDataStore):
2457         (WebKit::NetworkProcess::initializeStorageQuota):
2458         (WebKit::NetworkProcess::setCacheStorageParameters):
2459         * NetworkProcess/NetworkProcess.h:
2460         * NetworkProcess/NetworkProcess.messages.in:
2461         * Shared/WebsiteDataStoreParameters.cpp:
2462         (WebKit::WebsiteDataStoreParameters::encode const):
2463         (WebKit::WebsiteDataStoreParameters::decode):
2464         * Shared/WebsiteDataStoreParameters.h:
2465         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2466         (WKWebsiteDataStoreSetPerOriginStorageQuota):
2467         (WKWebsiteDataStoreSetCacheStoragePerOriginQuota): Deleted.
2468         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2469         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2470         (-[WKWebsiteDataStore _perOriginStorageQuota]):
2471         (-[WKWebsiteDataStore _setPerOriginStorageQuota:]):
2472         (-[WKWebsiteDataStore _cacheStoragePerOriginQuota]): Deleted.
2473         (-[WKWebsiteDataStore _setCacheStoragePerOriginQuota:]): Deleted.
2474         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2475         * UIProcess/Network/NetworkProcessProxy.cpp:
2476         (WebKit::NetworkProcessProxy::retrieveCacheStorageParameters):
2477         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2478         (WebKit::WebsiteDataStore::parameters):
2479         * UIProcess/WebsiteData/WebsiteDataStore.h:
2480         (WebKit::WebsiteDataStore::perOriginStorageQuota const):
2481         (WebKit::WebsiteDataStore::setPerOriginStorageQuota):
2482         (WebKit::WebsiteDataStore::cacheStoragePerOriginQuota const): Deleted.
2483         (WebKit::WebsiteDataStore::setCacheStoragePerOriginQuota): Deleted.
2484         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
2485         (WebKit::WebsiteDataStoreConfiguration::copy):
2486         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
2487         (WebKit::WebsiteDataStoreConfiguration::perOriginStorageQuota):
2488         (WebKit::WebsiteDataStoreConfiguration::setPerOriginStorageQuota):
2489         (WebKit::WebsiteDataStoreConfiguration::cacheStoragePerOriginQuota): Deleted.
2490         (WebKit::WebsiteDataStoreConfiguration::setCacheStoragePerOriginQuota): Deleted.
2491
2492 2019-04-04  Wenson Hsieh  <wenson_hsieh@apple.com>
2493
2494         Changing default website policies shouldn't change default website policies in subsequent navigations
2495         https://bugs.webkit.org/show_bug.cgi?id=196562
2496         <rdar://problem/49573377>
2497
2498         Reviewed by Tim Horton.
2499
2500         Currently, changing the default WKWebpagePreferences object when deciding navigation policy causes the set of
2501         default policies to change in subsequent navigations. Among other things, this prevents clients from passing
2502         a modified version of the default website policies into the decision handler without impacting future
2503         navigations. To fix this, teach API::WebsitePolicies to make a copy of itself, and then use this to pass a copy
2504         of the default website policies to the navigation delegate when deciding navigation policies.
2505
2506         Test: DoNotAllowChangingDefaultWebpagePreferencesInDelegateMethod
2507
2508         * UIProcess/API/APIWebsitePolicies.cpp:
2509         (API::WebsitePolicies::copy const):
2510
2511         Add a helper method to copy a set of website policies.
2512
2513         * UIProcess/API/APIWebsitePolicies.h:
2514         * UIProcess/Cocoa/NavigationState.mm:
2515         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2516
2517 2019-04-04  Michael Catanzaro  <mcatanzaro@igalia.com>
2518
2519         Unreviewed, fix -Wreturn-type warning
2520
2521         * Shared/WebsiteData/WebsiteData.cpp:
2522         (WebKit::WebsiteData::ownerProcess):
2523
2524 2019-04-04  Per Arne Vollan  <pvollan@apple.com>
2525
2526         [macOS] Fix sandbox violations
2527         https://bugs.webkit.org/show_bug.cgi?id=196616
2528         <rdar://problem/49498040>
2529
2530         Reviewed by Brent Fulgham.
2531
2532         Fix some observed sandbox violations in the WebContent process on macOS.
2533
2534         * WebProcess/com.apple.WebProcess.sb.in:
2535
2536 2019-04-04  Eric Carlson  <eric.carlson@apple.com>
2537
2538         [MediaStream] Host should be able to mute screen capture and camera/microphone independently
2539         https://bugs.webkit.org/show_bug.cgi?id=196555
2540         <rdar://problem/47303865>
2541
2542         Reviewed by Youenn Fablet.
2543
2544         * UIProcess/API/C/WKPagePrivate.h: Add kWKMediaScreenCaptureMuted.
2545
2546         * UIProcess/API/Cocoa/WKWebView.mm:
2547         (-[WKWebView _setPageMuted:]):
2548         (-[WKWebView _setMediaCaptureMuted:]): Deleted, it was unused.
2549         (-[WKWebView _muteMediaCapture]): Deleted, it was unused.
2550         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2551
2552         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2553         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest): Fix
2554         a log comment typo.
2555
2556         * UIProcess/WebPageProxy.cpp:
2557         (WebKit::WebPageProxy::setMediaStreamCaptureMuted): Use the new flag.
2558         (WebKit::WebPageProxy::activateMediaStreamCaptureInPage): Ditto.
2559         (WebKit::WebPageProxy::setMuted): Ditto.
2560         * UIProcess/WebPageProxy.h:
2561         (WebKit::WebPageProxy::isMediaStreamCaptureMuted const): Ditto.
2562
2563 2019-04-04  Per Arne Vollan  <pvollan@apple.com>
2564
2565         [macOS][iOS] Add filter to syscall sandbox rule
2566         https://bugs.webkit.org/show_bug.cgi?id=196613
2567         <rdar://problem/49531420>
2568
2569         Reviewed by Brent Fulgham.
2570
2571         This will restrict the existing sandbox rule for the syscall.
2572
2573         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2574         * WebProcess/com.apple.WebProcess.sb.in:
2575
2576 2019-04-04  Youenn Fablet  <youenn@apple.com>
2577
2578         Service Worker Process does not have the right domain name
2579         https://bugs.webkit.org/show_bug.cgi?id=196585
2580
2581         Reviewed by Chris Dumez.
2582
2583         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
2584         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
2585         Updated extraInitializationData to go from "security-origin" to "registrable-domain".
2586
2587 2019-04-04  Chris Dumez  <cdumez@apple.com>
2588
2589         Temporarily disable delayed WebProcess launch on iOS to address PLT regression
2590         https://bugs.webkit.org/show_bug.cgi?id=196604
2591         <rdar://problem/49074131>
2592
2593         Reviewed by Geoffrey Garen.
2594
2595         Temporarily disable delayed WebProcess launch on iOS to address PLT regression. This
2596         is while I figure out how to enable this on iOS without regressed PLT.
2597
2598         * UIProcess/WebProcessPool.h:
2599
2600 2019-04-04  Miguel Gomez  <magomez@igalia.com>
2601
2602         [CoordGraphics] Revalidate need for 'coordinated update completion' in ThreadedCompositor
2603         https://bugs.webkit.org/show_bug.cgi?id=188839
2604
2605         Reviewed by Žan Doberšek.
2606
2607         Even if a platform layer has changed, don't wait for a main thread callback to finish the
2608         CompositingRunLoop update. It can be finished as soon as we receive the frameComplete signal.
2609
2610         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
2611         (WebKit::CompositingRunLoop::scheduleUpdate):
2612         (WebKit::CompositingRunLoop::stopUpdates):
2613         (WebKit::CompositingRunLoop::updateCompleted):
2614         (WebKit::CompositingRunLoop::updateTimerFired):
2615         (WebKit::CompositingRunLoop::compositionCompleted): Deleted.
2616         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
2617         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2618         (WebKit::ThreadedCompositor::renderLayerTree):
2619         (WebKit::ThreadedCompositor::sceneUpdateFinished):
2620         (WebKit::ThreadedCompositor::displayRefreshMonitor):
2621         (WebKit::ThreadedCompositor::handleDisplayRefreshMonitorUpdate): Deleted.
2622         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2623         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
2624         (WebKit::LayerTreeHost::handleDisplayRefreshMonitorUpdate):
2625
2626 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2627
2628         [ATK] Cleanup WebPageAccessibilityObjectAtk
2629         https://bugs.webkit.org/show_bug.cgi?id=196537
2630
2631         Reviewed by Michael Catanzaro.
2632
2633         Several changes and cleanups:
2634
2635          - Add WebKit prefix so that style checker doesn't complain about GObject conventions.
2636          - Rename the header to remove the Atk prefix to match the cpp file and class name.
2637          - Use pragma once.
2638          - Use nullptr instead of 0.
2639          - Use WEBKIT_DEFINE_TYPE instead of G_DEFINE_TYPE.
2640          - Return generic AtkObject* from constructor.
2641
2642         * SourcesGTK.txt:
2643         * WebProcess/WebPage/WebPage.h:
2644         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp: Renamed from Source/WebKit/WebProcess/WebPage/atk/WebPageAccessibilityObjectAtk.cpp.
2645         (accessibilityRootObjectWrapper):
2646         (webkitWebPageAccessibilityObjectInitialize):
2647         (webkitWebPageAccessibilityObjectGetIndexInParent):
2648         (webkitWebPageAccessibilityObjectGetNChildren):
2649         (webkitWebPageAccessibilityObjectRefChild):
2650         (webkit_web_page_accessibility_object_class_init):
2651         (webkitWebPageAccessibilityObjectNew):
2652         (webkitWebPageAccessibilityObjectRefresh):
2653         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h: Added.
2654         * WebProcess/WebPage/atk/WebPageAccessibilityObject.h: Removed.
2655         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
2656         (WebKit::WebPage::platformInitialize):
2657         (WebKit::WebPage::updateAccessibilityTree):
2658
2659 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2660
2661         [ATK] Set ATK_STATE_TRANSIENT on the atk socket until it's embedded
2662         https://bugs.webkit.org/show_bug.cgi?id=196535
2663
2664         Reviewed by Michael Catanzaro.
2665
2666         This way the properties are not cached. Right now, if number of children is queried before the socket is
2667         embedded, 0 is returned and cached, so ATs don't see the child even after the socket has been embedded.
2668
2669         * UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp:
2670         (webkitWebViewBaseAccessibleRefStateSet): Set ATK_STATE_TRANSIENT is the socket is not occupied.
2671         * UIProcess/gtk/WebPageProxyGtk.cpp:
2672         (WebKit::WebPageProxy::bindAccessibilityTree): Unset ATK_STATE_TRANSIENT.
2673
2674 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2675
2676         [ATK] Embed the AtkSocket as soon as we receive the plug ID
2677         https://bugs.webkit.org/show_bug.cgi?id=196534
2678
2679         Reviewed by Michael Catanzaro.
2680
2681         We are currently storing the ID and waiting for the next time get_accessible is called to embed the socket. We
2682         can simply embed the socket when the plug ID is received.
2683
2684         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2685         (webkitWebViewBaseGetAccessible):
2686         * UIProcess/WebPageProxy.h:
2687         * UIProcess/gtk/WebPageProxyGtk.cpp:
2688         (WebKit::WebPageProxy::bindAccessibilityTree):
2689
2690 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2691
2692         [ATK] Don't touch accessibility tree in WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld
2693         https://bugs.webkit.org/show_bug.cgi?id=193914
2694
2695         Reviewed by Michael Catanzaro.
2696
2697         Move it to dispatchDidFinishDocumentLoad, since we know we have the document at that point and we can create the
2698         root accessibility object wrapper.
2699
2700         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2701         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad):
2702         (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld):
2703
2704 2019-04-03  Simon Fraser  <simon.fraser@apple.com>
2705
2706         Simplify some "programmaticScroll" code paths
2707         https://bugs.webkit.org/show_bug.cgi?id=196589
2708
2709         Reviewed by Zalan Bujtas.
2710
2711         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: Remove the parameter.
2712         (WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode): Use the enum type.
2713         * WebProcess/WebPage/ios/WebPageIOS.mm:
2714         (WebKit::WebPage::updateVisibleContentRects):
2715
2716 2019-04-03  Chris Dumez  <cdumez@apple.com>
2717
2718         The page's focusedFrame / frameSetLargestFrame do not get cleared on process swap or crash
2719         https://bugs.webkit.org/show_bug.cgi?id=196588
2720         <rdar://problem/49365787>
2721
2722         Reviewed by Ryosuke Niwa.
2723
2724         The page's focusedFrame / frameSetLargestFrame do not get cleared on process swap or crash.
2725         This can lead to returning stale frames to the client if it asks for those.
2726
2727         * UIProcess/WebPageProxy.cpp:
2728         (WebKit::WebPageProxy::resetState):
2729
2730 2019-04-03  Simon Fraser  <simon.fraser@apple.com>
2731
2732         Remove the isProgrammaticScroll argument to requestScroll() because no-one uses it
2733         https://bugs.webkit.org/show_bug.cgi?id=196587
2734
2735         Reviewed by Zalan Bujtas.
2736
2737         This argument was unused.
2738
2739         * UIProcess/API/gtk/PageClientImpl.cpp:
2740         (WebKit::PageClientImpl::requestScroll):
2741         * UIProcess/API/gtk/PageClientImpl.h:
2742         * UIProcess/API/wpe/PageClientImpl.cpp:
2743         (WebKit::PageClientImpl::requestScroll):
2744         * UIProcess/API/wpe/PageClientImpl.h:
2745         * UIProcess/PageClient.h:
2746         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2747         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
2748         * UIProcess/WebPageProxy.cpp:
2749         (WebKit::WebPageProxy::requestScroll):
2750         * UIProcess/WebPageProxy.h:
2751         * UIProcess/ios/PageClientImplIOS.h:
2752         * UIProcess/ios/PageClientImplIOS.mm:
2753         (WebKit::PageClientImpl::requestScroll):
2754         * UIProcess/mac/PageClientImplMac.h:
2755         * UIProcess/mac/PageClientImplMac.mm:
2756         (WebKit::PageClientImpl::requestScroll):
2757         * UIProcess/win/PageClientImpl.cpp:
2758         (WebKit::PageClientImpl::requestScroll):
2759         * UIProcess/win/PageClientImpl.h:
2760
2761 2019-04-03  Myles C. Maxfield  <mmaxfield@apple.com>
2762
2763         -apple-trailing-word is needed for browser detection
2764         https://bugs.webkit.org/show_bug.cgi?id=196575
2765
2766         Unreviewed.
2767
2768         * Configurations/FeatureDefines.xcconfig:
2769
2770 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2771
2772         Add a WebKit internal feature flag to always enable modern compatibility mode by default
2773         https://bugs.webkit.org/show_bug.cgi?id=196526
2774         <rdar://problem/49532923>
2775
2776         Reviewed by Tim Horton.
2777
2778         Change UseModernCompatibilityModeByDefault from an internal preference to a debug preference, so that it may be
2779         enabled for all apps on the system.
2780
2781         * Shared/WebPreferences.yaml:
2782
2783 2019-04-03  Alex Christensen  <achristensen@webkit.org>
2784
2785         Fix internal build after r243829
2786         https://bugs.webkit.org/show_bug.cgi?id=196549
2787
2788         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2789         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2790         Some SDK's don't include this selector in the header.
2791         Use NSSelectorFromString.
2792
2793 2019-04-03  Don Olmstead  <don.olmstead@sony.com>
2794
2795         [CMake][WTF] Mirror XCode header directories
2796         https://bugs.webkit.org/show_bug.cgi?id=191662
2797
2798         Reviewed by Konstantin Tokarev.
2799
2800         Use WTFFramework as a dependency and include frameworks/WTF.cmake for AppleWin internal
2801         builds.
2802
2803         * CMakeLists.txt:
2804
2805 2019-04-03  Alex Christensen  <achristensen@webkit.org>
2806
2807         Add SPI to disable legacy TLS fallback
2808         https://bugs.webkit.org/show_bug.cgi?id=196549
2809         <rdar://44979744>
2810
2811         Reviewed by Geoffrey Garen.
2812
2813         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2814         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
2815         (WebKit::NetworkSessionCreationParameters::encode const):
2816         (WebKit::NetworkSessionCreationParameters::decode):
2817         * NetworkProcess/NetworkSessionCreationParameters.h:
2818         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2819         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2820         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2821         (-[WKWebsiteDataStore _setAllowsTLSFallback:]):
2822         (-[WKWebsiteDataStore _allowsTLSFallback]):
2823         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2824         * UIProcess/WebProcessPool.cpp:
2825         (WebKit::WebProcessPool::ensureNetworkProcess):
2826         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2827         (WebKit::WebsiteDataStore::parameters):
2828         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2829         (WebKit::WebsiteDataStore::setSourceApplicationSecondaryIdentifier):
2830         (WebKit::WebsiteDataStore::setAllowsTLSFallback):
2831         (WebKit::WebsiteDataStore::setSourceApplicationBundleIdentifier):
2832         * UIProcess/WebsiteData/WebsiteDataStore.h:
2833         (WebKit::WebsiteDataStore::allowsTLSFallback const):
2834         (WebKit::WebsiteDataStore::networkingHasBegun):
2835         (WebKit::WebsiteDataStore::finalizeApplicationIdentifiers): Deleted.
2836
2837 2019-04-03  Myles C. Maxfield  <mmaxfield@apple.com>
2838
2839         Remove support for -apple-trailing-word
2840         https://bugs.webkit.org/show_bug.cgi?id=196525
2841
2842         Reviewed by Zalan Bujtas.
2843
2844         This CSS property is nonstandard and not used.
2845
2846         * Configurations/FeatureDefines.xcconfig:
2847
2848 2019-04-03  Alex Christensen  <achristensen@webkit.org>
2849
2850         Resurrect and fix layout test http/tests/adClickAttribution/store-ad-click-attribution.html
2851         https://bugs.webkit.org/show_bug.cgi?id=196476
2852
2853         Reviewed by Chris Dumez.
2854
2855         Re-apply a change I reverted in r241754 now that it's safe to do so.
2856
2857         * UIProcess/WebPageProxy.cpp:
2858         (WebKit::WebPageProxy::didCommitLoadForFrame):
2859
2860 2019-04-03  Daniel Bates  <dabates@apple.com>
2861
2862         [iOS] Should be able to dismiss picker or popover using the keyboard
2863         https://bugs.webkit.org/show_bug.cgi?id=196272
2864         <rdar://problem/48943170>
2865
2866         Reviewed by Wenson Hsieh.
2867
2868         Intercept key events and route them to the current input peripheral (if we have one). Add a base key event handler
2869         for all form peripherals that dismisses the accessory when either the Escape key is pressed or Command + . is pressed.
2870         I will fix this issue for the file upload picker/popover in <https://bugs.webkit.org/show_bug.cgi?id=196287>.
2871
2872         * SourcesCocoa.txt: Add file WKFormPeripheralBase.mm.
2873         * UIProcess/ios/WKContentViewInteraction.mm:
2874         (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason]): Added.
2875         (-[WKContentView resignFirstResponderForWebView]): Write in terms of -endEditingAndUpdateFocusAppearance.
2876         (-[WKContentView inputView]): Code style nit while I am here; add an empty line to demarcate the "crazy"
2877         code that the FIXME is referring to and should ideally be removed from the code that is sane to always do.
2878         (-[WKContentView accessoryDone]): When the accessory is dismissed via the Done button (iPhone) or by pressing
2879         Escape or Command + . using a hardware keyboard (iPhone or iPad) then end the current editing session, but
2880         do not resign first responder status as the page activation state should not be changed.
2881         (-[WKContentView _handleKeyUIEvent:]): Bring back this code when building with USE(UIKIT_KEYBOARD_ADDITIONS)
2882         as we need to route key events to the input peripheral (if we have one). If the input peripheral handles it
2883         then we're done: no need to let UIKit or WebKit handle it when building with USE(UIKIT_KEYBOARD_ADDITIONS),
2884         respectively. If the input peripheral does not handle it then do what we do now.
2885         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2886         If the element is re-focused and we have an input peripheral then we want to ensure we are first responder,
2887         reveal the focused element, update the accessory and tell the peripheral that editing has begun (again).
2888         For all other element re-focusing where we don't have a peripheral do what we do now. Also, update _isEditable
2889         to reflect whether the focused element contains selectable text. This is what UIKit wants to know when it queries
2890         -isEditable. Now that we no longer blur the focused element on iPad when the popover is dismissed and keep the
2891         peripheral until there is a focus change we need to ensure that we give the correct answer to UIKit on view
2892         editability. Otherwise, UIKit thinks it needs to update the text selection state when a popup button is tapped
2893         again (as part of its gesture recognizer logic) and this causes an assertion failure in UIKit after it calls back
2894         into us to ask for selection details, which we correctly respond with the equivalent of "we have none" and is
2895         not the answer UIKit expects since we told it we are editable. (Currently we manage to get away with telling UIKit
2896         we are always editable because it is not possible to perform a selection operation when we have a popover open.
2897         Closing the popover blurs the element, setting -isEditable to NO and deallocates the peripheral avoiding this issue).
2898         * UIProcess/ios/forms/WKFormColorControl.h:
2899         * UIProcess/ios/forms/WKFormColorControl.mm:
2900         (-[WKColorPopover controlEndEditing]): Dismiss the popover.
2901         (-[WKFormColorControl initWithView:]): Modified to call base class initializer.
2902         (-[WKFormColorControl assistantView]): Deleted.
2903         (-[WKFormColorControl beginEditing]): Deleted.
2904         (-[WKFormColorControl endEditing]): Deleted.
2905         * UIProcess/ios/forms/WKFormInputControl.h:
2906         * UIProcess/ios/forms/WKFormInputControl.mm:
2907         (-[WKFormInputControl initWithView:]): Modified to call base class initializer.
2908         (-[WKFormInputControl dateTimePickerCalendarType]): Write in terms of self.control.
2909         (-[WKDateTimePopover controlEndEditing]): Dismiss the popover and tell the controller that editing ended.
2910         (-[WKFormInputControl beginEditing]): Deleted.
2911         (-[WKFormInputControl endEditing]): Deleted.
2912         (-[WKFormInputControl assistantView]): Deleted.
2913         * UIProcess/ios/forms/WKFormPeripheral.h:
2914         * UIProcess/ios/forms/WKFormPeripheralBase.h: Added.
2915         * UIProcess/ios/forms/WKFormPeripheralBase.mm: Added.
2916         (-[WKFormPeripheralBase initWithView:control:]): Take ownership of the passed WKFormControl.
2917         (-[WKFormPeripheralBase beginEditing]): Turn around and tell the control.
2918         (-[WKFormPeripheralBase endEditing]): Ditto.
2919         (-[WKFormPeripheralBase assistantView]): Ditto.
2920         (-[WKFormPeripheralBase control]): Return the control.
2921         (-[WKFormPeripheralBase handleKeyEvent:]): Dismiss the accessory (in the same way we dismiss when the Done
2922         button is pressed on iPhone) on keydown of the Escape key or when we receive a UIKeyInputEscape event (for
2923         Command + .).
2924         * UIProcess/ios/forms/WKFormSelectControl.h:
2925         * UIProcess/ios/forms/WKFormSelectControl.mm:
2926         (-[WKFormSelectControl initWithView:]): Modified to call base class initializer.
2927         (-[WKFormSelectControl selectRow:inComponent:extendingSelection:]): Write in terms of self.control.
2928         (-[WKFormSelectControl selectFormPopoverTitle]): Ditto.
2929         (-[WKFormSelectControl assistantView]): Deleted.
2930         (-[WKFormSelectControl beginEditing]): Deleted.
2931         (-[WKFormSelectControl endEditing]): Deleted.
2932         * UIProcess/ios/forms/WKFormSelectPopover.mm:
2933         (-[WKSelectPopover controlEndEditing]): Dismiss the popover.
2934         * WebKit.xcodeproj/project.pbxproj: Add files WKFormPeripheralBase.{h, mm}.
2935
2936 2019-04-03  Youenn Fablet  <youenn@apple.com>
2937
2938         Resetting quota should take into account third party origins
2939         https://bugs.webkit.org/show_bug.cgi?id=196462
2940
2941         Reviewed by Geoffrey Garen.
2942
2943         When clearing the storage quota, we were resetting it to the default value
2944         without taking care of whether third party or not.
2945         Updated the code to ensure that the default quota is computed based on the origin.
2946
2947         Updated existing test to cover this case.
2948
2949         * NetworkProcess/NetworkProcess.cpp:
2950         (WebKit::NetworkProcess::clearStorageQuota):
2951         (WebKit::NetworkProcess::setCacheStorageParameters):
2952         (WebKit::NetworkProcess::updateQuotaBasedOnSpaceUsageForTesting):
2953         (WebKit::NetworkProcess::storageQuotaManager):
2954         * NetworkProcess/NetworkProcess.h:
2955         (WebKit::NetworkProcess::StorageQuotaManagers::defaultQuota const):
2956         (WebKit::NetworkProcess::StorageQuotaManagers::setDefaultQuotas):
2957         (WebKit::NetworkProcess::StorageQuotaManagers::managersPerOrigin):
2958
2959 2019-04-03  Michael Catanzaro  <mcatanzaro@igalia.com>
2960
2961         Get rid of HTMLInputElement::setEditingValue
2962         https://bugs.webkit.org/show_bug.cgi?id=196402
2963
2964         Reviewed by Darin Adler.
2965
2966         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMElement.cpp:
2967         (webkit_dom_element_html_input_element_set_editing_value):
2968         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLInputElement.cpp:
2969         (webkit_dom_html_input_element_set_editing_value):
2970
2971 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2972
2973         Add a WebKit internal feature flag to always enable modern compatibility mode by default
2974         https://bugs.webkit.org/show_bug.cgi?id=196526
2975         <rdar://problem/49532923>
2976
2977         Reviewed by Antoine Quint.
2978
2979         * Shared/WebPreferences.yaml:
2980
2981 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2982
2983         Introduce and add plumbing for a website policy for meta viewport tag handling
2984         https://bugs.webkit.org/show_bug.cgi?id=196285
2985
2986         Reviewed by Tim Horton.
2987
2988         Add WebsiteMetaViewportPolicy, a bit that can be used to determine whether to respect or ignore the meta
2989         viewport tag and use native web page parameters instead of the default parameters.
2990
2991         * Shared/WebsiteMetaViewportPolicy.h: Copied from Source/WebKit/Shared/WebsitePoliciesData.h.
2992         * Shared/WebsitePoliciesData.cpp:
2993         (WebKit::WebsitePoliciesData::encode const):
2994         (WebKit::WebsitePoliciesData::decode):
2995         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2996
2997         Convert WebKit::WebsiteMetaViewportPolicy into WebCore::MetaViewportPolicy.
2998
2999         * Shared/WebsitePoliciesData.h:
3000         * UIProcess/API/APIWebsitePolicies.cpp:
3001         (API::WebsitePolicies::data):
3002         * UIProcess/API/APIWebsitePolicies.h:
3003
3004         Add additional plumbing for the policy flag.
3005
3006         * WebKit.xcodeproj/project.pbxproj:
3007         * WebProcess/WebPage/ios/WebPageIOS.mm:
3008         (WebKit::WebPage::resetViewportDefaultConfiguration):
3009
3010         Use native web page parameters if either "shouldIgnoreMetaViewport" is enabled, or the new policy is set.
3011         Eventually, the policy should completely replace the former preference once no internal clients depend on it.
3012
3013 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3014
3015         Add plumbing for a compatibility mode preference in WebKit
3016         https://bugs.webkit.org/show_bug.cgi?id=196005
3017
3018         Reviewed by Tim Horton.
3019
3020         Add plumbing between the Cocoa API object (WKWebpagePreferences) and the inner C++ API object
3021         (API::WebsitePolicies) for compatibility mode.
3022
3023         * Shared/WebCompatibilityMode.h: Added.
3024         * UIProcess/API/APIWebsitePolicies.h:
3025         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
3026         * UIProcess/Cocoa/NavigationState.mm:
3027         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3028         * UIProcess/WebPageProxy.cpp:
3029         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode):
3030         * UIProcess/WebPageProxy.h:
3031         * UIProcess/ios/WebPageProxyIOS.mm:
3032         * WebKit.xcodeproj/project.pbxproj:
3033
3034 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3035
3036         [CoordinatedGraphics] Hidden pages are not suspended after a web view resize
3037         https://bugs.webkit.org/show_bug.cgi?id=196487
3038
3039         Reviewed by Žan Doberšek.
3040
3041         When resizing the window, the hidden tabs are updated too, to avoid flickering or getting the old size when
3042         switching tabs. For that we need to resume painting but we are not suspending it again after the update.
3043
3044         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
3045         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState): Suspend the painting again after a
3046         synchronous update if needed.
3047
3048 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3049
3050         Web Inspector: [GTK] Copy copies to nowhere
3051         https://bugs.webkit.org/show_bug.cgi?id=181228
3052
3053         Reviewed by Michael Catanzaro.
3054
3055         The thing is that those items are actually submenu items, with options, for example in the case of Copy to copy
3056         HTML, Text, XPath, etc. We are not correctly handling submenus when populating the context menu received from
3057         the web process.
3058
3059         * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
3060         (WebKit::WebContextMenuProxyGtk::populateSubMenu): Helper to populate submenu items recursively.
3061         (WebKit::WebContextMenuProxyGtk::populate): Handle submenu items.
3062         * UIProcess/gtk/WebContextMenuProxyGtk.h:
3063
3064 2019-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
3065
3066         [Cocoa] Add new API around WKWebpagePreferences in WKNavigationDelegate and WKWebViewConfiguration
3067         https://bugs.webkit.org/show_bug.cgi?id=196284
3068         <rdar://problem/47228232>
3069
3070         Reviewed by Tim Horton.
3071
3072         Tests for both of these APIs will be added in a subsequent patch.
3073
3074         * Shared/API/Cocoa/WebKit.h:
3075         * UIProcess/API/APIPageConfiguration.cpp:
3076         (API::PageConfiguration::defaultWebsitePolicies const):
3077         (API::PageConfiguration::setDefaultWebsitePolicies):
3078         * UIProcess/API/APIPageConfiguration.h:
3079         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
3080
3081         Add a new navigation delegate hook to allow clients to return a WKWebpagePreference targeting the given
3082         navigation action.
3083
3084         * UIProcess/API/Cocoa/WKWebView.mm:
3085         (-[WKWebView _initializeWithConfiguration:]):
3086         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
3087         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3088
3089         Add new API on WKWebViewConfiguration to specify a default WKWebpagePreference to use when navigating.
3090
3091         (-[WKWebViewConfiguration copyWithZone:]):
3092         (-[WKWebViewConfiguration defaultWebpagePreferences]):
3093         (-[WKWebViewConfiguration setDefaultWebpagePreferences:]):
3094         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
3095         * UIProcess/Cocoa/NavigationState.h:
3096         * UIProcess/Cocoa/NavigationState.mm:
3097         (WebKit::NavigationState::setNavigationDelegate):
3098         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3099
3100         Invoke the new WKWebpagePreferences-based navigation delegate method.
3101
3102         * WebKit.xcodeproj/project.pbxproj:
3103         * mac/postprocess-framework-headers.sh:
3104         * mac/replace-webkit-additions-in-framework-headers.sh: Added.
3105
3106         Move logic in the "Postprocess Framework Headers" step responsible for stripping away included files from
3107         WebKitAdditions out into a separate build phase, called "Replace WebKitAdditions in Framework Headers". This
3108         ensures headers attempting to include from WebKitAdditions have these additional statements removed.
3109
3110 2019-04-02  Geoffrey Garen  <ggaren@apple.com>
3111
3112         Eliminate plugin sandbox exceptions
3113         https://bugs.webkit.org/show_bug.cgi?id=196510
3114
3115         Reviewed by Chris Dumez.
3116
3117         * PluginProcess/mac/PluginProcessMac.mm:
3118         (WebKit::PluginProcess::initializeSandbox):
3119         * UIProcess/Plugins/PluginInfoStore.cpp:
3120         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed): Deleted.
3121         * UIProcess/Plugins/PluginInfoStore.h:
3122         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
3123         (WebKit::PluginInfoStore::shouldUsePlugin):
3124         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed): Deleted.
3125
3126 2019-04-02  Alex Christensen  <achristensen@webkit.org>
3127
3128         Fix assertion in http/tests/adClickAttribution/store-ad-click-attribution.html
3129         https://bugs.webkit.org/show_bug.cgi?id=196503
3130
3131         Reviewed by Chris Dumez.
3132
3133         In WebPageProxy::didDestroyNavigation we try to ignore a request to destroy a navigation from a page being navigated from
3134         during a cross-site navigation, but if the old web process sends the message after WebPageProxy::commitProvisionalPage
3135         has been called, we can still destroy a navigation when we are continuing a navigation in another process.  To prevent this,
3136         have the process not send the message when it knows the navigation is continuing in another process.
3137         Also make the use of unchecked navigation pointers more robust by checking it for nullity.
3138
3139         * UIProcess/WebPageProxy.cpp:
3140         (WebKit::WebPageProxy::didCommitLoadForFrame):
3141         * WebProcess/WebPage/WebFrame.cpp:
3142         (WebKit::WebFrame::didReceivePolicyDecision):
3143         (WebKit::WebFrame::documentLoaderDetached):
3144         * WebProcess/WebPage/WebFrame.h:
3145
3146 2019-04-02  Per Arne Vollan  <pvollan@apple.com>
3147
3148         [iOS] Fix iokit-get-properties sandbox violation in the WebContent process
3149         https://bugs.webkit.org/show_bug.cgi?id=196500
3150         <rdar://problem/49497788>
3151
3152         Reviewed by Brent Fulgham.
3153
3154         Attempting to get the iokit properties 'product-description', 'artwork-display-gamut' and
3155         'artwork-scale-factor' is causing sandbox violations.
3156
3157         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3158
3159 2019-04-02  Chris Dumez  <cdumez@apple.com>
3160
3161         [WK2] Add support for Window's beforeprint / afterprint events
3162         https://bugs.webkit.org/show_bug.cgi?id=196478
3163
3164         Reviewed by Alex Christensen.
3165
3166         Add support for Window's beforeprint / afterprint events as per:
3167         - https://html.spec.whatwg.org/#dom-print
3168
3169         Blink and Gecko already support this.
3170
3171         * WebProcess/WebPage/WebPage.cpp:
3172         (WebKit::WebPage::beginPrinting):
3173         (WebKit::WebPage::endPrinting):
3174
3175 2019-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
3176
3177         REGRESSION (r243726): Crash at unrecognized selector: -[WKWebpagePreferences webpagePreferences]
3178         https://bugs.webkit.org/show_bug.cgi?id=196496
3179         <rdar://problem/49521634>
3180
3181         Reviewed by Chris Dumez.
3182
3183         r243726 made an incorrect assumption that all callers of -decidePolicyForNavigationAction:decisionHandler: and
3184         -decidePolicyForNavigationAction:userInfo:decisionHandler: must be instances of _WKWebsitePolicies, as opposed
3185         to the new WKWebpagePreferences. However, it's possible for clients (in this case, Safari) to already generate
3186         and pass in an instance of WKWebpagePreferences by bridging the C API opaque ref (WKWebsitePoliciesRef) into the
3187         Objective-C object (which is now WKWebpagePreferences, after my change).
3188
3189         To maintain binary compatibility of trunk WebKit against prior versions of Safari, we need to handle both
3190         WKWebpagePreferences and the soon-to-be-deprecated _WKWebsitePolicies in the navigation action policy decision
3191         handler.
3192
3193         Tests:  WebKit.WebsitePoliciesWithBridgingCast
3194                 WebKit.WebsitePoliciesWithUnexpectedType
3195
3196         * UIProcess/Cocoa/NavigationState.mm:
3197         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3198
3199 2019-04-01  Chris Dumez  <cdumez@apple.com>
3200
3201         Unreviewed, drop debug logging landed as part of r242903 by mistake.
3202
3203         * UIProcess/WebPageProxy.cpp:
3204         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3205
3206 2019-04-01  Remy Demarest  <rdemarest@apple.com>
3207
3208         Add SPI to give injected bundles access to displayed PDFDocuments
3209         https://bugs.webkit.org/show_bug.cgi?id=196471
3210         <rdar://problem/48080768>
3211
3212         Reviewed by Tim Horton.
3213
3214         * WebKit.xcodeproj/project.pbxproj:
3215
3216         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.h: Added.
3217         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.mm: Added.
3218         (WKBundlePageGetPDFDocumentInFrame):
3219
3220 2019-04-01  Wenson Hsieh  <wenson_hsieh@apple.com>
3221
3222         [WebKit2] Introduce a public version of WKWebsitePolicies
3223         https://bugs.webkit.org/show_bug.cgi?id=195989
3224         <rdar://problem/47228232>
3225
3226         Reviewed by Tim Horton.
3227
3228         Expose the existing _WKWebsitePolicies object as WKWebpagePreferences, in what will eventually become a public
3229         header in the WebKit SDK (WKWebpagePreferences.h). Following a similar transitioning strategy as
3230         _WKWebsiteDataStore and WKWebsiteDataStore, we move existing logic from _WKWebsitePolicies to WKWebpagePreferences
3231         and make _WKWebsitePolicies a wrapper around WKWebpagePreferences.
3232
3233         No change in behavior.
3234
3235         * Shared/Cocoa/APIObject.mm:
3236         (API::Object::newObject):
3237
3238         Wrap API::WebsitePolicies with WKWebpagePreferences.
3239
3240         * SourcesCocoa.txt:
3241         * UIProcess/API/Cocoa/WKWebView.mm:
3242         (-[WKWebView _updateWebsitePolicies:]):
3243         * UIProcess/API/Cocoa/WKWebpagePreferences.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h.
3244         * UIProcess/API/Cocoa/WKWebpagePreferences.mm: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm.
3245
3246         Introduce WKWebpagePreferences.
3247
3248         (+[WKWebpagePreferences defaultPreferences]):
3249         (-[WKWebpagePreferences dealloc]):
3250         (-[WKWebpagePreferences init]):
3251         (-[WKWebpagePreferences _setContentBlockersEnabled:]):
3252         (-[WKWebpagePreferences _contentBlockersEnabled]):
3253         (-[WKWebpagePreferences _setAllowedAutoplayQuirks:]):
3254         (-[WKWebpagePreferences _allowedAutoplayQuirks]):
3255         (-[WKWebpagePreferences _setAutoplayPolicy:]):
3256         (-[WKWebpagePreferences _autoplayPolicy]):
3257         (-[WKWebpagePreferences _setDeviceOrientationAndMotionAccessPolicy:]):
3258         (-[WKWebpagePreferences _deviceOrientationAndMotionAccessPolicy]):
3259         (-[WKWebpagePreferences _setPopUpPolicy:]):
3260         (-[WKWebpagePreferences _popUpPolicy]):
3261         (-[WKWebpagePreferences _customHeaderFields]):
3262         (-[WKWebpagePreferences _setCustomHeaderFields:]):
3263         (-[WKWebpagePreferences _websiteDataStore]):
3264         (-[WKWebpagePreferences _setWebsiteDataStore:]):
3265         (-[WKWebpagePreferences _setCustomUserAgent:]):
3266         (-[WKWebpagePreferences _customUserAgent]):
3267         (-[WKWebpagePreferences _setCustomJavaScriptUserAgentAsSiteSpecificQuirks:]):
3268         (-[WKWebpagePreferences _customJavaScriptUserAgentAsSiteSpecificQuirks]):
3269         (-[WKWebpagePreferences _setCustomNavigatorPlatform:]):
3270         (-[WKWebpagePreferences _customNavigatorPlatform]):
3271         (-[WKWebpagePreferences _apiObject]):
3272         * UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h.
3273         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.h.
3274
3275         Reintroduce all the interfaces currently available on _WKWebsitePolicies as underscore-prefixed SPI on
3276         WKWebpagePreferences.
3277
3278         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
3279         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
3280
3281         Make _WKWebsitePolicies wrap WKWebpagePreferences, and plumb all existing SPI on WKWebsitePolicies through to
3282         WKWebpagePreferences.
3283
3284         (-[_WKWebsitePolicies init]):
3285         (-[_WKWebsitePolicies webpagePreferences]):
3286         (-[_WKWebsitePolicies setContentBlockersEnabled:]):
3287         (-[_WKWebsitePolicies contentBlockersEnabled]):
3288         (-[_WKWebsitePolicies setAllowedAutoplayQuirks:]):
3289         (-[_WKWebsitePolicies allowedAutoplayQuirks]):
3290         (-[_WKWebsitePolicies setAutoplayPolicy:]):
3291         (-[_WKWebsitePolicies autoplayPolicy]):
3292         (-[_WKWebsitePolicies setDeviceOrientationAndMotionAccessPolicy:]):
3293         (-[_WKWebsitePolicies deviceOrientationAndMotionAccessPolicy]):
3294         (-[_WKWebsitePolicies setPopUpPolicy:]):
3295         (-[_WKWebsitePolicies popUpPolicy]):
3296         (-[_WKWebsitePolicies customHeaderFields]):
3297         (-[_WKWebsitePolicies setCustomHeaderFields:]):
3298         (-[_WKWebsitePolicies websiteDataStore]):
3299         (-[_WKWebsitePolicies setWebsiteDataStore:]):
3300         (-[_WKWebsitePolicies setCustomUserAgent:]):
3301         (-[_WKWebsitePolicies customUserAgent]):
3302         (-[_WKWebsitePolicies setCustomJavaScriptUserAgentAsSiteSpecificQuirks:]):
3303         (-[_WKWebsitePolicies customJavaScriptUserAgentAsSiteSpecificQuirks]):
3304         (-[_WKWebsitePolicies setCustomNavigatorPlatform:]):
3305         (-[_WKWebsitePolicies customNavigatorPlatform]):
3306         (-[_WKWebsitePolicies description]):
3307         (-[_WKWebsitePolicies _apiObject]):
3308         (-[_WKWebsitePolicies dealloc]): Deleted.
3309         * UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h:
3310         * UIProcess/Cocoa/NavigationState.mm:
3311         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3312         * WebKit.xcodeproj/project.pbxproj:
3313
3314 2019-04-01  Wenson Hsieh  <wenson_hsieh@apple.com>
3315
3316         Unable to copy and paste a PDF from Notes into Mail compose body
3317         https://bugs.webkit.org/show_bug.cgi?id=196442
3318         <rdar://problem/48573098>
3319
3320         Reviewed by Tim Horton.
3321
3322         Relax the -canPerformAction: logic in the case of pasting an attachment. Consider an NSItemProvider to possibly
3323         paste as an attachment if either it has a preferred presentation style of UIPreferredPresentationStyleAttachment
3324         or has a style of UIPreferredPresentationStyleUnspecified, but has a suggested file name.
3325
3326         This allows for the "Paste" action to be shown in the callout menu when copying and pasting a non-text file.
3327
3328         * UIProcess/ios/WKContentViewInteraction.mm:
3329         (-[WKContentView canPerformActionForWebView:withSender:]):
3330
3331 2019-04-01  Tim Horton  <timothy_horton@apple.com>
3332
3333         Make UIWKDocumentContext rects per-character instead of per-word
3334         https://bugs.webkit.org/show_bug.cgi?id=196459
3335
3336         Reviewed by Wenson Hsieh.
3337
3338         * WebProcess/WebPage/ios/WebPageIOS.mm:
3339         (WebKit::WebPage::requestDocumentEditingContext):
3340         Switch to CharacterIterator instead of TextIterator directly, to get
3341         per-character rects as the API requests.
3342
3343 2019-04-01  Chris Dumez  <cdumez@apple.com>
3344
3345         UIProcess crash when a prewarmed process is terminated
3346         https://bugs.webkit.org/show_bug.cgi?id=196451
3347         <rdar://problem/49245471>
3348
3349         Reviewed by Geoffrey Garen.
3350
3351         Stop assuming that WebProcessProxy::m_websiteDataStore is non-null as this is no longer
3352         true after r243384. For example, prewarmed WebContent processe do not get a data store
3353         until they actually get used.
3354
3355         * UIProcess/API/Cocoa/WKProcessPool.mm:
3356         (-[WKProcessPool _prewarmedProcessIdentifier]):
3357         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3358         * UIProcess/WebProcessPool.cpp:
3359         (WebKit::WebProcessPool::networkProcessIdentifier):
3360         (WebKit::WebProcessPool::prewarmedProcessIdentifier):
3361         * UIProcess/WebProcessPool.h:
3362         * UIProcess/WebProcessProxy.cpp:
3363         (WebKit::WebProcessProxy::didClose):
3364         (WebKit::WebProcessProxy::didFinishLaunching):
3365         (WebKit::WebProcessProxy::requestTermination):
3366         (WebKit::WebProcessProxy::isReleaseLoggingAllowed const):
3367         * UIProcess/WebProcessProxy.h:
3368
3369 2019-04-01  Patrick Griffis  <pgriffis@igalia.com>
3370
3371         [GTK][WPE] Add more websitedatastore directories to web process sandbox
3372         https://bugs.webkit.org/show_bug.cgi?id=196447
3373
3374         Reviewed by Michael Catanzaro.
3375
3376         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
3377         (WebKit::bubblewrapSpawn):
3378         * UIProcess/glib/WebProcessProxyGLib.cpp:
3379         (WebKit::WebProcessProxy::platformGetLaunchOptions):
3380
3381 2019-04-01  Per Arne Vollan  <pvollan@apple.com>
3382
3383         [macOS] Crash when loading Twitter with autoplay video enabled.
3384         https://bugs.webkit.org/show_bug.cgi?id=196446
3385         <rdar://problem/49060359>
3386
3387         Reviewed by Brent Fulgham.
3388
3389         This is caused by a syscall violation.
3390
3391         * WebProcess/com.apple.WebProcess.sb.in:
3392
3393 2019-04-01  Patrick Griffis  <pgriffis@igalia.com>
3394
3395         [GTK][WPE] Fix seccomp rule for blacklisting TIOCSTI
3396         https://bugs.webkit.org/show_bug.cgi?id=196297
3397
3398         Reviewed by Michael Catanzaro.
3399
3400         More information can be found here: https://www.exploit-db.com/exploits/46594
3401
3402         Note that this sandbox never made it into production so does not
3403         warrant any CVE specific to WebKit.
3404
3405         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
3406         (WebKit::setupSeccomp):
3407
3408 2019-03-31  Wenson Hsieh  <wenson_hsieh@apple.com>
3409
3410         [iOS] Crash when changing inputmode for certain types of focusable elements
3411         https://bugs.webkit.org/show_bug.cgi?id=196431
3412         <rdar://problem/49454962>
3413
3414         Reviewed by Tim Horton.
3415
3416         The crash is happening because WebPage::focusedElementDidChangeInputMode assumes that the document's focused
3417         element must be the same as m_focusedElement in WebPage. However, this is not the case, since m_focusedElement
3418         is only set for certain types of elements that require user input (e.g. text fields, editable content, select
3419         menus, etc.). The function then attempts to dereference m_focusedElement, which may be null if the document's
3420         focused element doesn't fall into one of the aforementioned categories.
3421
3422         To fix this, bail if the element that is changing inputmode is not equal to the WebPage's current focused
3423         element. See below for more details.
3424
3425         Test: fast/forms/change-inputmode-crash.html
3426
3427         * WebProcess/WebPage/WebPage.cpp:
3428         (WebKit::isTextFormControlOrEditableContent):
3429
3430         Clean up some existing logic by introducing a helper method for determining whether an element should
3431         propagate inputmode attribute changes to the UI process. Also, check the element type using type traits instead
3432         of checking against the tag name.
3433
3434         (WebKit::WebPage::elementDidFocus):
3435         (WebKit::WebPage::focusedElementDidChangeInputMode):
3436
3437 2019-03-31  Sam Weinig  <weinig@apple.com>
3438
3439         Remove more i386 specific configurations
3440         https://bugs.webkit.org/show_bug.cgi?id=196430
3441
3442         Reviewed by Alexey Proskuryakov.
3443
3444         * Configurations/BaseTarget.xcconfig:
3445         WK_HAVE_CORE_PREDICTION can now be enabled unconditionally.
3446  
3447         * Configurations/FeatureDefines.xcconfig:
3448         ENABLE_WEB_AUTHN_macosx can now be enabled unconditionally on macOS.
3449
3450 2019-03-31  Andy Estes  <aestes@apple.com>
3451
3452         [iOS] WebKit should consult the navigation response policy delegate before previewing a QuickLook document
3453         https://bugs.webkit.org/show_bug.cgi?id=196433
3454         <rdar://problem/49293305>
3455
3456         Reviewed by Tim Horton.
3457
3458         Added WKWebViewConfiguration SPI for setting the QuickLook navigation response policy
3459         decision behavior. The configuration setting defaults to YES for clients linked on or after
3460         this WebKit change and NO otherwise.
3461
3462         * NetworkProcess/NetworkResourceLoader.cpp:
3463         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
3464         * Shared/WebPreferences.yaml:
3465         * Shared/ios/QuickLookDocumentData.cpp:
3466         (WebKit::QuickLookDocumentData::isEmpty const):
3467         * Shared/ios/QuickLookDocumentData.h:
3468         * UIProcess/API/Cocoa/WKWebView.mm:
3469         (-[WKWebView _initializeWithConfiguration:]):
3470         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3471         (defaultShouldDecidePolicyBeforeLoadingQuickLookPreview):
3472         (-[WKWebViewConfiguration init]):
3473         (-[WKWebViewConfiguration encodeWithCoder:]):
3474         (-[WKWebViewConfiguration initWithCoder:]):
3475         (-[WKWebViewConfiguration copyWithZone:]):
3476         (-[WKWebViewConfiguration _shouldDecidePolicyBeforeLoadingQuickLookPreview]):
3477         (-[WKWebViewConfiguration _setShouldDecidePolicyBeforeLoadingQuickLookPreview:]):
3478         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
3479         * UIProcess/Cocoa/VersionChecks.h:
3480         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp:
3481         (WebKit::WebPreviewLoaderClient::didReceiveDataArray):
3482
3483 2019-03-30  Zalan Bujtas  <zalan@apple.com>
3484
3485         [ContentChangeObserver] Subframe load should not reset content observation on the mainframe
3486         https://bugs.webkit.org/show_bug.cgi?id=196408
3487         <rdar://problem/49436797>
3488
3489         Reviewed by Simon Fraser.
3490
3491         Hover intent fails when an unrelated frame commits a load the same time.
3492         cancelPotentialTapInFrame is called from didCommitLoad, but what we are looking for here is the user initiated cancel of a tap (cancelPotentialTap).
3493         (If the current frame navigates away, willDetachPage takes care of canceling the observation.)
3494
3495         * WebProcess/WebPage/ios/WebPageIOS.mm:
3496         (WebKit::WebPage::cancelPotentialTap):
3497         (WebKit::WebPage::cancelPotentialTapInFrame):
3498
3499 2019-03-29  John Wilander  <wilander@apple.com>
3500
3501         Move WebResourceLoadStatisticsStore IPC calls from the UI process to the network process
3502         https://bugs.webkit.org/show_bug.cgi?id=196407
3503         <rdar://problem/47859936>
3504
3505         Reviewed by Brent Fulgham.
3506
3507         The two WebResourceLoadStatisticsStore IPC endpoints were left behind when we
3508         moved Resource Load Statistics from the UI process to the network process. One
3509         of the endpoints is the message RequestStorageAccessUnderOpener which underpins
3510         our compatibility fix for federated logins using popups. This patch redirects
3511         these IPC calls to the network process and cleans up some assumptions around
3512         them.
3513
3514         * CMakeLists.txt:
3515             Removed the old IPC receiver.
3516         * DerivedSources.make:
3517             Removed the old IPC receiver.
3518         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3519         (WebKit::WebResourceLoadStatisticsStore::requestUpdate): Deleted.
3520             This is no longer needed since there is a dedicated update mechanism
3521             that actually sends the update.
3522         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3523         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3524         (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
3525         (WebKit::NetworkConnectionToWebProcess::requestStorageAccessUnderOpener):
3526             Two new IPC receivers to pipe the calls to the network process.
3527         (WebKit::NetworkConnectionToWebProcess::requestResourceLoadStatisticsUpdate): Deleted.
3528             NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated now serves
3529             this purpose.
3530         * NetworkProcess/NetworkConnectionToWebProcess.h:
3531         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3532         * UIProcess/WebResourceLoadStatisticsStore.messages.in: Removed.
3533             Removed the old IPC receiver.
3534         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3535         * WebKit.xcodeproj/project.pbxproj:
3536         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
3537         (WKBundleResourceLoadStatisticsNotifyObserver):
3538             Function name update.
3539         * WebProcess/WebProcess.cpp:
3540             Now calls IPC to the network process instead of the UI process.
3541
3542 2019-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
3543
3544         Delete WebMetal implementation in favor of WebGPU
3545         https://bugs.webkit.org/show_bug.cgi?id=195418
3546
3547         Reviewed by Dean Jackson.
3548
3549         * Configurations/FeatureDefines.xcconfig:
3550         * Shared/WebPreferences.yaml:
3551         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3552         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3553
3554 2019-03-29  Takashi Komori  <Takashi.Komori@sony.com>
3555
3556         [Curl] Add Server Trust Evaluation Support.
3557         https://bugs.webkit.org/show_bug.cgi?id=191646
3558
3559         Reviewed by Fujii Hironori.
3560
3561         Tests: http/tests/ssl/iframe-upgrade.https.html
3562                http/tests/ssl/mixedContent/insecure-websocket.html
3563                http/tests/ssl/upgrade-origin-usage.html
3564
3565         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
3566         (WebKit::NetworkDataTaskCurl::curlDidFailWithError):
3567         (WebKit::NetworkDataTaskCurl::tryServerTrustEvaluation):
3568         (WebKit::NetworkDataTaskCurl::restartWithCredential):
3569         * NetworkProcess/curl/NetworkDataTaskCurl.h:
3570
3571 2019-03-29  Cathie Chen  <cathiechen@igalia.com>
3572
3573         Implement ResizeObserver.
3574         https://bugs.webkit.org/show_bug.cgi?id=157743
3575
3576         Reviewed by Simon Fraser.
3577
3578         Add WebPreferences and FeatureDefines for ResizeObserver.
3579
3580         * Configurations/FeatureDefines.xcconfig:
3581         * Shared/WebPreferences.yaml:
3582
3583 2019-03-28  Timothy Hatcher  <timothy@apple.com>
3584
3585         CFDictionary encoder crashes on non-string keys.
3586         https://bugs.webkit.org/show_bug.cgi?id=196388
3587         rdar://problem/49339242
3588
3589         Reviewed by Ryosuke Niwa.
3590
3591         Allow non-string keys in CFDictionary encoding/decoding. Encode the correct
3592         size for dictionaries and arrays when unknown keys or values are skipped.
3593         Allow null array encoding and decoding like dictionary already allowed.
3594
3595         * Shared/cf/ArgumentCodersCF.cpp:
3596         (IPC::encode):
3597         (IPC::decode):
3598
3599 2019-03-28  John Wilander  <wilander@apple.com>
3600
3601         Resource Load Statistics: IPC to the WebsiteDataStore in the UI process from NetworkProcess::deleteWebsiteDataForRegistrableDomains()
3602         https://bugs.webkit.org/show_bug.cgi?id=196281
3603         <rdar://problem/48938748>
3604
3605         Reviewed by Alex Christensen.
3606
3607         The move of Resource Load Statistics to the network process requires that it
3608         calls the UI process when clearing website data (previously the other way
3609         around). This patch achieves that.
3610
3611         Specifically, NetworkProcess::deleteWebsiteDataForRegistrableDomains() now
3612         filters its WebsiteDataTypes down to just the ones applicable for the UI
3613         process and then calls DeleteWebsiteDataInUIProcessForRegistrableDomains over
3614         IPC.
3615
3616         NetworkProcessProxy::deleteWebsiteDataInUIProcessForRegistrableDomains() on
3617         the UI process side makes use of the re-introduced
3618         WebsiteDataStore::fetchDataForRegistrableDomains() function to get the relevant
3619         data records and call WebsiteDataStore::removeData(). The re-introduced
3620         WebsiteDataStore::fetchDataForRegistrableDomains() was removed as dead code in
3621         https://trac.webkit.org/changeset/242056/webkit, then under the name
3622         WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains(). The reason it
3623         was dead code was the lack of IPC call that this patch adds.
3624
3625         * NetworkProcess/NetworkProcess.cpp:
3626         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
3627            Now calls DeleteWebsiteDataInUIProcessForRegistrableDomains over IPC if there
3628            are WebsiteDataTypes applicable to the UI process.
3629         * NetworkProcess/NetworkProcess.h:
3630         * Shared/WebsiteData/WebsiteData.cpp:
3631         (WebKit::WebsiteData::ownerProcess):
3632         (WebKit::WebsiteData::filter):
3633             Convenience functions to manage process ownership of website data types.
3634         * Shared/WebsiteData/WebsiteData.h:
3635         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3636         (WKWebsiteDataStoreStatisticsHasLocalStorage):
3637             Test infrastructure, called by the TestRunner.
3638         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3639         * UIProcess/Network/NetworkProcessProxy.cpp:
3640         (WebKit::NetworkProcessProxy::deleteWebsiteDataInUIProcessForRegistrableDomains):
3641             New function to be called from the network process.
3642         * UIProcess/Network/NetworkProcessProxy.h:
3643         * UIProcess/Network/NetworkProcessProxy.messages.in:
3644         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
3645         (WebKit::WebsiteDataRecord::matches const):
3646             Now matches with WebCore::RegistrableDomain instead of a string.
3647         (WebKit::WebsiteDataRecord::matchesTopPrivatelyControlledDomain const): Deleted.
3648             Replaced by WebsiteDataRecord::matches().
3649         * UIProcess/WebsiteData/WebsiteDataRecord.h:
3650         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3651         (WebKit::WebsiteDataStore::fetchDataForRegistrableDomains):
3652             Re-introduced. It was removed as dead code in r242056.
3653         (WebKit::computeNetworkProcessAccessTypeForDataRemoval):
3654         (WebKit::WebsiteDataStore::hasLocalStorageForTesting const):
3655             Test infrastructure, called by the TestRunner.
3656         * UIProcess/WebsiteData/WebsiteDataStore.h:
3657
3658 2019-03-28  Jiewen Tan  <jiewen_tan@apple.com>
3659
3660         API::Data::createWithoutCopying should do a null check before calling CFRelease
3661         https://bugs.webkit.org/show_bug.cgi?id=196276
3662         <rdar://problem/48059859>
3663
3664         Reviewed by Alex Christensen.
3665
3666         * Shared/Cocoa/APIDataCocoa.mm:
3667         (API::Data::createWithoutCopying):
3668
3669 2019-03-28  Per Arne Vollan  <pvollan@apple.com>
3670
3671         [iOS] Automatic focus of input field is flaky
3672         https://bugs.webkit.org/show_bug.cgi?id=196302
3673
3674         Reviewed by Brent Fulgham.
3675
3676         Sometimes the status of whether a keyboard is connected can be incorrect, both in the UI process, and in
3677         the WebContent process. Fix this by sending the keyboard status to the WebContent process as part of the
3678         Web page creation parameters. Stop caching the keyboard status in the Web process proxy, and call
3679         [UIKeyboard isInHardwareKeyboardMode] instead, since this method is swizzled in the test harness.
3680
3681         * Shared/WebPageCreationParameters.cpp:
3682         (WebKit::WebPageCreationParameters::encode const):
3683         (WebKit::WebPageCreationParameters::decode):
3684         * Shared/WebPageCreationParameters.h:
3685         * UIProcess/API/Cocoa/WKWebView.mm:
3686         (hardwareKeyboardAvailabilityChangedCallback):
3687         * UIProcess/WebPageProxy.cpp:
3688         (WebKit::WebPageProxy::creationParameters):
3689         * UIProcess/WebPageProxy.h:
3690         * UIProcess/WebProcessProxy.cpp:
3691         * UIProcess/WebProcessProxy.h:
3692         (WebKit::WebProcessProxy::setKeyboardIsAttached): Deleted.
3693         (WebKit::WebProcessProxy::keyboardIsAttached const): Deleted.
3694         * UIProcess/ios/WKContentViewInteraction.mm:
3695         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3696         * UIProcess/ios/WebPageProxyIOS.mm:
3697         (WebKit::WebPageProxy::isInHardwareKeyboardMode):
3698         (WebKit::WebPageProxy::applicationWillEnterForeground):
3699         * WebProcess/WebPage/WebPage.cpp:
3700         * WebProcess/WebPage/WebPage.h:
3701
3702 2019-03-28  Tim Horton  <timothy_horton@apple.com>
3703
3704         Fix the build.
3705
3706         * UIProcess/ios/WKActionSheetAssistant.mm:
3707         (-[WKActionSheetAssistant showImageSheet]):
3708         * UIProcess/ios/WKContentViewInteraction.mm:
3709         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
3710
3711 2019-03-28  Michael Catanzaro  <mcatanzaro@igalia.com>
3712
3713         [WPE][GTK] webkit_web_resource_get_data_finish can return NULL without setting error
3714         https://bugs.webkit.org/show_bug.cgi?id=186276
3715
3716         Reviewed by Carlos Garcia Campos.
3717
3718         Currently it's possible for webkit_web_resource_get_data_finish() to return NULL without
3719         setting the error parameter. This is illegal because it is an API guarantee (and a GObject
3720         convention) that if an error parameter exists, it should be set whenever a function call
3721         returns NULL. Epiphany correctly dereferences the error in this case without checking if it
3722         is NULL, because it knows it does not have to, and crashes. Fix this. We'll return a byte
3723         array of length 1 containing a NUL character. This isn't great, but there's not really any
3724         better solution without deprecating the API or returning an error code to indicate an empty
3725         resource, and it at least fixes the Epiphany crash.
3726
3727         This does not fix bug #186276, in which this function incorrectly returns no data when it
3728         ought to. But that is a different bug. Now, at least we won't crash when no data is
3729         available.
3730
3731         * UIProcess/API/glib/WebKitWebResource.cpp:
3732         (resourceDataCallback):
3733
3734 2019-03-28  Daniel Bates  <dabates@apple.com>
3735
3736         [iPad] Tapping on a popup form control may not show a popover
3737         https://bugs.webkit.org/show_bug.cgi?id=196322
3738         <rdar://problem/49229632>
3739
3740         Reviewed by Wenson Hsieh.
3741
3742         Stop taking advantage of -[WKContentView inputView] being called when we invoke -reloadInputViews
3743         to "lazily" allocate the input peripheral for the currently focused element. In theory, UIKit only
3744         needs to call -inputView when it actually needs to display the input view (the keyboard). For
3745         popup menu buttons, like <select>, no keyboard is needed. Instead we should create the peripheral
3746         as part of the logic in the UI process to focus a new element before we call -reloadInputViews.
3747
3748         * UIProcess/ios/WKContentViewInteraction.mm:
3749         (-[WKContentView inputView]): Extract logic to allocate the peripheral from here and moved it to createInputPeripheralWithView().
3750         (-[WKContentView accessoryTab:]): While I am here, add a FIXME comment to explain why we need to
3751         end the input sessions and nullify the input peripheral before we tell the web process to switch
3752         focus as opposed to letting this happen after the web process tells us it focused a new element.
3753         (createInputPeripheralWithView): Added.
3754         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3755         Write in terms of createInputPeripheralWithView(). Create the input peripheral after becoming
3756         first responder because creating the peripheral has known side-effects: for popup buttons it
3757         tells the popup controller to present the popover. For key input to popovers to work from the get-go,
3758         the content view must be the first responder. See <https://bugs.webkit.org/show_bug.cgi?id=196272>
3759         for more details.
3760
3761 2019-03-28  Víctor Manuel Jáquez Leal  <vjaquez@igalia.com>
3762
3763         Silence lot of warnings when compiling with clang
3764         https://bugs.webkit.org/show_bug.cgi?id=196310
3765
3766         Reviewed by Michael Catanzaro.
3767
3768         * UIProcess/API/glib/WebKitInjectedBundleClient.cpp: add missing
3769         override clause.
3770         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: add
3771         missing override clause.
3772
3773 2019-03-27  Ryosuke Niwa  <rniwa@webkit.org>
3774
3775         [macOS] Select element doesn't show popup if select element had lost focus while popup was previosuly shown
3776         https://bugs.webkit.org/show_bug.cgi?id=196336
3777
3778         Reviewed by Tim Horton.
3779
3780         The bug was caused by WebPopupMenu::hide never notifying PopupClient that the popup had been dismissed.
3781         This resulted in RenderMenuList::m_popupIsVisible to be never reset.
3782
3783         Also fixed a bug in WebPopupMenuProxyMac::hidePopupMenu that this function was never dismissing
3784         the popup as the selector "dismissPopUp", on the contrary to its name, does not dimiss the popup.
3785         Send cancelTracking to NSMenu instead, which DOES dismiss the popup.
3786
3787         Tests: fast/forms/select/mac-wk2/blur-dismisses-select-popup.html
3788                fast/forms/select/mac-wk2/open-select-popup-after-dismissing-by-blur.html
3789
3790         * UIProcess/mac/WebPopupMenuProxyMac.mm:
3791         (WebKit::WebPopupMenuProxyMac::hidePopupMenu):
3792         * WebProcess/WebCoreSupport/WebPopupMenu.cpp:
3793         (WebKit::WebPopupMenu::hide):
3794
3795 2019-03-27  Dean Jackson  <dino@apple.com>
3796
3797         [ARKit] Black view when opening a 3D model usdz file in new tab
3798         https://bugs.webkit.org/show_bug.cgi?id=196333
3799         <rdar://problem/47693367>
3800
3801         Reviewed by Tim Horton.
3802
3803         When opening a new WKSystemPreviewView, we were exiting if there was no
3804         presentingViewController. This code was unnecessary, and causing blank
3805         content when opening a new tab.
3806
3807         * UIProcess/ios/WKSystemPreviewView.mm:
3808         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
3809         Remove the code looking for a presentingViewController.
3810
3811 2019-03-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3812
3813         Need a way to include WebKitAdditions code in WebKit API headers
3814         https://bugs.webkit.org/show_bug.cgi?id=196173
3815
3816         Reviewed by Tim Horton.
3817
3818         Introduce a mechanism that allows us to insert code from WebKitAdditions into public or private SDK headers
3819         using `#import`s of the form:
3820
3821         ```
3822         #if USE(APPLE_INTERNAL_SDK)
3823         #import <WebKitAdditions/WKWebViewConfigurationAdditions.h>
3824         #endif
3825         ```
3826
3827         The resulting header in the built products directory will contain the contents of the imported file inserted in
3828         place of the `#if USE(APPLE_INTERNAL_SDK) … #endif` block; however, when building with the Apple internal SDK,
3829         the additions header content will be imported by the usual means.
3830
3831         * mac/postprocess-framework-headers.sh:
3832         * mac/replace-webkit-additions-includes.py: Added.
3833
3834         Add a step when post-processing framework headers to replace instances of `#if USE(APPLE_INTERNAL_SDK) … #endif`
3835         with the text content of the additions files. The replacement script first searches in the built products
3836         directory for the matching additions file, and falls back to the SDK if no matching file is found. If neither
3837         are present (e.g. a build using the public SDK), then the block is simply replaced by the empty string.
3838
3839         (read_content_from_webkit_additions):
3840         (main):
3841
3842 2019-03-27  Andy Estes  <aestes@apple.com>
3843
3844         REGRESSION (r242686): package-root creates roots with broken symlinks in WebKit.framework/XPCServices/
3845         https://bugs.webkit.org/show_bug.cgi?id=196317
3846
3847         Reviewed by Dan Bernstein.
3848
3849         Removed some remnants of the Storage Process.
3850
3851         * Configurations/BaseTarget.xcconfig:
3852         * Resources/SandboxProfiles/ios/com.apple.WebKit.Storage.sb: Removed.
3853         * WebKit.xcodeproj/project.pbxproj:
3854
3855 2019-03-27  Keith Rollin  <krollin@apple.com>
3856
3857         Include the CFNetworking task UUID to the NSError when a resource-load fails
3858         https://bugs.webkit.org/show_bug.cgi?id=196156
3859
3860         Reviewed by Alex Christensen.
3861
3862         In order to help track the connection between a failed resource-load
3863         and a user-visible error message, include the CFNetworking task UUID
3864         in the associated error as an element of the userInfo property. This
3865         can then be pulled out and reported in the logging at the point the
3866         error is reported to the user.
3867
3868         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3869         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
3870
3871 2019-03-27  Chris Dumez  <cdumez@apple.com>
3872
3873         [ iOS Sim ] REGRESSION (r242277) Layout Test http/tests/cookies/same-site/lax-samesite-cookie-after-cross-site-history-load.php is a flaky timeout
3874         https://bugs.webkit.org/show_bug.cgi?id=195425
3875         <rdar://problem/48682403>
3876
3877         Reviewed by Alex Christensen.
3878
3879         When process-swapping on history navigation, we lookup the WebProcessProxy we'd like to use from the
3880         process identifier that is saved on the WebBackForwardListItem, to try and load the item in the process
3881         in which it was previously loaded. However, we were failing to check if the WebProcess in question was
3882         still running so we could potentially try to use a process that's already exited.
3883
3884         * UIProcess/WebProcessPool.cpp:
3885         (WebKit::WebProcessPool::processForNavigationInternal):
3886
3887 2019-03-27  Zalan Bujtas  <zalan@apple.com>
3888
3889         [ContentChangeObserver] Always dispatch the synthetic click asynchronously
3890         https://bugs.webkit.org/show_bug.cgi?id=196278
3891         <rdar://problem/49299968>
3892
3893         Reviewed by Simon Fraser.
3894
3895         This patch ensures that all completeSyntheticClick() calls happen in an asynchronous manner (unless the feature is turned off).
3896
3897         * WebProcess/WebPage/ios/WebPageIOS.mm:
3898         (WebKit::dispatchSyntheticMouseMove):
3899         (WebKit::WebPage::handleSyntheticClick):
3900
3901 2019-03-27  Tim Horton  <timothy_horton@apple.com>
3902
3903         Fix some more deprecation warnings in WKDrawingView
3904         https://bugs.webkit.org/show_bug.cgi?id=196282
3905         <rdar://problem/47637608>
3906
3907         Reviewed by Wenson Hsieh.
3908
3909         * Platform/spi/ios/PencilKitSPI.h:
3910         * SourcesCocoa.txt:
3911         * UIProcess/ios/PencilKitSoftLink.h:
3912         * UIProcess/ios/PencilKitSoftLink.mm:
3913         * UIProcess/ios/WKContentViewInteraction.mm:
3914         * UIProcess/ios/WKDrawingCoordinator.h:
3915         * UIProcess/ios/WKDrawingCoordinator.mm:
3916         (-[WKDrawingCoordinator initWithContentView:]):
3917         (-[WKDrawingCoordinator currentInk]):
3918         (-[WKDrawingCoordinator undoManagerForInkPicker:]):
3919         (-[WKDrawingCoordinator containingViewForInkPicker:]):
3920         (-[WKDrawingCoordinator inkPickerDidToggleRuler:]):
3921         (-[WKDrawingCoordinator inkPickerDidChangeInk:]):
3922         (-[WKDrawingCoordinator installInkPickerForDrawing:]):
3923         (-[WKDrawingCoordinator uninstallInkPicker]):
3924         (-[WKDrawingCoordinator inkPicker]): Deleted.
3925         (-[WKDrawingCoordinator didChangeRulerState:]): Deleted.
3926         (-[WKDrawingCoordinator didChangeInk:]): Deleted.
3927         * UIProcess/ios/WKDrawingView.mm:
3928         (-[WKDrawingView _canvasViewWillBeginDrawing:]):
3929         * UIProcess/ios/WKInkPickerView.h: Removed.
3930         * UIProcess/ios/WKInkPickerView.mm: Removed.
3931         * WebKit.xcodeproj/project.pbxproj:
3932         Adopt the new names.
3933
3934 2019-03-27  Carlos Garcia Campos  <cgarcia@igalia.com>
3935
3936         Geolocation request not complete when watch request was started in a different web process
3937         https://bugs.webkit.org/show_bug.cgi?id=195996
3938
3939         Reviewed by Alex Christensen.
3940
3941         In WebGeolocationManagerProxy::startUpdating() we do nothing when the provider is already updating. We should
3942         reply with a DidChangePosition using the last known position, if available. If we are updating, but we still
3943         don't have a known position, the request will be completed when
3944         WebGeolocationManagerProxy::providerDidChangePosition() is called since it always notifies all web
3945         processes.
3946
3947         * UIProcess/WebGeolocationManagerProxy.cpp:
3948         (WebKit::WebGeolocationManagerProxy::providerDidChangePosition): Cache the position.
3949         (WebKit::WebGeolocationManagerProxy::startUpdating): Reply using cached position if already known.
3950         * UIProcess/WebGeolocationManagerProxy.h:
3951         (WebKit::WebGeolocationManagerProxy::lastPosition const): Return cached position.
3952         * WebProcess/WebCoreSupport/WebGeolocationClient.cpp:
3953         (WebKit::WebGeolocationClient::lastPosition): Remove the FIXME since we don't want this feature.
3954
3955 2019-03-26  Brent Fulgham  <bfulgham@apple.com>
3956
3957         [macOS] Correct kerberos-related sandbox violations
3958         https://bugs.webkit.org/show_bug.cgi?id=196279
3959         <rdar://problem/48622502>
3960
3961         Reviewed by Per Arne Vollan.
3962
3963         We need to allow communications with a Kerberos-related service on macOS
3964         until <rdar://problem/35542803> is fixed.
3965
3966         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
3967
3968 2019-03-26  Chris Dumez  <cdumez@apple.com>
3969
3970         [macOS] The network process is not exiting reliably when the WebProcessPool is destroyed
3971         https://bugs.webkit.org/show_bug.cgi?id=196277
3972         <rdar://problem/49127581>
3973
3974         Reviewed by Alex Christensen.
3975
3976         When, an AuxiliaryProcess receives the AuxiliaryProcess::Terminate IPC, it calls stopRunLoop()
3977         to exit. WebProcess overrides AuxiliaryProcess::stopRunLoop() to call exit(0) on the main
3978         thread. Other auxiliary processes such as the NetworkProcess would end up calling
3979         platformStopRunLoop(). On iOS and iOSMac, platformStopRunLoop() calls XPCServiceExit(), which
3980         makes sense since auxiliary processes run their run loop by calling xpc_main(). However, on
3981         macOS, platformStopRunLoop() was calling RunLoop::main().stop() to exit instead, which was
3982         unreliable as demonstrated by the test app attached to the radar.
3983
3984         Updating platformStopRunLoop() to call XPCServiceExit() on macOS fixes the problem and I now
3985         see the&nbs