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