Add facility for tracking times and results of page and resource loading
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-05-02  Keith Rollin  <krollin@apple.com>
2
3         Add facility for tracking times and results of page and resource loading
4         https://bugs.webkit.org/show_bug.cgi?id=184838
5         <rdar://problem/36548974>
6
7         Reviewed by Brent Fulgham.
8
9         Add NetworkActivityTracker. The idea behind this facility is to create
10         and destroy them around networking activity that we want to track for
11         the purpose of measuring overall network health. They can be created
12         around the loading of pages or individual resources, and can be
13         arranged in a parent/child hierarchy to indicate what pages the
14         resources are part of. The NetworkActivity tracker tracks load times
15         and results. On Cocoa, it can be integrated with CFNetwork in order to
16         associate WebKit activity with low-level networking activity.
17
18         * CMakeLists.txt:
19         * Configurations/WebKit.xcconfig:
20         * NetworkProcess/NetworkActivityTracker.cpp: Copied from Source/WebKit/NetworkProcess/NetworkLoadParameters.h.
21         (WebKit::NetworkActivityTracker::NetworkActivityTracker):
22         (WebKit::NetworkActivityTracker::~NetworkActivityTracker):
23         (WebKit::NetworkActivityTracker::setParent):
24         (WebKit::NetworkActivityTracker::start):
25         (WebKit::NetworkActivityTracker::complete):
26         * NetworkProcess/NetworkActivityTracker.h: Added.
27         (WebKit::NetworkActivityTracker::getPlatformObject):
28         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
29         (WebKit::NetworkConnectionToWebProcess::didClose):
30         (WebKit::NetworkConnectionToWebProcess::pageLoadCompleted):
31         (WebKit::networkActivityTrackingEnabled):
32         (WebKit::NetworkConnectionToWebProcess::startTrackingResourceLoad):
33         (WebKit::NetworkConnectionToWebProcess::stopTrackingResourceLoad):
34         (WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTracking):
35         (WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTrackingForPage):
36         (WebKit::NetworkConnectionToWebProcess::findRootNetworkActivity):
37         (WebKit::NetworkConnectionToWebProcess::findNetworkActivityTracker):
38         * NetworkProcess/NetworkConnectionToWebProcess.h:
39         (WebKit::NetworkConnectionToWebProcess::ResourceNetworkActivityTracker::ResourceNetworkActivityTracker):
40         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
41         * NetworkProcess/NetworkDataTask.cpp:
42         (WebKit::NetworkDataTask::create):
43         * NetworkProcess/NetworkLoadParameters.h:
44         * NetworkProcess/NetworkProcess.cpp:
45         (WebKit::NetworkProcess::initializeNetworkProcess):
46         * NetworkProcess/NetworkProcess.h:
47         (WebKit::NetworkProcess::trackNetworkActivity const):
48         * NetworkProcess/NetworkProcessCreationParameters.cpp:
49         (WebKit::NetworkProcessCreationParameters::encode const):
50         (WebKit::NetworkProcessCreationParameters::decode):
51         * NetworkProcess/NetworkProcessCreationParameters.h:
52         * NetworkProcess/NetworkResourceLoader.cpp:
53         (WebKit::NetworkResourceLoader::start):
54         (WebKit::NetworkResourceLoader::cleanup):
55         (WebKit::NetworkResourceLoader::abort):
56         (WebKit::NetworkResourceLoader::didFinishLoading):
57         (WebKit::NetworkResourceLoader::didFailLoading):
58         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
59         (WebKit::NetworkResourceLoader::continueProcessingCachedEntryAfterDidReceiveResponse):
60         * NetworkProcess/NetworkResourceLoader.h:
61         * NetworkProcess/cocoa/NetworkActivityTrackerCocoa.mm: Added.
62         (WebKit::NetworkActivityTracker::NetworkActivityTracker):
63         (WebKit::NetworkActivityTracker::~NetworkActivityTracker):
64         (WebKit::NetworkActivityTracker::setParent):
65         (WebKit::NetworkActivityTracker::start):
66         (WebKit::NetworkActivityTracker::complete):
67         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
68         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
69         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
70         * UIProcess/API/APIProcessPoolConfiguration.cpp:
71         (API::ProcessPoolConfiguration::copy):
72         * UIProcess/API/APIProcessPoolConfiguration.h:
73         * UIProcess/API/C/WKContextConfigurationRef.cpp:
74         (WKContextConfigurationTrackNetworkActivity):
75         (WKContextConfigurationSetTrackNetworkActivity):
76         * UIProcess/API/C/WKContextConfigurationRef.h:
77         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
78         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
79         (-[_WKProcessPoolConfiguration trackNetworkActivity]):
80         (-[_WKProcessPoolConfiguration setTrackNetworkActivity:]):
81         * UIProcess/WebProcessPool.cpp:
82         (WebKit::WebProcessPool::ensureNetworkProcess):
83         * WebKit.xcodeproj/project.pbxproj:
84         * WebProcess/Network/WebLoaderStrategy.cpp:
85         (WebKit::WebLoaderStrategy::pageLoadCompleted):
86         * WebProcess/Network/WebLoaderStrategy.h:
87
88 2018-05-02  Jer Noble  <jer.noble@apple.com>
89
90         Open audio/video sandbox services for minimal simulator
91         https://bugs.webkit.org/show_bug.cgi?id=185217
92         <rdar://problem/39918909>
93
94         Reviewed by Per Arne Vollan.
95
96         * WebKit.xcodeproj/project.pbxproj:
97         * WebProcess/com.apple.WebProcess.sb.in:
98
99 2018-05-02  Daniel Bates  <dabates@apple.com>
100
101         Cleanup NetworkResourceLoader::didReceiveResponse()
102         https://bugs.webkit.org/show_bug.cgi?id=185209
103
104         Reviewed by Chris Dumez.
105
106         Use early returns to make the control flow easier to read and reason about. Disregarding a
107         From-Origin violation, NetworkResourceLoader::didReceiveResponse() only returns NetworkLoadClient::ShouldContinueDidReceiveResponse::No
108         when the load is for a main resource and hence it must wait for the embedding client to allow
109         the load before continuing with it. With regards to a From-Origin violation, the network
110         process schedules to fail the load in a subsequent turn of the event loop before returning
111         NetworkLoadClient::ShouldContinueDidReceiveResponse::No. It return NetworkLoadClient::ShouldContinueDidReceiveResponse::No
112         solely to tell the NetworkLoadClient to defer assuming the load is allowed (because we will
113         fail it on the next turn of the event loop).
114
115         Additionally, remove all logging about the return value as we no longer have a need for
116         such logging.
117
118         * NetworkProcess/NetworkResourceLoader.cpp:
119         (WebKit::NetworkResourceLoader::didReceiveResponse):
120
121 2018-05-02  Alex Christensen  <achristensen@webkit.org>
122
123         Add WKWebsiteDataStorePrivate._proxyConfiguration SPI
124         https://bugs.webkit.org/show_bug.cgi?id=185179
125
126         Reviewed by Andy Estes.
127
128         * NetworkProcess/NetworkSessionCreationParameters.h:
129         (WebKit::NetworkSessionCreationParameters::encode const):
130         (WebKit::NetworkSessionCreationParameters::decode):
131         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
132         (WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):
133         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
134         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
135         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
136         * Shared/WebsiteDataStoreParameters.cpp:
137         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
138         * Shared/cf/ArgumentCodersCF.cpp:
139         (IPC::encode):
140         (IPC::decode):
141         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
142         (-[WKWebsiteDataStore _setProxyConfiguration:]):
143         (-[WKWebsiteDataStore _proxyConfiguration]):
144         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
145         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
146         (WebKit::WebsiteDataStore::parameters):
147         * UIProcess/WebsiteData/WebsiteDataStore.h:
148         (WebKit::WebsiteDataStore::setProxyConfiguration):
149         (WebKit::WebsiteDataStore::proxyConfiguration):
150
151 2018-05-02  Youenn Fablet  <youenn@apple.com>
152
153         Use NetworkLoadChecker for navigation loads
154         https://bugs.webkit.org/show_bug.cgi?id=184892
155         <rdar://problem/39652686>
156
157         Reviewed by Chris Dumez.
158
159         Compute whether a response is same origin in no-cors case.
160         This allows providing more precise filtering.
161         In case of navigate loads, set the tainting to basic which will make filtering to the minimum.
162
163         Pass the sourceOrigin for navigation loads as well.
164         Enable to restrict HTTP response access for navigation load.
165
166         Content Blockers are disabled for now in NetworkLoadChecker for navigation loads.
167         They should be reenabled as a follow-up.
168
169         Add a specific case to allow any redirection to about:// URLs.
170         While this does not conform with the spec, this keeps the existing WebKit behavior.
171
172         * NetworkProcess/NetworkLoadChecker.cpp:
173         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
174         (WebKit::NetworkLoadChecker::validateResponse):
175         (WebKit::NetworkLoadChecker::continueCheckingRequest):
176         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
177         * NetworkProcess/NetworkResourceLoader.cpp:
178         (WebKit::NetworkResourceLoader::sanitizeResponseIfPossible):
179         * WebProcess/Network/WebLoaderStrategy.cpp:
180         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
181         (WebKit::WebLoaderStrategy::isDoingLoadingSecurityChecks const):
182         We only do security checks if this runtime flag is on.
183         * WebProcess/Network/WebLoaderStrategy.h:
184
185 2018-05-02  Jer Noble  <jer.noble@apple.com>
186
187         Make EncryptedMediaAPIEnabled an experimental feature
188         https://bugs.webkit.org/show_bug.cgi?id=185212
189
190         Reviewed by Eric Carlson.
191
192         * Shared/WebPreferences.yaml:
193
194 2018-05-02  Per Arne Vollan  <pvollan@apple.com>
195
196         Adjust sandbox profile in simulator mode.
197         https://bugs.webkit.org/show_bug.cgi?id=185172
198         <rdar://problem/39876860>
199
200         Reviewed by Brent Fulgham.
201
202         Fix some sandbox violations.
203
204         * WebProcess/com.apple.WebProcess.sb.in:
205
206 2018-05-02  Brian Burg  <bburg@apple.com>
207
208         Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected
209         https://bugs.webkit.org/show_bug.cgi?id=184861
210         <rdar://problem/39153768>
211
212         Reviewed by Ryosuke Niwa.
213
214         We need to track how many frontends are attached to the web page (both local and remote).
215         InspectorController propagates this out to WebKit via InspectorClient. This is then
216         kept in UIProcess as a member of WebPageProxy. When making a decision whether to use a
217         new process for a navigation, return early with "no" if any frontends are open for the
218         page being navigated.
219
220         * UIProcess/WebPageProxy.h:
221         (WebKit::WebPageProxy::didChangeInspectorFrontendCount):
222         (WebKit::WebPageProxy::inspectorFrontendCount const):
223         * UIProcess/WebPageProxy.messages.in:
224         * UIProcess/WebProcessPool.cpp:
225         (WebKit::WebProcessPool::processForNavigation):
226         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
227         (WebKit::WebInspectorClient::frontendCountChanged):
228         * WebProcess/WebCoreSupport/WebInspectorClient.h:
229         * WebProcess/WebPage/WebPage.cpp:
230         (WebKit::WebPage::inspectorFrontendCountChanged):
231         * WebProcess/WebPage/WebPage.h:
232
233 2018-05-02  Jer Noble  <jer.noble@apple.com>
234
235         Adopt -destinationWindowToExitFullScreenForWindow:
236         https://bugs.webkit.org/show_bug.cgi?id=185204
237         <rdar://problem/22486621>
238
239         Reviewed by Eric Carlson.
240
241         * UIProcess/mac/WKFullScreenWindowController.mm:
242         (-[WKFullScreenWindowController destinationWindowToExitFullScreenForWindow:]):
243
244 2018-05-02  Per Arne Vollan  <pvollan@apple.com>
245
246         Disable Media capture rules in sandbox for simulator.
247         https://bugs.webkit.org/show_bug.cgi?id=185206
248         <rdar://problem/39910015>
249
250         Reviewed by Eric Carlson.
251
252         These rules are not relevant in this case.
253
254         * WebProcess/com.apple.WebProcess.sb.in:
255
256 2018-05-02  Eric Carlson  <eric.carlson@apple.com>
257
258         [iOS] Provide audio route information when invoking AirPlay picker
259         https://bugs.webkit.org/show_bug.cgi?id=185199
260         <rdar://problem/39853103>
261
262         Reviewed by Jer Noble.
263
264         * Scripts/webkit/messages.py:
265         * UIProcess/PageClient.h:
266         * UIProcess/WebPageProxy.h:
267         * UIProcess/WebPageProxy.messages.in:
268         * UIProcess/ios/PageClientImplIOS.h:
269         * UIProcess/ios/PageClientImplIOS.mm:
270         (WebKit::PageClientImpl::showPlaybackTargetPicker):  Pass route sharing policy and routing context UID.
271
272         * UIProcess/ios/WKContentViewInteraction.h:
273         * UIProcess/ios/WKContentViewInteraction.mm:
274         (-[WKContentView _showPlaybackTargetPicker:fromRect:routeSharingPolicy:routingContextUID:]): Take same.
275         (-[WKContentView _showPlaybackTargetPicker:fromRect:]): Deleted.
276
277         * UIProcess/ios/WebPageProxyIOS.mm:
278         (WebKit::WebPageProxy::showPlaybackTargetPicker): Pass route sharing policy and routing context UID.
279
280         * UIProcess/ios/forms/WKAirPlayRoutePicker.h:
281         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
282         (-[WKAirPlayRoutePicker showFromView:routeSharingPolicy:routingContextUID:]): Take same.
283         (-[WKAirPlayRoutePicker showFromView:]): Deleted.
284
285         * WebProcess/WebCoreSupport/WebChromeClient.h:
286         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
287         (WebKit::WebChromeClient::showPlaybackTargetPicker):
288
289 2018-05-02  Jer Noble  <jer.noble@apple.com>
290
291         Get the WebKit.framework bundle by asking for WKWebView
292         https://bugs.webkit.org/show_bug.cgi?id=185175
293
294         Reviewed by Tim Horton.
295
296         * NetworkProcess/mac/NetworkProcessMac.mm:
297         (WebKit::NetworkProcess::initializeSandbox):
298         * Shared/mac/ChildProcessMac.mm:
299         (WebKit::ChildProcess::initializeSandbox):
300         * StorageProcess/mac/StorageProcessMac.mm:
301         (WebKit::StorageProcess::initializeSandbox):
302
303 2018-05-02  Youenn Fablet  <youenn@apple.com>
304
305         Cannot gather srflx or relay ICE candidates on IPv6 network (ICE agent hangs?)
306         https://bugs.webkit.org/show_bug.cgi?id=181009
307         <rdar://problem/36144555>
308
309         Reviewed by Eric Carlson.
310
311         On iOS/IPv6 networks, STUN servers name resolution returns a zero IPv6 IP address.
312         No error is raised which leads to sending STUN requests with that IP address.
313         Once the request times out, the ICE candidate gathering finishes with host candidates only.
314
315         This patch makes WebRTC DNS resolver to send only IPv4 resolved addresses.
316         STUN is used for NAT traversal which is for IPv4 addresses.
317         Not sending IPv6 addresses allows terminating ICE candidate gathering sooner.
318
319         Manually tested on iOS with IPv4/IPv6 and IPv6 networks.
320
321         * NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp:
322         (WebKit::resolvedName):
323
324 2018-05-02  Youenn Fablet  <youenn@apple.com>
325
326         CacheStorage::Engine should keep a list of initialization callback
327         https://bugs.webkit.org/show_bug.cgi?id=185184
328         <rdar://problem/38875651>
329
330         Reviewed by Antti Koivisto.
331
332         Keep each initialize callback in a Vector so as to compute the salt only once.
333         Call all callbacks then in a loop.
334
335         * NetworkProcess/cache/CacheStorageEngine.cpp:
336         (WebKit::CacheStorage::Engine::~Engine):
337         (WebKit::CacheStorage::Engine::initialize):
338         * NetworkProcess/cache/CacheStorageEngine.h:
339
340 2018-05-02  Jer Noble  <jer.noble@apple.com>
341
342         Pipe volume through PlaybackSessionManager/Proxy.
343         https://bugs.webkit.org/show_bug.cgi?id=185182
344
345         Reviewed by Eric Carlson.
346
347         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
348         * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
349         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
350         (WebKit::PlaybackSessionModelContext::setVolume):
351         (WebKit::PlaybackSessionModelContext::volumeChanged):
352         (WebKit::PlaybackSessionManagerProxy::volumeChanged):
353         (WebKit::PlaybackSessionManagerProxy::setVolume):
354         * WebProcess/cocoa/PlaybackSessionManager.h:
355         * WebProcess/cocoa/PlaybackSessionManager.messages.in:
356         * WebProcess/cocoa/PlaybackSessionManager.mm:
357         (WebKit::PlaybackSessionInterfaceContext::volumeChanged):
358         (WebKit::PlaybackSessionManager::volumeChanged):
359         (WebKit::PlaybackSessionManager::setVolume):
360
361 2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
362
363         Use default std::optional if it is provided
364         https://bugs.webkit.org/show_bug.cgi?id=185159
365
366         Reviewed by JF Bastien.
367
368         * Shared/SandboxExtension.h:
369         (WebKit::SandboxExtension::Handle::decode):
370         * Shared/TouchBarMenuItemData.cpp:
371         (WebKit::TouchBarMenuItemData::decode):
372
373 2018-05-01  Jer Noble  <jer.noble@apple.com>
374
375         Production build error in Migrate Header phase when WK_ALTERNATE_FRAMEWORKS_DIR is set to non-empty value
376         https://bugs.webkit.org/show_bug.cgi?id=185171
377
378         Reviewed by Timothy Hatcher.
379
380         * Configurations/BaseTarget.xcconfig:
381
382 2018-05-01  Per Arne Vollan  <pvollan@apple.com>
383
384         Use correct runloop type in the WebContent process.
385         https://bugs.webkit.org/show_bug.cgi?id=185140
386
387         Reviewed by Brent Fulgham.
388
389         Use WK_MACOS_* machinery to determine runloop type for the WebContent process.
390
391         * Configurations/WebContentService.xcconfig:
392
393 2018-05-01  Oleksandr Skachkov  <gskachkov@gmail.com>
394
395         WebAssembly: add support for stream APIs - JavaScript API
396         https://bugs.webkit.org/show_bug.cgi?id=183442
397
398         Reviewed by Yusuke Suzuki and JF Bastien.
399
400         Add WEBASSEMBLY_STREAMING_API feature flag
401
402         * Configurations/FeatureDefines.xcconfig:
403
404 2018-04-30  Per Arne Vollan  <pvollan@apple.com>
405
406         Use correct runloop type in the WebContent process.
407         https://bugs.webkit.org/show_bug.cgi?id=185140
408         <rdar://problem/39585037>
409
410         Reviewed by Brent Fulgham.
411
412         The macOS target version should be used to determine the runloop type.
413
414         * Configurations/WebContentService.xcconfig:
415
416 2018-04-30  Michael Saboff  <msaboff@apple.com>
417
418         Eliminate WebProcessShim.dylib
419         https://bugs.webkit.org/show_bug.cgi?id=185147
420
421         Reviewed by Ryosuke Niwa.
422
423         * Configurations/WebContentService.xcconfig:
424         * Configurations/WebProcessShim.xcconfig: Removed.
425         * WebKit.xcodeproj/project.pbxproj:
426
427 2018-04-30  Michael Saboff  <msaboff@apple.com>
428
429         Remove unused mac/CookieStorageShimLibrary
430         https://bugs.webkit.org/show_bug.cgi?id=185146
431
432         Reviewed by Alex Christensen.
433
434         * Shared/mac/CookieStorageShimLibrary.cpp: Removed.
435         * Shared/mac/CookieStorageShimLibrary.h: Removed.
436         * WebKit.xcodeproj/project.pbxproj:
437
438 2018-04-30  Alex Christensen  <achristensen@webkit.org>
439
440         Add WKUIDelegatePrivate equivalent of WKPageContextMenuClient getContextMenuFromProposedMenuAsync
441         https://bugs.webkit.org/show_bug.cgi?id=180955
442
443         Reviewed by Andy Estes.
444
445         * UIProcess/API/APIContextMenuClient.h:
446         (API::ContextMenuClient::menuFromProposedMenu):
447         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
448         * UIProcess/Cocoa/UIDelegate.h:
449         * UIProcess/Cocoa/UIDelegate.mm:
450         (WebKit::UIDelegate::setDelegate):
451         (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
452         * UIProcess/mac/WebContextMenuProxyMac.mm:
453         (WebKit::WebContextMenuProxyMac::showContextMenuWithItems):
454
455 2018-04-30  JF Bastien  <jfbastien@apple.com>
456
457         Use some C++17 features
458         https://bugs.webkit.org/show_bug.cgi?id=185135
459
460         Reviewed by Alex Christensen.
461
462         As discussed here [0] let's move WebKit to a subset of C++17. We
463         now require GCC 6 [1] which means that, according to [2] we can
464         use the following C++17 language features (I removed some
465         uninteresting ones):
466
467          - New auto rules for direct-list-initialization
468          - static_assert with no message
469          - typename in a template template parameter
470          - Nested namespace definition
471          - Attributes for namespaces and enumerators
472          - u8 character literals
473          - Allow constant evaluation for all non-type template arguments
474          - Fold Expressions
475          - Unary fold expressions and empty parameter packs
476          - __has_include in preprocessor conditional
477          - Differing begin and end types in range-based for
478          - Improving std::pair and std::tuple
479
480         Consult the Tony Tables [3] to see before / after examples.
481
482         Of course we can use any library feature if we're willing to
483         import them to WTF (and they don't require language support).
484
485
486           [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html
487           [1]: https://trac.webkit.org/changeset/231152/webkit
488           [2]: https://en.cppreference.com/w/cpp/compiler_support
489           [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md
490
491         * Configurations/Base.xcconfig:
492         * DerivedSources.make:
493         * PlatformMac.cmake:
494
495 2018-04-30  Wenson Hsieh  <wenson_hsieh@apple.com>
496
497         [Extra zoom mode] Respect the existing shrink-to-fit attribute instead of using min-device-width
498         https://bugs.webkit.org/show_bug.cgi?id=185132
499         <rdar://problem/39834562>
500
501         Reviewed by Tim Horton.
502
503         Remove the experimental feature for `min-device-width`.
504
505         * Shared/WebPreferences.yaml:
506
507 2018-04-30  Keith Rollin  <krollin@apple.com>
508
509         Include breadcrumb for tracking resource loading into CFNetwork
510         https://bugs.webkit.org/show_bug.cgi?id=184837
511         rdar://problem/39575411
512
513         Reviewed by Brent Fulgham.
514
515         When starting the network-based loading of a resource, log the
516         description provided by NetworkDataTask. On Cocoa, this is implemented
517         to return the description property in NSURLSessionTask. This
518         information better allows us to track a resource load through the
519         WebContent process, the Networking process, and the Cocoa networking
520         layers.
521
522         * NetworkProcess/NetworkDataTask.cpp:
523         (WebKit::NetworkDataTask::description const):
524         * NetworkProcess/NetworkDataTask.h:
525         * NetworkProcess/NetworkLoad.cpp:
526         (WebKit::NetworkLoad::description const):
527         * NetworkProcess/NetworkLoad.h:
528         * NetworkProcess/NetworkResourceLoader.cpp:
529         (WebKit::NetworkResourceLoader::startNetworkLoad):
530         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
531         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
532         (WebKit::NetworkDataTaskCocoa::description const):
533
534 2018-04-30  Andy Estes  <aestes@apple.com>
535
536         [iOS] Try to unlock PDF documents before printing them
537         https://bugs.webkit.org/show_bug.cgi?id=185084
538         <rdar://problem/39356622>
539
540         Reviewed by Dan Bernstein.
541
542         * UIProcess/ios/WKPDFView.mm:
543         (-[WKPDFView pdfHostViewController:documentDidUnlockWithPassword:]):
544
545         Stored the password that successfully unlocked the current PDF document.
546
547         (-[WKPDFView _wk_printedDocument]):
548
549         Used the stored password to unlock the CGPDFDocument we create for printing.
550
551 2018-04-28  Andy Estes  <aestes@apple.com>
552
553         [iOS] Present an action sheet when long-pressing on PDF links
554         https://bugs.webkit.org/show_bug.cgi?id=185093
555         <rdar://problem/39356651>
556
557         Reviewed by Dan Bernstein.
558
559         * UIProcess/ios/WKPDFView.mm:
560         (-[WKPDFView dealloc]):
561
562         Called -[WKActionSheetAssistant cleanupSheet].
563
564         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
565
566         Created a WKActionSheetAssistant with the host view as the assistant view and
567         ourselves as the delegate.
568
569         (-[WKPDFView _URLWithPageIndex:]):
570
571         Added. Creates a URL to the current page with a page number fragment appended.
572
573         (-[WKPDFView _goToURL:atLocation:]):
574
575         Added. Navigates to a URL with a synthetic mouse click at a location in host view
576         coordinates.
577
578         (-[WKPDFView pdfHostViewController:goToURL:]):
579         (-[WKPDFView pdfHostViewController:goToPageIndex:withViewFrustum:]):
580
581         Called -_goToURL:atLocation:. Used -_URLWithPageIndex: to construct an NSURL from
582         a page index.
583
584         (-[WKPDFView _showActionSheetForURL:atLocation:]):
585
586         Added. Populates _positionInformation with a URL and location and calls
587         -[WKActionSheetAssistant showLinkSheet].
588
589         (-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:]):
590         (-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:]):
591
592         Called -_showActionSheetForURL:atLocation:. Used -_URLWithPageIndex: to construct
593         an NSURL from a page index.
594
595         (-[WKPDFView positionInformationForActionSheetAssistant:]):
596
597         Returned _positionInformation.
598
599         (-[WKPDFView actionSheetAssistant:performAction:]):
600
601         Populated the pasteboard with plain text and URL representations of
602         _positionInformation.url.
603
604         (-[WKPDFView actionSheetAssistant:openElementAtLocation:]):
605
606         Called -_goToURL:atLocation.
607
608         (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]):
609
610         Created a UIWKSelectionAssistant and called -showShareSheetFor:fromRect:.
611
612         (-[WKPDFView actionSheetAssistant:shouldIncludeAppLinkActionsForElement:]):
613
614         Returned API::UIClient::shouldIncludeAppLinkActionsForElement().
615
616         (-[WKPDFView actionSheetAssistant:decideActionsForElement:defaultActions:]):
617
618         Returned API::UIClient::actionsForElement()l
619
620 2018-04-28  Andy Estes  <aestes@apple.com>
621
622         [iOS] Allow com.apple.WebKit.Networking to look up com.apple.wifi.manager
623         https://bugs.webkit.org/show_bug.cgi?id=185114
624         <rdar://problem/39808763>
625
626         Reviewed by Wenson Hsieh.
627
628         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
629
630 2018-04-28  Brent Fulgham  <bfulgham@apple.com>
631
632         Revise sandboxes to allow additional IOKit property access
633         https://bugs.webkit.org/show_bug.cgi?id=185095
634         <rdar://problem/39809455>
635
636         Reviewed by Eric Carlson.
637
638         Update the WebContent and Plugin processes to allow additional IOKit property access.
639
640         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
641         * WebProcess/com.apple.WebProcess.sb.in:
642
643 2018-04-28  Carlos Garcia Campos  <cgarcia@igalia.com>
644
645         [GTK] WebProcess from WebKitGtk+ 2.19.92 SIGSEVs in WebCore::TextureMapperGL::~TextureMapperGL
646         https://bugs.webkit.org/show_bug.cgi?id=184040
647
648         Reviewed by Michael Catanzaro.
649
650         This can happen when using single shared process model or when the process limit is reached in multiple process
651         model. In this case, all pages in the same web process with accelerated compositing enabled share the same
652         compositing thread. Every page sets its GL context as current when rendering a frame, but not when invalidating
653         the threaded compositor when the page is closed. So, if a hidden tab is closed, the threaded compositor is
654         invalidated and the GL resources of the current context (the visible page) are destroyed. This is also causing
655         the blank pages issue when closing a tab related to another one, the current one stops rendering anything because
656         its GL context has been released. We should make the threaded compositor context current when invalidating it.
657
658         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
659         (WebKit::ThreadedCompositor::invalidate):
660
661 2018-04-27  Timothy Hatcher  <timothy@apple.com>
662
663         REGRESSION: Touch events fail to dispatch to the page in all cases.
664
665         https://bugs.webkit.org/show_bug.cgi?id=185097
666         rdar://problem/39731995
667
668         Reviewed by Tim Horton.
669
670         * UIProcess/ios/WKContentViewInteraction.mm:
671         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
672         Consult internal gesture recognizers, otherwise NO might get returned.
673
674 2018-04-26  Ryosuke Niwa  <rniwa@webkit.org>
675
676         PSON: Triggering a navigation to an invalid URL creates a new WebContent process
677         https://bugs.webkit.org/show_bug.cgi?id=185066
678
679         Reviewed by Youenn Fablet.
680
681         Don't create a new WebContent process when the target URL is invalid as well as when the source URL is invalid.
682
683         * UIProcess/WebProcessPool.cpp:
684         (WebKit::WebProcessPool::processForNavigationInternal):
685
686 2018-04-27  Youenn Fablet  <youenn@apple.com>
687
688         Use NetworkLoadChecker for XHR/fetch loads
689         https://bugs.webkit.org/show_bug.cgi?id=184741
690
691         Reviewed by Chris Dumez.
692
693         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
694         (WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
695         Pass the preflight error as completion error if any.
696         * NetworkProcess/NetworkLoad.cpp:
697         (WebKit::NetworkLoad::willPerformHTTPRedirection):
698         Set response source to Network so that checks relying on that are correct.
699         * NetworkProcess/NetworkLoadChecker.cpp:
700         (WebKit::NetworkLoadChecker::validateResponse):
701         Adding Oppaqueredirect tainting.
702         (NetworkLoadChecker::doesNotNeedCORSCheck):
703         Adding a check to only activate CORS checks for CORS enabled schemes.
704         Non CORS enabled schemes loads should have failed in WebProcess already.
705         (WebKit::NetworkLoadChecker::checkCORSRedirectedRequest):
706         Remove Authorization header as done by SubresourceLoader.
707         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
708         If error is cancellation, we still want to call the completion handler.
709         * NetworkProcess/NetworkResourceLoader.cpp:
710         Activate network load checker for all types of loads.
711         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
712         Handle manual redirection by directly calling didReceiveResponse.
713
714 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
715
716         Add an experimental feature flag for viewport "min-device-width"
717         https://bugs.webkit.org/show_bug.cgi?id=185050
718         <rdar://problem/39624038>
719
720         Reviewed by Tim Horton.
721
722         Add MinDeviceWidthEnabled as a new experimental feature, on by default in extra zoom mode and off elsewhere.
723
724         * Shared/WebPreferences.yaml:
725         * Shared/WebPreferencesDefaultValues.h:
726
727 2018-04-27  Daniel Bates  <dabates@apple.com>
728
729         UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance() is applicable to both Mac and iOS
730         https://bugs.webkit.org/show_bug.cgi?id=185079
731         <rdar://problem/39794960>
732
733         I inadvertently forgot to move the UIDelegate field webViewDidResignInputElementStrongPasswordAppearanceWithUserInfo
734         outside the PLATFORM(MAC)-guard.
735
736         * UIProcess/Cocoa/UIDelegate.h:
737
738 2018-04-27  Daniel Bates  <dabates@apple.com>
739
740         UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance() is applicable to both Mac and iOS
741         https://bugs.webkit.org/show_bug.cgi?id=185079
742         <rdar://problem/39794960>
743
744         Reviewed by Andy Estes.
745
746         * UIProcess/Cocoa/UIDelegate.h:
747         * UIProcess/Cocoa/UIDelegate.mm:
748         (WebKit::UIDelegate::setDelegate):
749         (WebKit::UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance):
750
751 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
752
753         Rename minimumLayoutSize to viewLayoutSize
754         https://bugs.webkit.org/show_bug.cgi?id=185050
755         <rdar://problem/39624038>
756
757         Reviewed by Tim Horton.
758
759         Renames minimumLayoutSize to viewLayoutSize, since the minimum layout size in ViewportConfiguration is now
760         different from the minimum layout size that is currently pushed down from the UI process (e.g. WKWebView SPI) in
761         the case where `min-device-width` is used to override the minimum layout size.
762
763         * Shared/WebPageCreationParameters.cpp:
764         (WebKit::WebPageCreationParameters::encode const):
765         (WebKit::WebPageCreationParameters::decode):
766         * Shared/WebPageCreationParameters.h:
767         * UIProcess/API/Cocoa/WKWebView.mm:
768         (-[WKWebView _processDidExit]):
769         (-[WKWebView activeViewLayoutSize:]):
770         (-[WKWebView _dispatchSetViewLayoutSize:]):
771         (-[WKWebView _frameOrBoundsChanged]):
772         (-[WKWebView _minimumLayoutSizeOverride]):
773         (-[WKWebView _setViewLayoutSizeOverride:]):
774         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
775         (-[WKWebView _endAnimatedResize]):
776         (-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:maximumUnobscuredSizeOverride:]):
777         (-[WKWebView _clearOverrideLayoutParameters]):
778         (-[WKWebView _minimumLayoutWidth]):
779         (-[WKWebView _setMinimumLayoutWidth:]):
780         (-[WKWebView activeMinimumLayoutSize:]): Deleted.
781         (-[WKWebView _dispatchSetMinimumLayoutSize:]): Deleted.
782         (-[WKWebView _setMinimumLayoutSizeOverride:]): Deleted.
783         (-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:minimumLayoutSizeForMinimalUI:maximumUnobscuredSizeOverride:]): Deleted.
784
785         Remove unused SPI that has been deprecated since iOS 9, has a simple drop-in replacement, and no longer has any
786         internal clients.
787
788         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
789         * UIProcess/Cocoa/WebViewImpl.mm:
790         (WebKit::WebViewImpl::setMinimumSizeForAutoLayout):
791         (WebKit::WebViewImpl::minimumSizeForAutoLayout const):
792         (WebKit::WebViewImpl::setIntrinsicContentSize):
793         * UIProcess/DrawingAreaProxy.h:
794         (WebKit::DrawingAreaProxy::viewLayoutSizeDidChange):
795         (WebKit::DrawingAreaProxy::minimumLayoutSizeDidChange): Deleted.
796         * UIProcess/WebPageProxy.cpp:
797         (WebKit::WebPageProxy::creationParameters):
798         (WebKit::WebPageProxy::setViewLayoutSize):
799         (WebKit::WebPageProxy::setMinimumLayoutSize): Deleted.
800         * UIProcess/WebPageProxy.h:
801         (WebKit::WebPageProxy::viewLayoutSize const):
802         (WebKit::WebPageProxy::minimumLayoutSize const): Deleted.
803         * UIProcess/ios/WebPageProxyIOS.mm:
804         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
805         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize):
806         (WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize): Deleted.
807         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
808         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
809         (WebKit::TiledCoreAnimationDrawingAreaProxy::viewLayoutSizeDidChange):
810         (WebKit::TiledCoreAnimationDrawingAreaProxy::didUpdateGeometry):
811         (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange):
812         (WebKit::TiledCoreAnimationDrawingAreaProxy::willSendUpdateGeometry):
813         (WebKit::TiledCoreAnimationDrawingAreaProxy::minimumLayoutSizeDidChange): Deleted.
814         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
815         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
816         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
817         (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
818         * WebProcess/WebPage/WebPage.cpp:
819         (WebKit::m_credentialsMessenger):
820         (WebKit::WebPage::setViewLayoutSize):
821         (WebKit::WebPage::setMinimumLayoutSize): Deleted.
822         * WebProcess/WebPage/WebPage.h:
823         (WebKit::WebPage::viewLayoutSize const):
824         (WebKit::WebPage::minimumLayoutSize const): Deleted.
825         * WebProcess/WebPage/WebPage.messages.in:
826         * WebProcess/WebPage/ios/WebPageIOS.mm:
827         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
828         (WebKit::WebPage::dynamicViewportSizeUpdate):
829         (WebKit::WebPage::setViewportConfigurationMinimumLayoutSize): Deleted.
830         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
831         (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded):
832         (WebKit::TiledCoreAnimationDrawingArea::updateGeometry):
833
834 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
835
836         [Extra zoom mode] Add a mechanism to override default viewport behaviors in extra zoom mode
837         https://bugs.webkit.org/show_bug.cgi?id=185050
838         <rdar://problem/39624038>
839
840         Reviewed by Tim Horton.
841
842         Remove the forceHorizontalViewportShrinkToFit and minimumAllowedLayoutWidth SPI hooks from WebKit, and
843         additionally remove all logic for plumbing viewSize to WebCore. See WebCore/ChangeLog for more information.
844
845         * Shared/VisibleContentRectUpdateInfo.cpp:
846         (WebKit::VisibleContentRectUpdateInfo::encode const):
847         (WebKit::VisibleContentRectUpdateInfo::decode):
848         (WebKit::operator<<):
849         * Shared/VisibleContentRectUpdateInfo.h:
850         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
851         (WebKit::VisibleContentRectUpdateInfo::allowShrinkToFit const):
852         (WebKit::operator==):
853         (WebKit::VisibleContentRectUpdateInfo::forceHorizontalShrinkToFit const): Deleted.
854         * UIProcess/API/Cocoa/WKWebView.mm:
855         (-[WKWebView _initializeWithConfiguration:]):
856         (-[WKWebView activeMinimumLayoutSize:]):
857         (-[WKWebView _dispatchSetMinimumLayoutSize:]):
858         (-[WKWebView _frameOrBoundsChanged]):
859         (-[WKWebView _setMinimumLayoutSizeOverride:]):
860         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
861         (-[WKWebView _endAnimatedResize]):
862         (-[WKWebView _minimumAllowedLayoutWidth]): Deleted.
863         (-[WKWebView _setMinimumAllowedLayoutWidth:]): Deleted.
864         (-[WKWebView activeMinimumLayoutSizes:]): Deleted.
865         (-[WKWebView _dispatchSetMinimumLayoutSize:viewSize:]): Deleted.
866         (-[WKWebView _setForceHorizontalViewportShrinkToFit:]): Deleted.
867         (-[WKWebView _forceHorizontalViewportShrinkToFit]): Deleted.
868         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
869         * UIProcess/WebPageProxy.cpp:
870         (WebKit::WebPageProxy::creationParameters):
871         * UIProcess/WebPageProxy.h:
872         * UIProcess/ios/WKContentView.mm:
873         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
874         * UIProcess/ios/WebPageProxyIOS.mm:
875         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
876         (WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize):
877         * WebProcess/WebPage/WebPage.cpp:
878         (WebKit::m_credentialsMessenger):
879         * WebProcess/WebPage/WebPage.h:
880         * WebProcess/WebPage/WebPage.messages.in:
881         * WebProcess/WebPage/ios/WebPageIOS.mm:
882         (WebKit::WebPage::setViewportConfigurationMinimumLayoutSize):
883         (WebKit::WebPage::dynamicViewportSizeUpdate):
884         (WebKit::WebPage::updateVisibleContentRects):
885
886 2018-04-27  Carlos Garcia Campos  <cgarcia@igalia.com>
887
888         REGRESSION(r230812): [WPE][GTK] WebKitWebViewSessionState.cpp throws away encoded BackForwardList identifier
889         https://bugs.webkit.org/show_bug.cgi?id=184823
890
891         Reviewed by Michael Catanzaro.
892
893         Bump session sate format version to 2 and stop encoding the backfoward list item identifier, since it's always
894         regenerated.
895
896         * UIProcess/API/glib/WebKitWebViewSessionState.cpp:
897         (encodeBackForwardListItemState): Always encode version 2.
898         (encodeBackForwardListState): Ditto.
899         (encodeSessionState): Ditto.
900         (decodeBackForwardListItemStateV1): Decode list item state for version 1.
901         (decodeBackForwardListItemState): Receive the version and call decodeBackForwardListItemStateV1() if it's 1 or
902         use the version 2 otherwise.
903         (decodeSessionState): Load data for known formats and use the one that worked to decode it.
904
905 2018-04-26  Megan Gardner  <megan_gardner@apple.com>
906
907         Add timeout for ensurePositionInformationIsUpToDate
908         https://bugs.webkit.org/show_bug.cgi?id=184567
909
910         Reviewed by Wenson Hsieh.
911         
912         We are having long hang times for WebKit, and this is one of the culprits.
913         If we do not get an answer for positionInformation in a reasonable amount of time, we should timeout,
914         so as to not hang the UI.
915
916         * UIProcess/ios/WKContentViewInteraction.mm:
917         (-[WKContentView ensurePositionInformationIsUpToDate:]):
918
919 2018-04-26  Andy Estes  <aestes@apple.com>
920
921         Try again to fix the iOS build after r231063.
922
923         * Configurations/Base.xcconfig:
924
925 2018-04-26  Jer Noble  <jer.noble@apple.com>
926
927         WK_COCOA_TOUCH the WK_ACCESSIBILITY_LDFLAGS
928         https://bugs.webkit.org/show_bug.cgi?id=185007
929         <rdar://problem/39735943>
930
931         Reviewed by Timothy Hatcher.
932
933         * Configurations/WebKit.xcconfig:
934
935 2018-04-26  Jer Noble  <jer.noble@apple.com>
936
937         Unreviewed build fix; fix iOS TAPI build step after r231063.
938
939         * Configurations/WebKit.xcconfig:
940
941 2018-04-26  Jer Noble  <jer.noble@apple.com>
942
943         WK_COCOA_TOUCH all the things.
944         https://bugs.webkit.org/show_bug.cgi?id=185006
945
946         Reviewed by Tim Horton.
947
948         * Configurations/BaseTarget.xcconfig:
949         * Configurations/WebKit.xcconfig:
950
951 2018-04-26  Daniel Bates  <dabates@apple.com>
952
953         Remove WebCore::-qualifier in NetworkLoadChecker.cpp
954         https://bugs.webkit.org/show_bug.cgi?id=185037
955
956         Reviewed by Youenn Fablet.
957
958         It is unncesssary to qualify WebCore types in NetworkLoadChecker.cpp as it has a
959         "using namespace WebCore" directive.
960
961         * NetworkProcess/NetworkLoadChecker.cpp:
962         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
963         (WebKit::NetworkLoadChecker::checkRedirection):
964         (WebKit::NetworkLoadChecker::validateResponse):
965         (WebKit::NetworkLoadChecker::continueCheckingRequest): Removed extra space character and unnecessary
966         parentheses from the right-hand side of the assignment to m_storedCredentialsPolicy.
967         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
968
969 2018-04-26  Daniel Bates  <dabates@apple.com>
970
971         Rename NetworkLoadChecker::returnError() to NetworkLoadChecker::accessControlErrorForValidationHandler()
972         https://bugs.webkit.org/show_bug.cgi?id=185035
973
974         Reviewed by Youenn Fablet.
975
976         Substitute NetworkLoadChecker::accessControlErrorForValidationHandler() for NetworkLoadChecker::returnError()
977         to better describe that it is a convenience function that returns a wrapped ResourceError object,
978         that represents an access control error, suitable to be passed directly to a validation handler.
979
980         * NetworkProcess/NetworkLoadChecker.cpp:
981         (WebKit::NetworkLoadChecker::checkRedirection): Update as needed for renaming.
982         (WebKit::NetworkLoadChecker::accessControlErrorForValidationHandler): Use auto -> syntax to avoid the need to
983         class-qualify the return type. Also renamed parameter from error to message as it represents the message/description
984         for the access control error.
985         (WebKit::NetworkLoadChecker::checkRequest): Update as needed for renaming. Also substitute "message" for "error"
986         to match the argument of accessControlErrorForValidationHandler() with the same name.
987         (WebKit::NetworkLoadChecker::continueCheckingRequest): Update as needed for renaming.
988         (WebKit::NetworkLoadChecker::returnError): Deleted; renamed to accessControlErrorForValidationHandler().
989         * NetworkProcess/NetworkLoadChecker.h:
990
991 2018-04-26  Jiewen Tan  <jiewen_tan@apple.com>
992
993         Remove access to keychain from the WebContent process
994         https://bugs.webkit.org/show_bug.cgi?id=184428
995         <rdar://problem/13150903>
996
997         Part 3.
998
999         Tighten WebContent Process' sandbox profile to all Security.framework services.
1000
1001         Reviewed by Brent Fulgham.
1002
1003         * WebProcess/com.apple.WebProcess.sb.in:
1004
1005 2018-04-26  Youenn Fablet  <youenn@apple.com>
1006
1007         Make cross origin redirection error messages consistent between SubresourceLoader and NetworkLoadChecker
1008         https://bugs.webkit.org/show_bug.cgi?id=185023
1009
1010         Reviewed by Chris Dumez.
1011
1012         Align NetworkLoadChecker with what SubresourceLoader is doing so that we can keep WK1 and WK2 error messages as consistent as possible.
1013
1014         * NetworkProcess/NetworkLoadChecker.cpp:
1015         (WebKit::NetworkLoadChecker::checkRedirection):
1016         (WebKit::NetworkLoadChecker::validateResponse):
1017
1018 2018-04-25  Megan Gardner  <megan_gardner@apple.com>
1019
1020         Activate selection when interacting with editable content
1021         https://bugs.webkit.org/show_bug.cgi?id=185017
1022
1023         Reviewed by Tim Horton.
1024         
1025         Fixes a regression from r231016 where selection now does not work when interacting with
1026         editable content. When we go into editable content, we should turn on the assistant.
1027         This fulfills the requirement of user interaction as well, so any javascript selections
1028         after this point should be valid.
1029
1030         * UIProcess/ios/WKContentViewInteraction.mm:
1031         (-[WKContentView _startAssistingKeyboard]):
1032         (-[WKContentView _stopAssistingKeyboard]):
1033
1034 2018-04-26  Per Arne Vollan  <pvollan@apple.com>
1035
1036         Disable content filtering in minimal simulator mode
1037         https://bugs.webkit.org/show_bug.cgi?id=185027
1038         <rdar://problem/39736091>
1039
1040         Reviewed by Jer Noble.
1041
1042         * Configurations/FeatureDefines.xcconfig:
1043
1044 2018-04-26  Brady Eidson  <beidson@apple.com>
1045
1046         Add a setting for keeping around all processes and always reusing them per-origin.
1047         <rdar://problem/39695798> and https://bugs.webkit.org/show_bug.cgi?id=185020
1048
1049         Reviewed by Andy Estes.
1050
1051         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1052         (API::ProcessPoolConfiguration::copy):
1053         * UIProcess/API/APIProcessPoolConfiguration.h:
1054
1055         * UIProcess/API/C/WKContextConfigurationRef.cpp:
1056         (WKContextConfigurationAlwaysKeepAndReuseSwappedProcesses):
1057         (WKContextConfigurationSetAlwaysKeepAndReuseSwappedProcesses):
1058         * UIProcess/API/C/WKContextConfigurationRef.h:
1059
1060         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1061         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1062         (-[_WKProcessPoolConfiguration setAlwaysKeepAndReuseSwappedProcesses:]):
1063         (-[_WKProcessPoolConfiguration alwaysKeepAndReuseSwappedProcesses]):
1064
1065         * UIProcess/SuspendedPageProxy.cpp:
1066         (WebKit::SuspendedPageProxy::webProcessDidClose):
1067         (WebKit::SuspendedPageProxy::destroyWebPageInWebProcess):
1068         * UIProcess/SuspendedPageProxy.h:
1069
1070         * UIProcess/WebPageProxy.cpp:
1071         (WebKit::WebPageProxy::suspendedPageClosed):
1072         (WebKit::WebPageProxy::suspendedPageProcessClosed): Deleted.
1073         * UIProcess/WebPageProxy.h:
1074         (WebKit::WebPageProxy::suspendedPage const):
1075
1076         * UIProcess/WebProcessPool.cpp:
1077         (WebKit::WebProcessPool::shouldTerminate):
1078         (WebKit::WebProcessPool::disconnectProcess):
1079         (WebKit::WebProcessPool::addProcessToOriginCacheSet):
1080         (WebKit::WebProcessPool::removeProcessFromOriginCacheSet):
1081         (WebKit::WebProcessPool::processForNavigation): If a swap will occur, cache the old process.
1082         (WebKit::WebProcessPool::processForNavigationInternal): Consider re-using a previously cached process.
1083         * UIProcess/WebProcessPool.h:
1084
1085         * WebProcess/WebPage/WebPage.cpp:
1086         (WebKit::m_credentialsMessenger):
1087
1088 2018-04-26  Andy VanWagoner  <thetalecrafter@gmail.com>
1089
1090         [INTL] Implement Intl.PluralRules
1091         https://bugs.webkit.org/show_bug.cgi?id=184312
1092
1093         Reviewed by JF Bastien.
1094
1095         Added Intl.PluralRules feature flag.
1096
1097         * Configurations/FeatureDefines.xcconfig:
1098
1099 2018-04-26  Zan Dobersek  <zdobersek@igalia.com>
1100
1101         [GTK][WPE] Initial ASYNC_SCROLLING support
1102         https://bugs.webkit.org/show_bug.cgi?id=184961
1103
1104         Reviewed by Carlos Garcia Campos.
1105
1106         Guard RemoteScrollingCoordinator and RemoteScrollingCoordinatorProxy
1107         usage in WebChromeClient and WebPageProxy, respectively, with
1108         PLATFORM(COCOA) in addition to the ASYNC_SCROLLING guards.
1109
1110         Despite enabling the code at build-time, the feature (as intended) is
1111         not yet used because of the DrawingArea rejection in the WebPage
1112         constructor.
1113
1114         * UIProcess/WebPageProxy.cpp:
1115         (WebKit::WebPageProxy::initializeWebPage):
1116         (WebKit::WebPageProxy::handleWheelEvent):
1117         (WebKit::WebPageProxy::updateTouchEventTracking):
1118         * UIProcess/WebPageProxy.h:
1119         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1120         (WebKit::WebChromeClient::createScrollingCoordinator const):
1121
1122 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
1123
1124         [WPE] Build and link against latest WPEBackend and WPEBackend-fdo
1125         https://bugs.webkit.org/show_bug.cgi?id=184643
1126
1127         Reviewed by Žan Doberšek.
1128
1129         Adapt to single-header WPE includes.
1130
1131         Null-initialize padding to silence -Wmissing-field-initializers. (Yuck.)
1132
1133         * Shared/NativeWebTouchEvent.h:
1134         * Shared/wpe/WebEventFactory.cpp:
1135         * UIProcess/API/glib/WebKitPrivate.cpp:
1136         * UIProcess/API/wpe/CompositingManagerProxy.cpp:
1137         * UIProcess/API/wpe/ScrollGestureController.h:
1138         * UIProcess/API/wpe/WPEView.cpp:
1139         (WKWPE::m_backend):
1140         * UIProcess/API/wpe/WebKitWebViewBackend.h:
1141         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
1142         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
1143         (WebKit::AcceleratedSurfaceWPE::initialize):
1144
1145 2018-04-25  Saam Barati  <sbarati@apple.com>
1146
1147         dlopen the bundle's executable before calling -[NSBundle load] since that will also do a bunch of other things we don't need
1148         https://bugs.webkit.org/show_bug.cgi?id=184904
1149
1150         Reviewed by Geoffrey Garen.
1151
1152         Loading an NSBundle does a lot of work to find the principal class inside
1153         the bundle. This means it walks all the objective C class names loaded
1154         by the bundle. Doing this is *really* expensive.
1155         
1156         Some users of the injected bundle define a WKBundleInitialize function.
1157         In such a case, we don't need the principal class, so we can skip loading
1158         the NSBundle. Now, before we load the bundle, we dlopen and dlsym looking
1159         for the WKBundleInitialize function. If we find it, we skip loading
1160         the bundle. If we don't find the WKBundleInitialize function, we fall
1161         back to loading the bundle and finding the principal class.
1162         
1163         This speeds up initializeWebProcess by ~70ms on my MBP.
1164
1165         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
1166         (WebKit::InjectedBundle::initialize):
1167
1168 2018-04-25  Youenn Fablet  <youenn@apple.com>
1169
1170         Use NetworkLoadChecker for all subresource loads except fetch/XHR
1171         https://bugs.webkit.org/show_bug.cgi?id=184870
1172         <rdar://problem/39370034>
1173
1174         Reviewed by Chris Dumez.
1175
1176         Relax rules to check for non HTTP(s) redirections to throw only when WebProcess says to load it after redirection.
1177         This allows WebProcess to load redirected non HTTP(s) URLs, such as data URLs.
1178         We keep these checks when WebProcess asks to continue the load and for all PingLoads.
1179
1180         Update error messages to be more consistent with WK1.
1181
1182         * NetworkProcess/NetworkLoadChecker.cpp:
1183         (WebKit::NetworkLoadChecker::checkRedirection):
1184         (WebKit::NetworkLoadChecker::continueCheckingRequest):
1185         (WebKit::NetworkLoadChecker::validateResourceResponse):
1186         (WebKit::NetworkLoadChecker::continueCheckingRequest):
1187         * NetworkProcess/NetworkLoadChecker.h:
1188         (WebKit::NetworkLoadChecker::validateResponse):
1189         * NetworkProcess/NetworkResourceLoader.cpp:
1190         (WebKit::shouldUseNetworkLoadChecker):
1191         (WebKit::NetworkResourceLoader::continueWillSendRequest):
1192
1193 2018-04-25  Ryosuke Niwa  <rniwa@webkit.org>
1194
1195         PSON: Don't create a new process when navigating to a blob URL, data URL, and about:blank
1196         https://bugs.webkit.org/show_bug.cgi?id=184962
1197
1198         Reviewed by Youenn Fablet.
1199         <rdar://problem/39715044>
1200
1201         Build fix. Revert the change in r231019 to remove the empty URL and about:blank check here.
1202         These checks are for the source / originating URL, not the target URL.
1203
1204         * UIProcess/WebProcessPool.cpp:
1205         (WebKit::WebProcessPool::processForNavigation):
1206
1207 2018-04-25  Youenn Fablet  <youenn@apple.com>
1208
1209         WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier should use DoNotProcessIncomingMessagesWhenWaitingForSyncReply
1210         https://bugs.webkit.org/show_bug.cgi?id=184978
1211         <rdar://problem/39667094>
1212
1213         Reviewed by Simon Fraser.
1214
1215         Use DoNotProcessIncomingMessagesWhenWaitingForSyncReply to keep a consistent state after the sync IPC call.
1216
1217         * WebProcess/Network/WebLoaderStrategy.cpp:
1218         (WebKit::WebLoaderStrategy::responseFromResourceLoadIdentifier):
1219         (WebKit::WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier):
1220
1221 2018-04-25  Jiewen Tan  <jiewen_tan@apple.com>
1222
1223         Remove access to keychain from the WebContent process
1224         https://bugs.webkit.org/show_bug.cgi?id=184428
1225         <rdar://problem/13150903>
1226
1227         Reviewed by Brent Fulgham.
1228
1229         This patch does the followings:
1230         1. Added necessary support to move HTMLKeygenElement's operation from WebContent Process to UI Process.
1231         2. Craft new SPI copySignedPublicKeyAndChallengeString to supply HTMLKeygenElement with dummy data such
1232         that WebKitTestRunner tests will not modify the underlying key store (e.g., the macOS Keychain).
1233
1234         * UIProcess/API/APINavigationClient.h:
1235         (API::NavigationClient::signedPublicKeyAndChallengeString):
1236         * UIProcess/API/C/WKPage.cpp:
1237         (WKPageSetPageNavigationClient):
1238         * UIProcess/API/C/WKPageNavigationClient.h:
1239         * UIProcess/Cocoa/NavigationState.h:
1240         * UIProcess/Cocoa/NavigationState.mm:
1241         (WebKit::NavigationState::NavigationClient::signedPublicKeyAndChallengeString):
1242         * UIProcess/WebPageProxy.cpp:
1243         (WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
1244         * UIProcess/WebPageProxy.h:
1245         * UIProcess/WebPageProxy.messages.in:
1246         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1247         (WebKit::WebChromeClient::signedPublicKeyAndChallengeString const):
1248         * WebProcess/WebCoreSupport/WebChromeClient.h:
1249
1250 2018-04-25  Wenson Hsieh  <wenson_hsieh@apple.com>
1251
1252         [Extra zoom mode] The search field on www.bing.com is missing label text
1253         https://bugs.webkit.org/show_bug.cgi?id=184975
1254         <rdar://problem/39723081>
1255
1256         Reviewed by Tim Horton.
1257
1258         Adds support for displaying the "aria-label" attribute as the input view's label text in extra zoom mode. Also
1259         adds support for grabbing the input label's text for testing.
1260
1261         Test: fast/forms/extrazoom/form-control-label-text.html
1262
1263         * Shared/AssistedNodeInformation.cpp:
1264         (WebKit::AssistedNodeInformation::encode const):
1265         (WebKit::AssistedNodeInformation::decode):
1266         * Shared/AssistedNodeInformation.h:
1267         * UIProcess/API/Cocoa/WKWebView.mm:
1268         (-[WKWebView formInputLabel]):
1269         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1270         * UIProcess/ios/WKContentViewInteraction.h:
1271         * UIProcess/ios/WKContentViewInteraction.mm:
1272         (-[WKContentView formInputLabel]):
1273         * WebProcess/WebPage/ios/WebPageIOS.mm:
1274         (WebKit::WebPage::getAssistedNodeInformation):
1275
1276 2018-04-25  Ryosuke Niwa  <rniwa@webkit.org>
1277
1278         PSON: Don't create a new process when navigating to a blob URL, data URL, and about:blank
1279         https://bugs.webkit.org/show_bug.cgi?id=184962
1280
1281         Reviewed by Youenn Fablet.
1282
1283         Don't create a new WebContent process when navigating to a blob object URL since doing so
1284         can result in a race condition in which the blog URL is removed from the blob registry of
1285         the network process by the time the navigation gets commited. This causes a failure in
1286         fast/dom/HTMLAnchorElement/anchor-download-unset.html and oher layout tests.
1287
1288         In the future, the network process should verify that a given WebContent process has access
1289         to a given blob URL. For now, we rely on WebContent process to tell us whether it can
1290         navigate to a given blob URL or not.
1291
1292         * Shared/NavigationActionData.cpp:
1293         (WebKit::NavigationActionData::encode const): Encode newly added treatAsSameOriginNavigation.
1294         (WebKit::NavigationActionData::decode): Ditto for decoding.
1295         * Shared/NavigationActionData.h:
1296         (WebKit::NavigationActionData::treatAsSameOriginNavigation): Added.
1297         * UIProcess/API/APINavigation.h:
1298         (API::Navigation::setTreatAsSameOriginNavigation): Added.
1299         (API::Navigation::treatAsSameOriginNavigation const): Added.
1300         * UIProcess/API/APIProcessPoolConfiguration.h:
1301         * UIProcess/WebPageProxy.cpp:
1302         (WebKit::WebPageProxy::decidePolicyForNavigationAction): Use the current process when
1303         treatAsSameOriginNavigation is set to true; i.e. when navigating to a blob URL the current
1304         document has access.
1305         * UIProcess/WebProcessPool.cpp:
1306         (WebKit::WebProcessPool::processForNavigation):
1307         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1308         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1309
1310 2018-04-25  Megan Gardner  <megan_gardner@apple.com>
1311
1312         Don't activate Selection Assistant unless it is actually needed.
1313         https://bugs.webkit.org/show_bug.cgi?id=184944
1314         <rdar://problem/39469671>
1315
1316         Reviewed by Tim Horton.
1317         
1318         Don't activate the selection unless we need to. Activating on init is overeager and allowing Javascript to 
1319         activate selections without user input.
1320
1321         * UIProcess/ios/WKContentViewInteraction.mm:
1322         (-[WKContentView useSelectionAssistantWithGranularity:]):
1323
1324 2018-04-25  Wenson Hsieh  <wenson_hsieh@apple.com>
1325
1326         Fix entitlements and sandbox configurations in WebKit after r230778
1327         https://bugs.webkit.org/show_bug.cgi?id=184960
1328         <rdar://problem/39662827>
1329
1330         Reviewed by Tim Horton.
1331
1332         Build fixes for watchOS and tvOS after r230778.
1333
1334         * Configurations/BaseXPCService.xcconfig:
1335         * Configurations/NetworkService.xcconfig:
1336         * Configurations/WebContentService.xcconfig:
1337
1338 2018-04-25  Brent Fulgham  <bfulgham@apple.com>
1339
1340         Unreviewed build fix after r231008.
1341
1342         * NetworkProcess/NetworkDataTask.cpp:
1343         (WebKit::NetworkDataTask::create): Forgot to remove an unneeded constructor argument.
1344
1345 2018-04-25  Brent Fulgham  <bfulgham@apple.com>
1346
1347         Don't Block First Party Cookies on Redirects
1348         https://bugs.webkit.org/show_bug.cgi?id=184948
1349         <rdar://problem/39534099>
1350
1351         Reviewed by Youenn Fablet.
1352
1353         Top-level navigations should not be subject to cookie blocking behavior. When performing redirects for main frame
1354         navigation we are blocking cookies, leading to site breakage.
1355         
1356         We need to keep track of which NetworkDataTasks are due to a main frame navigation. When a redirect is performed
1357         on the main frame, we should treat the new origin as the 'first party for cookies' and avoid blocking cookies for
1358         that URL.
1359
1360         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1361         (WebKit::NetworkConnectionToWebProcess::preconnectTo): Use the correct parameter type. We actually serialize
1362         NetworkResourceLoadParameters over IPC, so we should get access to all the members of this child class.
1363         * NetworkProcess/NetworkConnectionToWebProcess.h:
1364         * NetworkProcess/NetworkDataTask.cpp:
1365         (WebKit::NetworkDataTask::create): Pass new 'loadIsForNavigation' flag to create methods. 
1366         (WebKit::NetworkDataTask::NetworkDataTask): Capture 'loadIsForNavigation' in constructor.
1367         * NetworkProcess/NetworkDataTask.h:
1368         (WebKit::NetworkDataTask::isTopLevelNavigation const): Added.
1369         * NetworkProcess/NetworkDataTaskBlob.cpp:
1370         (WebKit::NetworkDataTaskBlob::NetworkDataTaskBlob): Accept new constructor argument.
1371         * NetworkProcess/NetworkDataTaskBlob.h:
1372         * NetworkProcess/NetworkLoad.cpp:
1373         (WebKit::NetworkLoad::willPerformHTTPRedirection): Retain requester value from old request during redirect.
1374         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1375         (NetworkResourceLoadParameters::decode): Update to pass new flag.
1376         (NetworkResourceLoadParameters::encode): Ditto.
1377         * NetworkProcess/NetworkLoadParameters.h:
1378         * NetworkProcess/capture/NetworkDataTaskReplay.cpp:
1379         (WebKit::NetworkCapture::NetworkDataTaskReplay::NetworkDataTaskReplay): Accept new constructor argument.
1380         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1381         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1382         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Accept new constructor argument.
1383         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
1384         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1385         (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl): Accept new constructor argument.
1386         * NetworkProcess/curl/NetworkDataTaskCurl.h:
1387         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1388         (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup): Accept new constructor argument.
1389         * NetworkProcess/soup/NetworkDataTaskSoup.h:
1390
1391 2018-04-25  Youenn Fablet  <youenn@apple.com>
1392
1393         Ensure DNT is set for redirections handled in NetworkProcess
1394         https://bugs.webkit.org/show_bug.cgi?id=184890
1395
1396         Reviewed by Ryosuke Niwa.
1397
1398         Compute whether DNT header should be set on requests based on:
1399         - request has a DNT header
1400         - session is ephemeral (aka private browsing mode)
1401         In both cases, we ensure a DNT header is added for any request triggered by a redirection.
1402
1403         Covered by http/wpt/fetch/dnt-header-after-redirection.html.
1404
1405         * NetworkProcess/NetworkLoadChecker.cpp:
1406         (WebKit::NetworkLoadChecker::check):
1407         (WebKit::NetworkLoadChecker::prepareRedirectedRequest):
1408         * NetworkProcess/NetworkLoadChecker.h:
1409         * NetworkProcess/NetworkResourceLoader.cpp:
1410         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1411         (WebKit::NetworkResourceLoader::continueWillSendRequest):
1412         * NetworkProcess/PingLoad.cpp:
1413         (WebKit::PingLoad::willPerformHTTPRedirection):
1414         * WebProcess/Network/WebLoaderStrategy.cpp:
1415         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1416
1417 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
1418
1419         [WPE] Remove deprecated functions and properties from the API
1420         https://bugs.webkit.org/show_bug.cgi?id=179295
1421
1422         Reviewed by Žan Doberšek.
1423
1424         * UIProcess/API/glib/WebKitCookieManager.cpp:
1425         * UIProcess/API/glib/WebKitFormSubmissionRequest.cpp:
1426         * UIProcess/API/glib/WebKitNavigationPolicyDecision.cpp:
1427         (webkitNavigationPolicyDecisionGetProperty):
1428         (webkit_navigation_policy_decision_class_init):
1429         * UIProcess/API/glib/WebKitSettings.cpp:
1430         (webKitSettingsSetProperty):
1431         (webKitSettingsGetProperty):
1432         (webkit_settings_class_init):
1433         * UIProcess/API/glib/WebKitWebContext.cpp:
1434         (webkitWebContextGetProperty):
1435         (webkitWebContextSetProperty):
1436         (webkit_web_context_class_init):
1437         * UIProcess/API/glib/WebKitWebView.cpp:
1438         (webkit_web_view_class_init):
1439         (webkitWebViewHandleAuthenticationChallenge):
1440         (webkitWebViewWebProcessTerminated):
1441         * UIProcess/API/wpe/WebKitCookieManager.h:
1442         * UIProcess/API/wpe/WebKitFormSubmissionRequest.h:
1443         * UIProcess/API/wpe/WebKitNavigationPolicyDecision.h:
1444         * UIProcess/API/wpe/WebKitSettings.h:
1445         * UIProcess/API/wpe/WebKitWebContext.h:
1446
1447 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
1448
1449         Unreviewed, silence -Wreturn-type warning
1450         https://bugs.webkit.org/show_bug.cgi?id=184560
1451
1452         * NetworkProcess/NetworkResourceLoader.cpp:
1453         (WebKit::shouldCancelCrossOriginLoad):
1454
1455 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
1456
1457         [GTK] Miscellaneous build cleanups
1458         https://bugs.webkit.org/show_bug.cgi?id=184399
1459
1460         Reviewed by Žan Doberšek.
1461
1462         * PlatformGTK.cmake:
1463
1464 2018-04-25  Dean Jackson  <dino@apple.com>
1465
1466         Make a better flag for system preview, and disable it where necessary
1467         https://bugs.webkit.org/show_bug.cgi?id=184968
1468         <rdar://problem/39686506>
1469
1470         Reviewed by Eric Carlson.
1471
1472         Use USE(SYSTEM_PREVIEW).
1473
1474         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
1475         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
1476         (-[WKWebViewContentProviderRegistry init]):
1477         * UIProcess/ios/WKSystemPreviewView.mm:
1478
1479 2018-04-25  Carlos Garcia Campos  <cgarcia@igalia.com>
1480
1481         [GTK] Implement MouseEvent.buttons
1482         https://bugs.webkit.org/show_bug.cgi?id=184913
1483
1484         Reviewed by Žan Doberšek.
1485
1486         It's currently returning always 0.
1487
1488         * Shared/gtk/WebEventFactory.cpp:
1489         (WebKit::pressedMouseButtons): Helper function to get the pressed mouse buttons.
1490         (WebKit::WebEventFactory::createWebMouseEvent): Pass presssed mouse buttons to constructor instead of 0.
1491         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
1492         (WebKit::WebAutomationSession::platformSimulateMouseInteraction): Include the mouse buttons state in automation
1493         synthesized events and update m_currentModifiers with the mouse buttons state.
1494         (WebKit::keyCodeForVirtualKey): Do not set the state here.
1495         (WebKit::modifiersForKeyCode): Helper to get the modifiers for a key code.
1496         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): Initialize the modifiers also when
1497         virtualKey is std::nullopt;
1498
1499 2018-04-24  Nan Wang  <n_wang@apple.com>
1500
1501         AX: soft link libAccessibility.dylb
1502         https://bugs.webkit.org/show_bug.cgi?id=184919
1503
1504         Reviewed by Dan Bernstein.
1505
1506         Weakly linked libAccessibility.dylib on macOS.
1507
1508         * Configurations/WebKit.xcconfig:
1509         * UIProcess/API/Cocoa/WKWebView.mm:
1510         (-[WKWebView _initializeWithConfiguration:]):
1511         (-[WKWebView _updateAccessibilityEventsEnabled]):
1512
1513 2018-04-24  Fujii Hironori  <Hironori.Fujii@sony.com>
1514
1515         [WinCairo] Add WKView and WKAPI
1516         https://bugs.webkit.org/show_bug.cgi?id=182869
1517
1518         Reviewed by Alex Christensen.
1519
1520         Resurrected source files for WebKit for Windows port which was
1521         removed in r139003.
1522
1523         * PlatformWin.cmake: Renamed the output name of WebKit to WebKit2
1524         not to conflict WebKitLegacy. Added source files and include paths.
1525         * UIProcess/API/C/WKAPICast.h:
1526         * UIProcess/API/C/win/WKAPICastWin.h: Added.
1527         * UIProcess/API/C/win/WKView.cpp: Added.
1528         (WKViewCreate):
1529         (WKViewGetWindow):
1530         (WKViewGetPage):
1531         (WKViewSetParentWindow):
1532         (WKViewWindowAncestryDidChange):
1533         (WKViewSetIsInWindow):
1534         (WKViewSetScrollOffsetOnNextResize):
1535         * UIProcess/API/C/win/WKView.h: Added.
1536         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp: Added.
1537         (API::WebsiteDataStore::defaultApplicationCacheDirectory):
1538         (API::WebsiteDataStore::defaultCacheStorageDirectory):
1539         (API::WebsiteDataStore::defaultNetworkCacheDirectory):
1540         (API::WebsiteDataStore::defaultIndexedDBDatabaseDirectory):
1541         (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
1542         (API::WebsiteDataStore::defaultLocalStorageDirectory):
1543         (API::WebsiteDataStore::defaultMediaKeysStorageDirectory):
1544         (API::WebsiteDataStore::defaultWebSQLDatabaseDirectory):
1545         (API::WebsiteDataStore::defaultResourceLoadStatisticsDirectory):
1546         (API::WebsiteDataStore::cacheDirectoryFileSystemRepresentation):
1547         (API::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation):
1548         (API::WebsiteDataStore::defaultDataStoreConfiguration):
1549         * UIProcess/Launcher/ProcessLauncher.h:
1550         * UIProcess/Launcher/win/ProcessLauncherWin.cpp: Added.
1551         (WebKit::processName):
1552         (WebKit::ProcessLauncher::launchProcess):
1553         (WebKit::ProcessLauncher::terminateProcess):
1554         (WebKit::ProcessLauncher::platformInvalidate):
1555         * UIProcess/Network/NetworkProcessProxy.cpp:
1556         (WebKit::NetworkProcessProxy::networkProcessFailedToLaunch):
1557         (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
1558         * UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp: Added.
1559         (WebKit::WebsiteDataStore::platformInitialize):
1560         (WebKit::WebsiteDataStore::platformDestroy):
1561         (WebKit::WebsiteDataStore::platformRemoveRecentSearches):
1562         * UIProcess/win/PageClientImpl.cpp: Added.
1563         (WebKit::PageClientImpl::PageClientImpl):
1564         (WebKit::PageClientImpl::createDrawingAreaProxy):
1565         (WebKit::PageClientImpl::setViewNeedsDisplay):
1566         (WebKit::PageClientImpl::requestScroll):
1567         (WebKit::PageClientImpl::viewScrollPosition):
1568         (WebKit::PageClientImpl::viewSize):
1569         (WebKit::PageClientImpl::isViewWindowActive):
1570         (WebKit::PageClientImpl::isViewFocused):
1571         (WebKit::PageClientImpl::isViewVisible):
1572         (WebKit::PageClientImpl::isViewInWindow):
1573         (WebKit::PageClientImpl::PageClientImpl::processDidExit):
1574         (WebKit::PageClientImpl::didRelaunchProcess):
1575         (WebKit::PageClientImpl::toolTipChanged):
1576         (WebKit::PageClientImpl::setCursor):
1577         (WebKit::PageClientImpl::setCursorHiddenUntilMouseMoves):
1578         (WebKit::PageClientImpl::didChangeViewportProperties):
1579         (WebKit::PageClientImpl::registerEditCommand):
1580         (WebKit::PageClientImpl::clearAllEditCommands):
1581         (WebKit::PageClientImpl::canUndoRedo):
1582         (WebKit::PageClientImpl::executeUndoRedo):
1583         (WebKit::PageClientImpl::convertToDeviceSpace):
1584         (WebKit::PageClientImpl::convertToUserSpace):
1585         (WebKit::PageClientImpl::screenToRootView):
1586         (WebKit::PageClientImpl::rootViewToScreen):
1587         (WebKit::PageClientImpl::doneWithKeyEvent):
1588         (WebKit::PageClientImpl::createPopupMenuProxy):
1589         (WebKit::PageClientImpl::createContextMenuProxy):
1590         (WebKit::createColorPicker):
1591         (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
1592         (WebKit::PageClientImpl::exitAcceleratedCompositingMode):
1593         (WebKit::PageClientImpl::updateAcceleratedCompositingMode):
1594         (WebKit::PageClientImpl::pageClosed):
1595         (WebKit::PageClientImpl::preferencesDidChange):
1596         (WebKit::PageClientImpl::didChangeContentSize):
1597         (WebKit::PageClientImpl::handleDownloadRequest):
1598         (WebKit::PageClientImpl::didCommitLoadForMainFrame):
1599         (WebKit::PageClientImpl::fullScreenManagerProxyClient):
1600         (WebKit::PageClientImpl::closeFullScreenManager):
1601         (WebKit::PageClientImpl::isFullScreen):
1602         (WebKit::PageClientImpl::enterFullScreen):
1603         (WebKit::PageClientImpl::exitFullScreen):
1604         (WebKit::PageClientImpl::beganEnterFullScreen):
1605         (WebKit::PageClientImpl::beganExitFullScreen):
1606         (WebKit::PageClientImpl::doneWithTouchEvent):
1607         (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore):
1608         (WebKit::PageClientImpl::didFinishLoadingDataForCustomContentProvider):
1609         (WebKit::PageClientImpl::navigationGestureDidBegin):
1610         (WebKit::PageClientImpl::navigationGestureWillEnd):
1611         (WebKit::PageClientImpl::navigationGestureDidEnd):
1612         (WebKit::PageClientImpl::willRecordNavigationSnapshot):
1613         (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
1614         (WebKit::PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame):
1615         (WebKit::PageClientImpl::didFinishLoadForMainFrame):
1616         (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame):
1617         (WebKit::PageClientImpl::didChangeBackgroundColor):
1618         (WebKit::PageClientImpl::isPlayingAudioWillChange):
1619         (WebKit::PageClientImpl::isPlayingAudioDidChange):
1620         (WebKit::PageClientImpl::refView):
1621         (WebKit::PageClientImpl::derefView):
1622         * UIProcess/win/PageClientImpl.h: Added.
1623         * UIProcess/win/TextCheckerWin.cpp: Added.
1624         (WebKit::checkerState):
1625         (WebKit::TextChecker::state):
1626         (WebKit::TextChecker::setTestingMode):
1627         (WebKit::TextChecker::isTestingMode):
1628         (WebKit::TextChecker::isContinuousSpellCheckingAllowed):
1629         (WebKit::TextChecker::setContinuousSpellCheckingEnabled):
1630         (WebKit::TextChecker::setGrammarCheckingEnabled):
1631         (WebKit::TextChecker::continuousSpellCheckingEnabledStateChanged):
1632         (WebKit::TextChecker::grammarCheckingEnabledStateChanged):
1633         (WebKit::TextChecker::uniqueSpellDocumentTag):
1634         (WebKit::TextChecker::closeSpellDocumentWithTag):
1635         (WebKit::TextChecker::checkSpellingOfString):
1636         (WebKit::TextChecker::checkGrammarOfString):
1637         (WebKit::TextChecker::spellingUIIsShowing):
1638         (WebKit::TextChecker::toggleSpellingUIIsShowing):
1639         (WebKit::TextChecker::updateSpellingUIWithMisspelledWord):
1640         (WebKit::TextChecker::updateSpellingUIWithGrammarString):
1641         (WebKit::TextChecker::getGuessesForWord):
1642         (WebKit::TextChecker::learnWord):
1643         (WebKit::TextChecker::ignoreWord):
1644         (WebKit::TextChecker::requestCheckingOfString):
1645         (WebKit::TextChecker::checkTextOfParagraph):
1646         * UIProcess/win/WebContextMenuProxyWin.cpp: Added.
1647         (WebKit::WebContextMenuProxyWin::show):
1648         (WebKit::WebContextMenuProxyWin::showContextMenuWithItems):
1649         (WebKit::WebContextMenuProxyWin::WebContextMenuProxyWin):
1650         (WebKit::WebContextMenuProxyWin::~WebContextMenuProxyWin):
1651         * UIProcess/win/WebContextMenuProxyWin.h: Added.
1652         (WebKit::WebContextMenuProxyWin::create):
1653         * UIProcess/win/WebInspectorProxyWin.cpp: Added.
1654         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
1655         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
1656         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
1657         (WebKit::WebInspectorProxy::platformDidCloseForCrash):
1658         (WebKit::WebInspectorProxy::platformInvalidate):
1659         (WebKit::WebInspectorProxy::platformHide):
1660         (WebKit::WebInspectorProxy::platformBringToFront):
1661         (WebKit::WebInspectorProxy::platformBringInspectedPageToFront):
1662         (WebKit::WebInspectorProxy::platformIsFront):
1663         (WebKit::WebInspectorProxy::platformInspectedURLChanged):
1664         (WebKit::WebInspectorProxy::inspectorPageURL):
1665         (WebKit::WebInspectorProxy::inspectorTestPageURL):
1666         (WebKit::WebInspectorProxy::inspectorBaseURL):
1667         (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
1668         (WebKit::WebInspectorProxy::platformInspectedWindowWidth):
1669         (WebKit::WebInspectorProxy::platformAttach):
1670         (WebKit::WebInspectorProxy::platformDetach):
1671         (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight):
1672         (WebKit::WebInspectorProxy::platformSetAttachedWindowWidth):
1673         (WebKit::WebInspectorProxy::platformStartWindowDrag):
1674         (WebKit::WebInspectorProxy::platformSave):
1675         (WebKit::WebInspectorProxy::platformAppend):
1676         (WebKit::WebInspectorProxy::platformAttachAvailabilityChanged):
1677         * UIProcess/win/WebPageProxyWin.cpp: Added.
1678         (WebKit::WebPageProxy::platformInitialize):
1679         (WebKit::WebPageProxy::standardUserAgent):
1680         (WebKit::WebPageProxy::saveRecentSearches):
1681         (WebKit::WebPageProxy::loadRecentSearches):
1682         (WebKit::WebPageProxy::editorStateChanged):
1683         * UIProcess/win/WebPreferencesWin.cpp: Added.
1684         (WebKit::WebPreferences::platformInitializeStore):
1685         (WebKit::WebPreferences::platformUpdateStringValueForKey):
1686         (WebKit::WebPreferences::platformUpdateBoolValueForKey):
1687         (WebKit::WebPreferences::platformUpdateUInt32ValueForKey):
1688         (WebKit::WebPreferences::platformUpdateDoubleValueForKey):
1689         (WebKit::WebPreferences::platformUpdateFloatValueForKey):
1690         (WebKit::WebPreferences::platformGetStringUserValueForKey):
1691         (WebKit::WebPreferences::platformGetBoolUserValueForKey):
1692         (WebKit::WebPreferences::platformGetUInt32UserValueForKey):
1693         (WebKit::WebPreferences::platformGetDoubleUserValueForKey):
1694         * UIProcess/win/WebProcessPoolWin.cpp: Added.
1695         (WebKit::WebProcessPool::platformInitialize):
1696         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1697         (WebKit::WebProcessPool::platformInitializeWebProcess):
1698         (WebKit::WebProcessPool::platformInvalidateContext):
1699         (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory):
1700         (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory):
1701         (WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory):
1702         (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory):
1703         (WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory):
1704         (WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory):
1705         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory):
1706         (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory):
1707         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
1708         * UIProcess/win/WebView.cpp: Added.
1709         (WebKit::WebView::WebViewWndProc):
1710         (WebKit::WebView::wndProc):
1711         (WebKit::WebView::registerWebViewWindowClass):
1712         (WebKit::WebView::WebView):
1713         (WebKit::WebView::~WebView):
1714         (WebKit::WebView::initialize):
1715         (WebKit::WebView::setParentWindow):
1716         (WebKit::findTopLevelParentWindow):
1717         (WebKit::WebView::windowAncestryDidChange):
1718         (WebKit::WebView::onMouseEvent):
1719         (WebKit::WebView::onWheelEvent):
1720         (WebKit::WebView::onHorizontalScroll):
1721         (WebKit::WebView::onVerticalScroll):
1722         (WebKit::WebView::onKeyEvent):
1723         (WebKit::drawPageBackground):
1724         (WebKit::WebView::paint):
1725         (WebKit::WebView::onPaintEvent):
1726         (WebKit::WebView::onPrintClientEvent):
1727         (WebKit::WebView::onSizeEvent):
1728         (WebKit::WebView::onWindowPositionChangedEvent):
1729         (WebKit::WebView::onSetFocusEvent):
1730         (WebKit::WebView::onKillFocusEvent):
1731         (WebKit::WebView::onTimerEvent):
1732         (WebKit::WebView::onShowWindowEvent):
1733         (WebKit::WebView::onSetCursor):
1734         (WebKit::WebView::updateActiveState):
1735         (WebKit::WebView::updateActiveStateSoon):
1736         (WebKit::initCommonControls):
1737         (WebKit::WebView::initializeToolTipWindow):
1738         (WebKit::WebView::startTrackingMouseLeave):
1739         (WebKit::WebView::stopTrackingMouseLeave):
1740         (WebKit::WebView::shouldInitializeTrackPointHack):
1741         (WebKit::WebView::close):
1742         (WebKit::WebView::cursorToShow const):
1743         (WebKit::WebView::updateNativeCursor):
1744         (WebKit::WebView::setOverrideCursor):
1745         (WebKit::WebView::setIsInWindow):
1746         (WebKit::WebView::setIsVisible):
1747         (WebKit::WebView::isWindowActive):
1748         (WebKit::WebView::isFocused):
1749         (WebKit::WebView::isVisible):
1750         (WebKit::WebView::isInWindow):
1751         (WebKit::WebView::setScrollOffsetOnNextResize):
1752         (WebKit::WebView::setViewNeedsDisplay):
1753         (WebKit::WebView::createColorChooserProxy):
1754         (WebKit::WebView::didCommitLoadForMainFrame):
1755         (WebKit::WebView::customRepresentationZoomFactor):
1756         (WebKit::WebView::setCustomRepresentationZoomFactor):
1757         (WebKit::WebView::findStringInCustomRepresentation):
1758         (WebKit::WebView::countStringMatchesInCustomRepresentation):
1759         (WebKit::WebView::nativeWindow):
1760         (WebKit::WebView::windowReceivedMessage):
1761         * UIProcess/win/WebView.h: Added.
1762         (WebKit::WebView::create):
1763         (WebKit::WebView::window const):
1764         (WebKit::WebView::page const):
1765         (WebKit::WebView::drawingArea):
1766         (WebKit::WebView::setWasActivatedByMouseEvent):
1767
1768 2018-04-24  Fujii Hironori  <Hironori.Fujii@sony.com>
1769
1770         Implement Same-Site cookies
1771         https://bugs.webkit.org/show_bug.cgi?id=159464
1772         <rdar://problem/27196358>
1773
1774         Unreviewed build fix.
1775
1776         WinCairo WebKit2 can't compile since r230921.
1777
1778         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1779         (WebKit::NetworkDataTaskCurl::appendCookieHeader):
1780         CookieJarCurlDatabase::cookieRequestHeaderFieldValue needs
1781         SameSiteInfo.
1782
1783 2018-04-24  Simon Fraser  <simon.fraser@apple.com>
1784
1785         Add a new "color-filter" CSS property as an experimental feature
1786         https://bugs.webkit.org/show_bug.cgi?id=184940
1787
1788         Reviewed by Jon Lee.
1789         
1790         Add the color-filter property as an experimental feature.
1791
1792         * Shared/WebPreferences.yaml:
1793
1794 2018-04-24  Saam Barati  <sbarati@apple.com>
1795
1796         Keep around a pre-warmed process when doing process swap on navigation
1797         https://bugs.webkit.org/show_bug.cgi?id=184765
1798         <rdar://problem/39685099>
1799
1800         Reviewed by Ryosuke Niwa and Brady Eidson.
1801
1802         This patch makes it so that WebProcessPool prewarms a process when process
1803         swap on navigation is turned on. When we do a process swap on navigation,
1804         we first try to grab a prewarmed process before creating a new one.
1805         
1806         We try to be smart about when to create these processes. The initial heuristic
1807         that this patch chooses is when we reach the DidFirstVisuallyNonEmptyLayout
1808         layout milestone. We're going to try to improve on this heuristic in:
1809         https://bugs.webkit.org/show_bug.cgi?id=184899
1810         
1811         This is a 40% progression on PLT with process swap on navigation turned on.
1812
1813         * UIProcess/API/Cocoa/WKProcessPool.mm:
1814         (-[WKProcessPool _prewarmedWebProcessCount]):
1815         (-[WKProcessPool _webProcessCountIgnoringPrewarmed]):
1816         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1817         * UIProcess/ServiceWorkerProcessProxy.cpp:
1818         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
1819         * UIProcess/WebPageProxy.cpp:
1820         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
1821         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
1822         * UIProcess/WebPageProxy.h:
1823         * UIProcess/WebProcessPool.cpp:
1824         (WebKit::WebProcessPool::createNewWebProcess):
1825         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
1826         (WebKit::WebProcessPool::warmInitialProcess):
1827         (WebKit::WebProcessPool::disconnectProcess):
1828         (WebKit::WebProcessPool::createWebPage):
1829         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
1830         (WebKit::WebProcessPool::processForNavigation):
1831         * UIProcess/WebProcessPool.h:
1832         * UIProcess/WebProcessProxy.cpp:
1833         (WebKit::WebProcessProxy::create):
1834         (WebKit::WebProcessProxy::WebProcessProxy):
1835         (WebKit::m_isInPrewarmedPool):
1836         (WebKit::m_userMediaCaptureManagerProxy): Deleted.
1837         * UIProcess/WebProcessProxy.h:
1838         (WebKit::WebProcessProxy::isInPrewarmedPool const):
1839         (WebKit::WebProcessProxy::setIsInPrewarmedPool):
1840
1841 2018-04-24  Commit Queue  <commit-queue@webkit.org>
1842
1843         Unreviewed, rolling out r230971.
1844         https://bugs.webkit.org/show_bug.cgi?id=184939
1845
1846         This fix was not appropriate (Requested by n_wang on #webkit).
1847
1848         Reverted changeset:
1849
1850         "AX: soft link libAccessibility.dylb"
1851         https://bugs.webkit.org/show_bug.cgi?id=184919
1852         https://trac.webkit.org/changeset/230971
1853
1854 2018-04-24  Nan Wang  <n_wang@apple.com>
1855
1856         AX: soft link libAccessibility.dylb
1857         https://bugs.webkit.org/show_bug.cgi?id=184919
1858
1859         Reviewed by Chris Fleizach.
1860
1861         Make sure we soft link the library so that it won't crash
1862         if it's missing in the system.
1863
1864         * Configurations/WebKit.xcconfig:
1865         * UIProcess/API/Cocoa/WKWebView.mm:
1866         (-[WKWebView _initializeWithConfiguration:]):
1867         (-[WKWebView _updateAccessibilityEventsEnabled]):
1868
1869 2018-04-24  John Wilander  <wilander@apple.com>
1870
1871         From-Origin: Support for 'same' and 'same-site' response header, nested frame origin check
1872         https://bugs.webkit.org/show_bug.cgi?id=184560
1873         <rdar://problem/38901344>
1874
1875         Reviewed by Youenn Fablet and Daniel Bates.
1876
1877         This patch implements significant parts of https://github.com/whatwg/fetch/issues/687.
1878         We consume the From-Origin response header and only load the resource if:
1879         - The header is non-existent, empty, or invalid.
1880         - The header specifies 'same' and the resource's origin matches the originating
1881           document's origin and the origins up the frame tree.
1882         - The header specifies 'same-site' and the resource's eTLD+1 matches the originating
1883           document's eTLD+1 and the eTLD+1 of the documents up the frame tree.
1884
1885         This feature is experimental and off by default.
1886
1887         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1888         (WebKit::NetworkResourceLoadParameters::encode const):
1889         (WebKit::NetworkResourceLoadParameters::decode):
1890             Support for the two new load parameters:
1891             - shouldEnableFromOriginResponseHeader
1892             - frameAncestorOrigins
1893         * NetworkProcess/NetworkResourceLoadParameters.h:
1894         * NetworkProcess/NetworkResourceLoader.cpp:
1895         (WebKit::areFrameAncestorsSameSite):
1896         (WebKit::areFrameAncestorsSameOrigin):
1897         (WebKit::shouldCancelCrossOriginLoad):
1898             The three functions above implement the new blocking logic.
1899         (WebKit::fromOriginResourceError):
1900             Convenience function that returns an error with the From-Origin error message.
1901         (WebKit::NetworkResourceLoader::didReceiveResponse):
1902             Now checks for a From-Origin response header.
1903         (WebKit::NetworkResourceLoader::didFailLoading):
1904             Now checks for a From-Origin response header.
1905         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
1906             Now checks for a From-Origin response header.
1907         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
1908             Now checks for a From-Origin response header.
1909         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
1910             Now checks for a From-Origin response header.
1911         * Shared/WebCoreArgumentCoders.cpp:
1912         (IPC::ArgumentCoder<Vector<RefPtr<SecurityOrigin>>>::encode):
1913         (IPC::ArgumentCoder<Vector<RefPtr<SecurityOrigin>>>::decode):
1914             Now encodes and decodes vectors of RefPtr<WebCore::SecurityOrigin>.
1915         * Shared/WebCoreArgumentCoders.h:
1916         * Shared/WebPreferences.yaml:
1917             Added From-Origin support as an experimental feature.
1918         * UIProcess/API/C/WKPreferences.cpp:
1919         (WKPreferencesSetFromOriginResponseHeaderEnabled):
1920         (WKPreferencesGetFromOriginResponseHeaderEnabled):
1921         * UIProcess/API/C/WKPreferencesRef.h:
1922         * WebProcess/Network/WebLoaderStrategy.cpp:
1923         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1924             Sets the two new load parameters:
1925             - shouldEnableFromOriginResponseHeader
1926             - frameAncestorOrigins
1927
1928 2018-04-24  Jer Noble  <jer.noble@apple.com>
1929
1930         Don't add system framework paths to FRAMEWORK_SEARCH_PATHS
1931         https://bugs.webkit.org/show_bug.cgi?id=184786
1932
1933         Reviewed by Tim Horton.
1934
1935         * Configurations/BaseTarget.xcconfig:
1936         * DerivedSources.make:
1937
1938 2018-04-24  Ryan Haddad  <ryanhaddad@apple.com>
1939
1940         Unreviewed, rolling out r230938.
1941
1942         Introduced two ProcessSwap API test failures.
1943
1944         Reverted changeset:
1945
1946         "Keep around a pre-warmed process when doing process swap on
1947         navigation"
1948         https://bugs.webkit.org/show_bug.cgi?id=184765
1949         https://trac.webkit.org/changeset/230938
1950
1951 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
1952
1953         [CoordGraphics] Remove dead fixed layer code
1954         https://bugs.webkit.org/show_bug.cgi?id=184912
1955
1956         Reviewed by Michael Catanzaro.
1957
1958         Drop the unused fixed layer handling  code in CoordinatedGraphicsScene.
1959         The m_fixedLayers container can be removed, along with the
1960         adjustPositionForFixedLayers() method that operated on that container.
1961
1962         This was the only method that operated with the m_scrollPosition member
1963         variable and the contentsPosition argument that's passed to the
1964         CoordinatedGraphicsScene::paintToCurrentGLContext() method. Both of
1965         these are removed, along with the scrollPosition attribute on the
1966         CoordinatedGraphicsState struct.
1967
1968         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1969         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
1970         (WebKit::CoordinatedGraphicsScene::setLayerState):
1971         (WebKit::CoordinatedGraphicsScene::deleteLayer):
1972         (WebKit::CoordinatedGraphicsScene::commitSceneState):
1973         (WebKit::CoordinatedGraphicsScene::purgeGLResources):
1974         (WebKit::CoordinatedGraphicsScene::adjustPositionForFixedLayers): Deleted.
1975         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
1976         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1977         (WebKit::ThreadedCompositor::renderLayerTree):
1978         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1979         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
1980
1981 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
1982
1983         REGRESSION(r230950): Faulty commit sequencing in CoordinatedGraphicsScene
1984         https://bugs.webkit.org/show_bug.cgi?id=184917
1985
1986         Reviewed by Michael Catanzaro.
1987
1988         After r230950, current animation state for a given layer is also taken
1989         into account when determining whether or not the layer requires a
1990         backing store. For that to work properly, all the animation state has
1991         to be updated before the backing store work. This patch changes the
1992         order of helper method invocations in
1993         CoordinatedGraphicsScene::setLayerState() to address that.
1994
1995         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1996         (WebKit::CoordinatedGraphicsScene::setLayerState):
1997
1998 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
1999
2000         [CoordGraphics] Remove unused fixed layout functionality
2001         https://bugs.webkit.org/show_bug.cgi?id=184908
2002
2003         Reviewed by Carlos Garcia Campos.
2004
2005         Ports using the CoordinatedGraphics subsystem don't expose fixed layout
2006         support. As such, we're able to remove a lot of unused code and
2007         unnecessary USE(COORDINATED_GRAPHICS) special cases in generic sections
2008         in both WebCore and WebKit.
2009
2010         Remove USE(COORDINATED_GRAPHICS) special-casing from the
2011         WebPage::setUseFixedLayout() method. This is not possible to enable for
2012         the GTK+ and WPE ports that use the CoordinatedGraphics subsytem via
2013         API. Removing all this unlocks removing considerable amounts of dead
2014         code and complexities in CoordinatedGraphics.
2015
2016         WebChromeClient::delegatedScrollRequested() method is removed, along
2017         with the WebPage::pageDidRequestScroll() method that was only called
2018         from there.
2019
2020         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2021         (WebKit::WebChromeClient::delegatedScrollRequested): Deleted.
2022         * WebProcess/WebCoreSupport/WebChromeClient.h:
2023         * WebProcess/WebPage/WebPage.cpp:
2024         (WebKit::WebPage::setUseFixedLayout):
2025         (WebKit::WebPage::pageDidRequestScroll): Deleted.
2026         * WebProcess/WebPage/WebPage.h:
2027
2028 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
2029
2030         [CoordGraphics] Avoid painting backing stores for zero-opacity layers
2031         https://bugs.webkit.org/show_bug.cgi?id=184143
2032
2033         Reviewed by Carlos Garcia Campos.
2034
2035         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2036         (WebKit::layerShouldHaveBackingStore):
2037         Mirror CoordinatedGraphicsLayer's backing store requirements.
2038
2039 2018-04-23  Daniel Bates  <dabates@apple.com>
2040
2041         Implement Same-Site cookies
2042         https://bugs.webkit.org/show_bug.cgi?id=159464
2043         <rdar://problem/27196358>
2044
2045         Reviewed by Brent Fulgham.
2046
2047         Pass the Same-Site info through the WebKit abstractions.
2048
2049         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2050         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
2051         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
2052         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
2053         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
2054         * NetworkProcess/NetworkConnectionToWebProcess.h:
2055         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2056         * NetworkProcess/NetworkResourceLoader.cpp:
2057         (WebKit::NetworkResourceLoader::logCookieInformation const):
2058         (WebKit::logBlockedCookieInformation):
2059         (logCookieInformationInternal):
2060         (NetworkResourceLoader::logCookieInformation):
2061         * NetworkProcess/NetworkResourceLoader.h:
2062         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2063         (WebKit::NetworkCache::constructRevalidationRequest):
2064         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
2065         (WebKit::NetworkCache::SubresourceInfo::encode const):
2066         (WebKit::NetworkCache::SubresourceInfo::decode):
2067         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
2068         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
2069         (WebKit::NetworkCache::SubresourceInfo::isSameSite const):
2070         (WebKit::NetworkCache::SubresourceInfo::isTopSite const): Returns false; subresources do not represent
2071         a top-level navigation.
2072         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2073         (WebKit::NetworkDataTaskCocoa::isThirdPartyRequest):
2074         (WebKit::updateTaskWithFirstPartyForSameSiteCookies):
2075         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2076         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
2077         * UIProcess/WebProcessPool.cpp:
2078         (WebKit::WebProcessPool::download):
2079         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2080         (WebKit::WebPlatformStrategies::cookiesForDOM):
2081         (WebKit::WebPlatformStrategies::setCookiesFromDOM):
2082         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
2083         (WebKit::WebPlatformStrategies::getRawCookies):
2084         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
2085
2086 2018-04-23  Youenn Fablet  <youenn@apple.com>
2087
2088         Make WebLoaderStrategy send to NetworkResourceLoader necessary parameters to handle full loads in NetworkProcess
2089         https://bugs.webkit.org/show_bug.cgi?id=184763
2090
2091         Reviewed by Chris Dumez.
2092
2093         Set all required NetworkResourceLoadParameters for asynchronous loads.
2094         This includes preflight policy, CSP response headers, SecurityOrigin and content blockers identifier.
2095
2096         Update NetworkLoadChecker to handle preflight policy.
2097         This is not needed right now since sync XHR and ping loads are using the default ConsiderPreflight policy.
2098         But this will be needed for XHR/fetch/EventSource loads. 
2099
2100         * NetworkProcess/NetworkLoadChecker.cpp:
2101         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
2102         (WebKit::NetworkLoadChecker::checkRedirection):
2103         (WebKit::NetworkLoadChecker::validateResponse):
2104         (WebKit::NetworkLoadChecker::checkCORSRequest):
2105         * NetworkProcess/NetworkLoadChecker.h:
2106         (WebKit::NetworkLoadChecker::create):
2107         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2108         (WebKit::NetworkResourceLoadParameters::encode const):
2109         (WebKit::NetworkResourceLoadParameters::decode):
2110         * NetworkProcess/NetworkResourceLoadParameters.h:
2111         * NetworkProcess/NetworkResourceLoader.cpp:
2112         * NetworkProcess/PingLoad.cpp:
2113         (WebKit::PingLoad::PingLoad):
2114         * WebProcess/Network/WebLoaderStrategy.cpp:
2115         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2116
2117 2018-04-23  Wenson Hsieh  <wenson_hsieh@apple.com>
2118
2119         [Extra zoom mode] REGRESSION(230860) Unable to change time input values using UI
2120         https://bugs.webkit.org/show_bug.cgi?id=184901
2121         <rdar://problem/39664797>
2122
2123         Reviewed by Tim Horton.
2124
2125         Fixes the bug by falling back to setting the value of the focused input element in the case where the selection
2126         is not editable. Also adds plumbing to make time pickers testable in extra zoom mode.
2127
2128         * UIProcess/API/Cocoa/WKWebView.mm:
2129         (-[WKWebView setTimePickerValueToHour:minute:]):
2130         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2131         * UIProcess/ios/WKContentViewInteraction.h:
2132         * UIProcess/ios/WKContentViewInteraction.mm:
2133         (-[WKContentView setTimePickerValueToHour:minute:]):
2134
2135         Add plumbing to make it possible for WebKitTestRunner to simulate picking a time from the given hours and
2136         minutes. This is currently only implemented for extra zoom mode, but may be implemented for UIKit's time picker
2137         as well in the future by adjusting -[WKContentView setTimePickerValueToHour:minute:].
2138
2139         * WebProcess/WebPage/WebPage.cpp:
2140         (WebKit::WebPage::setTextAsync):
2141
2142 2018-04-23  Saam Barati  <sbarati@apple.com>
2143
2144         Keep around a pre-warmed process when doing process swap on navigation
2145         https://bugs.webkit.org/show_bug.cgi?id=184765
2146
2147         Reviewed by Ryosuke Niwa.
2148
2149         This patch makes it so that WebProcessPool prewarms a process when process
2150         swap on navigation is turned on. When we do a process swap on navigation,
2151         we first try to grab a prewarmed process before creating a new one.
2152         
2153         We try to be smart about when to create these processes. The initial heuristic
2154         that this patch chooses is when we reach the DidFirstVisuallyNonEmptyLayout
2155         layout milestone. We're going to try to improve on this heuristic in:
2156         https://bugs.webkit.org/show_bug.cgi?id=184899
2157         
2158         This is a 40% progression on PLT with process swap on navigation turned on.
2159
2160         * UIProcess/ServiceWorkerProcessProxy.cpp:
2161         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
2162         * UIProcess/WebPageProxy.cpp:
2163         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
2164         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
2165         * UIProcess/WebPageProxy.h:
2166         * UIProcess/WebProcessPool.cpp:
2167         (WebKit::WebProcessPool::createNewWebProcess):
2168         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
2169         (WebKit::WebProcessPool::warmInitialProcess):
2170         (WebKit::WebProcessPool::disconnectProcess):
2171         (WebKit::WebProcessPool::createWebPage):
2172         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
2173         (WebKit::WebProcessPool::processForNavigation):
2174         * UIProcess/WebProcessPool.h:
2175         * UIProcess/WebProcessProxy.cpp:
2176         (WebKit::WebProcessProxy::create):
2177         (WebKit::WebProcessProxy::WebProcessProxy):
2178         (WebKit::m_isInPrewarmedPool):
2179         (WebKit::m_userMediaCaptureManagerProxy): Deleted.
2180         * UIProcess/WebProcessProxy.h:
2181         (WebKit::WebProcessProxy::isInPrewarmedPool const):
2182         (WebKit::WebProcessProxy::setIsInPrewarmedPool):
2183
2184 2018-04-23  Michael Catanzaro  <mcatanzaro@igalia.com>
2185
2186         [WPE][GTK] Remove WlUniquePtr<wl_display> footgun
2187         https://bugs.webkit.org/show_bug.cgi?id=184405
2188
2189         Reviewed by Carlos Garcia Campos.
2190
2191         Switch to std::unique_ptr.
2192
2193         * UIProcess/gtk/WaylandCompositor.cpp:
2194         (WebKit::WaylandCompositor::WaylandCompositor):
2195         * UIProcess/gtk/WaylandCompositor.h:
2196         (WebKit::WaylandCompositor::DisplayDeleter::operator()):
2197
2198 2018-04-23  Daniel Bates  <dabates@apple.com>
2199
2200         Attempt to fix the Apple Internal build following r230921
2201         (https://bugs.webkit.org/show_bug.cgi?id=159464)
2202
2203         Forward declare some SPI. Add availability guard.
2204
2205         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2206
2207 2018-04-23  Zalan Bujtas  <zalan@apple.com>
2208
2209         [LayoutFormattingContext] Initial commit.
2210         https://bugs.webkit.org/show_bug.cgi?id=184896
2211
2212         Reviewed by Antti Koivisto.
2213
2214         * Configurations/FeatureDefines.xcconfig:
2215
2216 2018-04-23  Daniel Bates  <dabates@apple.com>
2217
2218         Implement Same-Site cookies
2219         https://bugs.webkit.org/show_bug.cgi?id=159464
2220         <rdar://problem/27196358>
2221
2222         Reviewed by Brent Fulgham.
2223
2224         Pass the Same-Site info through the WebKit abstractions.
2225
2226         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2227         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
2228         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
2229         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
2230         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
2231         * NetworkProcess/NetworkConnectionToWebProcess.h:
2232         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2233         * NetworkProcess/NetworkResourceLoader.cpp:
2234         (WebKit::NetworkResourceLoader::logCookieInformation const):
2235         (WebKit::logBlockedCookieInformation):
2236         (logCookieInformationInternal):
2237         (NetworkResourceLoader::logCookieInformation):
2238         * NetworkProcess/NetworkResourceLoader.h:
2239         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2240         (WebKit::NetworkCache::constructRevalidationRequest):
2241         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
2242         (WebKit::NetworkCache::SubresourceInfo::encode const):
2243         (WebKit::NetworkCache::SubresourceInfo::decode):
2244         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
2245         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
2246         (WebKit::NetworkCache::SubresourceInfo::isSameSite const):
2247         (WebKit::NetworkCache::SubresourceInfo::isTopSite const): Returns false; subresources do not represent
2248         a top-level navigation.
2249         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2250         (WebKit::NetworkDataTaskCocoa::isThirdPartyRequest):
2251         (WebKit::updateTaskWithFirstPartyForSameSiteCookies):
2252         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2253         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
2254         * UIProcess/WebProcessPool.cpp:
2255         (WebKit::WebProcessPool::download):
2256         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2257         (WebKit::WebPlatformStrategies::cookiesForDOM):
2258         (WebKit::WebPlatformStrategies::setCookiesFromDOM):
2259         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
2260         (WebKit::WebPlatformStrategies::getRawCookies):
2261         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
2262
2263 2018-04-23  Chris Dumez  <cdumez@apple.com>
2264
2265         WebProcessProxy frequently re-takes a process assertion for the network process even though is already has one
2266         https://bugs.webkit.org/show_bug.cgi?id=184889
2267         <rdar://problem/38151530>
2268
2269         Reviewed by Brady Eidson.
2270
2271         In ProcessThrottler::updateAssertionNow(), if the new process assertion state is the same
2272         as the existing one, then return early. Otherwise, we would end up calling WebProcessProxy::didSetAssertionState()
2273         for the same assertion state, which would cause duplicate logging but also some unnecessary work.
2274
2275         * UIProcess/ProcessThrottler.cpp:
2276         (WebKit::ProcessThrottler::updateAssertionNow):
2277
2278 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
2279
2280         [CoordGraphics] Remove unused trajectory cruft in CoordinatedLayerTreeHost, CoordinatedGraphicsLayer
2281         https://bugs.webkit.org/show_bug.cgi?id=184881
2282
2283         Reviewed by Michael Catanzaro.
2284
2285         The CompositingCoordinator::setVisibleContentsRect() method is always
2286         called with a (0,0) FloatPoint value as the trajectory vector parameter,
2287         which is already the default value in TiledBackingStore where this ends
2288         up. Removing this call chain also enables removing some unnecessary and
2289         odd code in the CoordinatedGraphicsLayer class.
2290
2291         This doesn't yet touch the trajectory logic in the TiledBackingStore
2292         class since it's not yet a given this won't be used in the future. But
2293         if that will be necessary, hope is to not use it this way.
2294
2295         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2296         (WebKit::CompositingCoordinator::setVisibleContentsRect):
2297         (WebKit::CompositingCoordinator::mainContentsLayer): Deleted.
2298         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
2299         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
2300         (WebKit::CoordinatedLayerTreeHost::setVisibleContentsRect):
2301         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
2302         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
2303         (WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewport):
2304
2305 2018-04-23  Fujii Hironori  <Hironori.Fujii@sony.com>
2306
2307         [Win][WK2] REGRESSION(r230834) 'getpid': identifier not found
2308         https://bugs.webkit.org/show_bug.cgi?id=184877
2309
2310         Reviewed by Yusuke Suzuki.
2311
2312         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
2313         (WebKit::WebBackForwardListProxy::addItem): Use WTF::getCurrentProcessID() instead of getpid().
2314         * WebProcess/WebPage/WebPage.cpp:
2315         (WebKit::WebPage::goToBackForwardItem): Ditto.
2316
2317 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
2318
2319         [TexMap] Drop RefCounted inheritance off of TextureMapperBackingStore
2320         https://bugs.webkit.org/show_bug.cgi?id=184810
2321
2322         Reviewed by Carlos Garcia Campos.
2323
2324         CoordinatedBackingStore should inherit directly from RefCounted<> now
2325         that TextureMapperBackingStore doesn't anymore.
2326
2327         * Shared/CoordinatedGraphics/CoordinatedBackingStore.h:
2328         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2329         (WebKit::CoordinatedGraphicsScene::createBackingStoreIfNeeded):
2330
2331 2018-04-22  Zan Dobersek  <zdobersek@igalia.com>
2332
2333         [CoordinatedGraphics] Unused contentsSize, coveredRect attributes in CoordinatedGraphicsState
2334         https://bugs.webkit.org/show_bug.cgi?id=184811
2335
2336         Reviewed by Carlos Garcia Campos.
2337
2338         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2339         (WebKit::CompositingCoordinator::flushPendingLayerChanges): Stop setting
2340         the removed contentsSize and coveredRect attributes. These were only
2341         ever set to the appropriate values, but were then never used anywhere.
2342
2343 2018-04-22  Matt Baker  <mattbaker@apple.com>
2344
2345         Web Inspector: WebInspectorProxy releases WKWebInspectorProxyObjCAdapter without removing corresponding observer
2346         https://bugs.webkit.org/show_bug.cgi?id=184865
2347         <rdar://problem/37764960>
2348
2349         Reviewed by Brian Burg.
2350
2351         Replace the early return removed in https://bugs.webkit.org/show_bug.cgi?id=177661,
2352         so that WKWebInspectorProxyObjCAdapter and the view controller can be reused
2353         when reopening the Inspector while the WebView is still alive.
2354
2355         * UIProcess/mac/WebInspectorProxyMac.mm:
2356         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
2357
2358 2018-04-22  Paul Knight  <pknight@apple.com>
2359
2360         Add -[WKInputDelegate _webView:decidePolicyForFocusedElement:] so clients can request default focusing behavior
2361         https://bugs.webkit.org/show_bug.cgi?id=184844
2362
2363         Reviewed by Dan Bernstein.
2364
2365         If a client doesn't implement -[_WKInputDelegate _webView:focusShouldStartInputSession:] the default
2366         focus behavior only brings up the keyboard if it's already onscreen, the interaction is user driven,
2367         and other factors that even depend on what feature flags are enabled.
2368
2369         If a client implements _webView:focusShouldStartInputSession:, they don't have a good way to specifiy
2370         they'd like to fall back to the default behavior. This makes it difficult for a client to use the
2371         default in most cases, but sometimes allow programmatic focus from the page, for example.
2372
2373         Add a new delegate method -_webView:decidePolicyForFocusedElement: that returns a new enum type
2374         _WKFocusStartsInputSessionPolicy. Clients can return _WKFocusStartsInputSessionPolicyAuto to request
2375         the default behavior, or _WKFocusStartsInputSessionPolicyAllow / Disallow to directly control whether
2376         the keyboard appears to assist the focused node.
2377
2378         * UIProcess/API/Cocoa/_WKInputDelegate.h:
2379         * UIProcess/ios/WKContentViewInteraction.mm:
2380         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2381
2382 2018-04-21  Jeremy Jones  <jeremyj@apple.com>
2383
2384         Disable backward and forward navigation swipes while in fullscreen.
2385         https://bugs.webkit.org/show_bug.cgi?id=184656
2386         rdar://problem/36057535
2387
2388         Reviewed by Tim Horton.
2389
2390         Disable navigation swipes while in fullscreen.
2391
2392         * UIProcess/Cocoa/ViewGestureController.cpp:
2393         (WebKit::ViewGestureController::canSwipeInDirection const):
2394
2395 2018-04-21  Youenn Fablet  <youenn@apple.com>
2396
2397         Activate NetworkLoadChecker for media loads
2398         https://bugs.webkit.org/show_bug.cgi?id=184841
2399
2400         Reviewed by Eric Carlson.
2401
2402         Instantiate a NetworkLoadChecker for NetworkResourceLoader for audio/video loads.
2403
2404         Move CORS checks for response after handling of 304 checks.
2405         For 304 checks, we need to do the CORS checks on the validated cached response, not the 304 received response.
2406
2407         Updated ResourceError argument coder to explicitly pass the error type
2408         as some errors created by NetworkLoadChecker would otherwise be received as General errors by WebProcess.
2409         Updated platform data encoding of ResourceError accordingly.
2410
2411         All changes are covered by regular media loading layout tests.
2412
2413         * NetworkProcess/NetworkResourceLoader.cpp:
2414         (WebKit::shouldUseNetworkLoadChecker):
2415         (WebKit::NetworkResourceLoader::didReceiveResponse):
2416         * Shared/WebCoreArgumentCoders.cpp:
2417         (IPC::ArgumentCoder<ResourceError>::encode):
2418         (IPC::ArgumentCoder<ResourceError>::decode):
2419         * Shared/mac/WebCoreArgumentCodersMac.mm:
2420         (IPC::ArgumentCoder<ResourceError>::encodePlatformData):
2421         (IPC::ArgumentCoder<ResourceError>::decodePlatformData):
2422         We need to set the type after decoding the NSError as ResourceError tries to guess the type from NSError data.
2423         * Shared/soup/WebCoreArgumentCodersSoup.cpp:
2424         (IPC::ArgumentCoder<ResourceError>::encodePlatformData):
2425         (IPC::ArgumentCoder<ResourceError>::decodePlatformData):
2426
2427 2018-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2428
2429         [SOUP] Do TLS error checking on GTlsConnection::accept-certificate
2430         https://bugs.webkit.org/show_bug.cgi?id=184480
2431
2432         Reviewed by Michael Catanzaro.
2433
2434         Connect to GTlsConnection::accept-certificate signal instead of SoupMessage::notify::tls-errors to perform the
2435         TLS errors check.
2436
2437         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2438         (WebKit::NetworkDataTaskSoup::createRequest): Do not connect to SoupMessage::notify::tls-errors.
2439         (WebKit::NetworkDataTaskSoup::tlsConnectionAcceptCertificateCallback): Call tlsConnectionAcceptCertificate() is
2440         the task is still ongoing.
2441         (WebKit::NetworkDataTaskSoup::tlsConnectionAcceptCertificate): Check TLS errors here.
2442         (WebKit::NetworkDataTaskSoup::networkEventCallback): Pass the stream to networkEvent.
2443         (WebKit::NetworkDataTaskSoup::networkEvent): Connect to GTlsConnection::accept-certificate.
2444         * NetworkProcess/soup/NetworkDataTaskSoup.h:
2445
2446 2018-04-20  Timothy Hatcher  <timothy@apple.com>
2447
2448         NULL dereference crash sometimes under [super initWithCoder:] in WebView
2449
2450         https://bugs.webkit.org/show_bug.cgi?id=184851
2451         rdar://problem/39611236
2452
2453         Reviewed by Tim Horton.
2454
2455         * UIProcess/API/Cocoa/WKWebView.mm:
2456         (-[WKWebView _initializeWithConfiguration:]):
2457         (-[WKWebView effectiveAppearanceDidChange]):
2458         Added a null check and call the code later in initialization.
2459
2460 2018-04-20  Tim Horton  <timothy_horton@apple.com>
2461
2462         Adjust geolocation feature flag
2463         https://bugs.webkit.org/show_bug.cgi?id=184856
2464
2465         Reviewed by Wenson Hsieh.
2466
2467         * Configurations/FeatureDefines.xcconfig:
2468
2469 2018-04-20  Chris Dumez  <cdumez@apple.com>
2470
2471         Unreviewed attempt to fix GTK build after r230867.
2472
2473         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
2474         (webkit_dom_dom_window_get_self):
2475         (webkit_dom_dom_window_get_window):
2476         (webkit_dom_dom_window_get_frames):
2477         (webkit_dom_dom_window_get_opener):
2478         (webkit_dom_dom_window_get_parent):
2479         (webkit_dom_dom_window_get_top):
2480
2481 2018-04-20  Commit Queue  <commit-queue@webkit.org>
2482
2483         Unreviewed, rolling out r230873.
2484         https://bugs.webkit.org/show_bug.cgi?id=184857
2485
2486         Broke the iOS build (Requested by cdumez on #webkit).
2487
2488         Reverted changeset:
2489
2490         "Disable backward and forward navigation swipes while in
2491         fullscreen."
2492         https://bugs.webkit.org/show_bug.cgi?id=184656
2493         https://trac.webkit.org/changeset/230873
2494
2495 2018-04-20  Chris Dumez  <cdumez@apple.com>
2496
2497         REGRESSION (r229828): web view doesn’t update or respond to resizing until client calls policy decision handler
2498         https://bugs.webkit.org/show_bug.cgi?id=184210
2499         <rdar://problem/39072354>
2500
2501         Reviewed by Wenson Hsieh.
2502
2503         r229828 tried to have some API tests happy on iOS by freezing the layer tree
2504         during the navigation policy decision. However, this is observable by the client
2505         application and a regression from when the policy delegate was synchronous.
2506
2507         To address the issue, this patch reverts r229828 and instead updates the iOS
2508         API tests to wait for the next presentation update after navigating
2509         before interacting with the view.
2510
2511         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2512         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2513         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2514         (WebKit::WebFrameLoaderClient::cancelPolicyCheck):
2515         (WebKit::WebFrameLoaderClient::provisionalLoadStarted):
2516         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2517         * WebProcess/WebPage/WebPage.cpp:
2518         * WebProcess/WebPage/WebPage.h:
2519
2520 2018-04-20  Brent Fulgham  <bfulgham@apple.com>
2521
2522         Limit cookie header access to Network process
2523         https://bugs.webkit.org/show_bug.cgi?id=184764
2524         <rdar://problem/36785285>
2525
2526         Reviewed by Youenn Fablet.
2527
2528         Revise the handling of cookie request headers so that we don't interact with them in the
2529         WebContent process. They are only needed for interaction with the server and the network
2530         process, so we should limit their scope to just the Network process.
2531
2532         Instead, we should handle a token that represents the cookie headers in the WebContent
2533         process, which can be converted to the relevant cookie data in the network process when
2534         needed.
2535
2536         * NetworkProcess/NetworkSocketStream.cpp:
2537         (WebKit::NetworkSocketStream::sendHandshake):
2538         * NetworkProcess/NetworkSocketStream.h:
2539         * NetworkProcess/NetworkSocketStream.messages.in:
2540         * WebProcess/Network/WebSocketStream.cpp:
2541         (WebKit::WebSocketStream::networkProcessCrashed):
2542         (WebKit::WebSocketStream::platformSendHandshake):
2543         (WebKit::WebSocketStream::didSendHandshake):
2544         * WebProcess/Network/WebSocketStream.h:
2545         * WebProcess/Network/WebSocketStream.messages.in:
2546
2547 2018-04-20  Jeremy Jones  <jeremyj@apple.com>
2548
2549         Disable backward and forward navigation swipes while in fullscreen.
2550         https://bugs.webkit.org/show_bug.cgi?id=184656
2551         rdar://problem/36057535
2552
2553         Reviewed by Tim Horton.
2554
2555         Disable navigation swipes while in fullscreen.
2556
2557         * UIProcess/Cocoa/ViewGestureController.cpp:
2558         (WebKit::ViewGestureController::canSwipeInDirection const):
2559
2560 2018-04-20  Jeremy Jones  <jeremyj@apple.com>
2561
2562         Element fullscreen, expose WKWebView _fullScreenPlaceholderView as iOS SPI
2563         https://bugs.webkit.org/show_bug.cgi?id=184826
2564         rdar://problem/39600825
2565
2566         Reviewed by Tim Horton.
2567
2568         Add _fullScreenPlaceholderView for iOS similar to the one for Mac.
2569
2570         * UIProcess/API/Cocoa/WKWebView.mm:
2571         (-[WKWebView _fullScreenPlaceholderView]):
2572         (-[WKWebView closeFullScreenWindowController]):
2573         (-[WKWebView fullScreenPlaceholderView]): Deleted.
2574         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2575         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2576         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.h:
2577         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2578         (-[WKFullScreenWindowController webViewPlaceholder]):
2579
2580 2018-04-20  Wenson Hsieh  <wenson_hsieh@apple.com>
2581
2582         [Extra zoom mode] Injected bundle form client should be notified when editing text fields
2583         https://bugs.webkit.org/show_bug.cgi?id=184822
2584         <rdar://problem/38807319>
2585
2586         Reviewed by Tim Horton.
2587
2588         Fixes the bug by making a couple of tweaks: (1) don't use a separate codepath for inserting text in text inputs,
2589         and (2) force a user typing gesture when inserting text using this codepath (i.e. WKTextInputListViewController).
2590         Also adds plumbing to enable testing text entry with WKTextInputListViewController in extra zoom mode.
2591
2592         * UIProcess/API/Cocoa/WKWebView.mm:
2593         (-[WKWebView _simulateTextEntered:]):
2594         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2595
2596         Introduce testing SPI to simulate text entry. Additionally, add a missing availability annotation around testing
2597         SPI added in 2017 to help test drag and drop for iOS 11.
2598
2599         * UIProcess/ios/WKContentViewInteraction.h:
2600         * UIProcess/ios/WKContentViewInteraction.mm:
2601         (-[WKContentView _simulateTextEntered:]):
2602         * WebProcess/WebPage/WebPage.cpp:
2603         (WebKit::WebPage::setTextAsync):
2604
2605 2018-04-20  Jeremy Jones  <jeremyj@apple.com>
2606
2607         EnterFullscreen must update the minimum and maximum layout sizes.
2608         https://bugs.webkit.org/show_bug.cgi?id=184828
2609         rdar://problem/38435829
2610
2611         Reviewed by Jon Lee.
2612
2613         Without this, the WKWebView won't layout to the full size in fullscreen mode.
2614
2615         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2616         (-[WKFullScreenWindowController enterFullScreen]):
2617
2618 2018-04-18  Jer Noble  <jer.noble@apple.com>
2619
2620         Don't put build products into WK_ALTERNATE_WEBKIT_SDK_PATH for engineering builds
2621         https://bugs.webkit.org/show_bug.cgi?id=184762
2622
2623         Reviewed by Dan Bernstein.
2624
2625         * Configurations/BaseTarget.xcconfig:
2626
2627 2018-04-20  Youenn Fablet  <youenn@apple.com>
2628
2629         Refactor NetworkResourceLoader to check for m_networkLoadChecker presence before using it
2630         https://bugs.webkit.org/show_bug.cgi?id=184755
2631
2632         Reviewed by Chris Dumez.
2633
2634         Make NetworkResourceLoader always use m_networkLoadChecker if there is one.
2635         This is only used now for synchronous loads but will be used in the future for asynchronous loads as well.
2636
2637         Since we call didFail asynchronously to make sync/async handling more consistent,
2638         We need to keep track of whether we will do clean-up twice.
2639         A boolean is added for that purpose in NetworkResourceLoader.
2640
2641         There is a small change of behavior in the way we return an error.
2642         Instead of returning a platformBadResponseError, we are now returning the error as computed by NetworkLoadChecker.
2643         This allows getting some more error logging in the JS console.
2644
2645         * NetworkProcess/NetworkResourceLoader.cpp:
2646         (WebKit::NetworkResourceLoader::didReceiveResponse):
2647         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
2648         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
2649         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
2650         * NetworkProcess/NetworkResourceLoader.h:
2651
2652 2018-04-20  Timothy Hatcher  <timothy@apple.com>
2653
2654         Include missing files in WKContentViewInteraction.{mm,h}
2655
2656         https://bugs.webkit.org/show_bug.cgi?id=184832
2657         rdar://problem/35377120
2658
2659         Reviewed by Wenson Hsieh.
2660
2661         Some WebDriver files were missing and should be included.
2662
2663         * UIProcess/ios/WKContentViewInteraction.h:
2664         * UIProcess/ios/WKContentViewInteraction.mm:
2665         (-[WKContentView setupInteraction]):
2666         (-[WKContentView cleanupInteraction]):
2667         (-[WKContentView _removeDefaultGestureRecognizers]):
2668         (-[WKContentView _addDefaultGestureRecognizers]):
2669
2670 2018-04-20  Youenn Fablet  <youenn@apple.com>
2671
2672         WebPage sometimes incorrectly rules out PDF as a mime type that can be showed
2673         https://bugs.webkit.org/show_bug.cgi?id=184369
2674
2675         Reviewed by Chris Dumez.
2676
2677         Use API to check for plugin availability for response at navigation time.
2678
2679         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2680         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2681         * WebProcess/WebPage/WebPage.cpp:
2682         (WebKit::WebPage::canShowResponse const):
2683         (WebKit::WebPage::canShowMIMEType const):
2684         * WebProcess/WebPage/WebPage.h:
2685
2686 2018-04-20  Daniel Bates  <dabates@apple.com>
2687
2688         Remove Strong Password decoration when text field type changes
2689         https://bugs.webkit.org/show_bug.cgi?id=184795
2690         <rdar://problem/38325108>
2691
2692         Reviewed by Antti Koivisto.
2693
2694         Add injected bundle API and WebKit UI delegate SPI to notify the embedding client when the
2695         Strong Password appearance of an HTML input element is resigned.
2696
2697         We add C SPI for Safari on Mac.
2698
2699         * UIProcess/API/APIUIClient.h:
2700         (API::UIClient::didResignInputElementStrongPasswordAppearance):
2701         * UIProcess/API/C/WKPage.cpp:
2702         (WKPageSetPageUIClient):
2703         * UIProcess/API/C/WKPageUIClient.h:
2704         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2705         * UIProcess/Cocoa/UIDelegate.h:
2706         * UIProcess/Cocoa/UIDelegate.mm:
2707         (WebKit::UIDelegate::setDelegate):
2708         (WebKit::UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance):
2709         * UIProcess/WebPageProxy.cpp:
2710         (WebKit::WebPageProxy::didResignInputElementStrongPasswordAppearance):
2711         * UIProcess/WebPageProxy.h:
2712         * UIProcess/WebPageProxy.messages.in:
2713         * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
2714         (API::InjectedBundle::PageUIClient::didResignInputElementStrongPasswordAppearance):
2715         * WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h:
2716         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
2717         (WebKit::InjectedBundlePageUIClient::didResignInputElementStrongPasswordAppearance):
2718         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
2719         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2720         (WebKit::WebChromeClient::inputElementDidResignStrongPasswordAppearance):
2721         * WebProcess/WebCoreSupport/WebChromeClient.h:
2722
2723 2018-04-20  Megan Gardner  <megan_gardner@apple.com>
2724
2725         Fixes for failing tests associated with switching Text Selection Assistants
2726         https://bugs.webkit.org/show_bug.cgi?id=184806
2727         <rdar://problem/39367905>
2728
2729         Reviewed by Beth Dakin and Wenson Hsieh.
2730         
2731         The major fix is the disabling the double tap noneditable text selection gesture.
2732         The other fixes are small tweaks that shouldn't even be run into with the fix to 
2733         the double tap gesture, but they are incorrect, so I am taking the opportunity to 
2734         fix them now, in case we run into them again.
2735
2736         * UIProcess/ios/WKContentViewInteraction.mm:
2737         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
2738         We should not be allowing a double tap text gestures in non-editable web content.
2739         We didn't have one with the old assistant. Fortunately, this is easily disabled.
2740         (-[WKContentView canPerformActionForWebView:withSender:]):
2741         We should not allow the lookup action if we do not actually have a selection.
2742         It is meaningless without one.
2743         (-[WKContentView selectedTextRange]):
2744         We should not return a selection to UIKit if all we have is caret selection
2745         in non-editable content. We have this for selections on Mac, but UIKit does
2746         not know how to properly handle this, and will have incorrect behavior if we 
2747         return a valid selection.
2748
2749 2018-04-20  Timothy Hatcher  <timothy@apple.com>
2750
2751         WebEvent fails to convert synthetic WebMouseEvent for automation
2752
2753         https://bugs.webkit.org/show_bug.cgi?id=184824
2754         rdar://problem/35377120
2755
2756         Reviewed by Brian Burg.
2757
2758         Add WebEvent conversions that existed in PlatformEventFactoryIOS for legacy WebKit,
2759         but never got added in WebIOSEventFactory and NativeWebMouseEvent for modern WebKit.
2760         This affected WebDriver, and some events not being deliverd to the page.
2761
2762         * Shared/NativeWebMouseEvent.h:
2763         (WebKit::NativeWebMouseEvent::nativeEvent const):
2764         * Shared/ios/NativeWebMouseEventIOS.mm: Added.
2765         (WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
2766         * Shared/ios/WebIOSEventFactory.h:
2767         * Shared/ios/WebIOSEventFactory.mm:
2768         (WebIOSEventFactory::createWebMouseEvent):
2769         * WebKit.xcodeproj/project.pbxproj:
2770
2771 2018-04-20  Michael Catanzaro  <mcatanzaro@igalia.com>
2772
2773         Unreviewed, fix -Wformat warning
2774
2775         * UIProcess/WebPageProxy.cpp:
2776         (WebKit::WebPageProxy::didFinishLoadForFrame):
2777
2778 2018-04-20  Youenn Fablet  <youenn@apple.com>
2779
2780         Make PluginData cache its web visible plugins
2781         https://bugs.webkit.org/show_bug.cgi?id=184421
2782
2783         Reviewed by Chris Dumez.
2784
2785         Rename methods.
2786         Pass an URL instead of relying on Page URL as the page URL
2787         might not always be the URL we want to check against plugins.
2788         In particular when navigation is on-going, we want to check the
2789         plugins against the being navigated URL.
2790
2791         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
2792         (WebKit::WebPluginInfoProvider::pluginInfo):
2793         (WebKit::WebPluginInfoProvider::webVisiblePluginInfo):
2794         * WebProcess/Plugins/WebPluginInfoProvider.h:
2795
2796 2018-04-19  Carlos Garcia Campos  <cgarcia@igalia.com>
2797
2798         Unreviewed. Fix GTK+ build after r230830.
2799
2800         Add SimulatedInputDispatcher.cpp to the build.
2801
2802         * CMakeLists.txt:
2803
2804 2018-04-19  Brady Eidson  <beidson@apple.com>
2805
2806         Make back forward cache work with process swapping.
2807         <rdar://problem/38676604> and https://bugs.webkit.org/show_bug.cgi?id=184793
2808
2809         Reviewed by Chris Dumez.
2810
2811         We previously saved old processes in "SuspendedPageProxy" objects.
2812         Now we reuse them when going back or forward.
2813
2814         * Platform/Logging.h:
2815
2816         * Shared/WebBackForwardListItem.cpp:
2817         (WebKit::WebBackForwardListItem::setSuspendedPage):
2818         (WebKit::WebBackForwardListItem::loggingString):
2819         * Shared/WebBackForwardListItem.h:
2820         (WebKit::WebBackForwardListItem::suspendedPage const):
2821
2822         Teach Navigation objects their source WebBackForwardListItems:
2823         * UIProcess/API/APINavigation.cpp:
2824         (API::Navigation::Navigation):
2825         (API::Navigation::loggingString const):
2826         * UIProcess/API/APINavigation.h:
2827         (API::Navigation::create):
2828         (API::Navigation::targetItem const):
2829         (API::Navigation::fromItem const):
2830         (API::Navigation::backForwardListItem): Deleted.
2831
2832         * UIProcess/Cocoa/NavigationState.mm:
2833         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2834
2835         * UIProcess/SuspendedPageProxy.cpp:
2836         (WebKit::messageNamesToIgnoreWhileSuspended):
2837         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
2838         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
2839         (WebKit::SuspendedPageProxy::webProcessDidClose):
2840         (WebKit::SuspendedPageProxy::didReceiveMessage):
2841         (WebKit::SuspendedPageProxy::loggingString const):
2842         * UIProcess/SuspendedPageProxy.h:
2843         (WebKit::SuspendedPageProxy::origin const):
2844
2845         * UIProcess/WebBackForwardList.cpp:
2846         (WebKit::WebBackForwardList::WebBackForwardList):
2847         (WebKit::WebBackForwardList::~WebBackForwardList):
2848         (WebKit::WebBackForwardList::pageClosed):
2849         (WebKit::WebBackForwardList::addItem):
2850         (WebKit::WebBackForwardList::goToItem):
2851         (WebKit::WebBackForwardList::removeAllItems):
2852         (WebKit::WebBackForwardList::clear):
2853         (WebKit::WebBackForwardList::restoreFromState):
2854         (WebKit::WebBackForwardList::filteredItemStates const):
2855         (WebKit::WebBackForwardList::itemStates const):
2856         (WebKit::WebBackForwardList::loggingString):
2857         * UIProcess/WebBackForwardList.h:
2858
2859         * UIProcess/WebNavigationState.cpp:
2860         (WebKit::WebNavigationState::createLoadRequestNavigation):
2861         (WebKit::WebNavigationState::createBackForwardNavigation):
2862         * UIProcess/WebNavigationState.h:
2863
2864         * UIProcess/WebPageProxy.cpp:
2865         (WebKit::WebPageProxy::reattachToWebProcess):
2866         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
2867         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
2868         (WebKit::WebPageProxy::loadRequest):
2869         (WebKit::WebPageProxy::loadFile):
2870         (WebKit::WebPageProxy::goToBackForwardItem):
2871         (WebKit::WebPageProxy::receivedPolicyDecision):
2872         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2873         (WebKit::WebPageProxy::didCreateMainFrame):
2874         (WebKit::WebPageProxy::didCreateSubframe):
2875         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
2876         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
2877         (WebKit::WebPageProxy::didCommitLoadForFrame):
2878         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2879         (WebKit::WebPageProxy::connectionWillOpen):
2880         (WebKit::WebPageProxy::attachToProcessForNavigation): Deleted.
2881         * UIProcess/WebPageProxy.h:
2882
2883         * UIProcess/WebProcessLifetimeTracker.cpp:
2884         (WebKit::WebProcessLifetimeTracker::webPageEnteringWebProcess):
2885         (WebKit::WebProcessLifetimeTracker::connectionWillOpen): Deleted.
2886         * UIProcess/WebProcessLifetimeTracker.h:
2887
2888         * UIProcess/WebProcessPool.cpp:
2889         (WebKit::WebProcessPool::processForNavigation):
2890         (WebKit::WebProcessPool::registerSuspendedPageProxy):
2891         (WebKit::WebProcessPool::unregisterSuspendedPageProxy):
2892         * UIProcess/WebProcessPool.h:
2893
2894         * UIProcess/WebProcessProxy.cpp:
2895         (WebKit::WebProcessProxy::suspendWebPageProxy):
2896         (WebKit::WebProcessProxy::updateBackForwardItem):
2897         (WebKit::WebProcessProxy::frameCreated):
2898         * UIProcess/WebProcessProxy.h:
2899
2900         * WebProcess/WebPage/DrawingArea.h:
2901         (WebKit::DrawingArea::attachDrawingArea):
2902
2903         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
2904         (WebKit::WebBackForwardListProxy::addItemFromUIProcess):
2905         (WebKit::WebBackForwardListProxy::addItem):
2906         * WebProcess/WebPage/WebBackForwardListProxy.h:
2907
2908         * WebProcess/WebPage/WebPage.cpp:
2909         (WebKit::m_credentialsMessenger):
2910         (WebKit::WebPage::reinitializeWebPage):
2911         (WebKit::WebPage::goToBackForwardItem):
2912         (WebKit::WebPage::restoreSessionInternal):
2913         (WebKit::WebPage::restoreSession):
2914         (WebKit::WebPage::updateBackForwardListForReattach):
2915         * WebProcess/WebPage/WebPage.h:
2916         * WebProcess/WebPage/WebPage.messages.in:
2917
2918         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2919         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2920         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
2921         (WebKit::TiledCoreAnimationDrawingArea::attachDrawingArea): Force a reattachment of the drawing
2922           area from a resumed WebProcess to the UIProcess (to make the page cache work)
2923
2924 2018-04-19  Brian Burg  <bburg@apple.com>
2925
2926         Web Automation: add support for mouse/keyboard interaction sequences
2927         https://bugs.webkit.org/show_bug.cgi?id=184603
2928         <rdar://problem/39421839>
2929
2930         Reviewed by Timothy Hatcher.
2931
2932         Add new protocol methods and WebKit support for implementing the W3C Actions API.
2933         This is a generic command for sending low-level mouse, key, and touch events to
2934         test page behavior when performing drag-and-drop, gestures, or specific keydown/keyups.
2935
2936         To implement this functionality, this patch adds SimulatedInputDispatcher, a class
2937         for dispatching input events asynchronously. Similar to the WebDriver specification,
2938         this is designed as a keyframing API. Callers set up several "input sources" such
2939         as keyboard or mouse, and then specify the states of that input source over time. The
2940         dispatcher calculates diffs between the previous and current keyframes and generates
2941         the appropriate events that would happen if a user caused the state transition.
2942
2943         For example, if a mouse input source's state changes, the dispatcher sends synthetic mousemove,
2944         mousedown, or mouseup events depending on the pre- and post-state. This is uninteresting
2945         and overcomplicated for simple key and mouse presses, but it's really designed with an
2946         eye towards supporting mousemove interpolation and touch event interpolation in later patches.
2947
2948         The strategy for dispatching events depends on the input source type; right now, these
2949         map directly to the existing platformSimulate{Mouse, Keyboard}Interaction methods. In
2950         the future, the dispatch strategy may be elaborated for interpolated mousemove events.
2951
2952         This patch depends on support added in bug 184462.
2953
2954         No tests yet. When this command is hooked up to a driver, the code will be exercised by
2955         W3C actions test suite, which is fairly complex at this point relative to end-user code.
2956
2957         * UIProcess/Automation/Automation.json: Add new types and commands.
2958
2959         * UIProcess/Automation/SimulatedInputDispatcher.h: Added.
2960         (WebKit::SimulatedInputSourceState::emptyState):
2961         (WebKit::SimulatedInputSource::create):
2962         (WebKit::SimulatedInputSource::SimulatedInputSource):
2963         (WebKit::SimulatedInputDispatcher::Client::~Client):
2964         Add structs for input source, source state, and keyframe.
2965         The dispatcher's client interface is implemented by WebAutomationSession.
2966
2967         (WebKit::SimulatedInputDispatcher::create):
2968         * UIProcess/Automation/SimulatedInputDispatcher.cpp: Added.
2969         (WebKit::SimulatedInputKeyFrame::SimulatedInputKeyFrame):
2970         (WebKit::SimulatedInputKeyFrame::maximumDuration const):
2971         (WebKit::SimulatedInputKeyFrame::keyFrameFromStateOfInputSources):
2972         (WebKit::SimulatedInputKeyFrame::keyFrameToResetInputSources):
2973         (WebKit::SimulatedInputDispatcher::SimulatedInputDispatcher):
2974         (WebKit::SimulatedInputDispatcher::~SimulatedInputDispatcher):
2975         (WebKit::SimulatedInputDispatcher::isActive const):
2976         (WebKit::SimulatedInputDispatcher::keyFrameTransitionDurationTimerFired):
2977         (WebKit::SimulatedInputDispatcher::isKeyFrameTransitionComplete const):
2978         (WebKit::SimulatedInputDispatcher::transitionToNextKeyFrame):
2979         (WebKit::SimulatedInputDispatcher::transitionToNextInputSourceState):
2980         (WebKit::SimulatedInputDispatcher::transitionBetweenKeyFrames):
2981         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
2982         (WebKit::SimulatedInputDispatcher::run):
2983         (WebKit::SimulatedInputDispatcher::cancel):
2984         (WebKit::SimulatedInputDispatcher::finishDispatching):
2985         The dispatcher handles one interaction at a time. The interaction is described
2986         by an array of keyframes, and each keyframe has an array of states. The dispatcher
2987         transitions between keyframes by sequentially and asynchronously emitting events
2988         that cause each input source state to transition as desired. Keyframe transitions
2989         are additionally gated by a "maximum duration" timer. Each step that the dispatcher
2990         executes is asynchronous, so the dispatcher keeps most state in members and uses
2991         error argument lambdas as completion handlers for various async things.
2992
2993         * UIProcess/Automation/WebAutomationSession.h:
2994         * UIProcess/Automation/WebAutomationSession.cpp:
2995         (WebKit::WebAutomationSession::WebAutomationSession):
2996         (WebKit::WebAutomationSession::inputDispatcherForPage):
2997         (WebKit::WebAutomationSession::inputSourceForType const):
2998         Add canonical input sources that are used to keep track of state across
2999         interaction sequences.
3000
3001         (WebKit::WebAutomationSession::isSimulatingUserInteraction const):
3002         (WebKit::WebAutomationSession::mouseEventsFlushedForPage):
3003         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
3004         Remove m_simulatingUserInteraction since it can be computed based on other members.
3005
3006         (WebKit::WebAutomationSession::willClosePage):
3007         If the page is being torn down, stop the dispatcher if needed and cancel any
3008         callbacks waiting for mouse/key events to be retired.
3009
3010         (WebKit::WebAutomationSession::simulateMouseInteraction):
3011         (WebKit::WebAutomationSession::simulateKeyboardInteraction):
3012         Add easy-to-use async methods for simulating mouse and key events. These are
3013         hooked up to SimulatedInputDispatcher using async completion handlers.
3014
3015         (WebKit::protocolMouseButtonToWebMouseEventButton):
3016         (WebKit::WebAutomationSession::performMouseInteraction):
3017         (WebKit::WebAutomationSession::performKeyboardInteractions):
3018         Adjust some naming.
3019
3020         (WebKit::simulatedInputSourceTypeFromProtocolSourceType):
3021         (WebKit::WebAutomationSession::performInteractionSequence):
3022         (WebKit::WebAutomationSession::cancelInteractionSequence):
3023         Add command handlers for the new action commands in Automation protocol.
3024
3025         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
3026         (WebKit::mouseButtonToGdkButton):
3027         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
3028         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
3029         (WebKit::WebAutomationSession::platformSimulateKeyStroke): Deleted.
3030         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
3031         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
3032         (WebKit::WebAutomationSession::platformSimulateKeyStroke): Deleted.
3033         Rename the keyboard platform method to match the naming of the mouse platform method.
3034         Take advantage of the 'using' alias to make the tedious switches easier to read.
3035
3036         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
3037         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
3038         (WebKit::virtualKeyHasStickyModifier):
3039         (WebKit::keyCodeForVirtualKey):
3040         (WebKit::eventModifierFlagsForVirtualKey):
3041         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
3042         (WebKit::WebAutomationSession::platformSimulateKeySequence):
3043         (WebKit::keyHasStickyModifier): Deleted.
3044         (WebKit::WebAutomationSession::platformSimulateKeyStroke): Deleted.
3045         Allow the keyboard simulation method to take a virtual key and unichar to better
3046         match how this is used by the Perform Actions command and its machinery.
3047
3048         * WebKit.xcodeproj/project.pbxproj:
3049
3050 2018-04-19  Jiewen Tan  <jiewen_tan@apple.com>
3051
3052         Remove access to keychain from the WebContent process
3053         https://bugs.webkit.org/show_bug.cgi?id=184428
3054         <rdar://problem/13150903>
3055
3056         Reviewed by Brent Fulgham.
3057
3058         Part 1.
3059
3060         Remove com.apple.identities from WebContent-iOS.entitlements, which is needed to encode/decode NSError’s userInfo[NSErrorClientCertificateChainKey]
3061         when the corresponding NSErorr is relayed through WebContent Process from Networking Process to UI Process after a HTTPS client certificate
3062         authentication is rejected becuase of bad certificates. This patch implements corresponding workarounds as well. The workaround works for mac, too.
3063
3064         Sadly, this change can only be tested manually at this moment. Please refer to the radar for testing steps.
3065
3066         * Configurations/WebContent-iOS.entitlements:
3067         * Shared/mac/WebCoreArgumentCodersMac.mm:
3068         (IPC::encodeNSError):
3069         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3070         (WebKit::WebProcessPool::platformInitialize):
3071
3072 2018-04-19  David Kilzer  <ddkilzer@apple.com>
3073
3074         Enable Objective-C weak references
3075         <https://webkit.org/b/184789>
3076         <rdar://problem/39571716>
3077
3078         Reviewed by Dan Bernstein.
3079
3080         * Configurations/Base.xcconfig:
3081         (CLANG_ENABLE_OBJC_WEAK): Enable.
3082
3083 2018-04-19  Youenn Fablet  <youenn@apple.com>
3084
3085         Web Inspector backend should get headers & cookies from network process separately from resource requests
3086         https://bugs.webkit.org/show_bug.cgi?id=184396
3087         <rdar://problem/38877384>
3088
3089         Reviewed by Brian Burg.
3090
3091         Add support for storing response and network metrics for every resource load.
3092         This is made conditional on inspector being activated.
3093         NetworkConnectionToWebProcess keeps a response and network metrics for every load.
3094         This is cleared when inspector is going away or when a web process requests
3095         the data.
3096
3097         WebLoaderStrategy gets this data through synchronous IPC.
3098         Synchronous IPC is a temporary implementation until Inspector code gets refactored.
3099
3100         Updated WebLoaderStrategy to pass the sourceOrigin for every NetworkResourceLoader.
3101         This activates additional sanitization based on cross origin status.
3102
3103         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3104         (WebKit::NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled):
3105         * NetworkProcess/NetworkConnectionToWebProcess.h:
3106         (WebKit::NetworkConnectionToWebProcess::takeNetworkLoadInformationResponse):
3107         (WebKit::NetworkConnectionToWebProcess::takeNetworkLoadInformationMetrics):
3108         (WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationResponse):
3109         (WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics):
3110         (WebKit::NetworkConnectionToWebProcess::removeNetworkLoadInformation):
3111         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3112         * NetworkProcess/NetworkResourceLoader.cpp:
3113         (WebKit::NetworkResourceLoader::didReceiveResponse):
3114         (WebKit::NetworkResourceLoader::didFinishLoading):
3115         (WebKit::NetworkResourceLoader::didFailLoading):
3116         * WebProcess/Network/WebLoaderStrategy.cpp:
3117         (WebKit::WebLoaderStrategy::responseFromResourceLoadIdentifier):
3118         (WebKit::WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier):
3119         * WebProcess/Network/WebLoaderStrategy.h:
3120         * WebProcess/Network/WebResourceLoader.cpp:
3121         (WebKit::WebResourceLoader::didReceiveResponse):
3122
3123 2018-04-19  Wenson Hsieh  <wenson_hsieh@apple.com>
3124
3125         [Extra zoom mode] Add a mechanism to extend the height of the layout viewport in extra zoom mode
3126         https://bugs.webkit.org/show_bug.cgi?id=184782
3127         <rdar://problem/38346712>
3128
3129         Reviewed by Tim Horton.
3130
3131         In extra zoom mode, at initial scale, fixed position elements may take up a large portion of the viewport. This
3132         leaves little room for non-fixed-position elements; to improve this experience, we introduce a mechanism to
3133         extend the height of the layout viewport. By default, the layout viewport size is determined by the FrameView's
3134         baseLayoutViewportSize, and passed into FrameView::computeUpdatedLayoutViewportRect in the client layer; in
3135         extra zoom mode, if the layout viewport is shorter than the document width, we try to double the height of the
3136         layout viewport and clamp to the document height if necessary.
3137
3138         * Shared/WebPreferences.yaml:
3139
3140         Add a new preference to determine the factor by which we should expand the height of the layout viewport. By
3141         default, this is 0 (no increase in layout viewport height); in extra zoom mode, this is 1, which means we'll
3142         increase the layout viewport's height by 1x the default height.
3143
3144         * Shared/WebPreferencesDefaultValues.h:
3145         * UIProcess/API/Cocoa/WKWebView.mm:
3146         (-[WKWebView activeMinimumLayoutSizes:]):
3147
3148         Fixes a bug when computing the active minimum layout size. If a minimum allowed layout width is specified, we
3149         clamp the active layout width (normally the view size) so that it is no less than the minimum allowed layout
3150         width. However, the height is currently unaffected, which causes FrameView::baseLayoutViewportSize to return a
3151         bogus size, where the width is scaled to 320px but the height isn't. Instead, we should scale the layout height
3152         to match the new width here.
3153
3154         * UIProcess/ios/WebPageProxyIOS.mm:
3155         (WebKit::WebPageProxy::computeCustomFixedPositionRect const):
3156
3157         Expand the base viewport layout size if necessary, given the expansion factor in WebPreferences.
3158
3159         * WebProcess/WebPage/WebPage.cpp:
3160         (WebKit::WebPage::updatePreferences):
3161         * WebProcess/WebPage/ios/WebPageIOS.mm:
3162         (WebKit::WebPage::dynamicViewportSizeUpdate):
3163
3164         Expand the base viewport layout size if necessary, given the expansion factor in Settings.
3165
3166 2018-04-19  Brian Burg  <bburg@apple.com>
3167
3168         Web Automation: simulated mouse interactions should not be done until associated DOM events have been dispatched
3169         https://bugs.webkit.org/show_bug.cgi?id=184462
3170         <rdar://problem/39323336>
3171
3172         Reviewed by Carlos Garcia Campos and Tim Horton.
3173
3174         Covered by existing layout tests and actions endpoints in WebDriver test suite.
3175
3176         In preparation for implementing the W3C WebDriver command "Perform Actions", we need a way to
3177         know when a simulated mouse event has been fully processed by WebProcess and it is okay to continue
3178         to dispatch more simulated events.
3179
3180         This patch makes mouse events go through a queue as they are delivered to WebPageProxy. The approach
3181         is very similar to how key events are handled. In the key event case, lots of WebEvents can come out
3182         of typing one keystroke, so these need to be queued up and retired one by one when the WebProcess has
3183         finished handling each event. In some mouse event cases---particularly fake mouse moves---there can
3184         also be more than one mouse event waiting to be handled by WebProcess.
3185
3186         In the past, these queued mouse events were tracked with several member variables as different
3187         use cases emerged. These are all replaced with ordinary deque operations, such as peeking or
3188         checking the queue length.
3189
3190         * Platform/Logging.h: Add logging channel for mouse events.
3191         * UIProcess/Automation/WebAutomationSession.cpp:
3192         (WebKit::AutomationCommandError::toProtocolString): Add type-safe helper class for command errors.
3193         In future patches we can hide knowledge of how this is sent over the protocol by relying more on
3194         the convenience constructors and .toProtocolString() method.
3195
3196         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
3197         This section needs adjustments. Since performMouseInteraction now depends on key events being processed
3198         prior to returning from the command, we need to abort any key event callbacks that are pending if an
3199         alert pops up as a result of sending a mousedown event. Any mouse events that are still queued will
3200         be handled when the alert is dismissed and the nested run loop exits.
3201
3202         (WebKit::WebAutomationSession::mouseEventsFlushedForPage):
3203         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
3204         Modernize this a bit. Don't spread knowledge about how commands are sent back out into event handling code.
3205         Our wrapper callbacks in performXXXInteraction handle the protocol-specific details of the response.
3206
3207         (WebKit::WebAutomationSession::performMouseInteraction):
3208         Add code similar to performKeyboardInteractions so that the command doesn't finish until the mouse
3209         event has been fully handled. Unlike keyboards, sometimes mouse interactions don't turn into WebEvents
3210         so we also need to handle the case where there is nothing to be waited on because hit testing did
3211         not return a target to deliver the event to.
3212
3213         (WebKit::WebAutomationSession::performKeyboardInteractions):
3214         Modernize a little bit to use generic callbacks rather than protocol-generated callbacks in the
3215         event waiting/handling code. Now it matches the types used for the mouse event case.
3216
3217         * UIProcess/Automation/WebAutomationSession.h:
3218         (WebKit::AutomationCommandError::AutomationCommandError):
3219         Add a helper struct to hold an enumerated error name and an optional free-form error message.
3220
3221         * UIProcess/WebPageProxy.h:
3222         * UIProcess/WebPageProxy.cpp:
3223         (WebKit::webMouseEventTypeString):
3224         (WebKit::webKeyboardEventTypeString):
3225         (WebKit::WebPageProxy::handleMouseEvent):
3226         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
3227         Split the old method into handleMouseEvent (called by other code) and processNextQueuedMouseEvent.
3228         The latter sends the next mouse event to WebProcess, and can be triggered in didReceiveEvent
3229         if there are more mouse events to be sent to WebProcess.
3230
3231         (WebKit::WebPageProxy::isProcessingMouseEvents const): Added.
3232         (WebKit::WebPageProxy::currentlyProcessedMouseDownEvent): Reimplemented on top of the deque.
3233         (WebKit::WebPageProxy::didReceiveEvent):
3234         Unify the code paths for different mouse event types to all use the deque. They also will
3235         notify the automation session if there are no more mouse events to send (i.e., interaction is over).
3236
3237         (WebKit::WebPageProxy::resetStateAfterProcessExited): Add handling for new map.
3238
3239 2018-04-19  Andy Estes  <aestes@apple.com>
3240
3241         [iOS] Implement find-in-page in the new WKPDFView
3242         https://bugs.webkit.org/show_bug.cgi?id=184654
3243         <rdar://problem/39331654>
3244
3245         Reviewed by Tim Horton.
3246
3247         This is theoretically covered by existing WKPDFView API tests, but that's currently blocked
3248         by <rdar://problem/39475542>.
3249
3250         * UIProcess/ios/WKPDFView.mm:
3251         (stringCompareOptions):
3252
3253         Mapped _WKFindOptions to NSStringCompareOptions.
3254
3255         (-[WKPDFView _resetFind]):
3256
3257         Cancelled an in-progress search and reset the search state.
3258
3259         (-[WKPDFView _findString:withOptions:maxCount:completion:]):
3260
3261         Stored the completion block, find string, and max count, then called
3262         -[PDFHostViewController findString:withOptions:].
3263
3264         (-[WKPDFView web_countStringMatches:options:maxCount:]):
3265
3266         Called -_findString:withOptions:maxCount:completion: with a completion block that calls
3267         FindClient::didCountStringMatches() with _findStringCount.
3268
3269         (-[WKPDFView _computeFocusedSearchResultIndexWithOptions:didWrapAround:]):
3270
3271         Computed the focused search result index, taking _findStringCount and wrap-around into
3272         account. There are two interesting cases to mention here:
3273
3274         1. We can't change focus while a search is in progress, because we can't properly handle
3275         wrap-around without a _findStringCount. If a search is in progress, store the requested
3276         focus change in _focusedSearchResultPendingOffset, which will be applied once the search
3277         finishes.
3278
3279         2. If wrap-around is about to happen but the find options do not allow it, we need to call
3280         FindClient::didFailToFindString(). Handle this by returning NO, which will tell
3281         -_focusOnSearchResultWithOptions: to call didFailToFindString() if a search is not in
3282         progress.
3283
3284         (-[WKPDFView _focusOnSearchResultWithOptions:]):
3285
3286         If -_computeFocusedSearchResultIndexWithOptions:didWrapAround: failed while a search is in
3287         progress, just return early. Otherwise, call FindClient::didFailToFindString(). If
3288         computing the index did not fail, call -[PDFHostViewController focusOnSearchResultAtIndex:]
3289         to change focus and then call FindClient::didFindString() to inform the client.
3290
3291         (-[WKPDFView web_findString:options:maxCount:]):
3292
3293         If the find string is equal to _findString, change focus. Otherwise, start a new search.
3294
3295         (-[WKPDFView web_hideFindUI]):
3296
3297         Called -_resetFind.
3298
3299         (-[WKPDFView pdfHostViewController:findStringUpdate:done:]):
3300
3301         Stored the count in _findStringCount and called _findCompletion once the search is done.
3302
3303 2018-04-17  Filip Pizlo  <fpizlo@apple.com>
3304
3305         The InternalFunction hierarchy should be in IsoSubspaces
3306         https://bugs.webkit.org/show_bug.cgi?id=184721
3307
3308         Reviewed by Saam Barati.
3309
3310         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
3311         (WebKit::JSNPMethod::subspaceForImpl):
3312         * WebProcess/Plugins/Netscape/JSNPMethod.h:
3313         (WebKit::JSNPMethod::create): Deleted.
3314         (WebKit::JSNPMethod::npIdentifier const): Deleted.
3315         (WebKit::JSNPMethod::createStructure): Deleted.
3316         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
3317         (WebKit::JSNPObject::subspaceForImpl):
3318         * WebProcess/Plugins/Netscape/JSNPObject.h:
3319         (WebKit::JSNPObject::create): Deleted.
3320         (WebKit::JSNPObject::npObject const): Deleted.
3321         (WebKit::JSNPObject::createStructure): Deleted.
3322
3323 2018-04-19  Brady Eidson  <beidson@apple.com>
3324
3325         Add globally-unique HistoryItem identifiers (and have WebKit2 adopt them).
3326         <rdar://problem/39533949> and https://bugs.webkit.org/show_bug.cgi?id=184750
3327
3328         Reviewed by Ryosuke Niwa.
3329
3330         With process swapping, the assumption that "back/forward items belong to a process" is invalid.
3331
3332         All HistoryItem/WebBackForwardListItems now need to be uniquely identified across all processes,
3333         no matter which process they originated from, so there will never be a collision in the UIProcess.
3334
3335         This allows us to:
3336         - Have the UIProcess to keep a single process-wide map of all WebBackForwardListItems
3337         - Get rid of the per-WebProcess WebBackForwardListItem map
3338         - Simplify a lot of WebBackForwardList(Proxy) code that no longer needs to keep that per-process
3339           map in sync
3340         - Get rid of a lot of other ancillary code
3341
3342         * Shared/SessionState.cpp:
3343         (WebKit::BackForwardListItemState::decode):
3344         * Shared/SessionState.h:
3345
3346         * Shared/WebBackForwardListItem.cpp:
3347         (WebKit::WebBackForwardListItem::WebBackForwardListItem):
3348         (WebKit::WebBackForwardListItem::~WebBackForwardListItem):
3349         (WebKit::WebBackForwardListItem::itemForID):
3350         (WebKit::WebBackForwardListItem::highestUsedItemID): Deleted.
3351         * Shared/WebBackForwardListItem.h:
3352         (WebKit::WebBackForwardListItem::itemID const):
3353
3354         * Shared/WebPageCreationParameters.cpp:
3355         (WebKit::WebPageCreationParameters::encode const):
3356         (WebKit::WebPageCreationParameters::decode):
3357         * Shared/WebPageCreationParameters.h:
3358
3359         * UIProcess/WebBackForwardList.cpp:
3360         (WebKit::WebBackForwardList::itemForID):
3361         (WebKit::WebBackForwardList::pageClosed):
3362         (WebKit::WebBackForwardList::addItem):
3363         (WebKit::WebBackForwardList::restoreFromState):
3364         (WebKit::generateWebBackForwardItemID): Deleted.
3365         * UIProcess/WebBackForwardList.h:
3366
3367         * UIProcess/WebPageProxy.cpp:
3368         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
3369         (WebKit::WebPageProxy::initializeWebPage):
3370         (WebKit::WebPageProxy::willGoToBackForwardListItem):
3371         (WebKit::WebPageProxy::restoreFromSessionState):
3372         (WebKit::WebPageProxy::backForwardAddItem):
3373         (WebKit::WebPageProxy::backForwardGoToItem):
3374         (WebKit::WebPageProxy::backForwardItemAtIndex):
3375         (WebKit::WebPageProxy::creationParameters):
3376         (WebKit::WebPageProxy::backForwardRemovedItem):
3377         * UIProcess/WebPageProxy.h:
3378         * UIProcess/WebPageProxy.messages.in:
3379  
3380         * UIProcess/WebProcessPool.cpp: Explicitly set the UIProcess Process::Identifier so it starts
3381           at "1" and then the first child process starts at "2", etc etc.
3382
3383         * UIProcess/WebProcessProxy.cpp:
3384         (WebKit::WebProcessProxy::removeWebPage):
3385         (WebKit::WebProcessProxy::checkURLReceivedFromWebProcess):
3386         (WebKit::WebProcessProxy::updateBackForwardItem):
3387         (WebKit::WebProcessProxy::webBackForwardItem const): Deleted.
3388         (WebKit::WebProcessProxy::registerNewWebBackForwardListItem): Deleted.
3389         (WebKit::WebProcessProxy::removeBackForwardItem): Deleted.
3390         (WebKit::WebProcessProxy::addOrUpdateBackForwardItem): Deleted.
3391         * UIProcess/WebProcessProxy.h:
3392         * UIProcess/WebProcessProxy.messages.in:
3393
3394         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
3395         (WebKit::toBackForwardListItemState):
3396         (WebKit::applyFrameState):
3397         (WebKit::toHistoryItem):
3398         (WebKit::toPageState): Deleted.
3399         * WebProcess/WebCoreSupport/SessionStateConversion.h:
3400
3401         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3402         (WebKit::WebFrameLoaderClient::shouldGoToHistoryItem const):
3403
3404         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
3405         (WebKit::WebBackForwardListProxy::addItemFromUIProcess):
3406         (WebKit::WK2NotifyHistoryItemChanged):
3407         (WebKit::WebBackForwardListProxy::itemForID):
3408         (WebKit::WebBackForwardListProxy::removeItem):
3409         (WebKit::WebBackForwardListProxy::addItem): Previously this was a two-step process of adding an item
3410           to the process and then associating it with the page. Now it's just directly adding it to the page,
3411           so we don't need to call updateBackForwardItem first.
3412         (WebKit::WebBackForwardListProxy::goToItem):
3413         (WebKit::WebBackForwardListProxy::itemAtIndex):
3414         (WebKit::WebBackForwardListProxy::close):
3415         (WebKit::historyItemToIDMap): Deleted.
3416         (WebKit::generateHistoryItemID): Deleted.
3417         (WebKit::WebBackForwardListProxy::setHighestItemIDFromUIProcess): Deleted.
3418         (WebKit::updateBackForwardItem): Deleted.
3419         (WebKit::WebBackForwardListProxy::idForItem): Deleted.
3420         * WebProcess/WebPage/WebBackForwardListProxy.h:
3421
3422         * WebProcess/WebPage/WebPage.cpp:
3423         (WebKit::m_credentialsMessenger):
3424         (WebKit::WebPage::goToBackForwardItem):
3425         (WebKit::WebPage::restoreSessionInternal):
3426         (WebKit::WebPage::didRemoveBackForwardItem):
3427         * WebProcess/WebPage/WebPage.h:
3428         * WebProcess/WebPage/WebPage.messages.in:
3429
3430 2018-04-19  Youenn Fablet  <youenn@apple.com>
3431
3432         NetworkProcess should use CSP/content blockers for sync XHR
3433         https://bugs.webkit.org/show_bug.cgi?id=184760
3434
3435         Reviewed by Chris Dumez.
3436
3437         Setting CSP/ContentBlockers parameters for sync XHR loads.
3438         * NetworkProcess/NetworkResourceLoader.cpp:
3439
3440 2018-04-19  Nan Wang  <n_wang@apple.com>
3441
3442         AX: AOM: respect the accessibility setting for dispatching the accessible events
3443         https://bugs.webkit.org/show_bug.cgi?id=184619
3444
3445         Reviewed by Ryosuke Niwa.
3446
3447         Linked libAccessibility on iOS and macOS&nb