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