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