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