Add support for Intl NumberFormat formatToParts
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-05-16  Andy VanWagoner  <andy@vanwagoner.family>
2
3         Add support for Intl NumberFormat formatToParts
4         https://bugs.webkit.org/show_bug.cgi?id=185375
5
6         Reviewed by Yusuke Suzuki.
7
8         Add flag for NumberFormat formatToParts.
9
10         * Configurations/FeatureDefines.xcconfig:
11
12 2018-05-16  Andy Estes  <aestes@apple.com>
13
14         [Wi-Fi Assertions] Adopt WiFiAssertionHolderAdditions
15         https://bugs.webkit.org/show_bug.cgi?id=185685
16         <rdar://problem/40136681>
17
18         Reviewed by Sam Weinig.
19
20         * NetworkProcess/cocoa/WiFiAssertionHolder.cpp:
21         (WebKit::WiFiAssertionHolder::WiFiAssertionHolder):
22         (WebKit::WiFiAssertionHolder::~WiFiAssertionHolder):
23         (WebKit::ensureWiFiManagerClient): Deleted.
24
25 2018-05-16  Fujii Hironori  <Hironori.Fujii@sony.com>
26
27         [Win] Implement WebPage::handleEditingKeyboardEvent
28         https://bugs.webkit.org/show_bug.cgi?id=185327
29
30         Reviewed by Alexey Proskuryakov.
31
32         * WebProcess/WebPage/win/WebPageWin.cpp:
33         (WebKit::WebPage::handleEditingKeyboardEvent): Copied from WebKitLegacy.
34
35 2018-05-16  Sihui Liu  <sihui_liu@apple.com>
36
37         Session cookies aren't reliably set when using default WKWebSiteDataStore
38         https://bugs.webkit.org/show_bug.cgi?id=185624
39         <rdar://problem/39111626>
40
41         Reviewed by Geoffrey Garen.
42
43         Session cookies of default session were set in UI Process when there was no process pool, 
44         but they were not synced (or synced slowly to) Network Process. To make these cookies visible
45         as soon as they were set through API, we could manually set those cookies in Network Process
46         during its initilization. 
47
48         * NetworkProcess/mac/RemoteNetworkingContext.mm:
49         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
50         * UIProcess/API/APIHTTPCookieStore.cpp:
51         (API::HTTPCookieStore::cookies):
52         (API::HTTPCookieStore::setCookie):
53         (API::HTTPCookieStore::deleteCookie):
54         * UIProcess/WebProcessPool.cpp:
55         (WebKit::WebProcessPool::ensureNetworkProcess):
56         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
57         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
58         (WebKit::WebsiteDataStore::clearPendingCookies):
59         * UIProcess/WebsiteData/WebsiteDataStore.h:
60
61 2018-05-16  Chris Nardi  <cnardi@chromium.org>
62
63         Remove Document#selectedStylesheetSet/preferredStylesheetSet
64         https://bugs.webkit.org/show_bug.cgi?id=185381
65
66         Reviewed by Darin Adler.
67
68         Make API methods for Document#selectedStylesheetSet/preferredStylesheetSet do nothing.
69
70         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.h:
71         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
72         (webkit_dom_document_set_property):
73         (webkit_dom_document_get_property):
74         (webkit_dom_document_get_preferred_stylesheet_set):
75         (webkit_dom_document_get_selected_stylesheet_set):
76         (webkit_dom_document_set_selected_stylesheet_set):
77
78 2018-05-16  Alberto Garcia  <berto@igalia.com>
79
80         [CMake] Properly detect compiler flags, needed libs, and fallbacks for usage of 64-bit atomic operations
81         https://bugs.webkit.org/show_bug.cgi?id=182622
82
83         Reviewed by Michael Catanzaro.
84
85         Move the test to determine whether we need to link against
86         libatomic to the common file WebKitCompilerFlags.cmake so it can
87         also be used for JavaScriptCore.
88
89         * CMakeLists.txt:
90
91 2018-05-15  Yusuke Suzuki  <utatane.tea@gmail.com>
92
93         [JSC] Check TypeInfo first before calling getCallData when we would like to check whether given object is a function
94         https://bugs.webkit.org/show_bug.cgi?id=185601
95
96         Reviewed by Saam Barati.
97
98         * WebProcess/Plugins/Netscape/JSNPObject.h:
99
100 2018-05-15  Sihui Liu  <sihui_liu@apple.com>
101
102         StorageManager::deleteLocalStorageOriginsModifiedSince: database files get deleted before database connections close
103         https://bugs.webkit.org/show_bug.cgi?id=185671
104
105         Reviewed by Geoffrey Garen.
106
107         We should delete database files before closing databases.
108
109         * UIProcess/WebStorage/LocalStorageDatabase.cpp:
110         (WebKit::LocalStorageDatabase::updateDatabaseWithChangedItems):
111         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
112         (WebKit::LocalStorageDatabaseTracker::databasesModifiedSince):
113         (WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince): Deleted.
114         * UIProcess/WebStorage/LocalStorageDatabaseTracker.h:
115         * UIProcess/WebStorage/StorageManager.cpp:
116         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
117
118 2018-05-15  Dean Jackson  <dino@apple.com>
119
120         Launch System Preview as the download starts, rather than waiting for a response
121         https://bugs.webkit.org/show_bug.cgi?id=185669
122         <rdar://problem/40278181>
123
124         Reviewed by Tim Horton.
125
126         We were waiting for the RequestResponse to get a MIME-type before
127         launching the system preview. This causes an annoying delay.
128
129         Instead, assume that the system preview is one of the handled
130         mime types and launch the viewer immediately. If it gets something it
131         didn't expect, it will show an error.
132
133         * UIProcess/Cocoa/DownloadClient.mm:
134         (WebKit::DownloadClient::didStart):
135         (WebKit::DownloadClient::didReceiveResponse):
136         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
137         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
138         (WebKit::SystemPreviewController::start): Small cleanup to ensure we
139         don't try to present twice (this shouldn't happen).
140
141 2018-05-15  Dean Jackson  <dino@apple.com>
142
143         Post-review cleanup for 185459
144         https://bugs.webkit.org/show_bug.cgi?id=185665
145         <rdar://problem/40276689>
146
147         Reviewed by Tim Horton.
148
149         Jon made some comments in 185459 that I'm addressing here.
150
151         * UIProcess/Cocoa/DownloadClient.h:
152         * UIProcess/Cocoa/DownloadClient.mm: Guard the activity token for iOS
153         in a way that means it will still work ok on macOS.
154         (WebKit::DownloadClient::didStart):
155         (WebKit::DownloadClient::processDidCrash):
156         (WebKit::DownloadClient::didFinish):
157         (WebKit::DownloadClient::didFail):
158         (WebKit::DownloadClient::didCancel):
159         (WebKit::DownloadClient::takeActivityToken):
160         (WebKit::DownloadClient::releaseActivityTokenIfNecessary):
161         (WebKit::DownloadClient::releaseActivityToken): Deleted.
162
163         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Add an early return.
164         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
165
166 2018-05-15  Tadeu Zagallo  <tzagallo@apple.com>
167
168         Update touch event tracking type on every touch
169         https://bugs.webkit.org/show_bug.cgi?id=184250
170         <rdar://problem/39145092>
171
172         Reviewed by Geoffrey Garen.
173
174         The tracking type for touch events were only update on touchstart, which meant that event
175         listeners added after the touchstart would always be treated as passive, even if explicitly
176         setting passive to false.
177
178         * UIProcess/WebPageProxy.cpp:
179         (WebKit::WebPageProxy::handleTouchEventSynchronously):
180         (WebKit::WebPageProxy::handleTouchEvent):
181
182 2018-05-15  Per Arne Vollan  <pvollan@apple.com>
183
184         Pause display links when window is not visible.
185         https://bugs.webkit.org/show_bug.cgi?id=185627
186         <rdar://problem/39401106>
187
188         Reviewed by Simon Fraser.
189
190         Pause/resume display links created in the UI process when the window is hidden/shown.
191
192         * UIProcess/WebPageProxy.cpp:
193         (WebKit::WebPageProxy::dispatchActivityStateChange):
194         * UIProcess/mac/DisplayLink.cpp:
195         (WebKit::DisplayLink::pause):
196         (WebKit::DisplayLink::resume):
197         * UIProcess/mac/DisplayLink.h:
198
199 2018-05-15  Dean Jackson  <dino@apple.com>
200
201         Provide UIView and UIImage for zoom transition
202         https://bugs.webkit.org/show_bug.cgi?id=185655
203         <rdar://problem/40267224>
204
205         Reviewed by Antoine Quint.
206
207         Provide a UIView* for the frameForPreviewItem to use as a source view.
208         Also implement the transitionImageForPreviewItem delegate, even though
209         we're returning nil.
210
211         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
212         (-[_WKPreviewControllerDelegate previewController:frameForPreviewItem:inSourceView:]):
213         (-[_WKPreviewControllerDelegate previewController:transitionImageForPreviewItem:contentRect:]):
214
215 2018-05-15  Daniel Bates  <dabates@apple.com>
216
217         Fix the Apple Internal build
218
219         Make a similar change to WebKit as I did for LegacyWebKit in r231777. See <rdar://problem/40237873> for more details.
220
221         * UIProcess/mac/WKFullScreenWindowController.mm:
222         (-[WKFullScreenWindowController enterFullScreen:]):
223         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
224         (-[WKFullScreenWindowController exitFullScreen]):
225         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
226         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
227         (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]):
228         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
229         (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]):
230
231 2018-05-15  Megan Gardner  <megan_gardner@apple.com>
232
233         Clear selections from web content with single tap
234         https://bugs.webkit.org/show_bug.cgi?id=185634
235
236         Reviewed by Tim Horton.
237         
238         With the switch to the single text selection assistant, we were not correctly clearing the selection when a
239         single tap happened.
240
241         * UIProcess/ios/WKContentViewInteraction.mm:
242         (-[WKContentView _singleTapCommited:]):
243
244 2018-05-15  Antoine Quint  <graouts@apple.com>
245
246         [Web Animations] Expose Web Animations CSS integration as an experimental feature
247         https://bugs.webkit.org/show_bug.cgi?id=185647
248
249         Reviewed by Dean Jackson.
250
251         Rename the Web Animations CSS integration flag.
252
253         * Shared/WebPreferences.yaml:
254         * UIProcess/API/C/WKPreferences.cpp:
255         (WKPreferencesSetWebAnimationsCSSIntegrationEnabled):
256         (WKPreferencesGetWebAnimationsCSSIntegrationEnabled):
257         (WKPreferencesSetCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): Deleted.
258         (WKPreferencesGetCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): Deleted.
259         * UIProcess/API/C/WKPreferencesRefPrivate.h:
260         * UIProcess/API/Cocoa/WKPreferences.mm:
261         (-[WKPreferences _setWebAnimationsCSSIntegrationEnabled:]):
262         (-[WKPreferences _webAnimationsCSSIntegrationEnabled]):
263         (-[WKPreferences _setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled:]): Deleted.
264         (-[WKPreferences _cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled]): Deleted.
265         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
266         * WebProcess/InjectedBundle/InjectedBundle.cpp:
267         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
268         (WebKit::InjectedBundle::setWebAnimationsCSSIntegrationEnabled):
269         (WebKit::InjectedBundle::setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): Deleted.
270         * WebProcess/InjectedBundle/InjectedBundle.h:
271
272 2018-05-15  Dean Jackson  <dino@apple.com>
273
274         Update animation when presenting QuickLook
275         https://bugs.webkit.org/show_bug.cgi?id=185648
276         <rdar://problem/39652624>
277
278         Reviewed by Antoine Quint.
279
280         Implement the QuickLook delegate on _WKPreviewControllerDelegate that
281         produces a zoom-like animation when the QLPreviewController appears.
282
283         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
284         (-[_WKPreviewControllerDelegate previewController:frameForPreviewItem:inSourceView:]):
285         * UIProcess/SystemPreviewController.h: Add a reference back to the page, so that
286         the delegate implementation can access the presentingViewController.
287         (WebKit::SystemPreviewController::page):
288
289 2018-05-14  Dean Jackson  <dino@apple.com>
290
291         Download and present System Preview
292         https://bugs.webkit.org/show_bug.cgi?id=185459
293         <rdar://problem/40079228>
294
295         Reviewed by Tim Horton.
296
297         Extend DownloadClient so that it can handle the case where
298         the download was triggered by a System Preview. In this situation
299         the result (and progress) are piped into QuickLook via the SystemPreviewController.
300
301         The DownloadProxy class is also extended to handle the destination
302         filename and the size of the content.
303
304         Lastly, SystemPreviewController is updated to have a start(), show()
305         and cancel() interface, and no longer adjusts page navigation.
306
307         * UIProcess/Cocoa/DownloadClient.h:
308         * UIProcess/Cocoa/DownloadClient.mm: Handle the SystemPreview case, which
309         doesn't have a download delegate, but instead needs to communicate with
310         the SystemPreviewController, if one exists.
311         (WebKit::DownloadClient::didStart):
312         (WebKit::DownloadClient::didReceiveResponse):
313         (WebKit::DownloadClient::didReceiveData):
314         (WebKit::DownloadClient::didCreateDestination):
315         (WebKit::DownloadClient::processDidCrash):
316         (WebKit::DownloadClient::decideDestinationWithSuggestedFilename):
317         (WebKit::DownloadClient::didFinish):
318         (WebKit::DownloadClient::didFail):
319         (WebKit::DownloadClient::didCancel):
320         (WebKit::DownloadClient::releaseActivityToken):
321
322         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Implement the new API.
323         (-[_WKPreviewControllerDataSource initWithMIMEType:]):
324         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
325         (-[_WKPreviewControllerDataSource setProgress:]):
326         (-[_WKPreviewControllerDataSource finish:]):
327         (-[_WKPreviewControllerDelegate previewControllerDidDismiss:]):
328         (WebKit::SystemPreviewController::start):
329         (WebKit::SystemPreviewController::updateProgress):
330         (WebKit::SystemPreviewController::finish):
331         (WebKit::SystemPreviewController::cancel):
332         (-[_WKPreviewControllerDataSource initWithURL:]): Deleted.
333         (-[_WKPreviewControllerDelegate previewControllerWillDismiss:]): Deleted.
334         (WebKit::SystemPreviewController::canPreview const): Deleted.
335         (WebKit::SystemPreviewController::showPreview): Deleted.
336         * UIProcess/Downloads/DownloadProxy.h: Track the destination file by name
337         and size. Also expose a helper to identify system preview downloads.
338         (WebKit::DownloadProxy::destinationFilename const):
339         (WebKit::DownloadProxy::setDestinationFilename):
340         (WebKit::DownloadProxy::expectedContentLength const):
341         (WebKit::DownloadProxy::setExpectedContentLength):
342         (WebKit::DownloadProxy::bytesLoaded const):
343         (WebKit::DownloadProxy::setBytesLoaded):
344         (WebKit::DownloadProxy::isSystemPreviewDownload const):
345
346         * UIProcess/SystemPreviewController.cpp: New API.
347         (WebKit::SystemPreviewController::canPreview const):
348         (WebKit::SystemPreviewController::sendPageBack): Deleted.
349         (WebKit::SystemPreviewController::showPreview): Deleted.
350         * UIProcess/SystemPreviewController.h:
351
352         * UIProcess/WebPageProxy.cpp:
353         (WebKit::m_configurationPreferenceValues):
354         (WebKit::WebPageProxy::reattachToWebProcess):
355         (WebKit::WebPageProxy::resetState):
356         * UIProcess/WebPageProxy.h:
357
358 2018-05-14  Brady Eidson  <beidson@apple.com>
359
360         Add an API test to guard against regressions while re-entering setDefersLoading:.
361         <rdar://problem/37033737> and https://bugs.webkit.org/show_bug.cgi?id=185630
362
363         Reviewed by Chris Dumez.
364
365         * UIProcess/API/Cocoa/WKWebView.mm:
366         (-[WKWebView _setDefersLoadingForTesting:]):
367         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
368
369         * UIProcess/WebPageProxy.cpp:
370         (WebKit::WebPageProxy::setDefersLoadingForTesting):
371         * UIProcess/WebPageProxy.h:
372         * WebProcess/WebPage/WebPage.messages.in:
373
374 2018-05-14  Tim Horton  <timothy_horton@apple.com>
375
376         Use the system font by default in extra zoom mode
377         https://bugs.webkit.org/show_bug.cgi?id=185638
378         <rdar://problem/40230277>
379
380         Reviewed by Wenson Hsieh.
381
382         * Shared/WebPreferencesDefaultValues.h:
383
384 2018-05-14  Michael Catanzaro  <mcatanzaro@igalia.com>
385
386         Unreviewed, rolling out r231755.
387
388         Change is not correct
389
390         Reverted changeset:
391
392         "-Wmemset-elt-size warning in LibWebRTCSocket constructor"
393         https://bugs.webkit.org/show_bug.cgi?id=185555
394         https://trac.webkit.org/changeset/231755
395
396 2018-05-14  Wenson Hsieh  <wenson_hsieh@apple.com>
397
398         [Extra zoom mode] Google search results are excessively zoomed in
399         https://bugs.webkit.org/show_bug.cgi?id=185347
400         <rdar://problem/39999778>
401
402         Reviewed by Tim Horton.
403
404         Adds a new experimental feature for the "disabled-adaptations" meta tag, and adds plumbing in WebKit to
405         propagate disabled adaptation changes to the ViewportConfiguration. The experimental feature is on by default in
406         extra zoom mode.
407
408         * Shared/WebPreferences.yaml:
409         * Shared/WebPreferencesDefaultValues.h:
410         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
411         (WebKit::WebChromeClient::dispatchDisabledAdaptationsDidChange const):
412         * WebProcess/WebCoreSupport/WebChromeClient.h:
413         * WebProcess/WebPage/WebPage.cpp:
414         (WebKit::WebPage::disabledAdaptationsDidChange):
415         * WebProcess/WebPage/WebPage.h:
416
417 2018-05-14  Chris Dumez  <cdumez@apple.com>
418
419         Overly aggressive timer throttling in service workers
420         https://bugs.webkit.org/show_bug.cgi?id=185575
421         <rdar://problem/40219038>
422
423         Reviewed by Geoff Garen.
424
425         After ~30 seconds, the system would put the service worker process in "App Nap",
426         causing its timers to get aggressively throttled. This happens because the
427         service worker processes are WebProcesses that have no visible WebPages.
428
429         To address the issue, we now disable process suppression for all service worker
430         processes. This causes those processes to construct a UserActivity which prevents
431         App Nap.
432
433         This patch also refactors the code a bit to avoid duplication. The ProcessSuppression
434         suppression logic in now all on ChildProcessProxy / ChildProcess.
435
436         * NetworkProcess/NetworkProcess.messages.in:
437         * PluginProcess/PluginProcess.messages.in:
438         * Shared/ChildProcess.messages.in:
439         * UIProcess/ChildProcessProxy.cpp:
440         (WebKit::ChildProcessProxy::setProcessSuppressionEnabled):
441         * UIProcess/ChildProcessProxy.h:
442         * UIProcess/Network/NetworkProcessProxy.h:
443         * UIProcess/Network/mac/NetworkProcessProxyMac.mm: Removed.
444         * UIProcess/Plugins/PluginProcessProxy.h:
445         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
446         * UIProcess/ServiceWorkerProcessProxy.cpp:
447         (WebKit::ServiceWorkerProcessProxy::didFinishLaunching):
448         * UIProcess/ServiceWorkerProcessProxy.h:
449         * UIProcess/WebProcessProxy.h:
450         * WebKit.xcodeproj/project.pbxproj:
451         * WebProcess/WebProcess.messages.in:
452
453 2018-05-14  Andy Estes  <aestes@apple.com>
454
455         [Wi-Fi Assertions] Allow clients to specify a context identifier
456         https://bugs.webkit.org/show_bug.cgi?id=185620
457         <rdar://problem/39915196>
458
459         Reviewed by Brady Eidson.
460
461         Added an SPI on _WKProcessPoolConfiguration that allows clients to specify a
462         context identifier.
463
464         * NetworkProcess/NetworkProcessCreationParameters.cpp:
465         (WebKit::NetworkProcessCreationParameters::encode const):
466         (WebKit::NetworkProcessCreationParameters::decode):
467         * NetworkProcess/NetworkProcessCreationParameters.h:
468         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
469         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
470         * UIProcess/API/APIProcessPoolConfiguration.cpp:
471         (API::ProcessPoolConfiguration::copy):
472         * UIProcess/API/APIProcessPoolConfiguration.h:
473         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
474         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
475         (-[_WKProcessPoolConfiguration wirelessContextIdentifier]):
476         (-[_WKProcessPoolConfiguration setWirelessContextIdentifier:]):
477         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
478         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
479
480 2018-05-11  Brian Burg  <bburg@apple.com>
481
482         Web Automation: Automation.getBrowsingContext returns window origin that differs from window.screenX/Y
483         https://bugs.webkit.org/show_bug.cgi?id=185571
484         <rdar://problem/40180785>
485
486         Reviewed by Timothy Hatcher.
487
488         This code path was refactored to use completion handlers. It seems that the window.screenX/Y
489         code path converts back to user coordinates but the WebDriver code path does not. Make them
490         consistent since that is how it is spec'd and tested.
491
492         * UIProcess/WebPageProxy.cpp:
493         (WebKit::WebPageProxy::getWindowFrameWithCallback):
494         Convert the window frame to user coordinate space so it's the same as window.screenY.
495
496 2018-05-14  Brian Burg  <bburg@apple.com>
497
498         WebDriver: W3C test case actions/key.py::test_lone_keyup_sends_no_events is failing
499         https://bugs.webkit.org/show_bug.cgi?id=185577
500         <rdar://problem/40185478>
501
502         Reviewed by Timothy Hatcher.
503
504         This test is failing because it expects Release Actions to not emit any
505         events if nothing has changed from the initial state. Because the two code paths
506         for creating empty states don't actually produce the same empty state, a difference
507         in location was detected between the two empty states. This generates a mousemove.
508
509         To fix this, unify the code that creates an empty state. For mouse input sources, always
510         initialize the location to (0, 0) so that the mouse input source always has
511         a location that is valid to click at.
512
513         * UIProcess/Automation/SimulatedInputDispatcher.h:
514         Extract the type enum out of the class to avoid circular definitions of
515         SimulatedInputSource and SimulatedInputSourceState.
516
517         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
518         (WebKit::SimulatedInputSourceState::emptyStateForSourceType):
519         Take the input source type when generating an empty state. We always want location
520         set for a mouse input source, but not set it for other input sources like keys.
521
522         (WebKit::SimulatedInputKeyFrame::keyFrameToResetInputSources):
523         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
524         (WebKit::SimulatedInputSource::create):
525         (WebKit::SimulatedInputSource::SimulatedInputSource):
526         (WebKit::SimulatedInputSourceState::emptyState): Deleted.
527         * UIProcess/Automation/WebAutomationSession.cpp:
528         (WebKit::WebAutomationSession::WebAutomationSession):
529         (WebKit::WebAutomationSession::inputSourceForType const):
530         (WebKit::simulatedInputSourceTypeFromProtocolSourceType):
531         (WebKit::WebAutomationSession::performInteractionSequence):
532         * UIProcess/Automation/WebAutomationSession.h:
533
534 2018-05-14  Michael Catanzaro  <mcatanzaro@igalia.com>
535
536         -Wmemset-elt-size warning in LibWebRTCSocket constructor
537         https://bugs.webkit.org/show_bug.cgi?id=185555
538
539         Reviewed by Youenn Fablet.
540
541         Add missing multiplication.
542
543         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
544         (WebKit::LibWebRTCSocket::LibWebRTCSocket):
545
546 2018-05-14  Zan Dobersek  <zdobersek@igalia.com>
547
548         [GTK] REGRESSION(r231170) Build broken with Clang 5.0
549         https://bugs.webkit.org/show_bug.cgi?id=185198
550
551         Reviewed by Michael Catanzaro.
552
553         * Shared/RTCNetwork.h: With std::optional forward declaration gone,
554         explicitly include the WTF Optional.h header.
555
556 2018-05-13  Dean Jackson  <dino@apple.com>
557
558         WebKit2_Sim-7606.1.17.4 introduced dep cycle
559         https://bugs.webkit.org/show_bug.cgi?id=185588
560         <rdar://problem/40196581>
561
562         Reviewed by Tim Horton.
563
564         Soft link AssetViewer.framework to avoid a dependency cycle.
565
566         * Configurations/WebKit.xcconfig:
567         * UIProcess/ios/WKSystemPreviewView.mm:
568         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
569
570 2018-05-11  Daniel Bates  <dabates@apple.com>
571
572         X-Frame-Options: SAMEORIGIN needs to check all ancestor frames
573         https://bugs.webkit.org/show_bug.cgi?id=185567
574         <rdar://problem/40175008>
575
576         Reviewed by Brent Fulgham.
577
578         Change the behavior of "X-Frame-Options: SAMEORIGIN" to ensure that all ancestors frames
579         are same-origin with the document that delivered this header. This prevents an intermediary
580         malicious frame from clickjacking a child frame whose document is same-origin with the top-
581         level frame. It also makes the behavior of X-Frame-Options in WebKit more closely match
582         the behavior of X-Frame-Options in other browsers, including Chrome and Firefox.
583         
584         Currently a document delivered with "X-Frame-Options: SAMEORIGIN" must only be same-origin
585         with the top-level frame's document in order to be displayed. This prevents clickjacking by
586         a malicious page that embeds a page delivered with "X-Frame-Options: SAMEORIGIN". However,
587         it does not protect against clickjacking of the "X-Frame-Options: SAMEORIGIN" page (victim)
588         if embedded by an intermediate malicious iframe, say a "rogue ad", that was embedded in a
589         document same origin with the victim page. We should protect against such attacks.
590
591         * NetworkProcess/NetworkResourceLoader.cpp:
592         (WebKit::NetworkResourceLoader::shouldInterruptLoadForXFrameOptions):
593
594 2018-05-11  Dean Jackson  <dino@apple.com>
595
596         WKWebViewContentProvider should know what MIME type it was created to handle
597         https://bugs.webkit.org/show_bug.cgi?id=185574
598         <rdar://problem/40183049>
599
600         Reviewed by Tim Horton.
601
602         Pass the MIME type of the downloaded asset into the WKWebViewContentProvider's
603         init method, so it can choose to do something based on that information. The
604         PDF and LegacyPDF views don't care because they, clearly, only handle PDF. But
605         a WKSystemPreviewView can handle multiple types.
606
607         * UIProcess/API/Cocoa/WKWebView.mm:
608         (-[WKWebView _setHasCustomContentView:loadedMIMEType:]): Send the MIME type on
609         to the WKWebViewContentProvider.
610         * UIProcess/Cocoa/WKWebViewContentProvider.h: Add a new parameter to web_initWithFrame.
611         * UIProcess/ios/WKLegacyPDFView.mm:
612         (-[WKLegacyPDFView web_initWithFrame:webView:mimeType:]):
613         (-[WKLegacyPDFView web_initWithFrame:webView:]): Deleted.
614         * UIProcess/ios/WKPDFView.mm:
615         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
616         (-[WKPDFView web_initWithFrame:webView:]): Deleted.
617         * UIProcess/ios/WKSystemPreviewView.mm:
618         (-[WKSystemPreviewView web_initWithFrame:webView:mimeType:]):
619         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]): Actually use
620         the MIME type to tell QuickLook what it will be getting, rather than basing it on
621         the file extension.
622         (-[WKSystemPreviewView web_initWithFrame:webView:]): Deleted.
623
624 2018-05-11  Brent Fulgham  <bfulgham@apple.com>
625
626         Allow the WebContent process to read global ViewBridge preferences
627         https://bugs.webkit.org/show_bug.cgi?id=185569
628         <rdar://problem/40164339>
629
630         Reviewed by Eric Carlson.
631
632         Allow reads of the global /Library/Preferences/com.apple.ViewBridge.plist preference file.
633
634         * WebProcess/com.apple.WebProcess.sb.in:
635
636 2018-05-11  Megan Gardner  <megan_gardner@apple.com>
637
638         Cleanup canPerformActionForWebView in relation to the webSelectionAssistant being removed
639         https://bugs.webkit.org/show_bug.cgi?id=185536
640
641         Reviewed by Tim Horton.
642         
643         The _webSelectionAssistant is now always nil, therefor many of these checks are unnecessary.
644         Remove the check for a webSelection and clean up the logic surrounding those checks.
645
646         * UIProcess/ios/WKContentViewInteraction.mm:
647         (-[WKContentView canPerformActionForWebView:withSender:]):
648
649 2018-05-11  Brady Eidson  <beidson@apple.com>
650
651         Followup to: Make sure history navigations reuse the existing process when necessary.
652         https://bugs.webkit.org/show_bug.cgi?id=185532
653
654         Reviewed by Andy Estes.
655
656         * UIProcess/WebProcessPool.cpp:
657         (WebKit::WebProcessPool::processForNavigationInternal): When re-using the same process,
658           don't change the policy action.
659
660 2018-05-11  Charles Vazac  <cvazac@gmail.com>
661
662         Runtime feature flag for Server-Timing
663         https://bugs.webkit.org/show_bug.cgi?id=184758
664
665         Reviewed by Youenn Fablet.
666
667         * Shared/WebPreferences.yaml: Added ServerTimingEnabled.
668         * UIProcess/API/C/WKPreferences.cpp:
669         (WKPreferencesGetServerTimingEnabled):
670         * UIProcess/API/C/WKPreferencesRefPrivate.h: WK_EXPORT for WKPreferencesSetServerTimingEnabled.
671         * WebProcess/Storage/WebSWContextManagerConnection.cpp: Call setServerTimingEnabled.
672
673 2018-05-11  Antti Koivisto  <antti@apple.com>
674
675         Network process should not stat() all cache files on startup to find their sizes
676         https://bugs.webkit.org/show_bug.cgi?id=185542
677         <rdar://problem/40092953>
678
679         Reviewed by Chris Dumez.
680
681         This is done to compute how much disk space a cache is using. While the operation happens
682         in a background priority thread it is still quite a bit of work.
683
684         Large bodies are saved in separate blob files so record file sizes are capped. We can avoid work by
685         estimating their size instead of counting it exactly.
686
687         * NetworkProcess/cache/NetworkCacheStorage.cpp:
688         (WebKit::NetworkCache::estimateRecordsSize):
689         (WebKit::NetworkCache::Storage::synchronize):
690
691             Use size estimation if blob storage is in use.
692             Remove the code that would delete empty files. Normal cache shrinking handles this.
693
694         (WebKit::NetworkCache::Storage::shouldStoreBodyAsBlob):
695
696 2018-05-11  Brady Eidson  <beidson@apple.com>
697
698         Make sure history navigations reuse the existing process when necessary.
699         <rdar://problem/39746516> and https://bugs.webkit.org/show_bug.cgi?id=185532
700
701         Reviewed by Ryosuke Niwa.
702
703         If a view navigates to either a data: or blob: URL, it reuses the existing process.
704  
705         In such cases we need to also ensure that history navigations back will also reuse the existing process.
706
707         * Shared/NavigationActionData.cpp:
708         (WebKit::NavigationActionData::encode const):
709         (WebKit::NavigationActionData::decode):
710         * Shared/NavigationActionData.h:
711
712         * UIProcess/API/APINavigation.h:
713         (API::Navigation::setTargetItem):
714
715         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
716         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
717         (-[_WKProcessPoolConfiguration pageCacheEnabled]):
718         (-[_WKProcessPoolConfiguration setPageCacheEnabled:]):
719
720         * UIProcess/WebPageProxy.cpp:
721         (WebKit::WebPageProxy::receivedPolicyDecision):
722         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
723
724         * UIProcess/WebProcessPool.cpp:
725         (WebKit::WebProcessPool::processForNavigationInternal): If the current and target back/forward items both
726           came from the same process, then reuse the existing process.
727
728         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
729         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
730
731 2018-05-10  Brent Fulgham  <bfulgham@apple.com>
732
733         REGRESSION(r231057): Encrypted media content playback failures
734         https://bugs.webkit.org/show_bug.cgi?id=185537
735         <rdar://problem/40038478>
736
737         Reviewed by Eric Carlson.
738
739         Put access to the SecurityServer back in the sandbox so we can validate the
740         signatures of media encoder/decoders.
741
742         * WebProcess/com.apple.WebProcess.sb.in:
743
744 2018-05-11  Youenn Fablet  <youenn@apple.com>
745
746         NetworkCORSPreflightChecker should proceed when having a ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested challenge
747         https://bugs.webkit.org/show_bug.cgi?id=185522
748         <rdar://problem/39987152>
749
750         Reviewed by Brent Fulgham.
751
752         In case of such challenge, refuse to proceed with authentication since preflight is not using credentials.
753         Previously, we were failing right away which is not right in case preflight is the request triggering the connection.
754
755         Manually tested.
756
757         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
758         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
759
760 2018-05-10  Daniel Bates  <dabates@apple.com>
761
762         Use PlatformStrategies to switch between WebKit and WebKitLegacy checking of CSP frame-ancestors and X-Frame-Options
763         https://bugs.webkit.org/show_bug.cgi?id=185412
764
765         Reviewed by Ryosuke Niwa.
766
767         Update code for renaming and write in terms of WebLoaderStrategy::shouldPerformSecurityChecks()
768         instead of explicitly querying RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess().
769
770         * WebProcess/Network/WebLoaderStrategy.cpp:
771         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
772         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
773         (WebKit::WebLoaderStrategy::startPingLoad):
774         (WebKit::WebLoaderStrategy::preconnectTo):
775         (WebKit::WebLoaderStrategy::shouldPerformSecurityChecks const):
776         (WebKit::WebLoaderStrategy::havePerformedSecurityChecks const):
777         (WebKit::WebLoaderStrategy::isDoingLoadingSecurityChecks const): Deleted.
778         * WebProcess/Network/WebLoaderStrategy.h:
779         * WebProcess/WebPage/WebPage.cpp:
780
781 2018-05-10  Timothy Horton  <timothy_horton@apple.com>
782
783         Fix the build after r231393
784         ​https://bugs.webkit.org/show_bug.cgi?id=185519
785         <rdar://problem/40131741>
786
787         * Configurations/WebKit.xcconfig:
788
789 2018-05-10  John Wilander  <wilander@apple.com>
790
791         Storage Access API: Extend lifetime of cookies on successful user approval
792         https://bugs.webkit.org/show_bug.cgi?id=185534
793         <rdar://problem/40064547>
794
795         Reviewed by Brent Fulgham.
796
797         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
798         (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
799             Picks up the experimental feature flag.
800         * UIProcess/WebResourceLoadStatisticsStore.cpp:
801         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessInternal):
802             Now updates the domain's user interaction timestamp if the user was
803             prompted for this access.
804         * UIProcess/WebResourceLoadStatisticsStore.h:
805
806 2018-05-10  Chris Dumez  <cdumez@apple.com>
807
808         [iOS] Release page load process assertion if the screen is locked
809         https://bugs.webkit.org/show_bug.cgi?id=185333
810
811         Reviewed by Geoff Garen.
812
813         We normally take a background process assertion during page loads to allow them to complete
814         even if the tab / app is backgrounded. We should however avoid doing so when the backgrounding
815         is caused by the screen locking. Keeping the process assertion in this case would prevent the
816         whole device from sleeping longer than it should, thus negatively impacting power.
817
818         * UIProcess/Cocoa/NavigationState.h:
819         * UIProcess/Cocoa/NavigationState.mm:
820         (WebKit::NavigationState::NavigationState):
821         (WebKit::NavigationState::releaseNetworkActivityToken):
822         (WebKit::NavigationState::didChangeIsLoading):
823         * UIProcess/ios/WebPageProxyIOS.mm:
824         (WebKit::WebPageProxy::applicationDidEnterBackground):
825
826 2018-05-10  Megan Gardner  <megan_gardner@apple.com>
827
828         Remove Unused Chinese/Japanese Reanalyze code
829         https://bugs.webkit.org/show_bug.cgi?id=185529
830
831         Reviewed by Wenson Hsieh.
832         
833         The code for this has actually been completely removed from UIKit. This is unreachable 
834         dead code that should be removed if just for cleanliness. 
835
836         * Platform/spi/ios/UIKitSPI.h:
837         * UIProcess/API/Cocoa/WKWebViewInternal.h:
838         * UIProcess/ios/WKContentViewInteraction.h:
839         * UIProcess/ios/WKContentViewInteraction.mm:
840         (-[WKContentView canPerformActionForWebView:withSender:]):
841         (-[WKContentView _reanalyzeForWebView:]): Deleted.
842
843 2018-05-10  Chris Dumez  <cdumez@apple.com>
844
845         [iOS] Apps that are not visible may not get suspended if they trigger page loads while in the background
846         https://bugs.webkit.org/show_bug.cgi?id=185318
847
848         Reviewed by Geoffrey Garen.
849
850         Whenever there is a page load going on, we take a background process assertion to delay process
851         suspension until this load completes. However, there is also a 3 seconds grace period after
852         a load is complete to allow the app to trigger a new load shortly after. This grace period was
853         introduced to support use cases where a visible app does loads in an offscreen view. However,
854         it can be abused by apps running in the background as they could trigger new page loads while
855         in the background to delay process suspension. This patch tightens the policy so that only
856         apps that are currently visible get to use this grace period. Apps that are in the background
857         get to finish their current load and will then get suspended.
858
859         * UIProcess/Cocoa/NavigationState.mm:
860         (WebKit::NavigationState::didChangeIsLoading):
861
862 2018-05-10  Chris Dumez  <cdumez@apple.com>
863
864         'Cross-Origin-Options header implementation follow-up
865         https://bugs.webkit.org/show_bug.cgi?id=185520
866
867         Reviewed by Ryosuke Niwa.
868
869         * WebProcess/WebPage/WebPage.cpp:
870         (WebKit::WebPage::frameBecameRemote):
871
872 2018-05-10  Per Arne Vollan  <pvollan@apple.com>
873
874         Drop-down Control borders missing.
875         https://bugs.webkit.org/show_bug.cgi?id=185500
876         <rdar://problem/40093461>
877
878         Reviewed by Brent Fulgham.
879
880         Open sandbox for reading of some files in temp folder.
881
882         * WebProcess/com.apple.WebProcess.sb.in:
883
884 2018-05-10  Eric Carlson  <eric.carlson@apple.com>
885
886         [MediaStream, iOS] Don't check authorizationStatusForMediaType when using mock capture devices
887         https://bugs.webkit.org/show_bug.cgi?id=185516
888         <rdar://problem/36328191>
889
890         Reviewed by Youenn Fablet.
891
892         * UIProcess/Cocoa/UIDelegate.mm:
893         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): Don't check
894         +[AVCaptureDevice authorizationStatusForMediaType:] when using mock capture devices.
895
896 2018-05-10  Brent Fulgham  <bfulgham@apple.com>
897
898         REGRESSION(r230323): UIProcess needs to notify WebContent process of Accessibility setting changes
899         https://bugs.webkit.org/show_bug.cgi?id=185515
900         <rdar://problem/39627764>
901
902         Reviewed by Chris Fleizach.
903
904         The UIProcess needs to register for relevant Accessibility preference updates so that it can notify the
905         WebContent processes that screen properties have changed.
906
907         This is represented by NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification.
908
909         Tested manually with the Accessibility preferences pane.
910
911         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
912         (WebKit::WebProcessPool::registerNotificationObservers): Add notification observer. When the notification
913         is received, call 'screenPropertiesStateChanged' to message the information to the WebContent processes.
914         (WebKit::WebProcessPool::unregisterNotificationObservers): Clean up observer.
915         * UIProcess/WebProcessPool.cpp:
916         (WebKit::WebProcessPool::screenPropertiesStateChanged): Added helper function.
917         * UIProcess/WebProcessPool.h:
918
919 2018-05-09  Carlos Garcia Campos  <cgarcia@igalia.com>
920
921         WebDriver: implement advance user interactions
922         https://bugs.webkit.org/show_bug.cgi?id=174616
923
924         Reviewed by Brian Burg.
925
926         Handle origin in case of mouse move transitions.
927
928         * UIProcess/Automation/Automation.json: Add MouseMoveOrigin enum and pass it as parameter of InputSourceState
929         together with optional node handle. Also pass the frame handle to performInteractionSequence command to find the
930         node in the current browsing context.
931         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
932         (WebKit::SimulatedInputKeyFrame::keyFrameToResetInputSources): Ensure we reset the location.
933         (WebKit::SimulatedInputDispatcher::resolveLocation): Helper to resolve destination location based on current
934         location and mouse move origin.
935         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState): Use resolveLocation() in mouse transitions.
936         (WebKit::SimulatedInputDispatcher::run): Receive and save the frame ID.
937         (WebKit::SimulatedInputDispatcher::finishDispatching): Reset the frame ID.
938         * UIProcess/Automation/SimulatedInputDispatcher.h:
939         * UIProcess/Automation/WebAutomationSession.cpp:
940         (WebKit::WebAutomationSession::computeElementLayout): Use even numbers for the callback ID to not conflict with
941         viewportInViewCenterPointOfElement() callbacks.
942         (WebKit::WebAutomationSession::didComputeElementLayout): Handle computeElementLayout() or
943         viewportInViewCenterPointOfElement() requests by calling the right callback depending on whether the ID is odd
944         or even number.
945         (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement): Send ComputeElementLayout message to the
946         WebProcess using odd numbers for the callback ID to not conflict with computeElementLayout() callbacks.
947         (WebKit::WebAutomationSession::performInteractionSequence): Handle the mouse origin and element handle.
948         (WebKit::WebAutomationSession::cancelInteractionSequence): Pass the frame ID to the input dispatcher.
949         * UIProcess/Automation/WebAutomationSession.h:
950         * UIProcess/Automation/WebAutomationSessionMacros.h:
951
952 2018-05-09  Tim Horton  <timothy_horton@apple.com>
953
954         Remove the unused HAVE_OS_ACTIVITY
955         https://bugs.webkit.org/show_bug.cgi?id=185501
956
957         Reviewed by Wenson Hsieh.
958
959         * config.h:
960
961 2018-05-09  Chris Dumez  <cdumez@apple.com>
962
963         Add initial support for 'Cross-Origin-Options' HTTP response header
964         https://bugs.webkit.org/show_bug.cgi?id=184996
965         <rdar://problem/39664620>
966
967         Reviewed by Geoff Garen.
968
969         * Shared/WebPreferences.yaml:
970         Add this as an experimental feature, on by default.
971
972         * WebProcess/WebPage/WebPage.cpp:
973         (WebKit::WebPage::frameBecameRemote):
974         Make sure we pass the cross-origin options from the local Window
975         to the remote one when transitioning.
976
977 2018-05-09  Wenson Hsieh  <wenson_hsieh@apple.com>
978
979         [Extra zoom mode] fast/viewport/extrazoom/viewport-change-min-device-width.html sometimes fails
980         https://bugs.webkit.org/show_bug.cgi?id=185490
981         <rdar://problem/40097629>
982
983         Reviewed by Tim Horton.
984
985         This test is currently flaky due to incorrect logic when computing the unobscured content rect, in the slice of
986         time after a frame load has been committed, and before the first visible content rect update from the UI process
987         after the frame load has been committed.
988
989         * WebProcess/WebPage/ios/WebPageIOS.mm:
990         (WebKit::WebPage::viewportConfigurationChanged):
991
992         In the case where !m_hasReceivedVisibleContentRectsAfterDidCommitLoad, we try to set the unobscured content size
993         to be the view size divided by the initial scale. However, in extra zoom mode, `ViewportConfiguration`'s
994         `minimumLayoutSize()` is the layout size, which is larger than the size of the view by default, so dividing this
995         by the initial scale yields a bogus value. Instead, use `viewLayoutSize()` instead.
996
997         (WebKit::WebPage::updateViewportSizeForCSSViewportUnits):
998
999         We also try to divide the view size by the initial scale when computing the effective viewport size for `vw` and
1000         `vh`. Additionally, fix the misleading name of a variable (largestUnobscuredRect) that stores a size.
1001
1002 2018-05-09  Brent Fulgham  <bfulgham@apple.com>
1003
1004         Restrict unarchiving of bundle parameters to a set of known classes
1005         https://bugs.webkit.org/show_bug.cgi?id=185489
1006         <rdar://problem/21912401>
1007
1008         Reviewed by Ryosuke Niwa.
1009
1010         Stop accepting anything derived from NSObject, and instead only agree to unarchive objects
1011         from a set of things we actually pass as InjectedBundle parameters.
1012
1013         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
1014         (WebKit::InjectedBundle::setBundleParameter):
1015
1016 2018-05-09  Richard Houle  <rhoule@apple.com>
1017
1018         [Cocoa] Some fields are not identified as [WKWebProcessPlugInNodeHandle isTextField]
1019         https://bugs.webkit.org/show_bug.cgi?id=185260
1020         <rdar://problem/39290394>
1021
1022         INPUT element are not considered to be text fields when
1023         calling -[WKWebProcessPlugInNodeHandle isTextField]
1024         when they are of type number.
1025
1026         Reviewed by Tim Horton.
1027
1028         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
1029         (WebKit::InjectedBundleNodeHandle::isTextField const):
1030
1031 2018-05-09  Youenn Fablet  <youenn@apple.com>
1032
1033         Allow WebResourceLoader to cancel a load served from a service worker
1034         https://bugs.webkit.org/show_bug.cgi?id=185274
1035
1036         Reviewed by Chris Dumez.
1037
1038         Use FetchIdentifier instead of uint64_t.
1039         Add IPC support for cancelling a fetch from WebProcess to service worker process.
1040         Ask service worker process to cancel the fetch when its corresponding WebResourceLoader is cancelled.
1041         No change of behavior as once a WebResourceLoader is cancelled, any related IPC is not processed.
1042         A follow-up patch should try to cancel the FetchResponse load, meaning to either cancel the network load
1043         or to abort reading the readable stream.
1044
1045         * Scripts/webkit/messages.py:
1046         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1047         (WebKit::WebSWServerConnection::cancelFetch):
1048         (WebKit::WebSWServerConnection::startFetch):
1049         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
1050         (WebKit::WebSWServerConnection::didReceiveFetchData):
1051         (WebKit::WebSWServerConnection::didReceiveFetchFormData):
1052         (WebKit::WebSWServerConnection::didFinishFetch):
1053         (WebKit::WebSWServerConnection::didFailFetch):
1054         (WebKit::WebSWServerConnection::didNotHandleFetch):
1055         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1056         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1057         * StorageProcess/StorageProcess.cpp:
1058         (WebKit::StorageProcess::didFailFetch):
1059         (WebKit::StorageProcess::didNotHandleFetch):
1060         (WebKit::StorageProcess::didReceiveFetchResponse):
1061         (WebKit::StorageProcess::didReceiveFetchData):
1062         (WebKit::StorageProcess::didReceiveFetchFormData):
1063         (WebKit::StorageProcess::didFinishFetch):
1064         * StorageProcess/StorageProcess.h:
1065         * StorageProcess/StorageProcess.messages.in:
1066         * WebProcess/Network/WebLoaderStrategy.cpp:
1067         (WebKit::WebLoaderStrategy::remove):
1068         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
1069         (WebKit::ServiceWorkerClientFetch::create):
1070         (WebKit::ServiceWorkerClientFetch::ServiceWorkerClientFetch):
1071         (WebKit::ServiceWorkerClientFetch::start):
1072         (WebKit::ServiceWorkerClientFetch::cancel):
1073         * WebProcess/Storage/ServiceWorkerClientFetch.h:
1074         * WebProcess/Storage/WebSWClientConnection.cpp:
1075         (WebKit::WebSWClientConnection::startFetch):
1076         (WebKit::WebSWClientConnection::cancelFetch):
1077         * WebProcess/Storage/WebSWClientConnection.h:
1078         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1079         (WebKit::WebSWContextManagerConnection::cancelFetch):
1080         (WebKit::WebSWContextManagerConnection::startFetch):
1081         * WebProcess/Storage/WebSWContextManagerConnection.h:
1082         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1083         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
1084         (WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
1085         (WebKit::WebServiceWorkerFetchTaskClient::cancel):
1086         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
1087         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
1088         (WebKit::WebServiceWorkerProvider::handleFetch):
1089         (WebKit::WebServiceWorkerProvider::cancelFetch):
1090         (WebKit::WebServiceWorkerProvider::fetchFinished):
1091         * WebProcess/Storage/WebServiceWorkerProvider.h:
1092
1093 2018-05-09  Andy Estes  <aestes@apple.com>
1094
1095         [iOS] Consider the annotation bounds when positioning action sheets near long-pressed PDF links
1096         https://bugs.webkit.org/show_bug.cgi?id=185472
1097         <rdar://problem/39967092>
1098
1099         Reviewed by Daniel Bates.
1100
1101         Adopted new PDFHostViewControllerDelegate methods that include annotation rects
1102         when URLs and page indices are long-pressed. This allows us to avoid obscuring
1103         annotations when positioning action sheet popovers.
1104
1105         We also no longer need to convert the press location into host view coordinate
1106         space, as PDFKit now does that for us.
1107
1108         * UIProcess/ios/WKPDFView.mm:
1109         (-[WKPDFView _showActionSheetForURL:atLocation:withAnnotationRect:]):
1110         (-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:withAnnotationRect:]):
1111         (-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:withAnnotationRect:]):
1112         (-[WKPDFView _showActionSheetForURL:atLocation:]): Deleted.
1113         (-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:]): Deleted.
1114         (-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:]): Deleted.
1115
1116 2018-05-09  Andy Estes  <aestes@apple.com>
1117
1118         [iOS] Tell PDFHostViewController when animated resizes begin and end
1119         https://bugs.webkit.org/show_bug.cgi?id=185477
1120         <rdar://problem/39875372>
1121
1122         Reviewed by Anders Carlsson.
1123
1124         * UIProcess/API/Cocoa/WKWebView.mm:
1125         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
1126         (-[WKWebView _endAnimatedResize]):
1127         * UIProcess/Cocoa/WKWebViewContentProvider.h:
1128         * UIProcess/ios/WKPDFView.mm:
1129         (-[WKPDFView web_beginAnimatedResize]):
1130         (-[WKPDFView web_endAnimatedResize]):
1131
1132 2018-05-09  Michael Catanzaro  <mcatanzaro@igalia.com>
1133
1134         Unreviewed. Update OptionsWPE.cmake and NEWS for 2.21.1 release.
1135
1136         * wpe/NEWS: Added. Add release notes for 2.21.1.
1137
1138 2018-05-09  Michael Catanzaro  <mcatanzaro@igalia.com>
1139
1140         [WPE] Build cleanly with GCC 8 and ICU 60
1141         https://bugs.webkit.org/show_bug.cgi?id=185462
1142
1143         Reviewed by Carlos Alberto Lopez Perez.
1144
1145         * Platform/IPC/glib/GSocketMonitor.cpp:
1146         (IPC::GSocketMonitor::start): Silence -Wcast-function-type warning.
1147         * Shared/API/glib/WebKitContextMenu.cpp:
1148         (webkit_context_menu_new_with_items): Ditto.
1149
1150 2018-05-08  Sihui Liu  <sihui_liu@apple.com>
1151
1152         Adopt new async _savecookies SPI for keeping networking process active during flushing cookies
1153         https://bugs.webkit.org/show_bug.cgi?id=185261
1154         <rdar://problem/37214391>
1155
1156         Reviewed by Chris Dumez.
1157
1158         By adopting new async SPI _savecookies, we can keep networking process active(not suspended)
1159         until cookies are fully synced to disk with process assertion.
1160
1161         * NetworkProcess/NetworkProcess.cpp:
1162         (WebKit::NetworkProcess::didSyncAllCookies):
1163         * NetworkProcess/NetworkProcess.h:
1164         * NetworkProcess/NetworkProcess.messages.in:
1165         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1166         (WebKit::NetworkProcess::syncAllCookies):
1167         * UIProcess/Network/NetworkProcessProxy.cpp:
1168         (WebKit::NetworkProcessProxy::didClose):
1169         (WebKit::NetworkProcessProxy::syncAllCookies):
1170         (WebKit::NetworkProcessProxy::didSyncAllCookies):
1171         * UIProcess/Network/NetworkProcessProxy.h:
1172         * UIProcess/Network/NetworkProcessProxy.messages.in:
1173         * UIProcess/WebProcessPool.cpp:
1174         (WebKit::WebProcessPool::syncNetworkProcessCookies):
1175
1176 2018-05-08  Per Arne Vollan  <pvollan@apple.com>
1177
1178         Set colorspace in the PDF plugin.
1179         https://bugs.webkit.org/show_bug.cgi?id=185445
1180         <rdar://problem/40030981>
1181
1182         Reviewed by Simon Fraser.
1183
1184         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:
1185         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1186         (WebKit::PDFPlugin::PDFPlugin):
1187
1188 2018-05-08  Megan Gardner  <megan_gardner@apple.com>
1189
1190         Don't clear selection until we are actually interacting with a Node.
1191         https://bugs.webkit.org/show_bug.cgi?id=185455
1192
1193         Reviewed by Wenson Hsieh.
1194         
1195         The presence of TextInteractionAssistant should not be used as a proxy for it we are actually editing content.
1196         We need to check to see if we have an active node, and then we should clear the selection.
1197
1198         * UIProcess/ios/WKContentViewInteraction.mm:
1199         (-[WKContentView setSelectedTextRange:]):
1200
1201 2018-05-08  Ryan Haddad  <ryanhaddad@apple.com>
1202
1203         Unreviewed, rolling out r231486.
1204
1205         Caused service worker LayoutTest failures on macOS Debug WK2.
1206
1207         Reverted changeset:
1208
1209         "Allow WebResourceLoader to cancel a load served from a
1210         service worker"
1211         https://bugs.webkit.org/show_bug.cgi?id=185274
1212         https://trac.webkit.org/changeset/231486
1213
1214 2018-05-08  Andy Estes  <aestes@apple.com>
1215
1216         [iOS] _WKWebViewPrintFormatter should return a page count of 0 for PDF documents that do not allow printing
1217         https://bugs.webkit.org/show_bug.cgi?id=185133
1218
1219         Reviewed by Andreas Kling.
1220
1221         * UIProcess/ios/WKPDFView.mm:
1222         (-[WKPDFView _ensureDocumentForPrinting]):
1223         (-[WKPDFView _wk_pageCountForPrintFormatter:]):
1224         (-[WKPDFView _wk_printedDocument]):
1225
1226 2018-05-08  Andy Estes  <aestes@apple.com>
1227
1228         [iOS] WKPDFView remains in the view hierarchy after navigating away
1229         https://bugs.webkit.org/show_bug.cgi?id=185449
1230         <rdar://problem/39693469>
1231
1232         Reviewed by Tim Horton.
1233
1234         WKPDFView removes the PDF host view from the view hierarchy in its -dealloc
1235         method, and relies on WKWebView releasing its last reference in
1236         -_setHasCustomContentView:loadedMIMEType: when the user navigates.
1237
1238         However, WKWPDFView was capturing a strong reference to self in the block passed
1239         to +[PDFHostViewController createHostView:forExtensionIdentifier:], and PDFKit
1240         (actually UIKit) is retaining this block beyond its being called. This results in
1241         the PDF host view remaining as a child of the WKScrollView even after the user
1242         navigates to another page.
1243
1244         Changed the aforementioned block to a lambda that captures a weak reference to
1245         self to prevent WKPDFView from outliving the current navigation.
1246
1247         * UIProcess/ios/WKPDFView.mm:
1248         (-[WKPDFView retain]):
1249         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
1250
1251 2018-05-08  John Wilander  <wilander@apple.com>
1252
1253         Storage Access API: Make user opt-in sticky
1254         https://bugs.webkit.org/show_bug.cgi?id=185454
1255         <rdar://problem/40003946>
1256
1257         Reviewed by Alex Christensen.
1258
1259         This patch persists the user's choice to opt-in to access under specific domains.
1260         Such storage access should age out with the accessing domain's cookies and website
1261         data. The opt-in prompt is still an experimental feature.
1262
1263         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1264         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
1265         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
1266         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
1267         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
1268         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessInternal):
1269         (WebKit::WebResourceLoadStatisticsStore::hasUserGrantedStorageAccessThroughPrompt const):
1270         (WebKit::WebResourceLoadStatisticsStore::hasHadUnexpiredRecentUserInteraction const):
1271         * UIProcess/WebResourceLoadStatisticsStore.h:
1272
1273 2018-05-08  Daniel Bates  <dabates@apple.com>
1274
1275         Do not apply X-Frame-Options and CSP frame-ancestors to Quick Look-applicable responses in NetworkProcess
1276         https://bugs.webkit.org/show_bug.cgi?id=185442
1277         <rdar://problem/40067209>
1278
1279         Reviewed by Andy Estes.
1280
1281         Just as we exempt responses in WebContent process that will be handled by Quick Look from the Content
1282         Security Policy frame-ancestors directive and X-Frame-Options checking we need to do the same when
1283         such checks are performed in NetworkProcess following r231479.
1284
1285         HTTP responses that will be previewed using Quick Look are not considered web pages and are subject
1286         to the security model for Quick Look documents. That is, they are exempt from Content Security Policy
1287         and X-Frame-Options processing.
1288
1289         * NetworkProcess/NetworkResourceLoader.cpp:
1290         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
1291
1292 2018-05-08  Brian Burg  <bburg@apple.com>
1293
1294         REGRESSION(r230743): Mousemove events are not coalesced properly, mousemove/drag is very laggy
1295         https://bugs.webkit.org/show_bug.cgi?id=185425
1296         <rdar://problem/39323336>
1297
1298         Reviewed by Simon Fraser.
1299
1300         When mousemove events come in faster than they can be processed, we should coalesce
1301         pending mousemoves that have not yet been sent to WebProcess. This has the effect of
1302         processing the most recent mousemove location, which is the old behavior that regressed.
1303
1304         * UIProcess/WebPageProxy.cpp:
1305         (WebKit::WebPageProxy::handleMouseEvent):
1306         If there is >1 event in the mouse queue, then the first one is being processed by WebProcess
1307         and the second one is eligible for coalescing. Replace it if the last event and new event
1308         are both mousemoves.
1309
1310 2018-05-08  Per Arne Vollan  <pvollan@apple.com>
1311
1312         The PDF context menu should not be created in the WebContent process.
1313         https://bugs.webkit.org/show_bug.cgi?id=185401
1314
1315         Reviewed by Tim Horton.
1316
1317         Send a sync IPC message from the WebContent process to the UI process with the necessary context
1318         menu information when the menu is requested. The NSMenu will then be created and shown in the
1319         UI process. The reply will contain the selected menu item index.
1320
1321         * Shared/mac/PDFContextMenu.h: Added.
1322         (WebKit::PDFContextMenuItem::encode const):
1323         (WebKit::PDFContextMenuItem::decode):
1324         (WebKit::PDFContextMenu::encode const):
1325         (WebKit::PDFContextMenu::decode):
1326         * UIProcess/WebPageProxy.h:
1327         * UIProcess/WebPageProxy.messages.in:
1328         * UIProcess/mac/WebPageProxyMac.mm:
1329         (-[WKPDFMenuTarget menuItem]):
1330         (-[WKPDFMenuTarget contextMenuAction:]):
1331         (WebKit::WebPageProxy::showPDFContextMenu):
1332         * WebKit.xcodeproj/project.pbxproj:
1333         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1334         (WebKit::PDFPlugin::handleContextMenuEvent):
1335
1336 2018-05-08  Dean Jackson  <dino@apple.com>
1337
1338         System Preview links should trigger a download
1339         https://bugs.webkit.org/show_bug.cgi?id=185439
1340         <rdar://problem/40065545>
1341
1342         Reviewed by Jon Lee.
1343
1344         Encode the new field identifying a system preview. And
1345         if you encounter such a resource request, trigger
1346         a download.
1347
1348         * Shared/WebCoreArgumentCoders.cpp:
1349         (IPC::ArgumentCoder<ResourceRequest>::encode):
1350         (IPC::ArgumentCoder<ResourceRequest>::decode):
1351         * UIProcess/WebPageProxy.cpp:
1352         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1353
1354 2018-05-08  John Wilander  <wilander@apple.com>
1355
1356         Storage Access API: Add a request roundtrip to check whether prompting is needed
1357         https://bugs.webkit.org/show_bug.cgi?id=185368
1358         <rdar://problem/40011556>
1359
1360         Reviewed by Alex Christensen and Youenn Fablet.
1361
1362         This patch adds an enum WebKit::StorageAccessStatus to handle our three access
1363         states:
1364         - WebKit::StorageAccessStatus::CannotRequestAccess.
1365             This means the domain is blocked from cookie access.
1366         - WebKit::StorageAccessStatus::RequiresUserPrompt.
1367             This means that access has not been granted yet and a prompt is required.
1368         - WebKit::StorageAccessStatus::HasAccess.
1369             This either means that this domain does not need to ask for access,
1370             access was already granted, or access was granted now.
1371
1372         If the call to WebResourceLoadStatisticsStore::requestStorageAccess() comes
1373         back as WebKit::StorageAccessStatus::RequiresUserPrompt, the WebPageProxy
1374         prompts the user and if the user said yes, calls a direct
1375         WebResourceLoadStatisticsStore::grantStorageAccess().
1376
1377         Existing test cases pass because requestStorageAccessConfirm in WKPage.cpp
1378         does not have m_client.requestStorageAccessConfirm and thus returns true.
1379
1380         * UIProcess/Network/NetworkProcessProxy.messages.in:
1381             Added a missing #endif.
1382         * UIProcess/WebPageProxy.cpp:
1383         (WebKit::WebPageProxy::requestStorageAccess):
1384             Here we now handle the various cases encoded in WebKit::StorageAccessStatus.
1385         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1386         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
1387             Now covers the optional prompt case.
1388         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
1389         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
1390         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessInternal):
1391             Granting access is broken out to allow WebKit::WebPageProxy to call it
1392             directly.
1393         * UIProcess/WebResourceLoadStatisticsStore.h:
1394         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1395         (WebKit::WebsiteDataStore::requestStorageAccess):
1396         (WebKit::WebsiteDataStore::grantStorageAccess):
1397             Piping through calls from from WebKit::WebResourceLoadStatisticsStore
1398             to WebKit::WebPageProxy.
1399         * UIProcess/WebsiteData/WebsiteDataStore.h:
1400
1401 2018-05-08  Chris Dumez  <cdumez@apple.com>
1402
1403         Unreviewed, rolling out r231376 and r231458.
1404
1405         Caused some API tests failures on iOS
1406
1407         Reverted changesets:
1408
1409         "[iOS] Apps that are not visible may not get suspended if they
1410         trigger page loads while in the background"
1411         https://bugs.webkit.org/show_bug.cgi?id=185318
1412         https://trac.webkit.org/changeset/231376
1413
1414         "[iOS] Release page load process assertion if the screen is
1415         locked"
1416         https://bugs.webkit.org/show_bug.cgi?id=185333
1417         https://trac.webkit.org/changeset/231458
1418
1419 2018-05-08  Dean Jackson  <dino@apple.com>
1420
1421         Use thumbnails in System Previews
1422         https://bugs.webkit.org/show_bug.cgi?id=185397
1423         <rdar://problem/40039376>
1424
1425         Reviewed by Jon Lee.
1426
1427         A system preview that goes through the WKWebViewContentProvider will
1428         show a static thumbnail/snapshot of the item, rather than jumping
1429         directly to QuickLook.
1430
1431         This means we have to link to the AssetViewer framework. That provides
1432         a ASVThumbnailView that will trigger QuickLook for us.
1433
1434         * Configurations/WebKit.xcconfig: Link to AssetViewer.
1435
1436         * UIProcess/ios/WKSystemPreviewView.h: Better macro use. Remove some unneeded protocols.
1437         * UIProcess/ios/WKSystemPreviewView.mm:
1438         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]): Update this
1439         to use an ASVThumbnailView, when on the internal SDK (because it is private).
1440         (-[WKSystemPreviewView _layoutThumbnailView]): Use the content insets to put
1441         the thumbnail in the right place.
1442         (-[WKSystemPreviewView thumbnailView:wantsToPresentPreviewController:forItem:]):
1443         Delegate method.
1444         (-[WKSystemPreviewView web_contentView]):
1445         (-[WKSystemPreviewView web_computedContentInsetDidChange]):
1446         (-[WKSystemPreviewView numberOfPreviewItemsInPreviewController:]): Deleted.
1447         (-[WKSystemPreviewView previewController:previewItemAtIndex:]): Deleted.
1448         (-[WKSystemPreviewView previewControllerWillDismiss:]): Deleted.
1449
1450 2018-05-08  Youenn Fablet  <youenn@apple.com>
1451
1452         Allow WebResourceLoader to cancel a load served from a service worker
1453         https://bugs.webkit.org/show_bug.cgi?id=185274
1454
1455         Reviewed by Chris Dumez.
1456
1457         Use FetchIdentifier instead of uint64_t.
1458         Add IPC support for cancelling a fetch from WebProcess to service worker process.
1459         Ask service worker process to cancel the fetch when its corresponding WebResourceLoader is cancelled.
1460         No change of behavior as once a WebResourceLoader is cancelled, any related IPC is not processed.
1461         A follow-up patch should try to cancel the FetchResponse load, meaning to either cancel the network load
1462         or to abort reading the readable stream.
1463
1464         * Scripts/webkit/messages.py:
1465         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1466         (WebKit::WebSWServerConnection::cancelFetch):
1467         (WebKit::WebSWServerConnection::startFetch):
1468         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
1469         (WebKit::WebSWServerConnection::didReceiveFetchData):
1470         (WebKit::WebSWServerConnection::didReceiveFetchFormData):
1471         (WebKit::WebSWServerConnection::didFinishFetch):
1472         (WebKit::WebSWServerConnection::didFailFetch):
1473         (WebKit::WebSWServerConnection::didNotHandleFetch):
1474         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1475         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1476         * StorageProcess/StorageProcess.cpp:
1477         (WebKit::StorageProcess::didFailFetch):
1478         (WebKit::StorageProcess::didNotHandleFetch):
1479         (WebKit::StorageProcess::didReceiveFetchResponse):
1480         (WebKit::StorageProcess::didReceiveFetchData):
1481         (WebKit::StorageProcess::didReceiveFetchFormData):
1482         (WebKit::StorageProcess::didFinishFetch):
1483         * StorageProcess/StorageProcess.h:
1484         * StorageProcess/StorageProcess.messages.in:
1485         * WebProcess/Network/WebLoaderStrategy.cpp:
1486         (WebKit::WebLoaderStrategy::remove):
1487         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
1488         (WebKit::ServiceWorkerClientFetch::create):
1489         (WebKit::ServiceWorkerClientFetch::ServiceWorkerClientFetch):
1490         (WebKit::ServiceWorkerClientFetch::start):
1491         (WebKit::ServiceWorkerClientFetch::cancel):
1492         * WebProcess/Storage/ServiceWorkerClientFetch.h:
1493         * WebProcess/Storage/WebSWClientConnection.cpp:
1494         (WebKit::WebSWClientConnection::startFetch):
1495         (WebKit::WebSWClientConnection::cancelFetch):
1496         * WebProcess/Storage/WebSWClientConnection.h:
1497         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1498         (WebKit::WebSWContextManagerConnection::cancelFetch):
1499         (WebKit::WebSWContextManagerConnection::startFetch):
1500         * WebProcess/Storage/WebSWContextManagerConnection.h:
1501         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1502         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
1503         (WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
1504         (WebKit::WebServiceWorkerFetchTaskClient::cancel):
1505         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
1506         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
1507         (WebKit::WebServiceWorkerProvider::handleFetch):
1508         (WebKit::WebServiceWorkerProvider::cancelFetch):
1509         (WebKit::WebServiceWorkerProvider::fetchFinished):
1510         * WebProcess/Storage/WebServiceWorkerProvider.h:
1511
1512 2018-05-08  Antti Koivisto  <antti@apple.com>
1513
1514         Don't use mapped cache files in case of Class A/B protected app
1515         https://bugs.webkit.org/show_bug.cgi?id=185422
1516         <rdar://problem/34001688>
1517
1518         Reviewed by Chris Dumez.
1519
1520         Currently we don't use shared memory maps in these cases. This still leaves us open for crashes
1521         in the network process when the device is locked.
1522
1523         This patch disables use of blob storage (mapped cache files) in apps that use class A/B protection.
1524         Normally we use blobs for resources > 16KB. Since use of shared memory is already disabled,
1525         the only optimization lost for these apps is body data deduplication.
1526
1527         Any existing cache entries with blobs are ignored and deleted. New entries are created with
1528         body data inlined with the metadata.
1529
1530         * NetworkProcess/cache/NetworkCache.cpp:
1531         (WebKit::NetworkCache::Cache::store):
1532         * NetworkProcess/cache/NetworkCache.h:
1533         (WebKit::NetworkCache::Cache::canUseSharedMemoryForBodyData const): Deleted.
1534         * NetworkProcess/cache/NetworkCacheEntry.cpp:
1535         (WebKit::NetworkCache::Entry::initializeShareableResourceHandleFromStorageRecord const):
1536
1537             Remove the code the prevented use of shared memory in these cases. Non-mapped Data objects
1538             are never shareable.
1539
1540         (WebKit::NetworkCache::Entry::setNeedsValidation):
1541         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
1542         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
1543         (WebKit::NetworkCache::canUseSharedMemoryForPath): Deleted.
1544         * NetworkProcess/cache/NetworkCacheFileSystem.h:
1545         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1546         (WebKit::NetworkCache::Storage::Storage):
1547         (WebKit::NetworkCache::Storage::mayContainBlob const):
1548         (WebKit::NetworkCache::Storage::shouldStoreBodyAsBlob):
1549         (WebKit::NetworkCache::shouldStoreBodyAsBlob): Deleted.
1550         * NetworkProcess/cache/NetworkCacheStorage.h:
1551         (WebKit::NetworkCache::Storage::canUseSharedMemoryForBodyData const): Deleted.
1552
1553 2018-05-07  Carlos Garcia Campos  <cgarcia@igalia.com>
1554
1555         Unreviewed. Add missing exit not included in r231298.
1556
1557         * WebProcess/WebProcess.cpp:
1558         (WebKit::WebProcess::ensureWebToStorageProcessConnection):
1559
1560 2018-05-07  Daniel Bates  <dabates@apple.com>
1561
1562         Check X-Frame-Options and CSP frame-ancestors in network process
1563         https://bugs.webkit.org/show_bug.cgi?id=185410
1564         <rdar://problem/37733934>
1565
1566         Reviewed by Ryosuke Niwa.
1567
1568         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1569         (WebKit::NetworkResourceLoadParameters::encode const): Always encode the frame ancestor origins.
1570         (WebKit::NetworkResourceLoadParameters::decode): Always decode the frame ancestor origins.
1571         * NetworkProcess/NetworkResourceLoader.cpp:
1572         (WebKit::NetworkResourceLoader::shouldInterruptLoadForXFrameOptions): Added.
1573         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions): Added.
1574         (WebKit::NetworkResourceLoader::didReceiveResponse): Check if the load needs to be interrupted due
1575         to a violation of the CSP frame-ancestors directive or X-Frame-Options. If there is a violation
1576         then stop the load.
1577         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry): Ditto.
1578         (NetworkResourceLoader::addConsoleMessage): Added.
1579         (NetworkResourceLoader::sendCSPViolationReport): Added.
1580         * NetworkProcess/NetworkResourceLoader.h:
1581         * Scripts/webkit/messages.py: Teach the generator about data types MessageLevel and MessageSource
1582         as they are both defined in file JavaScriptCore/ConsoleTypes.h as opposed to independent headers.
1583         Also tell the generator that these types should not be forward declared so that we can use these
1584         types without their JSC:: prefix in WebPage.messages.in.
1585         * WebProcess/Network/NetworkProcessConnection.cpp:
1586         (WebKit::NetworkProcessConnection::didReceiveMessage): Route WebPage messages to the appropriate
1587         web page.
1588         * WebProcess/Network/WebLoaderStrategy.cpp:
1589         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): Added message StopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied.
1590         * WebProcess/Network/WebResourceLoader.cpp:
1591         (WebKit::WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied): Added.
1592         * WebProcess/Network/WebResourceLoader.h:
1593         * WebProcess/Network/WebResourceLoader.messages.in:
1594         * WebProcess/WebPage/WebFrame.cpp:
1595         (WebKit::WebFrame::addConsoleMessage):
1596         * WebProcess/WebPage/WebFrame.h:
1597         * WebProcess/WebPage/WebPage.cpp:
1598         (WebKit::WebPage::addConsoleMessage): Added.
1599         (WebKit::WebPage::sendCSPViolationReport): Added.
1600         * WebProcess/WebPage/WebPage.h:
1601         * WebProcess/WebPage/WebPage.messages.in: Add messages AddConsoleMessage and SendCSPViolationReport
1602         for adding a console message to Web Inspector and sending a CSP report, respectively.
1603
1604 2018-05-07  Daniel Bates  <dabates@apple.com>
1605
1606         Abstract logic to log console messages and send CSP violation reports into a client
1607         https://bugs.webkit.org/show_bug.cgi?id=185393
1608         <rdar://problem/40036053>
1609
1610         Reviewed by Brent Fulgham.
1611
1612         For now, build a URL from the source origin associated with the NetworkResourceLoader
1613         and pass this to the ContentSecurityPolicy constructor.
1614
1615         Additionally, make NetworkLoadChecker::contentSecurityPolicy() non-const since it returns
1616         a non-const pointer to a ContentSecurityPolicy object; => callers can mutate this object
1617         right from under NetworkLoadChecker. Making this non-const makes this clear to a reader.
1618         Also remove the mutable keyword from the definition of NetworkLoadChecker::m_contentSecurityPolicy.
1619
1620         * NetworkProcess/NetworkLoadChecker.cpp:
1621         (WebKit::NetworkLoadChecker::contentSecurityPolicy):
1622         (WebKit::NetworkLoadChecker::contentSecurityPolicy const): Deleted.
1623         * NetworkProcess/NetworkLoadChecker.h:
1624
1625 2018-05-07  Alex Christensen  <achristensen@webkit.org>
1626
1627         WebResourceLoadStatisticsStore::requestStorageAccess should call its completion handler on the main thread
1628         https://bugs.webkit.org/show_bug.cgi?id=185403
1629
1630         Reviewed by Brent Fulgham.
1631
1632         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1633         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
1634
1635 2018-05-07  Chris Dumez  <cdumez@apple.com>
1636
1637         [iOS] Release page load process assertion if the screen is locked
1638         https://bugs.webkit.org/show_bug.cgi?id=185333
1639
1640         Reviewed by Geoffrey Garen.
1641
1642         We normally take a background process assertion during page loads to allow them to complete
1643         even if the tab / app is backgrounded. We should however avoid doing so when the backgrounding
1644         is caused by the screen locking. Keeping the process assertion in this case would prevent the
1645         whole device from sleeping longer than it should, thus negatively impacting power.
1646
1647         * UIProcess/Cocoa/NavigationState.h:
1648         * UIProcess/Cocoa/NavigationState.mm:
1649         (WebKit::NavigationState::NavigationState):
1650         (WebKit::NavigationState::releaseNetworkActivityToken):
1651         (WebKit::NavigationState::didChangeIsLoading):
1652         * UIProcess/ios/WebPageProxyIOS.mm:
1653         (WebKit::WebPageProxy::applicationDidEnterBackground):
1654
1655 2018-05-07  Brent Fulgham  <bfulgham@apple.com>
1656
1657         Add experimental feature to prompt for Storage Access API use
1658         https://bugs.webkit.org/show_bug.cgi?id=185335
1659         <rdar://problem/39994649>
1660
1661         Reviewed by Alex Christensen and Youenn Fablet.
1662
1663         Create a new experimental feature that gates the ability of WebKit clients to prompt the user when
1664         Storage Access API is invoked.
1665
1666         Currently this feature doesn't have any user-visible impact.
1667
1668         * Shared/API/APIObject.h:
1669         * Shared/API/c/WKBase.h:
1670         * Shared/WebPreferences.yaml:
1671         * UIProcess/API/APIUIClient.h:
1672         (API::UIClient::requestStorageAccessConfirm):
1673         * UIProcess/API/C/WKPage.cpp:
1674         (WebKit::RequestStorageAccessConfirmResultListener::create):
1675         (WebKit::RequestStorageAccessConfirmResultListener::~RequestStorageAccessConfirmResultListener):
1676         (WebKit::RequestStorageAccessConfirmResultListener::call):
1677         (WebKit::RequestStorageAccessConfirmResultListener::RequestStorageAccessConfirmResultListener):
1678         (WKPageRequestStorageAccessConfirmResultListenerGetTypeID):
1679         (WKPageRequestStorageAccessConfirmResultListenerCall):
1680         (WKPageSetPageUIClient):
1681         * UIProcess/API/C/WKPageUIClient.h:
1682         * UIProcess/API/Cocoa/WKPreferences.mm:
1683         (-[WKPreferences _storageAccessPromptsEnabled]):
1684         (-[WKPreferences _setStorageAccessPromptsEnabled:]):
1685         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1686         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1687         * UIProcess/Cocoa/UIDelegate.h:
1688         * UIProcess/Cocoa/UIDelegate.mm:
1689         (WebKit::UIDelegate::setDelegate):
1690         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
1691         * UIProcess/WebPageProxy.cpp:
1692         (WebKit::WebPageProxy::requestStorageAccessConfirm):
1693         * UIProcess/WebPageProxy.h:
1694         * UIProcess/WebPageProxy.messages.in:
1695         * UIProcess/WebPreferences.cpp:
1696         (WebKit::WebPreferences::update):
1697         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1698         (WebKit::WebChromeClient::requestStorageAccess):
1699
1700 2018-05-07  Dean Jackson  <dino@apple.com>
1701
1702         Use a dark gray for system preview bbackground
1703         https://bugs.webkit.org/show_bug.cgi?id=185391
1704         <rdar://problem/40035120>
1705
1706         Reviewed by Eric Carlson.
1707
1708         Throw some darker shade at this view.
1709
1710         * UIProcess/ios/WKSystemPreviewView.mm:
1711         (-[WKSystemPreviewView web_initWithFrame:webView:]):
1712
1713 2018-05-07  Don Olmstead  <don.olmstead@sony.com>
1714
1715         [Win] Add missing methods to WebChromeClient
1716         https://bugs.webkit.org/show_bug.cgi?id=185325
1717
1718         Reviewed by Brent Fulgham.
1719
1720         * WebProcess/WebCoreSupport/WebChromeClient.h:
1721
1722 2018-05-07  Megan Gardner  <megan_gardner@apple.com>
1723
1724         Allow Web Touch events to timeout
1725         https://bugs.webkit.org/show_bug.cgi?id=185282
1726
1727         Reviewed by Tim Horton.
1728         
1729         This is backwards, fixing.
1730
1731         * UIProcess/WebPageProxy.cpp:
1732         (WebKit::WebPageProxy::handleTouchEventSynchronously):
1733
1734 2018-05-07  Don Olmstead  <don.olmstead@sony.com>
1735
1736         [Win] LoggingWin is missing includes
1737         https://bugs.webkit.org/show_bug.cgi?id=185326
1738
1739         Reviewed by Per Arne Vollan.
1740
1741         * Platform/win/LoggingWin.cpp:
1742
1743 2018-05-07  Daniel Bates  <dabates@apple.com>
1744
1745         CSP should be passed the referrer
1746         https://bugs.webkit.org/show_bug.cgi?id=185367
1747
1748         Reviewed by Per Arne Vollan.
1749
1750         Pass the referrer through NetworkLoadChecker so that it can pass it to the ContentSecurityPolicy
1751         object it instantiates.
1752
1753         * NetworkProcess/NetworkLoadChecker.cpp:
1754         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
1755         (WebKit::NetworkLoadChecker::contentSecurityPolicy const):
1756         * NetworkProcess/NetworkLoadChecker.h:
1757         (WebKit::NetworkLoadChecker::create):
1758         * NetworkProcess/NetworkResourceLoader.cpp:
1759         * NetworkProcess/PingLoad.cpp:
1760         (WebKit::PingLoad::PingLoad):
1761
1762 2018-05-07  Daniel Bates  <dabates@apple.com>
1763
1764         Substitute CrossOriginPreflightResultCache::clear() for CrossOriginPreflightResultCache::empty()
1765         https://bugs.webkit.org/show_bug.cgi?id=185170
1766
1767         Reviewed by Per Arne Vollan.
1768
1769         * WebProcess/WebProcess.cpp:
1770         (WebKit::WebProcess::clearResourceCaches):
1771         (WebKit::WebProcess::deleteWebsiteData):
1772
1773 2018-05-07  Brian Burg  <bburg@apple.com>
1774
1775         Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected
1776         https://bugs.webkit.org/show_bug.cgi?id=184861
1777         <rdar://problem/39153768>
1778
1779         Reviewed by Timothy Hatcher.
1780
1781         We need to track how many frontends are attached to the web page (both local and remote).
1782         InspectorController propagates this out to WebKit via InspectorClient. This is then
1783         kept in UIProcess as a member of WebPageProxy. When making a decision whether to use a
1784         new process for a navigation, return early with "no" if any frontends are open for the
1785         page being navigated.
1786
1787         * UIProcess/WebPageProxy.h:
1788         (WebKit::WebPageProxy::didChangeInspectorFrontendCount):
1789         (WebKit::WebPageProxy::inspectorFrontendCount const):
1790         * UIProcess/WebPageProxy.messages.in:
1791         * UIProcess/WebProcessPool.cpp:
1792         (WebKit::WebProcessPool::processForNavigation):
1793         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
1794         (WebKit::WebInspectorClient::frontendCountChanged):
1795         * WebProcess/WebCoreSupport/WebInspectorClient.h:
1796         * WebProcess/WebPage/WebPage.cpp:
1797         (WebKit::WebPage::inspectorFrontendCountChanged):
1798         * WebProcess/WebPage/WebPage.h:
1799
1800 2018-05-04  Tim Horton  <timothy_horton@apple.com>
1801
1802         Shift to a lower-level framework for simplifying URLs
1803         https://bugs.webkit.org/show_bug.cgi?id=185334
1804
1805         Reviewed by Dan Bernstein.
1806
1807         * Configurations/WebKit.xcconfig:
1808         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1809         (-[WKFullScreenWindowController _updateLocationInfo]):
1810
1811 2018-05-04  Per Arne Vollan  <pvollan@apple.com>
1812
1813         Shutdown WindowServer connections after checking in with launch services
1814         https://bugs.webkit.org/show_bug.cgi?id=185082
1815         <rdar://problem/39613173>
1816
1817         Reviewed by Brent Fulgham.
1818
1819         When WindowServer access is blocked in the WebContent process, we should shutdown all connections
1820         after checking in with launch services.
1821
1822         * WebProcess/cocoa/WebProcessCocoa.mm:
1823         (WebKit::WebProcess::platformInitializeProcess):
1824
1825 2018-05-04  Don Olmstead  <don.olmstead@sony.com>
1826
1827         [Win][WebKit] Fix forwarding headers for Windows build
1828         https://bugs.webkit.org/show_bug.cgi?id=184412
1829
1830         Reviewed by Alex Christensen.
1831
1832         * PlatformWin.cmake:
1833         * UIProcess/API/APIAttachment.h:
1834         * UIProcess/API/APIContextMenuClient.h:
1835         * UIProcess/API/C/WKProcessTerminationReason.h:
1836         * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
1837
1838 2018-05-04  Chris Dumez  <cdumez@apple.com>
1839
1840         [iOS] Apps that are not visible may not get suspended if they trigger page loads while in the background
1841         https://bugs.webkit.org/show_bug.cgi?id=185318
1842
1843         Reviewed by Geoffrey Garen.
1844
1845         Whenever there is a page load going on, we take a background process assertion to delay process
1846         suspension until this load completes. However, there is also a 3 seconds grace period after
1847         a load is complete to allow the app to trigger a new load shortly after. This grace period was
1848         introduced to support use cases where a visible app does loads in an offscreen view. However,
1849         it can be abused by apps running in the background as they could trigger new page loads while
1850         in the background to delay process suspension. This patch tightens the policy so that only
1851         apps that are currently visible get to use this grace period. Apps that are in the background
1852         get to finish their current load and will then get suspended.
1853
1854         * UIProcess/Cocoa/NavigationState.mm:
1855         (WebKit::NavigationState::didChangeIsLoading):
1856
1857 2018-05-04  Per Arne Vollan  <pvollan@apple.com>
1858
1859         Adjust sandbox profile for simulator.
1860         https://bugs.webkit.org/show_bug.cgi?id=185319
1861
1862         Reviewed by Brent Fulgham.
1863
1864         Disable Kerberos rules, as well as rules related to NSApplication initialization.
1865
1866         * WebProcess/com.apple.WebProcess.sb.in:
1867
1868 2018-05-04  Tim Horton  <timothy_horton@apple.com>
1869
1870         Wasted time dlopening Lookup when tearing down a WKWebView
1871         https://bugs.webkit.org/show_bug.cgi?id=185310
1872         <rdar://problem/39934085>
1873
1874         Reviewed by Wenson Hsieh.
1875
1876         * UIProcess/Cocoa/WebViewImpl.h:
1877         * UIProcess/Cocoa/WebViewImpl.mm:
1878         (-[WKWindowVisibilityObserver dealloc]):
1879         (-[WKWindowVisibilityObserver startObservingLookupDismissalIfNeeded]):
1880         (WebKit::WebViewImpl::prepareForDictionaryLookup):
1881         (-[WKWindowVisibilityObserver startObservingLookupDismissal]): Deleted.
1882         Avoid un-registering as a Lookup dismissal observer if we never
1883         registered in the first place, because that involves dlopening Lookup.
1884
1885 2018-05-04  Megan Gardner  <megan_gardner@apple.com>
1886
1887         Allow Web Touch events to timeout
1888         https://bugs.webkit.org/show_bug.cgi?id=185282
1889         <rdar://problem/38728319>
1890
1891         Reviewed by Tim Horton.
1892         
1893         Web Touch events currently never time out, which blocks the user from interacting with the UI Process at all.
1894         We should allow these events to time out so that the user can interact with the rest of the UI.
1895
1896         * UIProcess/WebPageProxy.cpp:
1897         (WebKit::WebPageProxy::handleTouchEventSynchronously):
1898
1899 2018-05-04  Wenson Hsieh  <whsieh@berkeley.edu>
1900
1901         REGRESSION: [ios-simulator] 3 WKWebViewAutofillTests API test failures seen with 11.3 SDK
1902         https://bugs.webkit.org/show_bug.cgi?id=184196
1903         <rdar://problem/39054481>
1904
1905         Reviewed by Tim Horton.
1906
1907         Remove an unnecessary call to NSClassFromString, now that trunk WebKit only supports iOS 11.3+.
1908
1909         * UIProcess/ios/WKContentViewInteraction.mm:
1910         (-[WKContentView insertTextSuggestion:]):
1911
1912 2018-05-04  Youenn Fablet  <youenn@apple.com>
1913
1914         NetworkProcessProxy::didReceiveAuthenticationChallenge should take an AuthenticationChallenge r-value
1915         https://bugs.webkit.org/show_bug.cgi?id=185302
1916
1917         Reviewed by Geoffrey Garen.
1918
1919         Pass AuthenticationChallenge as an r-value since it comes from IPC.
1920         No change of behavior.
1921
1922         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
1923         (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
1924         * UIProcess/Authentication/AuthenticationChallengeProxy.h:
1925         (WebKit::AuthenticationChallengeProxy::create):
1926         * UIProcess/Downloads/DownloadProxy.cpp:
1927         (WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
1928         * UIProcess/Downloads/DownloadProxy.h:
1929         * UIProcess/Network/NetworkProcessProxy.cpp:
1930         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
1931         * UIProcess/Network/NetworkProcessProxy.h:
1932
1933 2018-05-04  Sihui Liu  <sihui_liu@apple.com>
1934
1935         Assertion failure in NetworkStorageSession::setCookie: privilege of UI process is not set
1936         https://bugs.webkit.org/show_bug.cgi?id=185262
1937
1938         Reviewed by Chris Dumez.
1939
1940         Fix an assertion failure by setting UI process privileges in constructor of WebsiteDataStore
1941         because UI process may use the cookie API before creating a WebView.
1942
1943         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1944         (WebKit::WebsiteDataStore::WebsiteDataStore):
1945
1946 2018-05-04  Per Arne Vollan  <pvollan@apple.com>
1947
1948         Adjust sandbox rules for simulator.
1949         https://bugs.webkit.org/show_bug.cgi?id=185275
1950
1951         Reviewed by Brent Fulgham.
1952
1953         Enable rules related to CoreMedia for minimal simulator.
1954
1955         * WebProcess/com.apple.WebProcess.sb.in:
1956
1957 2018-05-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1958
1959         [GTK] Epiphany (GNOME Web) says "Error downloading: Service Unavailable." when trying to download an image from discogs.com
1960         https://bugs.webkit.org/show_bug.cgi?id=174730
1961
1962         Reviewed by Michael Catanzaro.
1963
1964         The problem is that we don't send any User-Agent HTTP header for downloads started by WebProcessPool::download().
1965
1966         * UIProcess/API/glib/WebKitDownload.cpp:
1967         (webkitDownloadUpdateRequest): Helper to update the cached request.
1968         (webkitDownloadStarted): Updated the cached request if we have one.
1969         (webkit_download_get_request): Use webkitDownloadUpdateRequest().
1970         * UIProcess/API/glib/WebKitDownloadClient.cpp:
1971         * UIProcess/API/glib/WebKitDownloadPrivate.h:
1972         * UIProcess/WebProcessPool.cpp:
1973         (WebKit::WebProcessPool::download): Set the User-Agent HTTP header if there isn't any.
1974
1975 2018-05-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1976
1977         [GTK] Some event tests failing after r230817
1978         https://bugs.webkit.org/show_bug.cgi?id=185072
1979
1980         Reviewed by Michael Catanzaro.
1981
1982         Do not send mouse move events to the WebProcess for crossing events during testing. WTR never generates crossing
1983         events and they can confuse tests.
1984
1985         Fixes: editing/pasteboard/drag-link-with-data-transfer-adds-trusted-link-to-pasteboard.html
1986                fast/css/user-drag-none.html
1987                fast/events/context-activated-by-key-event.html
1988                fast/events/drag-selects-image.html
1989                fast/events/dropzone-005.html
1990                fast/events/mouse-click-events.html
1991                fast/events/mouse-cursor-change.html
1992
1993         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1994         (webkitWebViewBaseCrossingNotifyEvent):
1995
1996 2018-05-03  Chris Dumez  <cdumez@apple.com>
1997
1998         More aggressively terminate child processes when the connection to their parent process is severed
1999         https://bugs.webkit.org/show_bug.cgi?id=177972
2000         <rdar://problem/33317607>
2001
2002         Reviewed by Geoff Garen.
2003
2004         More aggressively terminate child processes when the connection to their parent process is severed.
2005         Previously, we would dispatch to the main thread and then exit the process. This would sometimes
2006         cause the process to say alive for 10 seconds until our watchdog would forcefully terminate the
2007         process. This could happen in particular when the main thread is blocked on a synchronous IPC.
2008
2009         * NetworkProcess/NetworkProcess.cpp:
2010         (WebKit::NetworkProcess::didClose): Deleted.
2011         * NetworkProcess/NetworkProcess.h:
2012         * PluginProcess/PluginProcess.cpp:
2013         (WebKit::PluginProcess::didClose): Deleted.
2014         * PluginProcess/PluginProcess.h:
2015         * Shared/ChildProcess.cpp:
2016         (WebKit::ChildProcess::didClose):
2017         (WebKit::didCloseOnConnectionWorkQueue):
2018         (WebKit::ChildProcess::terminationTimerFired):
2019         * Shared/ChildProcess.h:
2020         * StorageProcess/StorageProcess.cpp:
2021         (WebKit::StorageProcess::didClose): Deleted.
2022         * StorageProcess/StorageProcess.h:
2023         * WebProcess/WebProcess.cpp:
2024         (WebKit::WebProcess::didClose): Deleted.
2025         * WebProcess/WebProcess.h:
2026
2027 2018-05-03  Yusuke Suzuki  <utatane.tea@gmail.com>
2028
2029         Use default std::optional if it is provided
2030         https://bugs.webkit.org/show_bug.cgi?id=185159
2031
2032         Reviewed by Michael Catanzaro.
2033
2034         * Shared/SandboxExtension.h:
2035         (WebKit::SandboxExtension::Handle::decode):
2036         * Shared/TouchBarMenuItemData.cpp:
2037         (WebKit::TouchBarMenuItemData::decode):
2038
2039 2018-05-03  Justin Fan  <justin_fan@apple.com>
2040
2041         [WebGL] Add runtime flag for enabling ASTC support in WebGL
2042         https://bugs.webkit.org/show_bug.cgi?id=184840
2043
2044         Reviewed by Myles C. Maxfield.
2045
2046         Added runtime flag for ASTC support in WebGL, to turn on/off when extension is implemented.
2047
2048         * Shared/WebPreferences.yaml:
2049
2050 2018-05-03  Keith Rollin  <krollin@apple.com>
2051
2052         Unreviewed build fix after <https://trac.webkit.org/changeset/231282>.
2053
2054         * NetworkProcess/NetworkActivityTracker.h:
2055
2056 2018-05-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2057
2058         Ads in NYTimes app are shifted downwards by the scroll view's top content inset
2059         https://bugs.webkit.org/show_bug.cgi?id=185251
2060         <rdar://problem/39062357>
2061
2062         Reviewed by Tim Horton.
2063
2064         The NYTimes app embeds advertisements in each article's WKWebView by adding views in the WKScrollView's view
2065         hierarchy. These views are positioned using the bounding client rects of elements in the DOM (via Element
2066         ::getBoundingClientRect). Prior to r229641, WebKit would report bounding client rects inset by the content
2067         insets of WKScrollView, which means that if a top content inset X is specified on the scroll view, an element
2068         that is flush against the top of the viewport will have a bounding client rect top of -X (when it should really
2069         be 0).
2070
2071         To account for this, NYTimes adds the scroll view content insets back to the bounding client rect when
2072         determining the position of each advertisement which, after r229641, causes these views to be shifted downwards
2073         by an amount equal to the scroll view content inset top.
2074
2075         This new behavior does not affect Safari, since Safari uses SPI to explicitly set obscured insets. As such, we
2076         address this by gating the scroll view content inset fix with a linked-on-or-after check.
2077
2078         * UIProcess/API/Cocoa/WKWebView.mm:
2079         (-[WKWebView _computedObscuredInset]):
2080         * UIProcess/Cocoa/VersionChecks.h:
2081
2082 2018-05-03  Chris Dumez  <cdumez@apple.com>
2083
2084         Load hangs if the WebProcess fails to launch
2085         https://bugs.webkit.org/show_bug.cgi?id=185225
2086         <rdar://problem/38249058>
2087
2088         Reviewed by Geoff Garen.
2089
2090         When a process fails to launch, ChildProcessProxy::didFinishLaunching() gets called with an
2091         invalid connection identifier. While NetworkProcessProxy::didFinishLaunching() properly deals with
2092         this situation, WebProcessProxy::didFinishLaunching() does not. As a result, we do not attempt to
2093         relaunch the process, we do not notify the client and WebPageProxy::m_isValid stays true.
2094
2095         This patch thus updates WebProcessProxy::didFinishLaunching() to check if the connection identifier
2096         is valid and treats it as a crash. As a result, the WebPageProxies properly reset their state and
2097         the client gets notified of the crash so that it can attempt to reload.
2098
2099         * UIProcess/API/Cocoa/WKProcessPool.mm:
2100         (-[WKProcessPool _makeNextWebProcessLaunchFailForTesting]):
2101         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2102         * UIProcess/Launcher/ProcessLauncher.h:
2103         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2104         (WebKit::ProcessLauncher::launchProcess):
2105         Add SPI to make the next WebProcess launch fail, for the purpose of API testing.
2106
2107         * UIProcess/WebProcessPool.h:
2108         * UIProcess/WebProcessProxy.cpp:
2109         (WebKit::WebProcessProxy::getLaunchOptions):
2110         (WebKit::WebProcessProxy::didClose):
2111         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
2112         (WebKit::WebProcessProxy::didFinishLaunching):
2113         * UIProcess/WebProcessProxy.h:
2114
2115 2018-05-03  Commit Queue  <commit-queue@webkit.org>
2116
2117         Unreviewed, rolling out r231223 and r231288.
2118         https://bugs.webkit.org/show_bug.cgi?id=185256
2119
2120         The change in r231223 breaks internal builds, and r231288 is a
2121         dependent change. (Requested by ryanhaddad on #webkit).
2122
2123         Reverted changesets:
2124
2125         "Use default std::optional if it is provided"
2126         https://bugs.webkit.org/show_bug.cgi?id=185159
2127         https://trac.webkit.org/changeset/231223
2128
2129         "Use pointer instead of
2130         std::optional<std::reference_wrapper<>>"
2131         https://bugs.webkit.org/show_bug.cgi?id=185186
2132         https://trac.webkit.org/changeset/231288
2133
2134 2018-05-03  Per Arne Vollan  <pvollan@apple.com>
2135
2136         An error message is written to stderr when the WebContent process is blocking WindowServer access.
2137         https://bugs.webkit.org/show_bug.cgi?id=184701
2138
2139         Reviewed by Brent Fulgham.
2140
2141         Calling 'setApplicationIsDaemon(true)' instead of 'CGSSetDenyWindowServerConnections(true)' to disable
2142         access to the WindowServer in the WebContent process, will remove this error message. After this change,
2143         the url of the WebContent process is still showing up in Activity Monitor, which previously was a
2144         problem when calling 'setApplicationIsDaemon(true)'.
2145
2146         * WebProcess/WebProcess.cpp:
2147         (WebKit::WebProcess::initializeProcess):
2148         * WebProcess/cocoa/WebProcessCocoa.mm:
2149         (WebKit::WebProcess::platformInitializeProcess):
2150
2151 2018-05-03  Ryan Haddad  <ryanhaddad@apple.com>
2152
2153         Unreviewed, rolling out r231253.
2154
2155         The API test added with this change is crashing on the bots.
2156
2157         Reverted changeset:
2158
2159         "Web Inspector: opt out of process swap on navigation if a Web
2160         Inspector frontend is connected"
2161         https://bugs.webkit.org/show_bug.cgi?id=184861
2162         https://trac.webkit.org/changeset/231253
2163
2164 2018-05-03  Brent Fulgham  <bfulgham@apple.com>
2165
2166         Re-eneable Network Extension support in the WebContent process
2167         https://bugs.webkit.org/show_bug.cgi?id=185236
2168         <rdar://problem/39883004>
2169
2170         Reviewed by Eric Carlson.
2171
2172         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2173         * WebProcess/com.apple.WebProcess.sb.in:
2174
2175 2018-05-03  Tim Horton  <timothy_horton@apple.com>
2176
2177         REGRESSION (r231014): Entitlements are not applied to XPC services on macOS
2178         https://bugs.webkit.org/show_bug.cgi?id=185241
2179
2180         Reviewed by Dan Bernstein.
2181
2182         * Configurations/BaseXPCService.xcconfig:
2183         * Configurations/WebContentService.Development.xcconfig:
2184         * Configurations/WebContentService.xcconfig:
2185
2186 2018-05-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2187
2188         REGRESSION(r222772): [GTK][WPE] WebProcess from WebKitGtk+ 2.19.9x SIGSEVs in WebKit::WebProcess::ensureNetworkProcessConnection() at Source/WebKit/WebProcess/WebProcess.cpp:1127
2189         https://bugs.webkit.org/show_bug.cgi?id=183348
2190
2191         Reviewed by Michael Catanzaro.
2192
2193         When connection doesn't exit in case of sync message failure, always exit in case of failing to send
2194         GetNetworkProcessConnection or GetStorageProcessConnection messages. This can happen when the WebView is created
2195         and destroyed quickly.
2196
2197         * WebProcess/WebProcess.cpp:
2198         (WebKit::WebProcess::ensureNetworkProcessConnection):
2199         (WebKit::WebProcess::ensureWebToStorageProcessConnection):
2200
2201 2018-05-02  Nan Wang  <n_wang@apple.com>
2202
2203         AX: Missing kAXSWebAccessibilityEventsEnabledNotification causes a crash
2204         https://bugs.webkit.org/show_bug.cgi?id=185237
2205
2206         Reviewed by Dan Bernstein.
2207
2208         When libAccessibility.dylib is missing, the compiler would optimize out the global
2209         notification and lead to a crash. Fixed it by using the isNullFunction check instead,
2210         since we are sure the global notification would be there when the corresponding function 
2211         is available.
2212
2213         * UIProcess/API/Cocoa/WKWebView.mm:
2214         (-[WKWebView _initializeWithConfiguration:]):
2215
2216 2018-05-02  Keith Rollin  <krollin@apple.com>
2217
2218         Add facility for tracking times and results of page and resource loading
2219         https://bugs.webkit.org/show_bug.cgi?id=184838
2220         <rdar://problem/36548974>
2221
2222         Reviewed by Brent Fulgham.
2223
2224         Add NetworkActivityTracker. The idea behind this facility is to create
2225         and destroy them around networking activity that we want to track for
2226         the purpose of measuring overall network health. They can be created
2227         around the loading of pages or individual resources, and can be
2228         arranged in a parent/child hierarchy to indicate what pages the
2229         resources are part of. The NetworkActivity tracker tracks load times
2230         and results. On Cocoa, it can be integrated with CFNetwork in order to
2231         associate WebKit activity with low-level networking activity.
2232
2233         * CMakeLists.txt:
2234         * Configurations/WebKit.xcconfig:
2235         * NetworkProcess/NetworkActivityTracker.cpp: Copied from Source/WebKit/NetworkProcess/NetworkLoadParameters.h.
2236         (WebKit::NetworkActivityTracker::NetworkActivityTracker):
2237         (WebKit::NetworkActivityTracker::~NetworkActivityTracker):
2238         (WebKit::NetworkActivityTracker::setParent):
2239         (WebKit::NetworkActivityTracker::start):
2240         (WebKit::NetworkActivityTracker::complete):
2241         * NetworkProcess/NetworkActivityTracker.h: Added.
2242         (WebKit::NetworkActivityTracker::getPlatformObject):
2243         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2244         (WebKit::NetworkConnectionToWebProcess::didClose):
2245         (WebKit::NetworkConnectionToWebProcess::pageLoadCompleted):
2246         (WebKit::networkActivityTrackingEnabled):
2247         (WebKit::NetworkConnectionToWebProcess::startTrackingResourceLoad):
2248         (WebKit::NetworkConnectionToWebProcess::stopTrackingResourceLoad):
2249         (WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTracking):
2250         (WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTrackingForPage):
2251         (WebKit::NetworkConnectionToWebProcess::findRootNetworkActivity):
2252         (WebKit::NetworkConnectionToWebProcess::findNetworkActivityTracker):
2253         * NetworkProcess/NetworkConnectionToWebProcess.h:
2254         (WebKit::NetworkConnectionToWebProcess::ResourceNetworkActivityTracker::ResourceNetworkActivityTracker):
2255         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2256         * NetworkProcess/NetworkDataTask.cpp:
2257         (WebKit::NetworkDataTask::create):
2258         * NetworkProcess/NetworkLoadParameters.h:
2259         * NetworkProcess/NetworkProcess.cpp:
2260         (WebKit::NetworkProcess::initializeNetworkProcess):
2261         * NetworkProcess/NetworkProcess.h:
2262         (WebKit::NetworkProcess::trackNetworkActivity const):
2263         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2264         (WebKit::NetworkProcessCreationParameters::encode const):
2265         (WebKit::NetworkProcessCreationParameters::decode):
2266         * NetworkProcess/NetworkProcessCreationParameters.h:
2267         * NetworkProcess/NetworkResourceLoader.cpp:
2268         (WebKit::NetworkResourceLoader::start):
2269         (WebKit::NetworkResourceLoader::cleanup):
2270         (WebKit::NetworkResourceLoader::abort):
2271         (WebKit::NetworkResourceLoader::didFinishLoading):
2272         (WebKit::NetworkResourceLoader::didFailLoading):
2273         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
2274         (WebKit::NetworkResourceLoader::continueProcessingCachedEntryAfterDidReceiveResponse):
2275         * NetworkProcess/NetworkResourceLoader.h:
2276         * NetworkProcess/cocoa/NetworkActivityTrackerCocoa.mm: Added.
2277         (WebKit::NetworkActivityTracker::NetworkActivityTracker):
2278         (WebKit::NetworkActivityTracker::~NetworkActivityTracker):
2279         (WebKit::NetworkActivityTracker::setParent):
2280         (WebKit::NetworkActivityTracker::start):
2281         (WebKit::NetworkActivityTracker::complete):
2282         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2283         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2284         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2285         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2286         (API::ProcessPoolConfiguration::copy):
2287         * UIProcess/API/APIProcessPoolConfiguration.h:
2288         * UIProcess/API/C/WKContextConfigurationRef.cpp:
2289         (WKContextConfigurationTrackNetworkActivity):
2290         (WKContextConfigurationSetTrackNetworkActivity):
2291         * UIProcess/API/C/WKContextConfigurationRef.h:
2292         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2293         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2294         (-[_WKProcessPoolConfiguration trackNetworkActivity]):
2295         (-[_WKProcessPoolConfiguration setTrackNetworkActivity:]):
2296         * UIProcess/WebProcessPool.cpp:
2297         (WebKit::WebProcessPool::ensureNetworkProcess):
2298         * WebKit.xcodeproj/project.pbxproj:
2299         * WebProcess/Network/WebLoaderStrategy.cpp:
2300         (WebKit::WebLoaderStrategy::pageLoadCompleted):
2301         * WebProcess/Network/WebLoaderStrategy.h:
2302
2303 2018-05-02  Jer Noble  <jer.noble@apple.com>
2304
2305         Open audio/video sandbox services for minimal simulator
2306         https://bugs.webkit.org/show_bug.cgi?id=185217
2307         <rdar://problem/39918909>
2308
2309         Reviewed by Per Arne Vollan.
2310
2311         * WebKit.xcodeproj/project.pbxproj:
2312         * WebProcess/com.apple.WebProcess.sb.in:
2313
2314 2018-05-02  Daniel Bates  <dabates@apple.com>
2315
2316         Cleanup NetworkResourceLoader::didReceiveResponse()
2317         https://bugs.webkit.org/show_bug.cgi?id=185209
2318
2319         Reviewed by Chris Dumez.
2320
2321         Use early returns to make the control flow easier to read and reason about. Disregarding a
2322         From-Origin violation, NetworkResourceLoader::didReceiveResponse() only returns NetworkLoadClient::ShouldContinueDidReceiveResponse::No
2323         when the load is for a main resource and hence it must wait for the embedding client to allow
2324         the load before continuing with it. With regards to a From-Origin violation, the network
2325         process schedules to fail the load in a subsequent turn of the event loop before returning
2326         NetworkLoadClient::ShouldContinueDidReceiveResponse::No. It return NetworkLoadClient::ShouldContinueDidReceiveResponse::No
2327         solely to tell the NetworkLoadClient to defer assuming the load is allowed (because we will
2328         fail it on the next turn of the event loop).
2329
2330         Additionally, remove all logging about the return value as we no longer have a need for
2331         such logging.
2332
2333         * NetworkProcess/NetworkResourceLoader.cpp:
2334         (WebKit::NetworkResourceLoader::didReceiveResponse):
2335
2336 2018-05-02  Alex Christensen  <achristensen@webkit.org>
2337
2338         Add WKWebsiteDataStorePrivate._proxyConfiguration SPI
2339         https://bugs.webkit.org/show_bug.cgi?id=185179
2340
2341         Reviewed by Andy Estes.
2342
2343         * NetworkProcess/NetworkSessionCreationParameters.h:
2344         (WebKit::NetworkSessionCreationParameters::encode const):
2345         (WebKit::NetworkSessionCreationParameters::decode):
2346         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2347         (WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):
2348         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
2349         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2350         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2351         * Shared/WebsiteDataStoreParameters.cpp:
2352         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
2353         * Shared/cf/ArgumentCodersCF.cpp:
2354         (IPC::encode):
2355         (IPC::decode):
2356         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2357         (-[WKWebsiteDataStore _setProxyConfiguration:]):
2358         (-[WKWebsiteDataStore _proxyConfiguration]):
2359         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2360         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2361         (WebKit::WebsiteDataStore::parameters):
2362         * UIProcess/WebsiteData/WebsiteDataStore.h:
2363         (WebKit::WebsiteDataStore::setProxyConfiguration):
2364         (WebKit::WebsiteDataStore::proxyConfiguration):
2365
2366 2018-05-02  Youenn Fablet  <youenn@apple.com>
2367
2368         Use NetworkLoadChecker for navigation loads
2369         https://bugs.webkit.org/show_bug.cgi?id=184892
2370         <rdar://problem/39652686>
2371
2372         Reviewed by Chris Dumez.
2373
2374         Compute whether a response is same origin in no-cors case.
2375         This allows providing more precise filtering.
2376         In case of navigate loads, set the tainting to basic which will make filtering to the minimum.
2377
2378         Pass the sourceOrigin for navigation loads as well.
2379         Enable to restrict HTTP response access for navigation load.
2380
2381         Content Blockers are disabled for now in NetworkLoadChecker for navigation loads.
2382         They should be reenabled as a follow-up.
2383
2384         Add a specific case to allow any redirection to about:// URLs.
2385         While this does not conform with the spec, this keeps the existing WebKit behavior.
2386
2387         * NetworkProcess/NetworkLoadChecker.cpp:
2388         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
2389         (WebKit::NetworkLoadChecker::validateResponse):
2390         (WebKit::NetworkLoadChecker::continueCheckingRequest):
2391         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
2392         * NetworkProcess/NetworkResourceLoader.cpp:
2393         (WebKit::NetworkResourceLoader::sanitizeResponseIfPossible):
2394         * WebProcess/Network/WebLoaderStrategy.cpp:
2395         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2396         (WebKit::WebLoaderStrategy::isDoingLoadingSecurityChecks const):
2397         We only do security checks if this runtime flag is on.
2398         * WebProcess/Network/WebLoaderStrategy.h:
2399
2400 2018-05-02  Jer Noble  <jer.noble@apple.com>
2401
2402         Make EncryptedMediaAPIEnabled an experimental feature
2403         https://bugs.webkit.org/show_bug.cgi?id=185212
2404
2405         Reviewed by Eric Carlson.
2406
2407         * Shared/WebPreferences.yaml:
2408
2409 2018-05-02  Per Arne Vollan  <pvollan@apple.com>
2410
2411         Adjust sandbox profile in simulator mode.
2412         https://bugs.webkit.org/show_bug.cgi?id=185172
2413         <rdar://problem/39876860>
2414
2415         Reviewed by Brent Fulgham.
2416
2417         Fix some sandbox violations.
2418
2419         * WebProcess/com.apple.WebProcess.sb.in:
2420
2421 2018-05-02  Brian Burg  <bburg@apple.com>
2422
2423         Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected
2424         https://bugs.webkit.org/show_bug.cgi?id=184861
2425         <rdar://problem/39153768>
2426
2427         Reviewed by Ryosuke Niwa.
2428
2429         We need to track how many frontends are attached to the web page (both local and remote).
2430         InspectorController propagates this out to WebKit via InspectorClient. This is then
2431         kept in UIProcess as a member of WebPageProxy. When making a decision whether to use a
2432         new process for a navigation, return early with "no" if any frontends are open for the
2433         page being navigated.
2434
2435         * UIProcess/WebPageProxy.h:
2436         (WebKit::WebPageProxy::didChangeInspectorFrontendCount):
2437         (WebKit::WebPageProxy::inspectorFrontendCount const):
2438         * UIProcess/WebPageProxy.messages.in:
2439         * UIProcess/WebProcessPool.cpp:
2440         (WebKit::WebProcessPool::processForNavigation):
2441         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
2442         (WebKit::WebInspectorClient::frontendCountChanged):
2443         * WebProcess/WebCoreSupport/WebInspectorClient.h:
2444         * WebProcess/WebPage/WebPage.cpp:
2445         (WebKit::WebPage::inspectorFrontendCountChanged):
2446         * WebProcess/WebPage/WebPage.h:
2447
2448 2018-05-02  Jer Noble  <jer.noble@apple.com>
2449
2450         Adopt -destinationWindowToExitFullScreenForWindow:
2451         https://bugs.webkit.org/show_bug.cgi?id=185204
2452         <rdar://problem/22486621>
2453
2454         Reviewed by Eric Carlson.
2455
2456         * UIProcess/mac/WKFullScreenWindowController.mm:
2457         (-[WKFullScreenWindowController destinationWindowToExitFullScreenForWindow:]):
2458
2459 2018-05-02  Per Arne Vollan  <pvollan@apple.com>
2460
2461         Disable Media capture rules in sandbox for simulator.
2462         https://bugs.webkit.org/show_bug.cgi?id=185206
2463         <rdar://problem/39910015>
2464
2465         Reviewed by Eric Carlson.
2466
2467         These rules are not relevant in this case.
2468
2469         * WebProcess/com.apple.WebProcess.sb.in:
2470
2471 2018-05-02  Eric Carlson  <eric.carlson@apple.com>
2472
2473         [iOS] Provide audio route information when invoking AirPlay picker
2474         https://bugs.webkit.org/show_bug.cgi?id=185199
2475         <rdar://problem/39853103>
2476
2477         Reviewed by Jer Noble.
2478
2479         * Scripts/webkit/messages.py:
2480         * UIProcess/PageClient.h:
2481         * UIProcess/WebPageProxy.h:
2482         * UIProcess/WebPageProxy.messages.in:
2483         * UIProcess/ios/PageClientImplIOS.h:
2484         * UIProcess/ios/PageClientImplIOS.mm:
2485         (WebKit::PageClientImpl::showPlaybackTargetPicker):  Pass route sharing policy and routing context UID.
2486
2487         * UIProcess/ios/WKContentViewInteraction.h:
2488         * UIProcess/ios/WKContentViewInteraction.mm:
2489         (-[WKContentView _showPlaybackTargetPicker:fromRect:routeSharingPolicy:routingContextUID:]): Take same.
2490         (-[WKContentView _showPlaybackTargetPicker:fromRect:]): Deleted.
2491
2492         * UIProcess/ios/WebPageProxyIOS.mm:
2493         (WebKit::WebPageProxy::showPlaybackTargetPicker): Pass route sharing policy and routing context UID.
2494
2495         * UIProcess/ios/forms/WKAirPlayRoutePicker.h:
2496         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
2497         (-[WKAirPlayRoutePicker showFromView:routeSharingPolicy:routingContextUID:]): Take same.
2498         (-[WKAirPlayRoutePicker showFromView:]): Deleted.
2499
2500         * WebProcess/WebCoreSupport/WebChromeClient.h:
2501         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
2502         (WebKit::WebChromeClient::showPlaybackTargetPicker):
2503
2504 2018-05-02  Jer Noble  <jer.noble@apple.com>
2505
2506         Get the WebKit.framework bundle by asking for WKWebView
2507         https://bugs.webkit.org/show_bug.cgi?id=185175
2508
2509         Reviewed by Tim Horton.
2510
2511         * NetworkProcess/mac/NetworkProcessMac.mm:
2512         (WebKit::NetworkProcess::initializeSandbox):
2513         * Shared/mac/ChildProcessMac.mm:
2514         (WebKit::ChildProcess::initializeSandbox):
2515         * StorageProcess/mac/StorageProcessMac.mm:
2516         (WebKit::StorageProcess::initializeSandbox):
2517
2518 2018-05-02  Youenn Fablet  <youenn@apple.com>
2519
2520         Cannot gather srflx or relay ICE candidates on IPv6 network (ICE agent hangs?)
2521         https://bugs.webkit.org/show_bug.cgi?id=181009
2522         <rdar://problem/36144555>
2523
2524         Reviewed by Eric Carlson.
2525
2526         On iOS/IPv6 networks, STUN servers name resolution returns a zero IPv6 IP address.
2527         No error is raised which leads to sending STUN requests with that IP address.
2528         Once the request times out, the ICE candidate gathering finishes with host candidates only.
2529
2530         This patch makes WebRTC DNS resolver to send only IPv4 resolved addresses.
2531         STUN is used for NAT traversal which is for IPv4 addresses.
2532         Not sending IPv6 addresses allows terminating ICE candidate gathering sooner.
2533
2534         Manually tested on iOS with IPv4/IPv6 and IPv6 networks.
2535
2536         * NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp:
2537         (WebKit::resolvedName):
2538
2539 2018-05-02  Youenn Fablet  <youenn@apple.com>
2540
2541         CacheStorage::Engine should keep a list of initialization callback
2542         https://bugs.webkit.org/show_bug.cgi?id=185184
2543         <rdar://problem/38875651>
2544
2545         Reviewed by Antti Koivisto.
2546
2547         Keep each initialize callback in a Vector so as to compute the salt only once.
2548         Call all callbacks then in a loop.
2549
2550         * NetworkProcess/cache/CacheStorageEngine.cpp:
2551         (WebKit::CacheStorage::Engine::~Engine):
2552         (WebKit::CacheStorage::Engine::initialize):
2553         * NetworkProcess/cache/CacheStorageEngine.h:
2554
2555 2018-05-02  Jer Noble  <jer.noble@apple.com>
2556
2557         Pipe volume through PlaybackSessionManager/Proxy.
2558         https://bugs.webkit.org/show_bug.cgi?id=185182
2559
2560         Reviewed by Eric Carlson.
2561
2562         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
2563         * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
2564         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
2565         (WebKit::PlaybackSessionModelContext::setVolume):
2566         (WebKit::PlaybackSessionModelContext::volumeChanged):
2567         (WebKit::PlaybackSessionManagerProxy::volumeChanged):
2568         (WebKit::PlaybackSessionManagerProxy::setVolume):
2569         * WebProcess/cocoa/PlaybackSessionManager.h:
2570         * WebProcess/cocoa/PlaybackSessionManager.messages.in:
2571         * WebProcess/cocoa/PlaybackSessionManager.mm:
2572         (WebKit::PlaybackSessionInterfaceContext::volumeChanged):
2573         (WebKit::PlaybackSessionManager::volumeChanged):
2574         (WebKit::PlaybackSessionManager::setVolume):
2575
2576 2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
2577
2578         Use default std::optional if it is provided
2579         https://bugs.webkit.org/show_bug.cgi?id=185159
2580
2581         Reviewed by JF Bastien.
2582
2583         * Shared/SandboxExtension.h:
2584         (WebKit::SandboxExtension::Handle::decode):
2585         * Shared/TouchBarMenuItemData.cpp:
2586         (WebKit::TouchBarMenuItemData::decode):
2587
2588 2018-05-01  Jer Noble  <jer.noble@apple.com>
2589
2590         Production build error in Migrate Header phase when WK_ALTERNATE_FRAMEWORKS_DIR is set to non-empty value
2591         https://bugs.webkit.org/show_bug.cgi?id=185171
2592
2593         Reviewed by Timothy Hatcher.
2594
2595         * Configurations/BaseTarget.xcconfig:
2596
2597 2018-05-01  Per Arne Vollan  <pvollan@apple.com>
2598
2599         Use correct runloop type in the WebContent process.
2600         https://bugs.webkit.org/show_bug.cgi?id=185140
2601
2602         Reviewed by Brent Fulgham.
2603
2604         Use WK_MACOS_* machinery to determine runloop type for the WebContent process.
2605
2606         * Configurations/WebContentService.xcconfig:
2607
2608 2018-05-01  Oleksandr Skachkov  <gskachkov@gmail.com>
2609
2610         WebAssembly: add support for stream APIs - JavaScript API
2611         https://bugs.webkit.org/show_bug.cgi?id=183442
2612
2613         Reviewed by Yusuke Suzuki and JF Bastien.
2614
2615         Add WEBASSEMBLY_STREAMING_API feature flag
2616
2617         * Configurations/FeatureDefines.xcconfig:
2618
2619 2018-04-30  Per Arne Vollan  <pvollan@apple.com>
2620
2621         Use correct runloop type in the WebContent process.
2622         https://bugs.webkit.org/show_bug.cgi?id=185140
2623         <rdar://problem/39585037>
2624
2625         Reviewed by Brent Fulgham.
2626
2627         The macOS target version should be used to determine the runloop type.
2628
2629         * Configurations/WebContentService.xcconfig:
2630
2631 2018-04-30  Michael Saboff  <msaboff@apple.com>
2632
2633         Eliminate WebProcessShim.dylib
2634         https://bugs.webkit.org/show_bug.cgi?id=185147
2635
2636         Reviewed by Ryosuke Niwa.
2637
2638         * Configurations/WebContentService.xcconfig:
2639         * Configurations/WebProcessShim.xcconfig: Removed.
2640         * WebKit.xcodeproj/project.pbxproj:
2641
2642 2018-04-30  Michael Saboff  <msaboff@apple.com>
2643
2644         Remove unused mac/CookieStorageShimLibrary
2645         https://bugs.webkit.org/show_bug.cgi?id=185146
2646
2647         Reviewed by Alex Christensen.
2648
2649         * Shared/mac/CookieStorageShimLibrary.cpp: Removed.
2650         * Shared/mac/CookieStorageShimLibrary.h: Removed.
2651         * WebKit.xcodeproj/project.pbxproj:
2652
2653 2018-04-30  Alex Christensen  <achristensen@webkit.org>
2654
2655         Add WKUIDelegatePrivate equivalent of WKPageContextMenuClient getContextMenuFromProposedMenuAsync
2656         https://bugs.webkit.org/show_bug.cgi?id=180955
2657
2658         Reviewed by Andy Estes.
2659
2660         * UIProcess/API/APIContextMenuClient.h:
2661         (API::ContextMenuClient::menuFromProposedMenu):
2662         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2663         * UIProcess/Cocoa/UIDelegate.h:
2664         * UIProcess/Cocoa/UIDelegate.mm:
2665         (WebKit::UIDelegate::setDelegate):
2666         (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
2667         * UIProcess/mac/WebContextMenuProxyMac.mm:
2668         (WebKit::WebContextMenuProxyMac::showContextMenuWithItems):
2669
2670 2018-04-30  JF Bastien  <jfbastien@apple.com>
2671
2672         Use some C++17 features
2673         https://bugs.webkit.org/show_bug.cgi?id=185135
2674
2675         Reviewed by Alex Christensen.
2676
2677         As discussed here [0] let's move WebKit to a subset of C++17. We
2678         now require GCC 6 [1] which means that, according to [2] we can
2679         use the following C++17 language features (I removed some
2680         uninteresting ones):
2681
2682          - New auto rules for direct-list-initialization
2683          - static_assert with no message
2684          - typename in a template template parameter
2685          - Nested namespace definition
2686          - Attributes for namespaces and enumerators
2687          - u8 character literals
2688          - Allow constant evaluation for all non-type template arguments
2689          - Fold Expressions
2690          - Unary fold expressions and empty parameter packs
2691          - __has_include in preprocessor conditional
2692          - Differing begin and end types in range-based for
2693          - Improving std::pair and std::tuple
2694
2695         Consult the Tony Tables [3] to see before / after examples.
2696
2697         Of course we can use any library feature if we're willing to
2698         import them to WTF (and they don't require language support).
2699
2700
2701           [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html
2702           [1]: https://trac.webkit.org/changeset/231152/webkit
2703           [2]: https://en.cppreference.com/w/cpp/compiler_support
2704           [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md
2705
2706         * Configurations/Base.xcconfig:
2707         * DerivedSources.make:
2708         * PlatformMac.cmake:
2709
2710 2018-04-30  Wenson Hsieh  <wenson_hsieh@apple.com>
2711
2712         [Extra zoom mode] Respect the existing shrink-to-fit attribute instead of using min-device-width
2713         https://bugs.webkit.org/show_bug.cgi?id=185132
2714         <rdar://problem/39834562>
2715
2716         Reviewed by Tim Horton.
2717
2718         Remove the experimental feature for `min-device-width`.
2719
2720         * Shared/WebPreferences.yaml:
2721
2722 2018-04-30  Keith Rollin  <krollin@apple.com>
2723
2724         Include breadcrumb for tracking resource loading into CFNetwork
2725         https://bugs.webkit.org/show_bug.cgi?id=184837
2726         rdar://problem/39575411
2727
2728         Reviewed by Brent Fulgham.
2729
2730         When starting the network-based loading of a resource, log the
2731         description provided by NetworkDataTask. On Cocoa, this is implemented
2732         to return the description property in NSURLSessionTask. This
2733         information better allows us to track a resource load through the
2734         WebContent process, the Networking process, and the Cocoa networking
2735         layers.
2736
2737         * NetworkProcess/NetworkDataTask.cpp:
2738         (WebKit::NetworkDataTask::description const):
2739         * NetworkProcess/NetworkDataTask.h:
2740         * NetworkProcess/NetworkLoad.cpp:
2741         (WebKit::NetworkLoad::description const):
2742         * NetworkProcess/NetworkLoad.h:
2743         * NetworkProcess/NetworkResourceLoader.cpp:
2744         (WebKit::NetworkResourceLoader::startNetworkLoad):
2745         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2746         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2747         (WebKit::NetworkDataTaskCocoa::description const):
2748
2749 2018-04-30  Andy Estes  <aestes@apple.com>
2750
2751         [iOS] Try to unlock PDF documents before printing them
2752         https://bugs.webkit.org/show_bug.cgi?id=185084
2753         <rdar://problem/39356622>
2754
2755         Reviewed by Dan Bernstein.
2756
2757         * UIProcess/ios/WKPDFView.mm:
2758         (-[WKPDFView pdfHostViewController:documentDidUnlockWithPassword:]):
2759
2760         Stored the password that successfully unlocked the current PDF document.
2761
2762         (-[WKPDFView _wk_printedDocument]):
2763
2764         Used the stored password to unlock the CGPDFDocument we create for printing.
2765
2766 2018-04-28  Andy Estes  <aestes@apple.com>
2767
2768         [iOS] Present an action sheet when long-pressing on PDF links
2769         https://bugs.webkit.org/show_bug.cgi?id=185093
2770         <rdar://problem/39356651>
2771
2772         Reviewed by Dan Bernstein.
2773
2774         * UIProcess/ios/WKPDFView.mm:
2775         (-[WKPDFView dealloc]):
2776
2777         Called -[WKActionSheetAssistant cleanupSheet].
2778
2779         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
2780
2781         Created a WKActionSheetAssistant with the host view as the assistant view and
2782         ourselves as the delegate.
2783
2784         (-[WKPDFView _URLWithPageIndex:]):
2785
2786         Added. Creates a URL to the current page with a page number fragment appended.
2787
2788         (-[WKPDFView _goToURL:atLocation:]):
2789
2790         Added. Navigates to a URL with a synthetic mouse click at a location in host view
2791         coordinates.
2792
2793         (-[WKPDFView pdfHostViewController:goToURL:]):
2794         (-[WKPDFView pdfHostViewController:goToPageIndex:withViewFrustum:]):
2795
2796         Called -_goToURL:atLocation:. Used -_URLWithPageIndex: to construct an NSURL from
2797         a page index.
2798
2799         (-[WKPDFView _showActionSheetForURL:atLocation:]):
2800
2801         Added. Populates _positionInformation with a URL and location and calls
2802         -[WKActionSheetAssistant showLinkSheet].
2803
2804         (-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:]):
2805         (-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:]):
2806
2807         Called -_showActionSheetForURL:atLocation:. Used -_URLWithPageIndex: to construct
2808         an NSURL from a page index.
2809
2810         (-[WKPDFView positionInformationForActionSheetAssistant:]):
2811
2812         Returned _positionInformation.
2813
2814         (-[WKPDFView actionSheetAssistant:performAction:]):
2815
2816         Populated the pasteboard with plain text and URL representations of
2817         _positionInformation.url.
2818
2819         (-[WKPDFView actionSheetAssistant:openElementAtLocation:]):
2820
2821         Called -_goToURL:atLocation.
2822
2823         (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]):
2824
2825         Created a UIWKSelectionAssistant and called -showShareSheetFor:fromRect:.
2826
2827         (-[WKPDFView actionSheetAssistant:shouldIncludeAppLinkActionsForElement:]):
2828
2829         Returned API::UIClient::shouldIncludeAppLinkActionsForElement().
2830
2831         (-[WKPDFView actionSheetAssistant:decideActionsForElement:defaultActions:]):
2832
2833         Returned API::UIClient::actionsForElement()l
2834
2835 2018-04-28  Andy Estes  <aestes@apple.com>
2836
2837         [iOS] Allow com.apple.WebKit.Networking to look up com.apple.wifi.manager
2838         https://bugs.webkit.org/show_bug.cgi?id=185114
2839         <rdar://problem/39808763>
2840
2841         Reviewed by Wenson Hsieh.
2842
2843         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2844
2845 2018-04-28  Brent Fulgham  <bfulgham@apple.com>
2846
2847         Revise sandboxes to allow additional IOKit property access
2848         https://bugs.webkit.org/show_bug.cgi?id=185095
2849         <rdar://problem/39809455>
2850
2851         Reviewed by Eric Carlson.
2852
2853         Update the WebContent and Plugin processes to allow additional IOKit property access.
2854
2855         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
2856         * WebProcess/com.apple.WebProcess.sb.in:
2857
2858 2018-04-28  Carlos Garcia Campos  <cgarcia@igalia.com>
2859
2860         [GTK] WebProcess from WebKitGtk+ 2.19.92 SIGSEVs in WebCore::TextureMapperGL::~TextureMapperGL
2861         https://bugs.webkit.org/show_bug.cgi?id=184040
2862
2863         Reviewed by Michael Catanzaro.
2864
2865         This can happen when using single shared process model or when the process limit is reached in multiple process
2866         model. In this case, all pages in the same web process with accelerated compositing enabled share the same
2867         compositing thread. Every page sets its GL context as current when rendering a frame, but not when invalidating
2868         the threaded compositor when the page is closed. So, if a hidden tab is closed, the threaded compositor is
2869         invalidated and the GL resources of the current context (the visible page) are destroyed. This is also causing
2870         the blank pages issue when closing a tab related to another one, the current one stops rendering anything because
2871         its GL context has been released. We should make the threaded compositor context current when invalidating it.
2872
2873         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2874         (WebKit::ThreadedCompositor::invalidate):
2875
2876 2018-04-27  Timothy Hatcher  <timothy@apple.com>
2877
2878         REGRESSION: Touch events fail to dispatch to the page in all cases.
2879
2880         https://bugs.webkit.org/show_bug.cgi?id=185097
2881         rdar://problem/39731995
2882
2883         Reviewed by Tim Horton.
2884
2885         * UIProcess/ios/WKContentViewInteraction.mm:
2886         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
2887         Consult internal gesture recognizers, otherwise NO might get returned.
2888
2889 2018-04-26  Ryosuke Niwa  <rniwa@webkit.org>
2890
2891         PSON: Triggering a navigation to an invalid URL creates a new WebContent process
2892         https://bugs.webkit.org/show_bug.cgi?id=185066
2893
2894         Reviewed by Youenn Fablet.
2895
2896         Don't create a new WebContent process when the target URL is invalid as well as when the source URL is invalid.
2897
2898         * UIProcess/WebProcessPool.cpp:
2899         (WebKit::WebProcessPool::processForNavigationInternal):
2900
2901 2018-04-27  Youenn Fablet  <youenn@apple.com>
2902
2903         Use NetworkLoadChecker for XHR/fetch loads
2904         https://bugs.webkit.org/show_bug.cgi?id=184741
2905
2906         Reviewed by Chris Dumez.
2907
2908         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
2909         (WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
2910         Pass the preflight error as completion error if any.
2911         * NetworkProcess/NetworkLoad.cpp:
2912         (WebKit::NetworkLoad::willPerformHTTPRedirection):
2913         Set response source to Network so that checks relying on that are correct.
2914         * NetworkProcess/NetworkLoadChecker.cpp:
2915         (WebKit::NetworkLoadChecker::validateResponse):
2916         Adding Oppaqueredirect tainting.
2917         (NetworkLoadChecker::doesNotNeedCORSCheck):
2918         Adding a check to only activate CORS checks for CORS enabled schemes.
2919         Non CORS enabled schemes loads should have failed in WebProcess already.
2920         (WebKit::NetworkLoadChecker::checkCORSRedirectedRequest):
2921         Remove Authorization header as done by SubresourceLoader.
2922         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
2923         If error is cancellation, we still want to call the completion handler.
2924         * NetworkProcess/NetworkResourceLoader.cpp:
2925         Activate network load checker for all types of loads.
2926         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
2927         Handle manual redirection by directly calling didReceiveResponse.
2928
2929 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2930
2931         Add an experimental feature flag for viewport "min-device-width"
2932         https://bugs.webkit.org/show_bug.cgi?id=185050
2933         <rdar://problem/39624038>
2934
2935         Reviewed by Tim Horton.
2936
2937         Add MinDeviceWidthEnabled as a new experimental feature, on by default in extra zoom mode and off elsewhere.
2938
2939         * Shared/WebPreferences.yaml:
2940         * Shared/WebPreferencesDefaultValues.h:
2941
2942 2018-04-27  Daniel Bates  <dabates@apple.com>
2943
2944         UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance() is applicable to both Mac and iOS
2945         https://bugs.webkit.org/show_bug.cgi?id=185079
2946         <rdar://problem/39794960>
2947
2948         I inadvertently forgot to move the UIDelegate field webViewDidResignInputElementStrongPasswordAppearanceWithUserInfo
2949         outside the PLATFORM(MAC)-guard.
2950
2951         * UIProcess/Cocoa/UIDelegate.h:
2952
2953 2018-04-27  Daniel Bates  <dabates@apple.com>
2954
2955         UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance() is applicable to both Mac and iOS
2956         https://bugs.webkit.org/show_bug.cgi?id=185079
2957         <rdar://problem/39794960>
2958
2959         Reviewed by Andy Estes.
2960
2961         * UIProcess/Cocoa/UIDelegate.h:
2962         * UIProcess/Cocoa/UIDelegate.mm:
2963         (WebKit::UIDelegate::setDelegate):
2964         (WebKit::UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance):
2965
2966 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2967
2968         Rename minimumLayoutSize to viewLayoutSize
2969         https://bugs.webkit.org/show_bug.cgi?id=185050
2970         <rdar://problem/39624038>
2971
2972         Reviewed by Tim Horton.
2973
2974         Renames minimumLayoutSize to viewLayoutSize, since the minimum layout size in ViewportConfiguration is now
2975         different from the minimum layout size that is currently pushed down from the UI process (e.g. WKWebView SPI) in
2976         the case where `min-device-width` is used to override the minimum layout size.
2977
2978         * Shared/WebPageCreationParameters.cpp:
2979         (WebKit::WebPageCreationParameters::encode const):
2980         (WebKit::WebPageCreationParameters::decode):
2981         * Shared/WebPageCreationParameters.h:
2982         * UIProcess/API/Cocoa/WKWebView.mm:
2983         (-[WKWebView _processDidExit]):
2984         (-[WKWebView activeViewLayoutSize:]):
2985         (-[WKWebView _dispatchSetViewLayoutSize:]):
2986         (-[WKWebView _frameOrBoundsChanged]):
2987         (-[WKWebView _minimumLayoutSizeOverride]):
2988         (-[WKWebView _setViewLayoutSizeOverride:]):
2989         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
2990         (-[WKWebView _endAnimatedResize]):
2991         (-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:maximumUnobscuredSizeOverride:]):
2992         (-[WKWebView _clearOverrideLayoutParameters]):
2993         (-[WKWebView _minimumLayoutWidth]):
2994         (-[WKWebView _setMinimumLayoutWidth:]):
2995         (-[WKWebView activeMinimumLayoutSize:]): Deleted.
2996         (-[WKWebView _dispatchSetMinimumLayoutSize:]): Deleted.
2997         (-[WKWebView _setMinimumLayoutSizeOverride:]): Deleted.
2998         (-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:minimumLayoutSizeForMinimalUI:maximumUnobscuredSizeOverride:]): Deleted.
2999
3000         Remove unused SPI that has been deprecated since iOS 9, has a simple drop-in replacement, and no longer has any
3001         internal clients.
3002
3003         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3004         * UIProcess/Cocoa/WebViewImpl.mm:
3005         (WebKit::WebViewImpl::setMinimumSizeForAutoLayout):
3006         (WebKit::WebViewImpl::minimumSizeForAutoLayout const):
3007         (WebKit::WebViewImpl::setIntrinsicContentSize):
3008         * UIProcess/DrawingAreaProxy.h:
3009         (WebKit::DrawingAreaProxy::viewLayoutSizeDidChange):
3010         (WebKit::DrawingAreaProxy::minimumLayoutSizeDidChange): Deleted.
3011         * UIProcess/WebPageProxy.cpp:
3012         (WebKit::WebPageProxy::creationParameters):
3013         (WebKit::WebPageProxy::setViewLayoutSize):
3014         (WebKit::WebPageProxy::setMinimumLayoutSize): Deleted.
3015         * UIProcess/WebPageProxy.h:
3016         (WebKit::WebPageProxy::viewLayoutSize const):
3017         (WebKit::WebPageProxy::minimumLayoutSize const): Deleted.
3018         * UIProcess/ios/WebPageProxyIOS.mm:
3019         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
3020         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize):
3021         (WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize): Deleted.
3022         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
3023         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
3024         (WebKit::TiledCoreAnimationDrawingAreaProxy::viewLayoutSizeDidChange):
3025         (WebKit::TiledCoreAnimationDrawingAreaProxy::didUpdateGeometry):
3026         (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange):
3027         (WebKit::TiledCoreAnimationDrawingAreaProxy::willSendUpdateGeometry):
3028         (WebKit::TiledCoreAnimationDrawingAreaProxy::minimumLayoutSizeDidChange): Deleted.
3029         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3030         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
3031         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
3032         (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
3033         * WebProcess/WebPage/WebPage.cpp:
3034         (WebKit::m_credentialsMessenger):
3035         (WebKit::WebPage::setViewLayoutSize):
3036         (WebKit::WebPage::setMinimumLayoutSize): Deleted.
3037         * WebProcess/WebPage/WebPage.h:
3038         (WebKit::WebPage::viewLayoutSize const):
3039         (WebKit::WebPage::minimumLayoutSize const): Deleted.
3040         * WebProcess/WebPage/WebPage.messages.in:
3041         * WebProcess/WebPage/ios/WebPageIOS.mm:
3042         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
3043         (WebKit::WebPage::dynamicViewportSizeUpdate):
3044         (WebKit::WebPage::setViewportConfigurationMinimumLayoutSize): Deleted.
3045         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3046         (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded):
3047         (WebKit::TiledCoreAnimationDrawingArea::updateGeometry):
3048
3049 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3050
3051         [Extra zoom mode] Add a mechanism to override default viewport behaviors in extra zoom mode
3052         https://bugs.webkit.org/show_bug.cgi?id=185050
3053         <rdar://problem/39624038>
3054
3055         Reviewed by Tim Horton.
3056
3057         Remove the forceHorizontalViewportShrinkToFit and minimumAllowedLayoutWidth SPI hooks from WebKit, and
3058         additionally remove all logic for plumbing viewSize to WebCore. See WebCore/ChangeLog for more information.
3059
3060         * Shared/VisibleContentRectUpdateInfo.cpp:
3061         (WebKit::VisibleContentRectUpdateInfo::encode const):
3062         (WebKit::VisibleContentRectUpdateInfo::decode):
3063         (WebKit::operator<<):
3064         * Shared/VisibleContentRectUpdateInfo.h:
3065         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
3066         (WebKit::VisibleContentRectUpdateInfo::allowShrinkToFit const):
3067         (WebKit::operator==):
3068         (WebKit::VisibleContentRectUpdateInfo::forceHorizontalShrinkToFit const): Deleted.
3069         * UIProcess/API/Cocoa/WKWebView.mm:
3070         (-[WKWebView _initializeWithConfiguration:]):
3071         (-[WKWebView activeMinimumLayoutSize:]):
3072         (-[WKWebView _dispatchSetMinimumLayoutSize:]):
3073         (-[WKWebView _frameOrBoundsChanged]):
3074         (-[WKWebView _setMinimumLayoutSizeOverride:]):
3075         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
3076         (-[WKWebView _endAnimatedResize]):
3077         (-[WKWebView _minimumAllowedLayoutWidth]): Deleted.
3078         (-[WKWebView _setMinimumAllowedLayoutWidth:]): Deleted.
3079         (-[WKWebView activeMinimumLayoutSizes:]): Deleted.
3080         (-[WKWebView _dispatchSetMinimumLayoutSize:viewSize:]): Deleted.
3081         (-[WKWebView _setForceHorizontalViewportShrinkToFit:]): Deleted.
3082         (-[WKWebView _forceHorizontalViewportShrinkToFit]): Deleted.
3083         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3084         * UIProcess/WebPageProxy.cpp:
3085         (WebKit::WebPageProxy::creationParameters):
3086         * UIProcess/WebPageProxy.h:
3087         * UIProcess/ios/WKContentView.mm:
3088         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
3089         * UIProcess/ios/WebPageProxyIOS.mm:
3090         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
3091         (WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize):
3092         * WebProcess/WebPage/WebPage.cpp:
3093         (WebKit::m_credentialsMessenger):
3094         * WebProcess/WebPage/WebPage.h:
3095         * WebProcess/WebPage/WebPage.messages.in:
3096         * WebProcess/WebPage/ios/WebPageIOS.mm:
3097         (WebKit::WebPage::setViewportConfigurationMinimumLayoutSize):
3098         (WebKit::WebPage::dynamicViewportSizeUpdate):
3099         (WebKit::WebPage::updateVisibleContentRects):
3100
3101 2018-04-27  Carlos Garcia Campos  <cgarcia@igalia.com>
3102
3103         REGRESSION(r230812): [WPE][GTK] WebKitWebViewSessionState.cpp throws away encoded BackForwardList identifier
3104         https://bugs.webkit.org/show_bug.cgi?id=184823
3105
3106         Reviewed by Michael Catanzaro.
3107
3108         Bump session sate format version to 2 and stop encoding the backfoward list item identifier, since it's always
3109         regenerated.
3110
3111         * UIProcess/API/glib/WebKitWebViewSessionState.cpp:
3112         (encodeBackForwardListItemState): Always encode version 2.
3113         (encodeBackForwardListState): Ditto.
3114         (encodeSessionState): Ditto.
3115         (decodeBackForwardListItemStateV1): Decode list item state for version 1.
3116         (decodeBackForwardListItemState): Receive the version and call decodeBackForwardListItemStateV1() if it's 1 or
3117         use the version 2 otherwise.
3118         (decodeSessionState): Load data for known formats and use the one that worked to decode it.
3119
3120 2018-04-26  Megan Gardner  <megan_gardner@apple.com>
3121
3122         Add timeout for ensurePositionInformationIsUpToDate
3123         https://bugs.webkit.org/show_bug.cgi?id=184567
3124
3125         Reviewed by Wenson Hsieh.
3126         
3127         We are having long hang times for WebKit, and this is one of the culprits.
3128         If we do not get an answer for positionInformation in a reasonable amount of time, we should timeout,
3129         so as to not hang the UI.
3130
3131         * UIProcess/ios/WKContentViewInteraction.mm:
3132         (-[WKContentView ensurePositionInformationIsUpToDate:]):
3133
3134 2018-04-26  Andy Estes  <aestes@apple.com>
3135
3136         Try again to fix the iOS build after r231063.
3137
3138         * Configurations/Base.xcconfig:
3139
3140 2018-04-26  Jer Noble  <jer.noble@apple.com>
3141
3142         WK_COCOA_TOUCH the WK_ACCESSIBILITY_LDFLAGS
3143         https://bugs.webkit.org/show_bug.cgi?id=185007
3144         <rdar://problem/39735943>
3145
3146         Reviewed by Timothy Hatcher.
3147
3148         * Configurations/WebKit.xcconfig:
3149
3150 2018-04-26  Jer Noble  <jer.noble@apple.com>
3151
3152         Unreviewed build fix; fix iOS TAPI build step after r231063.
3153
3154         * Configurations/WebKit.xcconfig:
3155
3156 2018-04-26  Jer Noble  <jer.noble@apple.com>
3157
3158         WK_COCOA_TOUCH all the things.
3159         https://bugs.webkit.org/show_bug.cgi?id=185006
3160
3161         Reviewed by Tim Horton.
3162
3163         * Configurations/BaseTarget.xcconfig:
3164         * Configurations/WebKit.xcconfig:
3165
3166 2018-04-26  Daniel Bates  <dabates@apple.com>
3167
3168         Remove WebCore::-qualifier in NetworkLoadChecker.cpp
3169         https://bugs.webkit.org/show_bug.cgi?id=185037
3170
3171         Reviewed by Youenn Fablet.
3172
3173         It is unncesssary to qualify WebCore types in NetworkLoadChecker.cpp as it has a
3174         "using namespace WebCore" directive.
3175
3176         * NetworkProcess/NetworkLoadChecker.cpp:
3177         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
3178         (WebKit::NetworkLoadChecker::checkRedirection):
3179         (WebKit::NetworkLoadChecker::validateResponse):
3180         (WebKit::NetworkLoadChecker::continueCheckingRequest): Removed extra space character and unnecessary
3181         parentheses from the right-hand side of the assignment to m_storedCredentialsPolicy.
3182         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
3183
3184 2018-04-26  Daniel Bates  <dabates@apple.com>
3185
3186         Rename NetworkLoadChecker::returnError() to NetworkLoadChecker::accessControlErrorForValidationHandler()
3187         https://bugs.webkit.org/show_bug.cgi?id=185035
3188
3189         Reviewed by Youenn Fablet.
3190
3191         Substitute NetworkLoadChecker::accessControlErrorForValidationHandler() for NetworkLoadChecker::returnError()
3192         to better describe that it is a convenience function that returns a wrapped ResourceError object,
3193         that represents an access control error, suitable to be passed directly to a validation handler.
3194
3195         * NetworkProcess/NetworkLoadChecker.cpp:
3196         (WebKit::NetworkLoadChecker::checkRedirection): Update as needed for renaming.
3197         (WebKit::NetworkLoadChecker::accessControlErrorForValidationHandler): Use auto -> syntax to avoid the need to
3198         class-qualify the return type. Also renamed parameter from error to message as it represents the message/description
3199         for the access control error.
3200         (WebKit::NetworkLoadChecker::checkRequest): Update as needed for renaming. Also substitute "message" for "error"
3201         to match the argument of accessControlErrorForValidationHandler() with the same name.
3202         (WebKit::NetworkLoadChecker::continueCheckingRequest): Update as needed for renaming.
3203         (WebKit::NetworkLoadChecker::returnError): Deleted; renamed to accessControlErrorForValidationHandler().
3204         * NetworkProcess/NetworkLoadChecker.h:
3205
3206 2018-04-26  Jiewen Tan  <jiewen_tan@apple.com>
3207
3208         Remove access to keychain from the WebContent process
3209         https://bugs.webkit.org/show_bug.cgi?id=184428
3210         <rdar://problem/13150903>
3211
3212         Part 3.
3213
3214         Tighten WebContent Process' sandbox profile to all Security.framework services.
3215
3216         Reviewed by Brent Fulgham.
3217
3218         * WebProcess/com.apple.WebProcess.sb.in:
3219
3220 2018-04-26  Youenn Fablet  <youenn@apple.com>
3221
3222         Make cross origin redirection error messages consistent between SubresourceLoader and NetworkLoadChecker
3223         https://bugs.webkit.org/show_bug.cgi?id=185023
3224
3225         Reviewed by Chris Dumez.
3226
3227         Align NetworkLoadChecker with what SubresourceLoader is doing so that we can keep WK1 and WK2 error messages as consistent as possible.
3228
3229         * NetworkProcess/NetworkLoadChecker.cpp:
3230         (WebKit::NetworkLoadChecker::checkRedirection):
3231         (WebKit::NetworkLoadChecker::validateResponse):
3232
3233 2018-04-25  Megan Gardner  <megan_gardner@apple.com>
3234
3235         Activate selection when interacting with editable content
3236         https://bugs.webkit.org/show_bug.cgi?id=185017
3237
3238         Reviewed by Tim Horton.
3239         
3240         Fixes a regression from r231016 where selection now does not work when interacting with
3241         editable content. When we go into editable content, we should turn on the assistant.
3242         This fulfills the requirement of user interaction as well, so any javascript selections
3243         after this point should be valid.
3244
3245         * UIProcess/ios/WKContentViewInteraction.mm:
3246         (-[WKContentView _startAssistingKeyboard]):
3247         (-[WKContentView _stopAssistingKeyboard]):
3248
3249 2018-04-26  Per Arne Vollan  <pvollan@apple.com>
3250
3251         Disable content filtering in minimal simulator mode
3252         https://bugs.webkit.org/show_bug.cgi?id=185027
3253         <rdar://problem/39736091>
3254
3255         Reviewed by Jer Noble.
3256
3257         * Configurations/FeatureDefines.xcconfig:
3258
3259 2018-04-26  Brady Eidson  <beidson@apple.com>
3260
3261         Add a setting for keeping around all processes and always reusing them per-origin.
3262         <rdar://problem/39695798> and https://bugs.webkit.org/show_bug.cgi?id=185020
3263
3264         Reviewed by Andy Estes.
3265
3266         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3267         (API::ProcessPoolConfiguration::copy):
3268         * UIProcess/API/APIProcessPoolConfiguration.h:
3269
3270         * UIProcess/API/C/WKContextConfigurationRef.cpp:
3271         (WKContextConfigurationAlwaysKeepAndReuseSwappedProcesses):
3272         (WKContextConfigurationSetAlwaysKeepAndReuseSwappedProcesses):
3273         * UIProcess/API/C/WKContextConfigurationRef.h:
3274
3275         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3276         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3277         (-[_WKProcessPoolConfiguration setAlwaysKeepAndReuseSwappedProcesses:]):
3278         (-[_WKProcessPoolConfiguration alwaysKeepAndReuseSwappedProcesses]):
3279
3280         * UIProcess/SuspendedPageProxy.cpp:
3281         (WebKit::SuspendedPageProxy::webProcessDidClose):
3282         (WebKit::SuspendedPageProxy::destroyWebPageInWebProcess):
3283         * UIProcess/SuspendedPageProxy.h:
3284
3285         * UIProcess/WebPageProxy.cpp:
3286         (WebKit::WebPageProxy::suspendedPageClosed):
3287         (WebKit::WebPageProxy::suspendedPageProcessClosed): Deleted.
3288         * UIProcess/WebPageProxy.h:
3289         (WebKit::WebPageProxy::suspendedPage const):
3290
3291         * UIProcess/WebProcessPool.cpp:
3292         (WebKit::WebProcessPool::shouldTerminate):
3293         (WebKit::WebProcessPool::disconnectProcess):
3294         (WebKit::WebProcessPool::addProcessToOriginCacheSet):
3295         (WebKit::WebProcessPool::removeProcessFromOriginCacheSet):
3296         (WebKit::WebProcessPool::processForNavigation): If a swap will occur, cache the old process.
3297         (WebKit::WebProcessPool::processForNavigationInternal): Consider re-using a previously cached process.
3298         * UIProcess/WebProcessPool.h:
3299
3300         * WebProcess/WebPage/WebPage.cpp:
3301         (WebKit::m_credentialsMessenger):
3302
3303 2018-04-26  Andy VanWagoner  <thetalecrafter@gmail.com>
3304
3305         [INTL] Implement Intl.PluralRules
3306         https://bugs.webkit.org/show_bug.cgi?id=184312
3307
3308         Reviewed by JF Bastien.
3309
3310         Added Intl.PluralRules feature flag.
3311
3312         * Configurations/FeatureDefines.xcconfig:
3313
3314 2018-04-26  Zan Dobersek  <zdobersek@igalia.com>
3315
3316         [GTK][WPE] Initial ASYNC_SCROLLING support
3317         https://bugs.webkit.org/show_bug.cgi?id=184961
3318
3319         Reviewed by Carlos Garcia Campos.
3320
3321         Guard RemoteScrollingCoordinator and RemoteScrollingCoordinatorProxy
3322         usage in WebChromeClient and WebPageProxy, respectively, with
3323         PLATFORM(COCOA) in addition to the ASYNC_SCROLLING guards.
3324
3325         Despite enabling the code at build-time, the feature (as intended) is
3326         not yet used because of the DrawingArea rejection in the WebPage
3327         constructor.
3328
3329         * UIProcess/WebPageProxy.cpp:
3330         (WebKit::WebPageProxy::initializeWebPage):
3331         (WebKit::WebPageProxy::handleWheelEvent):
3332         (WebKit::WebPageProxy::updateTouchEventTracking):
3333         * UIProcess/WebPageProxy.h:
3334         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3335         (WebKit::WebChromeClient::createScrollingCoordinator const):
3336
3337 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
3338
3339         [WPE] Build and link against latest WPEBackend and WPEBackend-fdo
3340         https://bugs.webkit.org/show_bug.cgi?id=184643
3341
3342         Reviewed by Žan Doberšek.
3343
3344         Adapt to single-header WPE includes.
3345
3346         Null-initialize padding to silence -Wmissing-field-initializers. (Yuck.)
3347
3348         * Shared/NativeWebTouchEvent.h:
3349         * Shared/wpe/WebEventFactory.cpp:
3350         * UIProcess/API/glib/WebKitPrivate.cpp:
3351         * UIProcess/API/wpe/CompositingManagerProxy.cpp:
3352         * UIProcess/API/wpe/ScrollGestureController.h:
3353         * UIProcess/API/wpe/WPEView.cpp:
3354         (WKWPE::m_backend):
3355         * UIProcess/API/wpe/WebKitWebViewBackend.h:
3356         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
3357         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
3358         (WebKit::AcceleratedSurfaceWPE::initialize):
3359
3360 2018-04-25  Saam Barati  <sbarati@apple.com>
3361
3362         dlopen the bundle's executable before calling -[NSBundle load] since that will also do a bunch of other things we don't need
3363         https://bugs.webkit.org/show_bug.cgi?id=184904
3364
3365         Reviewed by Geoffrey Garen.
3366
3367         Loading an NSBundle does a lot of work to find the principal class inside
3368         the bundle. This means it walks all the objective C class names loaded
3369         by the bundle. Doing this is *really* expensive.
3370         
3371         Some users of the injected bundle define a WKBundleInitialize function.
3372         In such a case, we don't need the principal class, so we can skip loading
3373         the NSBundle. Now, before we load the bundle, we dlopen and dlsym looking
3374         for the WKBundleInitialize function. If we find it, we skip loading
3375         the bundle. If we don't find the WKBundleInitialize function, we fall
3376         back to loading the bundle and finding the principal class.
3377         
3378         This speeds up initializeWebProcess by ~70ms on my MBP.
3379
3380         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
3381         (WebKit::InjectedBundle::initialize):
3382
3383 2018-04-25  Youenn Fablet  <youenn@apple.com>
3384
3385         Use NetworkLoadChecker for all subresource loads except fetch/XHR
3386         https://bugs.webkit.org/show_bug.cgi?id=184870
3387         <rdar://problem/39370034>
3388
3389         Reviewed by Chris Dumez.
3390
3391         Relax rules to check for non HTTP(s) redirections to throw only when WebProcess says to load it after redirection.
3392         This allows WebProcess to load redirected non HTTP(s) URLs, such as data URLs.
3393         We keep these checks when WebProcess asks to continue the load and for all PingLoads.
3394
3395         Update error messages to be more consistent with WK1.
3396
3397         * NetworkProcess/NetworkLoadChecker.cpp:
3398         (WebKit::NetworkLoadChecker::checkRedirection):
3399         (WebKit::NetworkLoadChecker::continueCheckingRequest):
3400         (WebKit::NetworkLoadChecker::validateResourceResponse):
3401         (WebKit::NetworkLoadChecker::continueCheckingRequest):
3402         * NetworkProcess/NetworkLoadChecker.h:
3403         (WebKit::NetworkLoadChecker::validateResponse):
3404         * NetworkProcess/NetworkResourceLoader.cpp:
3405         (WebKit::shouldUseNetworkLoadChecker):
3406         (WebKit::NetworkResourceLoader::continueWillSendRequest):
3407
3408 2018-04-25  Ryosuke Niwa  <rniwa@webkit.org>
3409
3410         PSON: Don't create a new process when navigating to a blob URL, data URL, and about:blank
3411         https://bugs.webkit.org/show_bug.cgi?id=184962
3412
3413         Reviewed by Youenn Fablet.
3414         <rdar://problem/39715044>
3415
3416         Build fix. Revert the change in r231019 to remove the empty URL and about:blank check here.
3417         These checks are for the source / originating URL, not the target URL.
3418
3419         * UIProcess/WebProcessPool.cpp:
3420         (WebKit::WebProcessPool::processForNavigation):
3421
3422 2018-04-25  Youenn Fablet  <youenn@apple.com>
3423
3424         WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier should use DoNotProcessIncomingMessagesWhenWaitingForSyncReply
3425         https://bugs.webkit.org/show_bug.cgi?id=184978
3426         <rdar://problem/39667094>
3427
3428         Reviewed by Simon Fraser.
3429
3430         Use DoNotProcessIncomingMessagesWhenWaitingForSyncReply to keep a consistent state after the sync IPC call.
3431
3432         * WebProcess/Network/WebLoaderStrategy.cpp:
3433         (WebKit::WebLoaderStrategy::responseFromResourceLoadIdentifier):
3434         (WebKit::WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier):
3435
3436 2018-04-25  Jiewen Tan  <jiewen_tan@apple.com>
3437
3438         Remove access to keychain from the WebContent process
3439         https://bugs.webkit.org/show_bug.cgi?id=184428
3440         <rdar://problem/13150903>
3441
3442         Reviewed by Brent Fulgham.
3443
3444         This patch does the followings:
3445         1. Added necessary support to move HTMLKeygenElement's operation from WebContent Process to UI Process.
3446         2. Craft new SPI copySignedPublicKeyAndChallengeString to supply HTMLKeygenElement with dummy data such
3447         that WebKitTestRunner tests will not modify the underlying key store (e.g., the macOS Keychain).
3448
3449         * UIProcess/API/APINavigationClient.h:
3450         (API::NavigationClient::signedPublicKeyAndChallengeString):
3451         * UIProcess/API/C/WKPage.cpp:
3452         (WKPageSetPageNavigationClient):
3453         * UIProcess/API/C/WKPageNavigationClient.h:
3454         * UIProcess/Cocoa/NavigationState.h:
3455         * UIProcess/Cocoa/NavigationState.mm:
3456         (WebKit::NavigationState::NavigationClient::signedPublicKeyAndChallengeString):
3457         * UIProcess/WebPageProxy.cpp:
3458         (WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
3459         * UIProcess/WebPageProxy.h:
3460         * UIProcess/WebPageProxy.messages.in:
3461         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3462         (WebKit::WebChromeClient::signedPublicKeyAndChallengeString const):
3463         * WebProcess/WebCoreSupport/WebChromeClient.h:
3464
3465 2018-04-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3466
3467         [Extra zoom mode] The search field on www.bing.com is missing label text
3468         https://bugs.webkit.org/show_bug.cgi?id=184975
3469         <rdar://problem/39723081>
3470
3471         Reviewed by Tim Horton.
3472
3473         Adds support for displaying the "aria-label" attribute as the input view's label text in extra zoom mode. Also
3474         adds support for grabbing the input label's text for testing.
3475
3476         Test: fast/forms/extrazoom/form-control-label-text.html
3477
3478         * Shared/AssistedNodeInformation.cpp:
3479         (WebKit::AssistedNodeInformation::encode const):
3480         (WebKit::AssistedNodeInformation::decode):
3481         * Shared/AssistedNodeInformation.h:
3482         * UIProcess/API/Cocoa/WKWebView.mm:
3483         (-[WKWebView formInputLabel]):
3484         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3485         * UIProcess/ios/WKContentViewInteraction.h:
3486         * UIProcess/ios/WKContentViewInteraction.mm:
3487         (-[WKContentView formInputLabel]):
3488         * WebProcess/WebPage/ios/WebPageIOS.mm:
3489         (WebKit::WebPage::getAssistedNodeInformation):
3490
3491 2018-04-25  Ryosuke Niwa  <rniwa@webkit.org>
3492
3493         PSON: Don't create a new process when navigating to a blob URL, data URL, and about:blank
3494         https://bugs.webkit.org/show_bug.cgi?id=184962
3495
3496         Reviewed by Youenn Fablet.
3497
3498         Don't create a new WebContent process when navigating to a blob object URL since doing so
3499         can result in a race condition in which the blog URL is removed from the blob registry of
3500         the network process by the time the navigation gets commited. This causes a failure in
3501         fast/dom/HTMLAnchorElement/anchor-download-unset.html and oher layout tests.
3502
3503         In the future, the network process should verify that a given WebContent process has access
3504         to a given blob URL. For now, we rely on WebContent process to tell us whether it can
3505         navigate to a given blob URL or not.
3506
3507         * Shared/NavigationActionData.cpp:
3508         (WebKit::NavigationActionData::encode const): Encode newly added treatAsSameOriginNavigation.
3509         (WebKit::NavigationActionData::decode): Ditto for decoding.
3510         * Shared/NavigationActionData.h:
3511         (WebKit::NavigationActionData::treatAsSameOriginNavigation): Added.
3512         * UIProcess/API/APINavigation.h:
3513         (API::Navigation::setTreatAsSameOriginNavigation): Added.
3514         (API::Navigation::treatAsSameOriginNavigation const): Added.
3515         * UIProcess/API/APIProcessPoolConfiguration.h:
3516         * UIProcess/WebPageProxy.cpp:
3517         (WebKit::WebPageProxy::decidePolicyForNavigationAction): Use the current process when
3518         treatAsSameOriginNavigation is set to true; i.e. when navigating to a blob URL the current
3519         document has access.
3520         * UIProcess/WebProcessPool.cpp:
3521         (WebKit::WebProcessPool::processForNavigation):
3522         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3523         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3524
3525 2018-04-25  Megan Gardner  <megan_gardner@apple.com>
3526
3527         Don't activate Selection Assistant unless it is actually needed.
3528         https://bugs.webkit.org/show_bug.cgi?id=184944
3529         <rdar://problem/39469671>
3530
3531         Reviewed by Tim Horton.
3532         
3533         Don't activate the selection unless we need to. Activating on init is overeager and allowing Javascript to 
3534         activate selections without user input.
3535
3536         * UIProcess/ios/WKContentViewInteraction.mm:
3537         (-[WKContentView useSelectionAssistantWithGranularity:]):
3538
3539 2018-04-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3540
3541         Fix entitlements and sandbox configurations in WebKit after r230778
3542         https://bugs.webkit.org/show_bug.cgi?id=184960
3543         <rdar://problem/39662827>
3544
3545         Reviewed by Tim Horton.
3546
3547         Build fixes for watchOS and tvOS after r230778.
3548
3549         * Configurations/BaseXPCService.xcconfig:
3550         * Configurations/NetworkService.xcconfig:
3551         * Configurations/WebContentService.xcconfig:
3552
3553 2018-04-25  Brent Fulgham  <bfulgham@apple.com>
3554
3555         Unreviewed build fix after r231008.
3556
3557         * NetworkProcess/NetworkDataTask.cpp:
3558         (WebKit::NetworkDataTask::create): Forgot to remove an unneeded constructor argument.
3559
3560 2018-04-25  Brent Fulgham  <bfulgham@apple.com>
3561
3562         Don't Block First Party Cookies on Redirects
3563         https://bugs.webkit.org/show_bug.cgi?id=184948
3564         <rdar://problem/39534099>
3565
3566         Reviewed by Youenn Fablet.
3567
3568         Top-level navigations should not be subject to cookie blocking behavior. When performing redirects for main frame
3569         navigation we are blocking cookies, leading to site breakage.
3570         
3571         We need to keep track of which NetworkDataTasks are due to a main frame navigation. When a redirect is performed
3572         on the main frame, we should treat the new origin as the 'first party for cookies' and avoid blocking cookies for
3573         that URL.
3574
3575         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3576         (WebKit::NetworkConnectionToWebProcess::preconnectTo): Use the correct parameter type. We actually serialize
3577         NetworkResourceLoadParameters over IPC, so we should get access to all the members of this child class.
3578         * NetworkProcess/NetworkConnectionToWebProcess.h:
3579         * NetworkProcess/NetworkDataTask.cpp:
3580         (WebKit::NetworkDataTask::create): Pass new 'loadIsForNavigation' flag to create methods. 
3581         (WebKit::NetworkDataTask::NetworkDataTask): Capture 'loadIsForNavigation' in constructor.
3582         * NetworkProcess/NetworkDataTask.h:
3583         (WebKit::NetworkDataTask::isTopLevelNavigation const): Added.
3584         * NetworkProcess/NetworkDataTaskBlob.cpp:
3585         (WebKit::NetworkDataTaskBlob::NetworkDataTaskBlob): Accept new constructor argument.
3586         * NetworkProcess/NetworkDataTaskBlob.h:
3587         * NetworkProcess/NetworkLoad.cpp:
3588         (WebKit::NetworkLoad::willPerformHTTPRedirection): Retain requester value from old request during redirect.
3589         * NetworkProcess/NetworkResourceLoadParameters.cpp:
3590         (NetworkResourceLoadParameters::decode): Update to pass new flag.
3591         (NetworkResourceLoadParameters::encode): Ditto.
3592         * NetworkProcess/NetworkLoadParameters.h:
3593         * NetworkProcess/capture/NetworkDataTaskReplay.cpp:
3594         (WebKit::NetworkCapture::NetworkDataTaskReplay::NetworkDataTaskReplay): Accept new constructor argument.
3595         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
3596         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3597         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Accept new constructor argument.
3598         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
3599         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
3600         (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl): Accept new constructor argument.
3601         * NetworkProcess/curl/NetworkDataTaskCurl.h:
3602         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
3603         (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup): Accept new constructor argument.
3604         * NetworkProcess/soup/NetworkDataTaskSoup.h:
3605
3606 2018-04-25  Youenn Fablet  <youenn@apple.com>
3607
3608         Ensure DNT is set for redirections handled in NetworkProcess
3609         https://bugs.webkit.org/show_bug.cgi?id=184890
3610
3611         Reviewed by Ryosuke Niwa.
3612
3613         Compute whether DNT header should be set on requests based on:
3614         - request has a DNT header
3615         - session is ephemeral (aka private browsing mode)
3616         In both cases, we ensure a DNT header is added for any request triggered by a redirection.
3617
3618         Covered by http/wpt/fetch/dnt-header-after-redirection.html.
3619
3620         * NetworkProcess/NetworkLoadChecker.cpp:
3621         (WebKit::NetworkLoadChecker::check):
3622         (WebKit::NetworkLoadChecker::prepareRedirectedRequest):
3623         * NetworkProcess/NetworkLoadChecker.h:
3624         * NetworkProcess/NetworkResourceLoader.cpp:
3625         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
3626         (WebKit::NetworkResourceLoader::continueWillSendRequest):
3627         * NetworkProcess/PingLoad.cpp:
3628         (WebKit::PingLoad::willPerformHTTPRedirection):
3629         * WebProcess/Network/WebLoaderStrategy.cpp:
3630         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3631
3632 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
3633
3634         [WPE] Remove deprecated functions and properties from the API
3635         https://bugs.webkit.org/show_bug.cgi?id=179295
3636
3637         Reviewed by Žan Doberšek.
3638
3639         * UIProcess/API/glib/WebKitCookieManager.cpp:
3640         * UIProcess/API/glib/WebKitFormSubmissionRequest.cpp:
3641         * UIProcess/API/glib/WebKitNavigationPolicyDecision.cpp:
3642         (webkitNavigationPolicyDecisionGetProperty):
3643         (webkit_navigation_policy_decision_class_init):
3644         * UIProcess/API/glib/WebKitSettings.cpp:
3645         (webKitSettingsSetProperty):
3646         (webKitSettingsGetProperty):
3647         (webkit_settings_class_init):
3648         * UIProcess/API/glib/WebKitWebContext.cpp:
3649         (webkitWebContextGetProperty):
3650         (webkitWebContextSetProperty):
3651         (webkit_web_context_class_init):
3652         * UIProcess/API/glib/WebKitWebView.cpp:
3653         (webkit_web_view_class_init):
3654         (webkitWebViewHandleAuthenticationChallenge):
3655         (webkitWebViewWebProcessTerminated):
3656         * UIProcess/API/wpe/WebKitCookieManager.h:
3657         * UIProcess/API/wpe/WebKitFormSubmissionRequest.h:
3658         * UIProcess/API/wpe/WebKitNavigationPolicyDecision.h:
3659         * UIProcess/API/wpe/WebKitSettings.h:
3660         * UIProcess/API/wpe/WebKitWebContext.h:
3661
3662 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
3663
3664         Unreviewed, silence -Wreturn-type warning
3665         https://bugs.webkit.org/show_bug.cgi?id=184560
3666
3667         * NetworkProcess/NetworkResourceLoader.cpp:
3668         (WebKit::shouldCancelCrossOriginLoad):
3669
3670 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
3671
3672         [GTK] Miscellaneous build cleanups
3673         https://bugs.webkit.org/show_bug.cgi?id=184399
3674
3675         Reviewed by Žan Doberšek.
3676
3677         * PlatformGTK.cmake:
3678
3679 2018-04-25  Dean Jackson  <dino@apple.com>
3680
3681         Make a better flag for system preview, and disable it where necessary
3682         https://bugs.webkit.org/show_bug.cgi?id=184968
3683         <rdar://problem/39686506>
3684
3685         Reviewed by Eric Carlson.
3686
3687         Use USE(SYSTEM_PREVIEW).
3688
3689         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
3690         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
3691         (-[WKWebViewContentProviderRegistry init]):
3692         * UIProcess/ios/WKSystemPreviewView.mm:
3693
3694 2018-04-25  Carlos Garcia Campos  <cgarcia@igalia.com>
3695
3696         [GTK] Implement MouseEvent.buttons
3697         https://bugs.webkit.org/show_bug.cgi?id=184913
3698
3699         Reviewed by Žan Doberšek.
3700
3701         It's currently returning always 0.
3702
3703         * Shared/gtk/WebEventFactory.cpp:
3704         (WebKit::pressedMouseButtons): Helper function to get the pressed mouse buttons.
3705         (WebKit::WebEventFactory::createWebMouseEvent): Pass presssed mouse buttons to constructor instead of 0.
3706         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
3707         (WebKit::WebAutomationSession::platformSimulateMouseInteraction): Include the mouse buttons state in automation
3708         synthesized events and update m_currentModifiers with the mouse buttons state.
3709         (WebKit::keyCodeForVirtualKey): Do not set the state here.
3710         (WebKit::modifiersForKeyCode): Helper to get the modifiers for a key code.
3711         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): Initialize the modifiers also when
3712         virtualKey is std::nullopt;
3713
3714 2018-04-24  Nan Wang  <n_wang@apple.com>
3715
3716         AX: soft link libAccessibility.dylb
3717         https://bugs.webkit.org/show_bug.cgi?id=184919
3718
3719         Reviewed by Dan Bernstein.
3720
3721         Weakly linked libAccessibility.dylib on macOS.
3722
3723         * Configurations/WebKit.xcconfig:
3724         * UIProcess/API/Cocoa/WKWebView.mm:
3725         (-[WKWebView _initializeWithConfiguration:]):
3726         (-[WKWebView _updateAccessibilityEventsEnabled]):
3727
3728 2018-04-24  Fujii Hironori  <Hironori.Fujii@sony.com>
3729
3730         [WinCairo] Add WKView and WKAPI
3731         https://bugs.webkit.org/show_bug.cgi?id=182869
3732
3733         Reviewed by Alex Christensen.
3734
3735         Resurrected source files for WebKit for Windows port which was
3736         removed in r139003.
3737
3738         * PlatformWin.cmake: Renamed the output name of WebKit to WebKit2
3739         not to conflict WebKitLegacy. Added source files and include paths.
3740         * UIProcess/API/C/WKAPICast.h:
3741         * UIProcess/API/C/win/WKAPICastWin.h: Added.
3742         * UIProcess/API/C/win/WKView.cpp: Added.
3743         (WKViewCreate):
3744         (WKViewGetWindow):
3745         (WKViewGetPage):
3746         (WKViewSetParentWindow):
3747         (WKViewWindowAncestryDidChange):
3748         (WKViewSetIsInWindow):
3749         (WKViewSetScrollOffsetOnNextResize):
3750         * UIProcess/API/C/win/WKView.h: Added.
3751         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp: Added.
3752         (API::WebsiteDataStore::defaultApplicationCacheDirectory):
3753         (API::WebsiteDataStore::defaultCacheStorageDirectory):
3754         (API::WebsiteDataStore::defaultNetworkCacheDirectory):
3755         (API::WebsiteDataStore::defaultIndexedDBDatabaseDirectory):
3756         (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
3757         (API::WebsiteDataStore::defaultLocalStorageDirectory):
3758         (API::WebsiteDataStore::defaultMediaKeysStorageDirectory):
3759         (API::WebsiteDataStore::defaultWebSQLDatabaseDirectory):
3760         (API::WebsiteDataStore::defaultResourceLoadStatisticsDirectory):
3761         (API::WebsiteDataStore::cacheDirectoryFileSystemRepresentation):
3762         (API::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation):
3763         (API::WebsiteDataStore::defaultDataStoreConfiguration):
3764         * UIProcess/Launcher/ProcessLauncher.h:
3765         * UIProcess/Launcher/win/ProcessLauncherWin.cpp: Added.
3766         (WebKit::processName):
3767         (WebKit::ProcessLauncher::launchProcess):
3768         (WebKit::ProcessLauncher::terminateProcess):
3769         (WebKit::ProcessLauncher::platformInvalidate):
3770         * UIProcess/Network/NetworkProcessProxy.cpp:
3771         (WebKit::NetworkProcessProxy::networkProcessFailedToLaunch):
3772         (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
3773         * UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp: Added.
3774         (WebKit::WebsiteDataStore::platformInitialize):
3775         (WebKit::WebsiteDataStore::platformDestroy):
3776         (WebKit::WebsiteDataStore::platformRemoveRecentSearches):
3777         * UIProcess/win/PageClientImpl.cpp: Added.
3778         (WebKit::PageClientImpl::PageClientImpl):
3779         (WebKit::PageClientImpl::createDrawingAreaProxy):
3780         (WebKit::PageClientImpl::setViewNeedsDisplay):
3781         (WebKit::PageClientImpl::requestScroll):
3782         (WebKit::PageClientImpl::viewScrollPosition):
3783         (WebKit::PageClientImpl::viewSize):
3784         (WebKit::PageClientImpl::isViewWindowActive):
3785         (WebKit::PageClientImpl::isViewFocused):
3786         (WebKit::PageClientImpl::isViewVisible):
3787         (WebKit::PageClientImpl::isViewInWindow):
3788         (WebKit::PageClientImpl::PageClientImpl::processDidExit):
3789         (WebKit::PageClientImpl::didRelaunchProcess):
3790         (WebKit::PageClientImpl::toolTipChanged):
3791         (WebKit::PageClientImpl::setCursor):
3792         (WebKit::PageClientImpl::setCursorHiddenUntilMouseMoves):
3793         (WebKit::PageClientImpl::didChangeViewportProperties):
3794         (WebKit::PageClientImpl::registerEditCommand):
3795         (WebKit::PageClientImpl::clearAllEditCommands):
3796         (WebKit::PageClientImpl::canUndoRedo):
3797         (WebKit::PageClientImpl::executeUndoRedo):
3798         (WebKit::PageClientImpl::convertToDeviceSpace):
3799         (WebKit::PageClientImpl::convertToUserSpace):
3800         (WebKit::PageClientImpl::screenToRootView):
3801         (WebKit::PageClientImpl::rootViewToScreen):
3802         (WebKit::PageClientImpl::doneWithKeyEvent):
3803         (WebKit::PageClientImpl::createPopupMenuProxy):
3804         (WebKit::PageClientImpl::createContextMenuProxy):
3805         (WebKit::createColorPicker):
3806         (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
3807         (WebKit::PageClientImpl::exitAcceleratedCompositingMode):
3808         (WebKit::PageClientImpl::updateAcceleratedCompositingMode):
3809         (WebKit::PageClientImpl::pageClosed):
3810         (WebKit::PageClientImpl::preferencesDidChange):
3811         (WebKit::PageClientImpl::didChangeContentSize):
3812         (WebKit::PageClientImpl::handleDownloadRequest):
3813         (WebKit::PageClientImpl::didCommitLoadForMainFrame):
3814         (WebKit::PageClientImpl::fullScreenManagerProxyClient):
3815         (WebKit::PageClientImpl::closeFullScreenManager):
3816         (WebKit::PageClientImpl::isFullScreen):
3817         (WebKit::PageClientImpl::enterFullScreen):
3818         (WebKit::PageClientImpl::exitFullScreen):
3819         (WebKit::PageClientImpl::beganEnterFullScreen):
3820         (WebKit::PageClientImpl::beganExitFullScreen):
3821         (WebKit::PageClientImpl::doneWithTouchEvent):
3822         (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore):
3823         (WebKit::PageClientImpl::didFinishLoadingDataForCustomContentProvider):
3824         (WebKit::PageClientImpl::navigationGestureDidBegin):
3825         (WebKit::PageClientImpl::navigationGestureWillEnd):
3826         (WebKit::PageClientImpl::navigationGestureDidEnd):
3827         (WebKit::PageClientImpl::willRecordNavigationSnapshot):
3828         (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
3829         (WebKit::PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame):
3830         (WebKit::PageClientImpl::didFinishLoadForMainFrame):
3831         (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame):
3832         (WebKit::PageClientImpl::didChangeBackgroundColor):
3833         (WebKit::PageClientImpl::isPlayingAudioWillChange):
3834         (WebKit::PageClientImpl::isPlayingAudioDidChange):
3835         (WebKit::PageClientImpl::refView):
3836         (WebKit::PageClientImpl::derefView):
3837         * UIProcess/win/PageClientImpl.h: Added.
3838         * UIProcess/win/TextCheckerWin.cpp: Added.
3839         (WebKit::checkerState):
3840         (WebKit::TextChecker::state):
3841         (WebKit::TextChecker::setTestingMode):
3842         (WebKit::TextChecker::isTestingMode):
3843         (WebKit::TextChecker::isContinuousSpellCheckingAllowed):
3844         (WebKit::TextChecker::setContinuousSpellCheckingEnabled):
3845         (WebKit::TextChecker::setGrammarCheckingEnabled):
3846         (WebKit::TextChecker::continuousSpellCheckingEnabledStateChanged):
3847         (WebKit::TextChecker::grammarCheckingEnabledStateChanged):
3848         (WebKit::TextChecker::uniqueSpellDocumentTag):
3849         (WebKit::TextChecker::closeSpellDocumentWithTag):
3850         (WebKit::TextChecker::checkSpellingOfString):
3851         (WebKit::TextChecker::checkGrammarOfString):
3852         (WebKit::TextChecker::spellingUIIsShowing):
3853         (WebKit::TextChecker::toggleSpellingUIIsShowing):
3854         (WebKit::TextChecker::updateSpellingUIWithMisspelledWord):
3855         (WebKit::TextChecker::updateSpellingUIWithGrammarString):
3856         (WebKit::TextChecker::getGuessesForWord):
3857         (WebKit::TextChecker::learnWord):
3858         (WebKit::TextChecker::ignoreWord):
3859         (WebKit::TextChecker::requestCheckingOfString):
3860         (WebKit::TextChecker::checkTextOfParagraph):
3861         * UIProcess/win/WebContextMenuProxyWin.cpp: Added.
3862         (WebKit::WebContextMenuProxyWin::show):
3863         (WebKit::WebContextMenuProxyWin::showContextMenuWithItems):
3864         (WebKit::WebContextMenuProxyWin::WebContextMenuProxyWin):
3865         (WebKit::WebContextMenuProxyWin::~WebContextMenuProxyWin):
3866         * UIProcess/win/WebContextMenuProxyWin.h: Added.
3867         (WebKit::WebContextMenuProxyWin::create):
3868         * UIProcess/win/WebInspectorProxyWin.cpp: Added.
3869         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
3870         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
3871         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
3872         (WebKit::WebInspectorProxy::platformDidCloseForCrash):
3873         (WebKit::WebInspectorProxy::platformInvalidate):
3874         (WebKit::WebInspectorProxy::platformHide):
3875         (WebKit::WebInspectorProxy::platformBringToFront):
3876         (WebKit::WebInspectorProxy::platformBringInspectedPageToFront):
3877         (WebKit::WebInspectorProxy::platformIsFront):
3878         (WebKit::WebInspectorProxy::platformInspectedURLChanged):
3879         (WebKit::WebInspectorProxy::inspectorPageURL):
3880         (WebKit::WebInspectorProxy::inspectorTestPageURL):
3881         (WebKit::WebInspectorProxy::inspectorBaseURL):
3882         (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
3883         (WebKit::WebInspectorProxy::platformInspectedWindowWidth):
3884         (WebKit::WebInspectorProxy::platformAttach):
3885         (WebKit::WebInspectorProxy::platformDetach):
3886         (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight):
3887         (WebKit::WebInspectorProxy::platformSetAttachedWindowWidth):
3888         (WebKit::WebInspectorProxy::platformStartWindowDrag):
3889         (WebKit::WebInspectorProxy::platformSave):
3890         (WebKit::WebInspectorProxy::platformAppend):
3891         (WebKit::WebInspectorProxy::platformAttachAvailabilityChanged):
3892         * UIProcess/win/WebPageProxyWin.cpp: Added.
3893         (WebKit::WebPageProxy::platformInitialize):
3894         (WebKit::WebPageProxy::standardUserAgent):
3895         (WebKit::WebPageProxy::saveRecentSearches):
3896         (WebKit::WebPageProxy::loadRecentSearches):
3897         (WebKit::WebPageProxy::editorStateChanged):
3898         * UIProcess/win/WebPreferencesWin.cpp: Added.
3899         (WebKit::WebPreferences::platformInitializeStore):
3900         (WebKit::WebPreferences::platformUpdateStringValueForKey):
3901         (WebKit::WebPreferences::platformUpdateBoolValueForKey):
3902         (WebKit::WebPreferences::platformUpdateUInt32ValueForKey):
3903         (WebKit::WebPreferences::platformUpdateDoubleValueForKey):
3904         (WebKit::WebPreferences::platformUpdateFloatValueForKey):
3905         (WebKit::WebPreferences::platformGetStringUserValueForKey):
3906         (WebKit::WebPreferences::platformGetBoolUserValueForKey):
3907         (WebKit::WebPreferences::platformGetUInt32UserValueForKey):
3908         (WebKit::WebPreferences::platformGetDoubleUserValueForKey):
3909         * UIProcess/win/WebProcessPoolWin.cpp: Added.
3910         (WebKit::WebProcessPool::platformInitialize):
3911         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3912         (WebKit::WebProcessPool::platformInitializeWebProcess):
3913         (WebKit::WebProcessPool::platformInvalidateContext):
3914         (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory):
3915         (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory):
3916         (WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory):
3917         (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory):
3918         (WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory):
3919         (WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory):
3920         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory):
3921         (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory):
3922         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
3923         * UIProcess/win/WebView.cpp: Added.
3924         (WebKit::WebView::WebViewWndProc):
3925         (WebKit::WebView::wndProc):
3926         (WebKit::WebView::registerWebViewWindowClass):
3927         (WebKit::WebView::WebView):
3928         (WebKit::WebView::~WebView):
3929         (WebKit::WebView::initialize):
3930         (WebKit::WebView::setParentWindow):
3931         (WebKit::findTopLevelParentWindow):
3932         (WebKit::WebView::windowAncestryDidChange):
3933         (WebKit::WebView::onMouseEvent):
3934         (WebKit::WebView::onWheelEvent):
3935         (WebKit::WebView::onHorizontalScroll):
3936         (WebKit::WebView::onVerticalScroll):
3937         (WebKit::WebView::onKeyEvent):
3938         (WebKit::drawPageBackground):
3939         (WebKit::WebView::paint):
3940         (WebKit::WebView::onPaintEvent):
3941         (WebKit::WebView::onPrintClientEvent):
3942         (WebKit::WebView::onSizeEvent):
3943         (WebKit::WebView::onWindowPositionChangedEvent):
3944         (WebKit::WebView::onSetFocusEvent):
3945         (WebKit::WebView::onKillFocusEvent):
3946         (WebKit::WebView::onTimerEvent):
3947         (WebKit::WebView::onShowWindowEvent):
3948         (WebKit::WebView::onSetCursor):
3949         (WebKit::WebView::updateActiveState):
3950         (WebKit::WebView::updateActiveStateSoon):
3951         (WebKit::initCommonControls):
3952         (WebKit::WebView::initializeToolTipWindow):
3953         (WebKit::WebView::startTrackingMouseLeave):
3954         (WebKit::WebView::stopTrackingMouseLeave):
3955         (WebKit::WebView::shouldInitializeTrackPointHack):
3956         (WebKit::WebView::close):
3957         (WebKit::WebView::cursorToShow const):
3958         (WebKit::WebView::updateNativeCursor):
3959         (WebKit::WebView::setOverrideCursor):
3960         (WebKit::WebView::setIsInWindow):
3961         (WebKit::WebView::setIsVisible):
3962         (WebKit::WebView::isWindowActive):
3963         (WebKit::WebView::isFocused):
3964         (WebKit::WebView::isVisible):
3965         (WebKit::WebView::isInWindow):
3966         (WebKit::WebView::setScrollOffsetOnNextResize):
3967         (WebKit::WebView::setViewNeedsDisplay):
3968         (WebKit::WebView::createColorChooserProxy):
3969         (WebKit::WebView::didCommitLoadForMainFrame):
3970         (WebKit::WebView::customRepresentationZoomFactor):
3971         (WebKit::WebView::setCustomRepresentationZoomFactor):
3972         (WebKit::WebView::findStringInCustomRepresentation):
3973         (WebKit::WebView::countStringMatchesInCustomRepresentation):
3974         (WebKit::WebView::nativeWindow):
3975         (WebKit::WebView::windowReceivedMessage):
3976         * UIProcess/win/WebView.h: Added.
3977         (WebKit::WebView::create):
3978         (WebKit::WebView::window const):
3979         (WebKit::WebView::page const):
3980         (WebKit::WebView::drawingArea):
3981         (WebKit::WebView::setWasActivatedByMouseEvent):
3982
3983 2018-04-24  Fujii Hironori  <Hironori.Fujii@sony.com>
3984
3985         Implement Same-Site cookies
3986         https://bugs.webkit.org/show_bug.cgi?id=159464
3987         <rdar://problem/27196358>
3988
3989         Unreviewed build fix.
3990
3991         WinCairo WebKit2 can't compile since r230921.
3992
3993         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
3994         (WebKit::NetworkDataTaskCurl::appendCookieHeader):
3995         CookieJarCurlDatabase::cookieRequestHeaderFieldValue needs
3996         SameSiteInfo.
3997
3998 2018-04-24  Simon Fraser  <simon.fraser@apple.com>
3999
4000         Add a new "color-filter" CSS property as an experimental feature
4001         https://bugs.webkit.org/show_bug.cgi?id=184940
4002
4003         Reviewed by Jon Lee.
4004         
4005         Add the color-filter property as an experimental feature.
4006
4007         * Shared/WebPreferences.yaml:
4008
4009 2018-04-24  Saam Barati  <sbarati@apple.com>
4010
4011         Keep around a pre-warmed process when doing process swap on navigation
4012         https://bugs.webkit.org/show_bug.cgi?id=184765
4013         <rdar://problem/39685099>
4014
4015         Reviewed by Ryosuke Niwa and Brady Eidson.
4016
4017         This patch makes it so that WebProcessPool prewarms a process when process
4018         swap on navigation is turned on. When we do a process swap on navigation,
4019         we first try to grab a prewarmed process before creating a new one.
4020         
4021         We try to be smart about when to create these processes. The initial heuristic
4022         that this patch chooses is when we reach the DidFirstVisuallyNonEmptyLayout
4023         layout milestone. We're going to try to improve on this heuristic in:
4024         https://bugs.webkit.org/show_bug.cgi?id=184899
4025         
4026         This is a 40% progression on PLT with process swap on navigation turned on.
4027
4028         * UIProcess/API/Cocoa/WKProcessPool.mm:
4029         (-[WKProcessPool _prewarmedWebProcessCount]):
4030         (-[WKProcessPool _webProcessCountIgnoringPrewarmed]):
4031         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
4032         * UIProcess/ServiceWorkerProcessProxy.cpp:
4033         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
4034         * UIProcess/WebPageProxy.cpp:
4035         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
4036         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
4037         * UIProcess/WebPageProxy.h:
4038         * UIProcess/WebProcessPool.cpp:
4039         (WebKit::WebProcessPool::createNewWebProcess):
4040         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
4041         (WebKit::WebProcessPool::warmInitialProcess):
4042         (WebKit::WebProcessPool::disconnectProcess):
4043         (WebKit::WebProcessPool::createWebPage):
4044         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
4045         (WebKit::WebProcessPool::processForNavigation):
4046         * UIProcess/WebProcessPool.h: