1edaa625f3c6ce77d66c2e44108721c0f465ff7f
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-06-03  Andy Estes  <aestes@apple.com>
2
3         [iOS] Add a needed networking process entitlement
4         https://bugs.webkit.org/show_bug.cgi?id=186246
5         <rdar://problem/39578861>
6
7         Reviewed by Brent Fulgham.
8
9         Also sorted the existing entitlements.
10
11         * Configurations/Network-iOS.entitlements:
12
13 2018-06-03  Brent Fulgham  <bfulgham@apple.com>
14
15         Make sure that the fencePort received over IPC has the expected disposition (SEND)
16         https://bugs.webkit.org/show_bug.cgi?id=186211
17         <rdar://problem/37814171>
18
19         Reviewed by Geoffrey Garen.
20
21         It is possible (though very unlikely) for a message to be recevied that has the wrong mach port disposition.
22         If this happens, we shouldn't manipulate the passed mach_port_t or pass it on to other API. We already
23         drop messages that violate this expectation in the IPC layer, but code handling IPC::Attachment data types
24         are not checking this value.
25
26         * WebProcess/WebPage/WebPage.cpp:
27         (WebKit::WebPage::setTopContentInsetFenced):
28         * WebProcess/cocoa/VideoFullscreenManager.mm:
29         (WebKit::VideoFullscreenManager::setVideoLayerFrameFenced):
30
31 2018-06-02  Chris Dumez  <cdumez@apple.com>
32
33         Unreviewed, rolling out r232275.
34
35         May have caused a ~1% PLT regression on iOS
36
37         Reverted changeset:
38
39         "Store 0-lifetime stylesheets / scripts into the disk cache
40         for faster history navigations"
41         https://bugs.webkit.org/show_bug.cgi?id=186060
42         https://trac.webkit.org/changeset/232275
43
44 2018-06-02  Jeremy Jones  <jeremyj@apple.com>
45
46         Make WKWebView firstResponder after entering or exiting fullscreen.
47         https://bugs.webkit.org/show_bug.cgi?id=186088
48         rdar://problem/40387859
49
50         Reviewed by Jer Noble.
51
52         Update first responder when WKWebView moves to a new window, otherwise there won't be a first responder.
53
54         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
55         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
56         (-[WKFullScreenWindowController _completedExitFullScreen]):
57
58 2018-06-02  Jeremy Jones  <jeremyj@apple.com>
59
60         Exit fullscreen when javascript alerts are presented.
61         https://bugs.webkit.org/show_bug.cgi?id=185619
62         rdar://problem/35724264
63
64         Reviewed by Jer Noble.
65
66         Prevent users from being trapped in fullscreen by alert cycles.
67         Prevent fullscreen from becoming unresponsive due to alerts hidden behind fullscreen.
68
69         Fullscreen exit is initiated here in the UI process so that fullscreen UI is torn down immediately,
70         before the alert is shown.
71
72         * UIProcess/WebPageProxy.cpp:
73         (WebKit::WebPageProxy::exitFullscreenImmediately):
74         (WebKit::WebPageProxy::runJavaScriptAlert):
75         (WebKit::WebPageProxy::runJavaScriptConfirm):
76         (WebKit::WebPageProxy::runJavaScriptPrompt):
77         * UIProcess/WebPageProxy.h:
78
79 2018-06-02  Youenn Fablet  <youenn@apple.com>
80
81         Add a sandbox profile for com.cisco.webex.plugin.gpc64 plugin
82         https://bugs.webkit.org/show_bug.cgi?id=186110
83
84         Reviewed by Brent Fulgham.
85
86         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: Webex needs to create some symlinks.
87         * Resources/PlugInSandboxProfiles/com.cisco.webex.plugin.gpc64.sb: Added.
88         * WebKit.xcodeproj/project.pbxproj:
89
90 2018-06-01  Wenson Hsieh  <wenson_hsieh@apple.com>
91
92         [Extra zoom mode] The user should always be able to double tap to zoom to a scale of at least 1
93         https://bugs.webkit.org/show_bug.cgi?id=186209
94         <rdar://problem/40529255>
95
96         Reviewed by Tim Horton.
97
98         Tweaks the way double-tap-to-zoom scales are determined in extra zoom mode. Rather than zooming to make the 50th
99         and 90th percentiles of text in the document legible, only consider the 90th percentile of text size when
100         determining zoom scale, and fix the other potential zoom scale at 1; additionally, if the zoom scales are close
101         (within 0.3 of each other), snap the lower zoom scale to the higher value.
102
103         This results in the following changes in behavior:
104         -   Enables double tap to zoom in cases where all the text in the page is already legible.
105         -   On pages with mobile viewports, usually allows the user to toggle between initial scale and a scale of 1.
106         -   If a significant portion of text is unusually small, the zoomed-in scale may exceed 1.
107
108         Test: fast/events/extrazoom/double-tap-to-zoom-with-large-text.html
109
110         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
111         (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
112         (WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales):
113
114 2018-06-01  Jeremy Jones  <jeremyj@apple.com>
115
116         Keyboard focus should exit fullscreen.
117         https://bugs.webkit.org/show_bug.cgi?id=185617
118         rdar://problem/34697938
119
120         Reviewed by Ryosuke Niwa.
121
122         While in element fullscreen, initiating keyboard focus should exit fullscreen in iOS.
123
124         * WebProcess/WebPage/WebPage.cpp:
125         (WebKit::WebPage::elementDidFocus):
126
127 2018-06-01  Chris Dumez  <cdumez@apple.com>
128
129         Regression(r230567): Unable to log into twitter.com in private sessions
130         https://bugs.webkit.org/show_bug.cgi?id=186205
131         <rdar://problem/40670799>
132
133         Reviewed by Youenn Fablet.
134
135         We were using the same SWServer for all private sessions and the SWServer's sessionID would
136         be legacyPrivateSessionID(). As a result, the service worker's sessionID would be legacyPrivateSessionID()
137         as well and would not match the sessionID of its client pages. This sessionID mismatch was 
138         causing the breakage.
139
140         Instead of using the same SWServer of all private sessions, we now go back to using a SWServer
141         per private session. However, we now make sure that the SWServer gets destroyed whenever its
142         corresponding session gets destroyed.
143
144         * NetworkProcess/NetworkProcess.cpp:
145         (WebKit::NetworkProcess::destroySession):
146         * NetworkProcess/cache/CacheStorageEngine.cpp:
147         (WebKit::CacheStorage::Engine::from):
148         * StorageProcess/StorageProcess.cpp:
149         (WebKit::StorageProcess::destroySession):
150         (WebKit::StorageProcess::swServerForSession):
151         * StorageProcess/StorageProcess.h:
152         * StorageProcess/StorageProcess.messages.in:
153         * UIProcess/WebProcessPool.cpp:
154         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
155         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
156         (WebKit::WebsiteDataStore::~WebsiteDataStore):
157
158         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
159         * UIProcess/WebsiteData/WebsiteDataStore.h:
160         (WebKit::WebsiteDataStore::weakPtrFactory const):
161         Fix memory leak caused by a reference cycle between the WebsiteDataStore and its
162         WebResourceLoadStatisticsStore, by using WeakPtr to break the cycle. This was causing
163         us to leak WebsiteDataStore objects, which would prevent the destruction of sessions.
164
165
166 2018-06-01  Youenn Fablet  <youenn@apple.com>
167
168         Add an option to restrict communication to localhost sockets
169         https://bugs.webkit.org/show_bug.cgi?id=186208
170
171         Reviewed by Eric Carlson.
172
173         Implement restriction to localhost sockets by setting any IP address to 127.0.0.1.
174         This is done on WebProcess side just before requesting to open the socket by NetworkProcess.
175
176         * WebProcess/Network/webrtc/LibWebRTCNetwork.h:
177         (WebKit::LibWebRTCNetwork::disableNonLocalhostConnections):
178         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
179         (WebKit::LibWebRTCProvider::disableNonLocalhostConnections):
180         (WebKit::LibWebRTCProvider::registerMDNSName):
181         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
182         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
183         (WebKit::prepareSocketAddress):
184         (WebKit::LibWebRTCSocketFactory::CreateServerTcpSocket):
185         (WebKit::LibWebRTCSocketFactory::CreateUdpSocket):
186         (WebKit::LibWebRTCSocketFactory::CreateClientTcpSocket):
187         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h:
188
189 2018-06-01  Chris Dumez  <cdumez@apple.com>
190
191         Regression(r230876): Swipe navigation snapshot may get removed too early
192         https://bugs.webkit.org/show_bug.cgi?id=186168
193         <rdar://problem/39743617>
194
195         Reviewed by Tim Horton.
196
197         The swipe navigation snapshot would get removed too early when receiving a paint
198         event after requesting a history navigation but before the provisional load has
199         actually started. This is because of the asynchronous navigation policy decision
200         which occurs after requesting to navigate. To address the issue, we now start
201         listening for events only after the provisional load has started.
202
203         * UIProcess/API/Cocoa/WKWebView.mm:
204         (-[WKWebView _didStartProvisionalLoadForMainFrame]):
205         * UIProcess/API/Cocoa/WKWebViewInternal.h:
206         * UIProcess/Cocoa/ViewGestureController.cpp:
207         (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
208         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
209         (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
210         * UIProcess/Cocoa/ViewGestureController.h:
211         * UIProcess/ios/PageClientImplIOS.mm:
212         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame):
213         * UIProcess/ios/ViewGestureControllerIOS.mm:
214         (WebKit::ViewGestureController::endSwipeGesture):
215         * UIProcess/mac/PageClientImplMac.h:
216         * UIProcess/mac/PageClientImplMac.mm:
217         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame):
218         * UIProcess/mac/ViewGestureControllerMac.mm:
219         (WebKit::ViewGestureController::endSwipeGesture):
220
221 2018-06-01  Jiewen Tan  <jiewen_tan@apple.com>
222
223         Unreviewed, build fix for r232276.
224
225         iOS sandbox profiles don't preprocess macros. Therefore, remove the whole
226         macro condition block.
227
228         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
229
230 2018-06-01  Sihui Liu  <sihui_liu@apple.com>
231
232         Stop using StorageTracker.db in LocalStorageDatabaseTracker
233         https://bugs.webkit.org/show_bug.cgi?id=186104
234
235         Reviewed by Geoffrey Garen.
236
237         Stop using StorageTracker.db and stop caching origins in LocalStorageDatabaseTracker for efficiency 
238         and simplicity. Since functions in LocalStorageDatabaseTracker are not frequently called, we get 
239         little benefits from caching origins.
240
241         * Platform/Logging.h:
242         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
243         (WKKeyValueStorageManagerGetStorageDetailsByOrigin):
244         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
245         (WebKit::LocalStorageDatabaseTracker::LocalStorageDatabaseTracker):
246         (WebKit::LocalStorageDatabaseTracker::didOpenDatabaseWithOrigin):
247         (WebKit::LocalStorageDatabaseTracker::deleteDatabaseWithOrigin):
248         (WebKit::LocalStorageDatabaseTracker::deleteAllDatabases):
249         (WebKit::LocalStorageDatabaseTracker::databasesModifiedSince):
250         (WebKit::LocalStorageDatabaseTracker::origins const):
251         (WebKit::LocalStorageDatabaseTracker::originDetails):
252         (WebKit::LocalStorageDatabaseTracker::databasePath const):
253         (WebKit::fileCreationTime): Deleted.
254         (WebKit::fileModificationTime): Deleted.
255         (WebKit::LocalStorageDatabaseTracker::trackerDatabasePath const): Deleted.
256         (WebKit::LocalStorageDatabaseTracker::openTrackerDatabase): Deleted.
257         (WebKit::LocalStorageDatabaseTracker::importOriginIdentifiers): Deleted.
258         (WebKit::LocalStorageDatabaseTracker::updateTrackerDatabaseFromLocalStorageDatabaseFiles): Deleted.
259         (WebKit::LocalStorageDatabaseTracker::addDatabaseWithOriginIdentifier): Deleted.
260         (WebKit::LocalStorageDatabaseTracker::removeDatabaseWithOriginIdentifier): Deleted.
261         (WebKit::LocalStorageDatabaseTracker::pathForDatabaseWithOriginIdentifier): Deleted.
262         * UIProcess/WebStorage/LocalStorageDatabaseTracker.h:
263         * UIProcess/WebStorage/StorageManager.h:
264
265 2018-06-01  Michael Catanzaro  <mcatanzaro@igalia.com>
266
267         [GTK] Crash in WebKitFaviconDatabase when pageURL is unset
268         https://bugs.webkit.org/show_bug.cgi?id=186164
269
270         Reviewed by Carlos Garcia Campos.
271
272         PageURL can legitimately be null here if JavaScript does something silly with window.open.
273
274         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
275         (webkitFaviconDatabaseSetIconURLForPageURL):
276         (webkitFaviconDatabaseSetIconForPageURL):
277
278 2018-05-31  Brian Burg  <bburg@apple.com>
279
280         [Cocoa] Web Automation: use the session delegate to perform window maximize
281         https://bugs.webkit.org/show_bug.cgi?id=186167
282         <rdar://problem/40544391>
283
284         Reviewed by Timothy Hatcher.
285
286         Add plumbing to hand off window maximizing to the session delegate.
287
288         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
289         * UIProcess/Cocoa/AutomationSessionClient.h:
290         * UIProcess/Cocoa/AutomationSessionClient.mm:
291         (WebKit::AutomationSessionClient::AutomationSessionClient):
292         (WebKit::AutomationSessionClient::requestMaximizeWindowOfPage):
293
294 2018-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
295
296         Unreviewed. Try to fix GTK+ build with old versions of GTK+ after r232390.
297
298         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
299         (WebKit::WebPopupMenuProxyGtk::showPopupMenu):
300
301 2018-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
302
303         [GTK] Switch to use a popup window with a tree view instead of a menu for option menu default implementation
304         https://bugs.webkit.org/show_bug.cgi?id=186146
305
306         Reviewed by Michael Catanzaro.
307
308         It's more convenient to use than the menu.
309
310         * UIProcess/API/gtk/WebKitPopupMenu.cpp:
311         (WebKit::menuCloseCallback):
312         (WebKit::WebKitPopupMenu::activateItem):
313         * UIProcess/API/gtk/WebKitPopupMenu.h:
314         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
315         (WebKit::WebPopupMenuProxyGtk::WebPopupMenuProxyGtk):
316         (WebKit::WebPopupMenuProxyGtk::selectItem):
317         (WebKit::WebPopupMenuProxyGtk::activateItem):
318         (WebKit::WebPopupMenuProxyGtk::activateItemAtPath):
319         (WebKit::WebPopupMenuProxyGtk::treeViewRowActivatedCallback):
320         (WebKit::WebPopupMenuProxyGtk::treeViewButtonReleaseEventCallback):
321         (WebKit::WebPopupMenuProxyGtk::buttonPressEventCallback):
322         (WebKit::WebPopupMenuProxyGtk::keyPressEventCallback):
323         (WebKit::WebPopupMenuProxyGtk::createPopupMenu):
324         (WebKit::WebPopupMenuProxyGtk::show):
325         (WebKit::WebPopupMenuProxyGtk::showPopupMenu):
326         (WebKit::WebPopupMenuProxyGtk::hidePopupMenu):
327         (WebKit::WebPopupMenuProxyGtk::cancelTracking):
328         (WebKit::WebPopupMenuProxyGtk::typeAheadFindIndex):
329         (WebKit::WebPopupMenuProxyGtk::typeAheadFind):
330         * UIProcess/gtk/WebPopupMenuProxyGtk.h:
331
332 2018-05-31  Per Arne Vollan  <pvollan@apple.com>
333
334         Add OpenGL display mask to WebPage creation parameters.
335         https://bugs.webkit.org/show_bug.cgi?id=186163
336         <rdar://problem/40634504>
337
338         Reviewed by Brent Fulgham.
339
340         To make sure the OpenGL display mask is always available, include it in the WebPage creation parameters.
341         The OpenGL display mask is sent to the WebProcess when the platform display ID changes, but that is not
342         early enough in all cases. If the OpenGL display mask is not set, only OpenGL software rendering is offered
343         on some hardware configurations.
344
345         * Shared/WebPageCreationParameters.cpp:
346         (WebKit::WebPageCreationParameters::encode const):
347         (WebKit::WebPageCreationParameters::decode):
348         * Shared/WebPageCreationParameters.h:
349         * UIProcess/WebPageProxy.cpp:
350         (WebKit::WebPageProxy::creationParameters):
351         * WebProcess/WebPage/WebPage.cpp:
352         (WebKit::m_credentialsMessenger):
353
354 2018-05-31  Brent Fulgham  <bfulgham@apple.com>
355
356         Add a rule to allow reading files with prefix /private/var/db/CVMS/cvmsCodeSignObj
357         https://bugs.webkit.org/show_bug.cgi?id=186157
358         <rdar://problem/40666437>
359
360         Reviewed by Eric Carlson.
361
362         * WebProcess/com.apple.WebProcess.sb.in:
363
364 2018-05-31  Megan Gardner  <megan_gardner@apple.com>
365
366         Add setting to allow override screen size to be disabled.
367         https://bugs.webkit.org/show_bug.cgi?id=186109
368
369         Reviewed by Andy Estes.
370
371         Pipe the needed settings through to WebCore.
372
373         * Shared/WebPreferences.yaml:
374         * UIProcess/WebPageProxy.cpp:
375         (WebKit::m_configurationPreferenceValues):
376
377 2018-05-31  Brent Fulgham  <bfulgham@apple.com>
378
379         [macOS] Add JIT entitlements to WebContent process and plugin process on macOS
380         https://bugs.webkit.org/show_bug.cgi?id=184485
381         <rdar://problem/37556535>
382
383         Reviewed by Dan Bernstein.
384
385         This patch builds on the changes from Bug 185526 to add support for a JIT entitlement. It makes the
386         following changes:
387
388         1. Adds a new 'WebContent-OSX.entitlements file that unconditionally adds the JIT entitlement for all builds.
389         2. Modifies the PluginService.entitlements to unconditionally add the JIT entitlement.
390
391         * Configurations/PluginService.entitlements: Updated to add the JIT entitlement.
392         * Configurations/WebContent-OSX.entitlements: Updated to add the JIT entitlement.
393         * Configurations/WebContentService.xcconfig: Updated to use the new 'WebContent-OSX.entitlements' file.
394         * WebKit.xcodeproj/project.pbxproj:
395
396 2018-05-31  Brent Fulgham  <bfulgham@apple.com>
397
398         Don't attempt to extend sandbox when running tests with mock media devices
399         https://bugs.webkit.org/show_bug.cgi?id=186150
400         <rdar://problem/40690875>
401
402         Reviewed by Alexey Proskuryakov.
403
404         Avoid attempting to issue a sandbox extension to actual media devices when
405         running with Mock capture devices.
406
407         Also handle the 'denyNextRequest' test state outside of the USE(APPLE_INTERNAL_SDK)
408         guards, since it is needed for Open Source builds as well.
409
410         * UIProcess/UserMediaProcessManager.cpp:
411         (WebKit::UserMediaProcessManager::willCreateMediaStream):
412
413 2018-05-31  Antti Koivisto  <antti@apple.com>
414
415         WebKit memory management: Safari jetsams on some websites when zooming and scrolling
416         https://bugs.webkit.org/show_bug.cgi?id=186091
417         <rdar://problem/36315010>
418
419         Reviewed by Geoff Garen.
420
421         When zooming a page rapidly the visible rect and the page zoom level may get momentarily out of sync.
422         When this happens we may generate tiles for a much larger area than needed and run out of memory
423         building the next layer tree transaction. Running out of memory is more likely if the page has lots of
424         tiled layers in addition to the main content layer.
425
426         We already have code for dealing with the scale mismatch for zoom-out case (where this would cause
427         visibly missing tiles). This patch enables the same exact adjustment for zoom-in case (where the
428         symptom is creating too many tiles).
429
430         * WebProcess/WebPage/ios/WebPageIOS.mm:
431         (WebKit::adjustExposedRectForNewScale):
432
433         Do some renames to make it clear that this can both expand and contract the visible rect.
434         Bail out if there is nothing to do.
435
436         (WebKit::WebPage::updateVisibleContentRects):
437
438         Call adjustExposedRectForNewScale directly and unconditionally.
439
440         (WebKit::adjustExposedRectForBoundedScale): Deleted.
441
442 2018-05-30  Yusuke Suzuki  <utatane.tea@gmail.com>
443
444         [JSC] Pass VM& parameter as much as possible
445         https://bugs.webkit.org/show_bug.cgi?id=186085
446
447         Reviewed by Saam Barati.
448
449         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
450         (WebKit::NPJSObject::hasMethod):
451         (WebKit::NPJSObject::construct):
452         (WebKit::NPJSObject::invoke):
453
454 2018-05-30  Brent Fulgham  <bfulgham@apple.com>
455
456         [macOS] WebProcess needs TCC entitlements for media capture (Take 2)
457         https://bugs.webkit.org/show_bug.cgi?id=185526
458         <rdar://problem/36674649>
459
460         Reviewed by Alexey Proskuryakov.
461
462         In Bug 181995 I added TCC entitlements for media capture to the macOS entitlements used for
463         relocatable builds. These changes also need to apply to system builds of WebKit.
464
465         Previously we had not needed an entitlements file for system builds of WebKit, so only provided
466         an entitlements file for our relocatable build targets. Now we need entitlements when building
467         on recent macOS targets using internal SDKs.
468
469         Since these various scenarios are beginning to multiple, this patch dynamically generates the
470         entitlements file.
471
472         This patch does the following:
473
474         1. Changes the "WebContent-OSX.entitlements" to hold the TCC entitlements needed for media capture, and rename
475            to "WebContent-OSX-restricted.entitlements".
476         2. Removes the unneeded "com.apple.private.xpc.domain-extension" from WebContent-OSX.entitlement, and dynamically
477            adds it using a new build step using the script 'process-webcontent-entitlements.sh'
478         3. Updates DebugRelease.xcconfig to use the 'Safari Engineering' signing key for internal builds.
479         4. Updates WebContentService.xcconfig to remove the CODE_SIGN_ENTITLEMENTS_OSX_WITH_XPC_DOMAIN_EXTENSION_YES target
480            since we no longer need a custom entitlement file for this case.
481         5. Updates WebContentService.Development.xcconfig to remove CODE_SIGN_ENTITLEMENTS_COCOA_TOUCH_NO since it is no
482            longer needed.
483         6. Deletes the file Configurations/WebContent.Development.entitlements since it is no longer needed.
484         7. Revises the WebContent process sandbox to allow camera and microphone access without needing TCC
485            entitlements, since those cannot be applied without an internal SDK.
486         8. Revises the UserMediaProcessManager to not pass dynamic sandbox extensions to the WebContent process
487            when building with the public SDK since those entitlements cannot be added or consumed in Open
488            Source builds.
489
490         We want to use the TCC entitlements when building with the internal SDK on recent macOS builds.
491
492         * Configurations/Base.xcconfig:
493         * Configurations/DebugRelease.xcconfig:
494         * Configurations/WebContent-OSX-restricted.entitlements: Renamed from Source/WebKit/Configurations/WebContent-OSX.entitlements.
495         * Configurations/WebContent.Development.entitlements: Removed.
496         * Configurations/WebContentService.Development.xcconfig:
497         * Configurations/WebContentService.xcconfig:
498         * Scripts/process-webcontent-entitlements.sh: Added.
499         * UIProcess/UserMediaProcessManager.cpp:
500         (WebKit::UserMediaProcessManager::willCreateMediaStream): Don't bother creating and sending sandbox extensions for
501         camera and microphone control for builds that cannot support them.
502         * WebKit.xcodeproj/project.pbxproj:
503
504 2018-05-30  Daniel Bates  <dabates@apple.com>
505
506         NavigationAction does not need to hold initiating DOM Event
507         https://bugs.webkit.org/show_bug.cgi?id=185958
508         <rdar://problem/40531539>
509
510         Reviewed by Simon Fraser.
511
512         Write in terms of NavigationAction::{keyStateEventData, mouseEventDataForFirstMouseEvent}().
513
514         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
515         (WebKit::mouseButtonForMouseEventData):
516         (WebKit::syntheticClickTypeForMouseEventData):
517         (WebKit::clickLocationInRootViewCoordinatesForMouseEventData):
518         (WebKit::InjectedBundleNavigationAction::modifiersForNavigationAction):
519         (WebKit::InjectedBundleNavigationAction::mouseButtonForNavigationAction):
520         (WebKit::InjectedBundleNavigationAction::syntheticClickTypeForNavigationAction):
521         (WebKit::InjectedBundleNavigationAction::clickLocationInRootViewCoordinatesForNavigationAction):
522         (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
523         (WebKit::mouseEventForNavigationAction): Deleted.
524         (WebKit::mouseButtonForMouseEvent): Deleted.
525         (WebKit::syntheticClickTypeForMouseEvent): Deleted.
526         (WebKit::clickLocationInRootViewCoordinatesForMouseEvent): Deleted.
527
528 2018-05-30  Andy Estes  <aestes@apple.com>
529
530         [Cocoa] Add an SPI to suppress connection termination errors from CFNetwork when network interfaces change
531         https://bugs.webkit.org/show_bug.cgi?id=186107
532         <rdar://problem/39338957>
533
534         Reviewed by Brady Eidson.
535
536         Added an SPI which configures a process pool's networking process to set the
537         kCFStreamPropertyAutoErrorOnSystemChange to NO on its NSURLSessionConfigurations.
538         This instructs CFNetwork to not terminate active connections when the system's
539         network interfaces change.
540
541         * NetworkProcess/NetworkProcess.h:
542         (WebKit::NetworkProcess::suppressesConnectionTerminationOnSystemChange const):
543         * NetworkProcess/NetworkProcessCreationParameters.cpp:
544         (WebKit::NetworkProcessCreationParameters::encode const):
545         (WebKit::NetworkProcessCreationParameters::decode):
546         * NetworkProcess/NetworkProcessCreationParameters.h:
547         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
548         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
549         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
550         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
551         * UIProcess/API/APIProcessPoolConfiguration.cpp:
552         (API::ProcessPoolConfiguration::copy):
553         * UIProcess/API/APIProcessPoolConfiguration.h:
554         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
555         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
556         (-[_WKProcessPoolConfiguration suppressesConnectionTerminationOnSystemChange]):
557         (-[_WKProcessPoolConfiguration setSuppressesConnectionTerminationOnSystemChange:]):
558         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
559         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
560
561 2018-05-30  Youenn Fablet  <youenn@apple.com>
562
563         Rename FromOrigin runtime flag to CrossOriginResourcePolicy and enable it by default
564         https://bugs.webkit.org/show_bug.cgi?id=186082
565
566         Reviewed by Chris Dumez.
567
568         * NetworkProcess/NetworkResourceLoadParameters.cpp:
569         (WebKit::NetworkResourceLoadParameters::encode const):
570         (WebKit::NetworkResourceLoadParameters::decode):
571         * NetworkProcess/NetworkResourceLoadParameters.h:
572         * Shared/WebPreferences.yaml:
573         * UIProcess/API/C/WKPreferences.cpp:
574         (WKPreferencesSetCrossOriginResourcePolicyEnabled):
575         (WKPreferencesGetCrossOriginResourcePolicyEnabled):
576         (WKPreferencesSetFromOriginResponseHeaderEnabled): Deleted.
577         (WKPreferencesGetFromOriginResponseHeaderEnabled): Deleted.
578         * UIProcess/API/C/WKPreferencesRef.h:
579         * WebProcess/Network/WebLoaderStrategy.cpp:
580         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
581
582 2018-05-30  Youenn Fablet  <youenn@apple.com>
583
584         Rename CrossOriginResourcePolicy same to same-origin
585         https://bugs.webkit.org/show_bug.cgi?id=186080
586
587         Reviewed by Chris Dumez.
588
589         * NetworkProcess/NetworkLoadChecker.cpp:
590         (WebKit::NetworkLoadChecker::shouldCrossOriginResourcePolicyPolicyCancelLoad):
591
592 2018-05-30  David Kilzer  <ddkilzer@apple.com>
593
594         [iOS] -[WKFullScreenViewController viewWillAppear:] should call [super viewWillAppeear:]
595         <https://webkit.org/b/186103>
596         <rdar://problem/40655695>
597
598         Reviewed by Eric Carlson.
599
600         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
601         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
602         Drive-by clean up.  For consistency, we always use the same
603         variable in the body of the `if` statement that was used in the
604         condition.
605         (-[WKFullScreenViewController viewWillAppear:]): Call
606         [super viewWillAppeear:] to fulfill API contract.
607
608 2018-05-30  Chris Dumez  <cdumez@apple.com>
609
610         Take a background process assertion in WebPageProxy::callAfterNextPresentationUpdate()
611         https://bugs.webkit.org/show_bug.cgi?id=186097
612         <rdar://problem/40651225>
613
614         Reviewed by Dan Bernstein.
615
616         Refactor fix landed in r232298 so that we rely on the existing Callback infrastructure
617         to take a background process assertion.
618
619         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
620         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
621         * UIProcess/WebPageProxy.cpp:
622         (WebKit::WebPageProxy::callAfterNextPresentationUpdate):
623
624 2018-05-30  Aditya Keerthi  <akeerthi@apple.com>
625
626         Fix the ENABLE(DATALIST_ELEMENT) build
627         https://bugs.webkit.org/show_bug.cgi?id=186105
628
629         Reviewed by Wenson Hsieh.
630
631         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
632
633 2018-05-30  Jiewen Tan  <jiewen_tan@apple.com>
634
635         Unreviewed, a quick build fix for r232276.
636
637         Enabled SecItemShim again as it turns out to be useful for CFNetwork APIs that
638         query Keychains underneath us.
639
640         * NetworkProcess/ios/NetworkProcessIOS.mm:
641         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
642         * NetworkProcess/mac/NetworkProcessMac.mm:
643         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
644
645 2018-05-30  Jer Noble  <jer.noble@apple.com>
646
647         Auto-pip should use main content heuristic.
648         https://bugs.webkit.org/show_bug.cgi?id=186065
649         <rdar://problem/35862502>
650
651         Reviewed by Eric Carlson.
652
653         Make the m_pipStandbyElement clearable, which will allow the auto-pip mechanism to be torn down. Add
654         a WebProcess-side notification when the main content changes, to facilitate this.
655
656         * WebProcess/FullScreen/WebFullScreenManager.cpp:
657         (WebKit::WebFullScreenManager::videoControlsManagerDidChange):
658         (WebKit::WebFullScreenManager::setPIPStandbyElement):
659         (WebKit::WebFullScreenManager::didEnterFullScreen):
660         (WebKit::WebFullScreenManager::willExitFullScreen):
661         * WebProcess/FullScreen/WebFullScreenManager.h:
662         * WebProcess/WebPage/WebPage.cpp:
663         (WebKit::WebPage::videoControlsManagerDidChange):
664         * WebProcess/WebPage/WebPage.h:
665         * WebProcess/cocoa/PlaybackSessionManager.h:
666         * WebProcess/cocoa/PlaybackSessionManager.mm:
667         (WebKit::PlaybackSessionManager::setUpPlaybackControlsManager):
668         (WebKit::PlaybackSessionManager::clearPlaybackControlsManager):
669         (WebKit::PlaybackSessionManager::currentPlaybackControlsElement const):
670
671 2018-05-30  Jer Noble  <jer.noble@apple.com>
672
673         Fix a few issues in WKFullScreenViewController
674         https://bugs.webkit.org/show_bug.cgi?id=186067
675         <rdar://problem/40630944>
676
677         Reviewed by Darin Adler.
678
679         The check in setInterface() is checking the wrong pointer:
680         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
681         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
682
683         The check in -_effectiveFullscreenInsetTop is backwards:
684         (-[WKFullScreenViewController _effectiveFullscreenInsetTop]):
685
686 2018-05-30  Chris Dumez  <cdumez@apple.com>
687
688         Take a background process assertion in WebPageProxy::callAfterNextPresentationUpdate()
689         https://bugs.webkit.org/show_bug.cgi?id=186097
690         <rdar://problem/40651225>
691
692         Reviewed by Tim Horton.
693
694         Take a background process assertion in WebPageProxy::callAfterNextPresentationUpdate(). Otherwise,
695         apps may get stuck on _doAfterNextPresentationUpdate because the WebProcess got suspended.
696
697         * UIProcess/WebPageProxy.cpp:
698         (WebKit::WebPageProxy::callAfterNextPresentationUpdate):
699
700 2018-05-29  Tim Horton  <timothy_horton@apple.com>
701
702         Fix the build
703         https://bugs.webkit.org/show_bug.cgi?id=186078
704
705         Unreviewed build fix.
706
707         * UIProcess/API/Cocoa/WKWebView.mm:
708         (-[WKWebView _denyNextUserMediaRequest]):
709
710 2018-05-29  Andy Estes  <aestes@apple.com>
711
712         [Wi-Fi Assertions] Track whether WiFiAssertionHolder should actually hold a Wi-Fi assertion
713         https://bugs.webkit.org/show_bug.cgi?id=185983
714         <rdar://problem/40205486>
715
716         Reviewed by Tim Horton.
717
718         * Configurations/Network-iOS.entitlements:
719
720         Added a needed entitlement.
721
722         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
723         * NetworkProcess/cocoa/WiFiAssertionHolder.h:
724         (WebKit::WiFiAssertionHolder::shouldHoldWiFiAssertion const):
725
726         Track whether WiFiAssertionHolder should actually hold a Wi-Fi assertion.
727
728         * NetworkProcess/cocoa/WiFiAssertionHolder.mm: Renamed from Source/WebKit/NetworkProcess/cocoa/WiFiAssertionHolder.cpp.
729         (holdWiFiAssertion):
730         (releaseWiFiAssertion):
731         (WebKit::WiFiAssertionHolder::WiFiAssertionHolder):
732         (WebKit::WiFiAssertionHolder::~WiFiAssertionHolder):
733
734         Changed holdWiFiAssertion() and releaseWiFiAssertion() to take the
735         WiFiAssertionHolder as an argument.
736
737         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
738
739         Added a needed sandbox extension.
740
741         * WebKit.xcodeproj/project.pbxproj:
742
743 2018-05-29  Youenn Fablet  <youenn@apple.com>
744
745         Add a consistency check between URL and CFURL
746         https://bugs.webkit.org/show_bug.cgi?id=186057
747         <rdar://problem/40258457>
748
749         Reviewed by Geoff Garen.
750
751         * Shared/Cocoa/WKNSURLExtras.mm:
752         (+[NSURL _web_URLWithWTFString:relativeToURL:]):
753         (urlWithWTFString): Deleted.
754         (+[NSURL _web_URLWithWTFString:]): Deleted.
755
756 2018-05-29  Alex Christensen  <achristensen@webkit.org>
757
758         Remove unused WebPage::dummy
759         https://bugs.webkit.org/show_bug.cgi?id=186068
760
761         Reviewed by Sam Weinig.
762
763         * WebProcess/WebPage/WebPage.cpp:
764         (WebKit::WebPage::dummy): Deleted.
765         * WebProcess/WebPage/WebPage.h:
766         * WebProcess/WebPage/WebPage.messages.in:
767
768 2018-05-29  Per Arne Vollan  <pvollan@apple.com>
769
770         Create typedef for HashMap<PlatformDisplayID, ScreenProperties>
771         https://bugs.webkit.org/show_bug.cgi?id=186056
772
773         Reviewed by Brent Fulgham.
774
775         * Shared/WebProcessCreationParameters.cpp:
776         (WebKit::WebProcessCreationParameters::decode):
777         * Shared/WebProcessCreationParameters.h:
778
779 2018-05-25  Jiewen Tan  <jiewen_tan@apple.com>
780
781         Tighten sandbox profiles for Networking Processes to restrict accesses to macOS/iOS Keychains
782         https://bugs.webkit.org/show_bug.cgi?id=162948
783         <rdar://problem/40558894>
784
785         Reviewed by Brent Fulgham.
786
787         The patch conditionally tighten sandbox profiles for Networking Processes to remove Keychain related
788         permissions and some security permisssions that are not needed. Also it conditionally remove the
789         Process Privilege for Networking Processes to access Credentials.
790
791         In addition, it remove process privilege assertions for SecItemShim as it is supposed to work in processes
792         that don't have privileges to access Keychains and delegate all operations to UI Process via IPC. Also,
793         the patch disables SecItemShim for Networking Process conditionally.
794
795         * Configurations/Network-iOS.entitlements:
796         * NetworkProcess/NetworkProcess.cpp:
797         (WebKit::NetworkProcess::initializeNetworkProcess):
798         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
799         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
800         * Shared/mac/SecItemShim.cpp:
801         (WebKit::sendSecItemRequest):
802         (WebKit::webSecItemCopyMatching):
803         (WebKit::webSecItemAdd):
804         (WebKit::webSecItemUpdate):
805         (WebKit::webSecItemDelete):
806         (WebKit::initializeSecItemShim):
807
808 2018-05-29  Chris Dumez  <cdumez@apple.com>
809
810         Store 0-lifetime stylesheets / scripts into the disk cache for faster history navigations
811         https://bugs.webkit.org/show_bug.cgi?id=186060
812         <rdar://problem/40627270>
813
814         Reviewed by Geoffrey Garen.
815
816         Tweak our storeUnconditionallyForHistoryNavigation logic to match resources whose priority
817         is High, not just VeryHigh. Per logic in CachedResource::defaultPriorityForResourceType(Type),
818         This now matches stylesheets and scripts in addition to main resources.
819
820         I found that in case of a history navigation to apple.com, a significant number of scripts
821         and stylesheets had to be loaded from the network because our previous heuristic decided
822         not to store them (because their priority was not VeryHigh and because their max-age was
823         0).
824
825         * NetworkProcess/cache/NetworkCache.cpp:
826         (WebKit::NetworkCache::makeStoreDecision):
827
828 2018-05-28  Jeff Miller  <jeffm@apple.com>
829
830         Expose additional WKMenuItemIdentifier strings
831         https://bugs.webkit.org/show_bug.cgi?id=186041
832
833         Reviewed by Dan Bernstein.
834
835         Expose identifiers for media-related menu items.
836
837         * UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm:
838         Define new identifiers.
839
840         * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h:
841         Declare new identifiers.
842
843         * UIProcess/mac/WebContextMenuProxyMac.mm:
844         (WebKit::menuItemIdentifier):
845         Map to new identifiers.
846
847 2018-05-29  Geoffrey Garen  <ggaren@apple.com>
848
849         Removed some unused WebSQL trackers
850         https://bugs.webkit.org/show_bug.cgi?id=186026
851
852         Reviewed by Dan Bernstein.
853
854         * NetworkProcess/NetworkProcess.cpp:
855         (WebKit::NetworkProcess::NetworkProcess):
856         * NetworkProcess/NetworkProcess.h:
857         * WebProcess/WebProcess.cpp:
858         (WebKit::m_nonVisibleProcessCleanupTimer):
859         (WebKit::m_webSQLiteDatabaseTracker): Deleted.
860         * WebProcess/WebProcess.h:
861
862 2018-05-29  Per Arne Vollan  <pvollan@apple.com>
863
864         Follow-up fixes after r228907.
865         https://bugs.webkit.org/show_bug.cgi?id=183338
866
867         Reviewed by Brent Fulgham.
868
869         Add screen properties to the WebProcess creation parameters, instead of sending
870         them in a message to the WebProcess just after starting it up.
871
872         * Shared/WebProcessCreationParameters.cpp:
873         (WebKit::WebProcessCreationParameters::encode const):
874         (WebKit::WebProcessCreationParameters::decode):
875         * Shared/WebProcessCreationParameters.h:
876         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
877         (WebKit::WebProcessPool::platformInitializeWebProcess):
878         * UIProcess/WebProcessPool.cpp:
879         (WebKit::WebProcessPool::initializeNewWebProcess):
880         * WebProcess/cocoa/WebProcessCocoa.mm:
881         (WebKit::WebProcess::platformInitializeWebProcess):
882
883 2018-05-29  Sihui Liu  <sihui_liu@apple.com>
884
885         Unable to remove IndexedDB Databases with Cocoa API removeDataOfTypes
886         https://bugs.webkit.org/show_bug.cgi?id=185835
887         <rdar://problem/39142257>
888
889         Reviewed by Chris Dumez.
890
891         Fix a wrong if condition: databases should be closed and deleted if websiteDataTypes contains 
892         WebsiteDataType::IndexedDBDatabases.
893
894         * StorageProcess/StorageProcess.cpp:
895         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
896
897 2018-05-28  Sam Weinig  <sam@webkit.org>
898
899         Modernize SVGRenderStyleDefs.h
900         https://bugs.webkit.org/show_bug.cgi?id=186024
901
902         Reviewed by Daniel Bates.
903
904         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
905         (WebKit::applyPropertiesToLayer):
906         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
907         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
908         Update for new enum names.
909
910 2018-05-28  Carlos Garcia Campos  <cgarcia@igalia.com>
911
912         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.3 release.
913
914         * gtk/NEWS: Add release notes for 2.21.3.
915
916 2018-05-27  Dan Bernstein  <mitz@apple.com>
917
918         Reverted the changes made for https://webkit.org/b/186016
919
920         They broke the USE(APPLE_INTERNAL_SDK) Sierra build.
921
922 2018-05-27  David Kilzer  <ddkilzer@apple.com>
923
924         [iOS] Fix warnings about leaks found by clang static analyzer
925         <https://webkit.org/b/186009>
926         <rdar://problem/40574267>
927
928         Reviewed by Daniel Bates.
929
930         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
931         (WebKit::WebAutomationSession::platformSimulateKeySequence): Fix
932         leak of two WebEvent objects that happened in a loop.
933         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
934         (-[_WKPreviewControllerDelegate previewController:transitionImageForPreviewItem:contentRect:]):
935         Fix leak of a UIImage.
936
937 2018-05-27  Dan Bernstein  <mitz@apple.com>
938
939         [Cocoa] Avoid importing directly from subumbrella frameworks
940         https://bugs.webkit.org/show_bug.cgi?id=186016
941
942         Reviewed by Sam Weinig.
943
944         * Configurations/BaseTarget.xcconfig: Removed -iframework options from OTHER_CFLAGS and
945           OTHER_CPLUSPLUSFLAGS.
946         * UIProcess/Automation/mac/WebAutomationSessionMac.mm: Import Carbon.h instead of an
947           HIToolbox header.
948         * UIProcess/Cocoa/WebViewImpl.mm: Ditto.
949         * UIProcess/mac/WKPrintingView.mm: Import Quartz.h instead of a PDFKit header.
950         * UIProcess/mac/WKTextInputWindowController.mm: Import Carbon.h instead of an HIToolbox
951           header.
952         * WebProcess/Plugins/PDF/PDFAnnotationTextWidgetDetails.h: Import Quartz.h instead of a
953           PDFKit header.
954         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h: Ditto.
955         * WebProcess/Plugins/PDF/PDFPlugin.mm: Ditto.
956         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm: Ditto.
957         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm: Ditto.
958         * WebProcess/Plugins/PDF/PDFPluginPasswordField.mm: Ditto.
959         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: Ditto.
960         * WebProcess/WebPage/mac/WebPageMac.mm: Ditto.
961
962 2018-05-25  Timothy Hatcher  <timothy@apple.com>
963
964         Setting drawsBackground to YES on a WKView doesn't take effect immediately
965         https://bugs.webkit.org/show_bug.cgi?id=185885
966         rdar://problem/39706506
967
968         Reviewed by Simon Fraser.
969
970         * UIProcess/API/Cocoa/WKWebView.mm:
971         (-[WKWebView _initializeWithConfiguration:]): Removed setBackgroundExtendsBeyondPage(true)
972         since it is now the default.
973         * UIProcess/Cocoa/WebViewImpl.mm:
974         (WebKit::WebViewImpl::setDrawsBackground): Make sure updateLayer gets called on the web view
975         by calling setNeedsDisplay:YES.
976         (WebKit::WebViewImpl::setBackgroundColor): Ditto.
977         (WebKit::WebViewImpl::updateLayer): Removed dead code.
978         * UIProcess/WebPageProxy.h: Make m_backgroundExtendsBeyondPage default to true. WebKit was
979         always turning this on during WKWebView initializtion, which would cause the scroll
980         shadow layer to be created, flash black because of no background, then destroyed soon
981         after once WebKit's message to turn it on got delivered.
982         * WebProcess/WebPage/WebPage.cpp:
983         (WebPage::WebPage): Call setBackgroundExtendsBeyondPage earlier to avoid creating the scroll
984         shadow layer, since backgroundShouldExtendBeyondPage defautls to false in WebCore for WK1.
985         (WebKit::WebPage::setDrawsBackground): Use updateBackgroundRecursively to propagate the
986         correct base background color.
987
988 2018-05-25  Youenn Fablet  <youenn@apple.com>
989
990         Migrate From-Origin to Cross-Origin-Resource-Policy
991         https://bugs.webkit.org/show_bug.cgi?id=185840
992
993         Reviewed by Chris Dumez.
994
995         Do Cross-Origin-Resource-Policy (CORP) checks in NetworkLoadChecker instead of NetworkResourceLoader directly.
996         Make sure CORP only applies to no-cors loads.
997         Remove ancestor checks and only consider the document origin making the load.
998         This means that in case of cross-origin redirection to same-origin, the redirection will be CORP-checked,
999         the final response will not be CORP-checked but will be opaque.
1000
1001         * NetworkProcess/NetworkLoadChecker.cpp:
1002         (WebKit::NetworkLoadChecker::validateCrossOriginResourcePolicyPolicy):
1003         (WebKit::NetworkLoadChecker::validateResponse):
1004         * NetworkProcess/NetworkLoadChecker.h:
1005         * NetworkProcess/NetworkResourceLoader.cpp:
1006         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1007         (WebKit::NetworkResourceLoader::didReceiveResponse):
1008         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
1009         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
1010         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
1011         * NetworkProcess/NetworkResourceLoader.h:
1012         * WebProcess/Network/WebLoaderStrategy.cpp:
1013         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1014         Send ancestor information for navigation loads only.
1015
1016 2018-05-25  Daniel Bates  <dabates@apple.com>
1017
1018         NavigationAction should not hold a strong reference to a Document
1019         https://bugs.webkit.org/show_bug.cgi?id=185712
1020         <rdar://problem/40320916>
1021
1022         Reviewed by Brent Fulgham.
1023
1024         Update code to make use of NavigationAction::requester().
1025
1026         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1027         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1028
1029 2018-05-25  Tim Horton  <timothy_horton@apple.com>
1030
1031         Ensure that the Web Content process doesn't sleep during initialization
1032         https://bugs.webkit.org/show_bug.cgi?id=185975
1033         <rdar://problem/40548159>
1034
1035         Reviewed by Geoffrey Garen.
1036
1037         WebProcessPool::warmInitialProcess isn't worth much (or at least, as much
1038         as it could be) if the Web Content process goes to sleep in the middle
1039         of initializeWebProcess.
1040
1041         Keep the Web Content process alive until it has handled all messages
1042         sent from WebProcessPool::initializeNewWebProcess.
1043
1044         This is a significant speedup on some benchmarks I've been running
1045         that involve prewarming a process long before any content is loaded.
1046
1047         * UIProcess/WebProcessPool.cpp:
1048         (WebKit::WebProcessPool::initializeNewWebProcess):
1049
1050 2018-05-25  Chris Dumez  <cdumez@apple.com>
1051
1052         WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback() unexpectedly constructs a process pool
1053         https://bugs.webkit.org/show_bug.cgi?id=185992
1054
1055         Reviewed by Geoffrey Garen.
1056
1057         Update enableResourceLoadStatisticsAndSetTestingCallback() to pass the right parameter to processPools()
1058         to avoid constructing a process pool when none exist. Also drop the 'resourceLoadStatisticsEnabled'
1059         flag on the WebProcessPool and have it query its data store instead to know if the feature is enabled.
1060
1061         * UIProcess/WebProcessPool.cpp:
1062         (WebKit::WebProcessPool::initializeNewWebProcess):
1063         (WebKit::WebProcessPool::setResourceLoadStatisticsEnabled):
1064         * UIProcess/WebProcessPool.h:
1065         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1066         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
1067
1068 2018-05-25  Chris Dumez  <cdumez@apple.com>
1069
1070         Drop support for NSURLCache in WebKit2
1071         https://bugs.webkit.org/show_bug.cgi?id=185990
1072
1073         Reviewed by Geoffrey Garen.
1074
1075         Drop support for NSURLCache in WebKit2 now that the WebKit network cache is stable.
1076
1077         * NetworkProcess/NetworkProcess.cpp:
1078         (WebKit::NetworkProcess::setCacheModel):
1079         * NetworkProcess/NetworkProcess.h:
1080         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1081         (WebKit::NetworkProcessCreationParameters::encode const):
1082         (WebKit::NetworkProcessCreationParameters::decode):
1083         * NetworkProcess/NetworkProcessCreationParameters.h:
1084         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1085         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1086         (WebKit::NetworkProcess::clearDiskCache):
1087         (WebKit::NetworkProcess::platformSetURLCacheSize): Deleted.
1088         (WebKit::clearNSURLCache): Deleted.
1089         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1090         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1091         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1092         (): Deleted.
1093         (WebKit::NetworkSessionCocoa::setUsesNetworkCache): Deleted.
1094         * NetworkProcess/curl/NetworkProcessCurl.cpp:
1095         (WebKit::NetworkProcess::platformSetURLCacheSize): Deleted.
1096         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1097         (WebKit::NetworkProcess::platformSetURLCacheSize): Deleted.
1098         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1099         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1100         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory):
1101         (WebKit::WebProcessPool::isNetworkCacheEnabled): Deleted.
1102         * UIProcess/WebProcessPool.h:
1103         * WebProcess/WebPage/WebFrame.cpp:
1104         (WebKit::WebFrame::suggestedFilenameForResourceWithURL const):
1105         (WebKit::WebFrame::mimeTypeForResourceWithURL const):
1106         * WebProcess/WebPage/WebPage.cpp:
1107         (WebKit::WebPage::getResourceDataFromFrame):
1108         (WebKit::WebPage::hasLocalDataForURL):
1109         * WebProcess/WebPage/WebPage.h:
1110         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
1111         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
1112         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
1113         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
1114         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
1115         * WebProcess/WebPage/ios/WebPageIOS.mm:
1116         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
1117         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
1118         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
1119         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
1120         * WebProcess/WebPage/mac/WebPageMac.mm:
1121         (WebKit::WebPage::accessibilityRemoteObject):
1122         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
1123         (WebKit::cachedResponseForURL): Deleted.
1124         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
1125         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
1126         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
1127         * WebProcess/WebPage/win/WebPageWin.cpp:
1128         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
1129         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
1130         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
1131         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
1132         * WebProcess/WebPage/wpe/WebPageWPE.cpp:
1133         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
1134         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
1135         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
1136         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
1137         * WebProcess/cocoa/WebProcessCocoa.mm:
1138         (WebKit::WebProcess::platformInitializeWebProcess):
1139
1140 2018-05-25  Alex Christensen  <achristensen@webkit.org>
1141
1142         Fix internal iOS builds after r232198
1143         https://bugs.webkit.org/show_bug.cgi?id=185986
1144
1145         * WebProcess/WebPage/ios/WebPageIOS.mm:
1146         (WebKit::WebPage::sendTapHighlightForNodeIfNecessary):
1147
1148 2018-05-25  Alex Christensen  <achristensen@webkit.org>
1149
1150         URL::host should return a StringView to reduce allocations
1151         https://bugs.webkit.org/show_bug.cgi?id=185986
1152
1153         Reviewed by Geoff Garen.
1154
1155         * NetworkProcess/NetworkProcess.cpp:
1156         (WebKit::fetchDiskCacheEntries):
1157         * NetworkProcess/NetworkResourceLoader.cpp:
1158         (WebKit::areFrameAncestorsSameSite):
1159         * NetworkProcess/mac/NetworkProcessMac.mm:
1160         (WebKit::overrideSystemProxies):
1161         * Shared/API/APIURL.h:
1162         (API::URL::host const):
1163         * UIProcess/Automation/WebAutomationSession.cpp:
1164         (WebKit::WebAutomationSession::addSingleCookie):
1165         (WebKit::WebAutomationSession::deleteAllCookies):
1166         * UIProcess/WebProcessProxy.cpp:
1167         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
1168         * WebProcess/Plugins/PluginView.cpp:
1169         (WebKit::PluginView::pluginDidReceiveUserInteraction):
1170         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
1171         (WebKit::WebPluginInfoProvider::populatePluginCache):
1172         * WebProcess/WebPage/WebPage.cpp:
1173         (WebKit::needsHiddenContentEditableQuirk):
1174         (WebKit::needsPlainTextQuirk):
1175         (WebKit::WebPage::determinePrimarySnapshottedPlugIn):
1176
1177 2018-05-25  Adrian Perez de Castro  <aperez@igalia.com>
1178
1179         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.2 release.
1180
1181         * wpe/NEWS: Add release notes for the 2.21.2 release.
1182
1183 2018-05-25  Chris Dumez  <cdumez@apple.com>
1184
1185         Minor ApplicationCacheStorage clean up
1186         https://bugs.webkit.org/show_bug.cgi?id=185984
1187
1188         Reviewed by Youenn Fablet.
1189
1190         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1191         (WebKit::WebsiteDataStore::fetchDataAndApply):
1192         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1193         (WKBundlePageCopyOriginsWithApplicationCache):
1194
1195 2018-05-25  Chris Dumez  <cdumez@apple.com>
1196
1197         Avoid triggering network cache speculative revalidation for loads allowing expired content
1198         https://bugs.webkit.org/show_bug.cgi?id=185985
1199
1200         Reviewed by Antti Koivisto.
1201
1202         Avoid triggering network cache speculative revalidation for loads allowing expired content
1203         (e.g. history loads, restoring pages after crash or safari relaunch). This causes us to do
1204         unnecessary revalidations, it is both wasteful and bad for performance.
1205
1206         * NetworkProcess/cache/NetworkCache.cpp:
1207         (WebKit::NetworkCache::Cache::retrieve):
1208
1209 2018-05-25  David Kilzer  <ddkilzer@apple.com>
1210
1211         Fix issues with -dealloc methods found by clang static analyzer
1212         <https://webkit.org/b/185887>
1213
1214         Reviewed by Joseph Pecoraro.
1215
1216         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Drive-by fix
1217         to use `copy` for `mimeType` property.
1218         (-[_WKPreviewControllerDataSource initWithMIMEType:]): Drive-by
1219         fix to use `instancetype` instead of `id`.  Use -copy for
1220         `mimeType` argument to match property definition.
1221         (-[_WKPreviewControllerDataSource dealloc]): Add.  Release
1222         `_completionHandler` and `_mimeType` to fix leaks.
1223         * UIProcess/ios/WKPasswordView.mm:
1224         (-[WKPasswordView dealloc]): Add.  Release
1225         `_userDidEnterPassword` to fix leak.
1226         * UIProcess/ios/fullscreen/WKFullScreenViewController.h:
1227         Drive-by clean-up to make `location` property `copy` instead of
1228         `retain`.
1229         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1230         (-[WKFullScreenViewController dealloc]): Release `_target` and
1231         `_location` to fix leaks.
1232         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1233         (-[WKFullscreenAnimationController dealloc]): Add.  Release
1234         `_viewController` to fix leak.
1235         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
1236         (@property secondaryMaterialOverlayView): Mark explicitly as
1237         `assign` since this isn't a retained variable.
1238         (@property secondaryMaterialOverlayViewConstraints): Mark
1239         explicitly as `retain` since there is nothing to keep this
1240         object alive.
1241         (+[WKFullscreenStackView secondaryMaterialOverlayView]): Fix
1242         leak by autoreleasing the return value.
1243         (-[WKFullscreenStackView dealloc]): Release retained instance
1244         variables to fix leaks.  Note that `_stackView` and
1245         `_visualEffectView` are internally retained despite their
1246         @property declarations.
1247         (-[WKFullscreenStackView setTargetViewForSecondaryMaterialOverlay:]):
1248         Retain @property targetViewForSecondaryMaterialOverlay to match
1249         its declaration.
1250
1251 2018-05-23  Antoine Quint  <graouts@apple.com>
1252
1253         [Web Animations] Use DEFAULT_EXPERIMENTAL_FEATURES_ENABLED for Web Animations experimental features
1254         https://bugs.webkit.org/show_bug.cgi?id=185919
1255
1256         Reviewed by Dean Jackson.
1257
1258         * Shared/WebPreferences.yaml:
1259
1260 2018-05-24  Dan Bernstein  <mitz@apple.com>
1261
1262         ProcessLauncherMac.mm contains a couple of meaningless #ifndef directives
1263         https://bugs.webkit.org/show_bug.cgi?id=185973
1264
1265         Reviewed by Tim Horton.
1266
1267         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1268         (WebKit::ProcessLauncher::launchProcess): Use #if !ASSERT_DISABLED to guard statements that
1269           are only needed for an assertion, instead of #ifndef _NDEBUG, which is always true.
1270
1271 2018-05-24  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1272
1273         [GTK][WPE] Memory pressure monitor doesn't reliable notify all the subprocesses
1274         https://bugs.webkit.org/show_bug.cgi?id=184261
1275
1276         Reviewed by Carlos Garcia Campos.
1277
1278         On Linux we had two implementations for getting notifications about memory pressure events:
1279         - The memory cgroup (called systemd here).
1280         - The UIProcess memory monitor (which delivered events via a shared eventfd)
1281
1282         The problem with the first is that it was usually not working on a standard machine due to
1283         the special permissions or configurations required for memory cgroups, so the second one
1284         (eventfd) was used as a fall-back in that case.
1285         But this eventfd method is racy with more than one WebKit child process and it wasn't
1286         reliably delivering the notifications.
1287
1288         This patch removes the memory cgroup implementation and modifies the UIProcess memory monitor
1289         to deliver the events via WebKit IPC. This simplifies the code a lot and allows us to have
1290         only one implementation that should work in any Linux machine.
1291
1292         The implementation now also triggers the event with information about the criticalness of it.
1293
1294         Previously a critical event was triggered always at a 95% of pressure.
1295         Now a non-critical one is triggered at 90% and critical remains at a 95%.
1296
1297         Start triggering events early should compensate the fact than triggering the event via WebKit IPC is
1298         a bit slower than doing that via an eventfd (or than listening on the memory cgroup event controller).
1299
1300         The events are delivered to all WebKit childs: WebProcess, NetworkProcess, StorageProcess, PluginProcess.
1301
1302         In the case of the StorageProcess a dummy controller is installed, which currently does nothing,
1303         but leaves a note for a future implementation and at least allows to trigger platformReleaseMemory()
1304         that on Linux/glibc should end calling malloc_trim()
1305
1306         * NetworkProcess/NetworkProcess.cpp:
1307         (WebKit::NetworkProcess::initializeNetworkProcess):
1308         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1309         (WebKit::NetworkProcessCreationParameters::encode const):
1310         (WebKit::NetworkProcessCreationParameters::decode):
1311         * NetworkProcess/NetworkProcessCreationParameters.h:
1312         * PluginProcess/PluginProcess.cpp:
1313         (WebKit::PluginProcess::didReceiveMessage):
1314         (WebKit::PluginProcess::initializePluginProcess):
1315         * Shared/ChildProcess.cpp:
1316         (WebKit::ChildProcess::didReceiveMemoryPressureEvent):
1317         * Shared/ChildProcess.h:
1318         * Shared/ChildProcess.messages.in:
1319         * Shared/Plugins/PluginProcessCreationParameters.cpp:
1320         (WebKit::PluginProcessCreationParameters::encode const):
1321         (WebKit::PluginProcessCreationParameters::decode):
1322         * Shared/Plugins/PluginProcessCreationParameters.h:
1323         * Shared/WebProcessCreationParameters.cpp:
1324         (WebKit::WebProcessCreationParameters::encode const):
1325         (WebKit::WebProcessCreationParameters::decode):
1326         * Shared/WebProcessCreationParameters.h:
1327         * StorageProcess/StorageProcess.cpp:
1328         (WebKit::StorageProcess::initializeProcess):
1329         * UIProcess/Plugins/PluginProcessManager.cpp:
1330         (WebKit::PluginProcessManager::sendMemoryPressureEvent):
1331         * UIProcess/Plugins/PluginProcessManager.h:
1332         * UIProcess/Plugins/PluginProcessProxy.cpp:
1333         (WebKit::PluginProcessProxy::sendMemoryPressureEvent):
1334         (WebKit::PluginProcessProxy::didFinishLaunching):
1335         * UIProcess/Plugins/PluginProcessProxy.h:
1336         * UIProcess/WebProcessPool.cpp:
1337         (WebKit::WebProcessPool::sendMemoryPressureEvent):
1338         (WebKit::WebProcessPool::ensureNetworkProcess):
1339         (WebKit::WebProcessPool::initializeNewWebProcess):
1340         * UIProcess/WebProcessPool.h:
1341         (WebKit::WebProcessPool::sendToStorageProcess):
1342         * UIProcess/linux/MemoryPressureMonitor.cpp:
1343         (WebKit::pollIntervalForUsedMemoryPercentage): Fix equation for calculating the interval percentage.
1344         (WebKit::MemoryPressureMonitor::singleton):
1345         (WebKit::MemoryPressureMonitor::start):
1346         * UIProcess/linux/MemoryPressureMonitor.h:
1347         * WebProcess/WebProcess.cpp:
1348         (WebKit::WebProcess::initializeWebProcess):
1349
1350 2018-05-24  Youenn Fablet  <youenn@apple.com>
1351
1352         Update plugin search path to look for user installed plugins
1353         https://bugs.webkit.org/show_bug.cgi?id=185960
1354
1355         Reviewed by Brent Fulgham.
1356
1357         Now that UIProcess may be sandboxed, the home directory is no longer the user home directory.
1358         Update the path to still look for plugins in the user home directory.
1359
1360         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
1361         (WebKit::PluginInfoStore::pluginsDirectories):
1362
1363 2018-05-24  Jiewen Tan  <jiewen_tan@apple.com>
1364
1365         Adopt SecKeyProxy SPI in certificate based challenge response code
1366         https://bugs.webkit.org/show_bug.cgi?id=185848
1367         <rdar://problem/34586181>
1368
1369         Reviewed by Alex Christensen.
1370
1371         This patch adopts SecKeyProxy SPI in HTTPS client certificate authentication code.
1372         1) SecKeyProxy is a new SPI to relay crypto operations from one process to another. The owner process of the proxy
1373         will behave like a server, and other owners of the SecKeys created from the proxy's endpoints will then behave
1374         like clients. This client-server model allows more restricted sandbox for client processes, and meanwhile permits
1375         them to relay crypto operations to the server process while maintaining the same SecKey interfaces as used for local operations.
1376         2) Because of the client-server model, the server process, i.e. the UI Process in our case, needs to keep the proxy
1377         object alive long enough for the client process, i.e. Network Processes in our case, to finish all operations, and then destroy
1378         the proxy object afterward. The ideal place to hold such a proxy is WebsiteDataStore such that proxies could live with the
1379         corresponding network session.
1380         3) A new class called SecKeyProxyStore is then created to bind the lifetime of SecKeyProxy to the WebsiteDataStore while initializing
1381         it correctly. At the time the authentication process reaches WebPageProxy::didReceiveAuthenticationChallengeProxy where we have
1382         accesses to the WebsiteDataStore, we haven't yet been able to determine the Credential to authenticate the challenge. Therefore, we
1383         have to reserve a place in the WebsiteDataStore ahead and then fill it with the right Credential. That's why SecKeyProxyStore exists.
1384         In WebPageProxy::didReceiveAuthenticationChallengeProxy, we create a strong reference of SecKeyProxyStore which will eventually hold
1385         a strong reference of the SecKeyProxy, and move it to the WebsiteDataStore. We also create a weak reference to SecKeyProxyStore
1386         and move it to the AuthenticationChallenge. In this way, we indirectly bind the lifetime of SecKeyProxy to the WebsiteDataStore through
1387         the strong reference and also we can initialize the proxy through the weak reference while a credential is finally determined.
1388         4) Endpoints of the SecKeyProxy will be passed to the Network Process for creating the 'remote' SecKey. However, those endpoints are
1389         of NSXPCListenerEndpoint type, which can only be passed with xpc connections and are not compatible with our IPC mechanism. In order
1390         to pass endpoints around, this patch reuses the xpc connection that is used to bootstrap Network Processes from the UI Process. To do
1391         so, it sends xpc messages at the place where original IPC messages are sent and overwrites the boostrap listener of the xpc connection
1392         when Network Process is initialized. From the listener, it continues the original authentication code path.
1393         5) Tests, again, are manually covered by tlstestwebkit.org. Noted, the prompting Keychain dialog in macOS should say Safari instead of
1394         "com.apple.WebKit.Networking*" now.
1395
1396         * Shared/AuthenticationManagerCocoa.mm: Added.
1397         (WebKit::AuthenticationManager::initializeConnection):
1398         * Shared/Authentication/cocoa/AuthenticationManager.h:
1399         * Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.h:
1400         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
1401         (WebKit::AuthenticationChallengeProxy::useCredential):
1402         (WebKit::AuthenticationChallengeProxy::setSecKeyProxyStore):
1403         * UIProcess/Authentication/AuthenticationChallengeProxy.h:
1404         * UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm: Added.
1405         (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc const):
1406         * UIProcess/Authentication/cocoa/SecKeyProxyStore.h: Added.
1407         (WebKit::SecKeyProxyStore::create):
1408         (WebKit::SecKeyProxyStore::isInitialized const):
1409         (WebKit::SecKeyProxyStore::get const):
1410         (WebKit::SecKeyProxyStore::weakPtrFactory const):
1411         * UIProcess/Authentication/cocoa/SecKeyProxyStore.mm: Added.
1412         (WebKit::SecKeyProxyStore::initialize):
1413         * UIProcess/WebPageProxy.cpp:
1414         (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
1415         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1416         (WebKit::WebsiteDataStore::addSecKeyProxyStore):
1417         * UIProcess/WebsiteData/WebsiteDataStore.h:
1418         * WebKit.xcodeproj/project.pbxproj:
1419
1420 2018-05-24  Megan Gardner  <megan_gardner@apple.com>
1421
1422         Fix Issues with Loupe Gesture
1423         https://bugs.webkit.org/show_bug.cgi?id=185926
1424
1425         Reviewed by Tim Horton.
1426
1427         The loupe gesture was not giving us the correct selection in some situations.
1428
1429         * UIProcess/ios/WKContentViewInteraction.mm:
1430         (-[WKContentView gestureRecognizer:canBePreventedByGestureRecognizer:]):
1431         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
1432         (-[WKContentView setSelectedTextRange:]):
1433         * WebProcess/WebPage/WebPage.h:
1434         * WebProcess/WebPage/ios/WebPageIOS.mm:
1435         (WebKit::WebPage::selectWithGesture):
1436         (WebKit::WebPage::clearSelection):
1437
1438 2018-05-24  Keith Rollin  <krollin@apple.com>
1439
1440         Don't track resource load milestones in private sessions
1441         https://bugs.webkit.org/show_bug.cgi?id=185828
1442         <rdar://problem/40424197>
1443
1444         Reviewed by Brent Fulgham.
1445
1446         Bug 184838 adds the facility for tracing the beginning and ending of
1447         resources loads and reporting so that historical information can be
1448         gathered to assess the health of the networking stack. Disable this
1449         facility for private browsing sessions.
1450
1451         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1452         (WebKit::NetworkConnectionToWebProcess::startTrackingResourceLoad):
1453         (WebKit::NetworkConnectionToWebProcess::stopTrackingResourceLoad):
1454         * NetworkProcess/NetworkConnectionToWebProcess.h:
1455         * NetworkProcess/NetworkResourceLoader.cpp:
1456         (WebKit::NetworkResourceLoader::start):
1457
1458 2018-05-24  Brent Fulgham  <bfulgham@apple.com>
1459
1460         REGRESSION(r224908): [macOS] Media playback not honoring custom caption styles
1461         https://bugs.webkit.org/show_bug.cgi?id=185955
1462         <rdar://problem/40339278>
1463
1464         Reviewed by Eric Carlson.
1465
1466         In r224908 I removed access to the MediaAccessibility mach port, as well as
1467         read/write access to various preferences associated with that process, as it
1468         was no longer needed by modern WebKit media routines.
1469
1470         Detailed testing reveals that read access is still needed to these preferences
1471         to properly handle custom caption styles.
1472
1473         This patch re-enables access to the media accessibility preferences.
1474
1475         * WebProcess/com.apple.WebProcess.sb.in:
1476
1477 2018-05-24  Brent Fulgham  <bfulgham@apple.com>
1478
1479         REGRESSION(r230269): ASSERTION FAILED: sendRightCount == 1 at ProcessLauncherMac.mm(218)
1480         https://bugs.webkit.org/show_bug.cgi?id=185687
1481         <rdar://problem/39386361>
1482
1483         Reviewed by Brady Eidson.
1484
1485         In r230269 I added an assertion to help identify cases where we were doing bad
1486         bookkeeping in our port send rights. I assumed that because we were adding
1487         one send right, that when we went to close down the connection that we should
1488         have only one send right.
1489         
1490         I have since discovered that this assumption is invalid, and that I should
1491         only be checking that we have AT LEAST ONE send right at the time we attempt
1492         to remove it.
1493
1494         This patch changes the assertion to confirm that we have at least one send
1495         right before we remove the send right.
1496
1497         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1498         (WebKit::ProcessLauncher::launchProcess):
1499
1500 2018-05-24  Chris Dumez  <cdumez@apple.com>
1501
1502         Some of the work in initializeLogChannelsIfNecessary() is unnecessary for release builds
1503         https://bugs.webkit.org/show_bug.cgi?id=185951
1504
1505         Reviewed by Geoffrey Garen.
1506
1507         Some of the work in initializeLogChannelsIfNecessary() is unnecessary for release builds and slows down
1508         launch time. In particular, it is unnecessary to read NSDefaults to figure out which logging channels
1509         should be enabled.
1510
1511         * Platform/foundation/LoggingFoundation.mm:
1512         (WebKit::logLevelString):
1513         * Platform/unix/LoggingUnix.cpp:
1514         (WebKit::logLevelString):
1515         * Platform/win/LoggingWin.cpp:
1516         (WebKit::logLevelString):
1517
1518 2018-05-24  Per Arne Vollan  <pvollan@apple.com>
1519
1520         Crash under WebKit::PluginProxy::destroy()
1521         https://bugs.webkit.org/show_bug.cgi?id=185841
1522         <rdar://problem/39936896>
1523
1524         Reviewed by Brent Fulgham.
1525
1526         A release assert in Connection::sencSync is failing since scripts are not allowed in this context,
1527         and the WebKit process is allowed to process incoming messages while waiting for the sync reply.
1528         In this context, scripts are disallowed in the method Element::addShadowRoot. To make sure the
1529         WebContent process will not wait indefinitely for a reply from the Plugin process, use a timeout
1530         of 1 second when sending the message.
1531
1532         * WebProcess/Plugins/PluginProxy.cpp:
1533         (WebKit::PluginProxy::destroy):
1534
1535 2018-05-24  Carlos Garcia Campos  <cgarcia@igalia.com>
1536
1537         Unreviewed. Fix GTK+ input method unit tests after r232049.
1538
1539         Unit tests don't use a WebPageProxy.
1540
1541         * UIProcess/gtk/InputMethodFilter.cpp:
1542         (WebKit::InputMethodFilter::isViewFocused const):
1543         (WebKit::InputMethodFilter::setEnabled):
1544         * UIProcess/gtk/InputMethodFilter.h:
1545
1546 2018-05-24  Carlos Garcia Campos  <cgarcia@igalia.com>
1547
1548         WebDriver: implement maximize, minimize and fullscreen window commands
1549         https://bugs.webkit.org/show_bug.cgi?id=180398
1550
1551         Reviewed by Brian Burg.
1552
1553         * UIProcess/API/APIAutomationSessionClient.h:
1554         (API::AutomationSessionClient::requestMaximizeWindowOfPage): Added to allow clients maximize the window.
1555         * UIProcess/API/glib/WebKitAutomationSession.cpp:
1556         * UIProcess/API/glib/WebKitWebViewPrivate.h:
1557         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
1558         (WindowStateEvent::WindowStateEvent): Struct to handle window state events.
1559         (WindowStateEvent::~WindowStateEvent): Complete the event.
1560         (WindowStateEvent::complete): Call the completion handler is not called already.
1561         (windowStateEventCallback): Handle window state event changes.
1562         (webkitWebViewMaximizeWindow): Try to maximize the window and wait for the event.
1563         (webkitWebViewMinimizeWindow): Try to minimize the window and wait for the event.
1564         (webkitWebViewRestoreWindow): Try to unmaximize or unminimize the window and wait for the event.
1565         * UIProcess/API/wpe/WebKitWebViewWPE.cpp:
1566         (webkitWebViewMaximizeWindow):
1567         (webkitWebViewMinimizeWindow):
1568         (webkitWebViewRestoreWindow):
1569         * UIProcess/Automation/Automation.json:
1570         * UIProcess/Automation/WebAutomationSession.cpp:
1571         (WebKit::WebAutomationSession::maximizeWindowOfBrowsingContext): Exit fullscreen, restore the window and then
1572         maximize it.
1573         (WebKit::WebAutomationSession::maximizeWindowForPage): Ask the client to maximize the window of page.
1574         * UIProcess/Automation/WebAutomationSession.h:
1575         * UIProcess/Automation/atoms/EnterFullscreen.js:
1576         (enterFullscreen): Return early if fullscreen is disabled or if window is already in fullscreen.
1577
1578 2018-05-23  Eric Carlson  <eric.carlson@apple.com>
1579
1580         Avoid loading AVFoundation to check supported MIME types if possible
1581         https://bugs.webkit.org/show_bug.cgi?id=185839
1582         <rdar://problem/40182010>
1583
1584         Reviewed by Jer Noble.
1585         
1586         * Shared/WebProcessCreationParameters.cpp:
1587         (WebKit::WebProcessCreationParameters::encode const): Encode mediaMIMETypes.
1588         (WebKit::WebProcessCreationParameters::decode): Decode mediaMIMETypes.
1589         * Shared/WebProcessCreationParameters.h:
1590
1591         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
1592         (WebKit::mediaTypeCache): Static Vector of media MIME types.
1593         (WebKit::WebProcessProxy::cacheMediaMIMETypes): Cache the type list and pass it to every other
1594         process proxy.
1595         (WebKit::WebProcessProxy::cacheMediaMIMETypesInternal): Cache the type list and pass it to the
1596         web process.
1597         (WebKit::WebProcessProxy::mediaMIMETypes): Return the cached type list.
1598
1599         * UIProcess/WebProcessPool.cpp:
1600         (WebKit::WebProcessPool::initializeNewWebProcess): Set parameters.mediaMIMETypes.
1601
1602         * UIProcess/WebProcessProxy.h:
1603         * UIProcess/WebProcessProxy.messages.in: Add CacheMediaMIMETypes.
1604
1605         * WebProcess/WebProcess.h:
1606         * WebProcess/WebProcess.messages.in: Add SetMediaMIMETypes.
1607
1608         * WebProcess/cocoa/WebProcessCocoa.mm:
1609         (WebKit::WebProcess::platformInitializeWebProcess): Cache the MIME types if the list isn't
1610         empty, else register with AVFoundationMIMETypeCache to be notified when it loads types.
1611         AVFoundationMIMETypeCache to 
1612         (WebKit::WebProcess::platformTerminate): Unregister with AVFoundationMIMETypeCache.
1613         (WebKit::WebProcess::setMediaMIMETypes): Pass list of types to AVFoundationMIMETypeCache.
1614
1615 2018-05-23  Brian Burg  <bburg@apple.com>
1616
1617         Web Automation: disable process swap on navigation when an automation session is active
1618         https://bugs.webkit.org/show_bug.cgi?id=185552
1619
1620         Reviewed by Tim Horton.
1621
1622         * UIProcess/WebProcessPool.cpp:
1623         (WebKit::WebProcessPool::processForNavigationInternal):
1624         This is not intended to work right now. Opt out to avoid crashing
1625         later when a process is deallocated unexpectedly.
1626
1627 2018-05-23  Youenn Fablet  <youenn@apple.com>
1628
1629         NetworkLoadChecker should check cached redirections
1630         https://bugs.webkit.org/show_bug.cgi?id=185849
1631
1632         Reviewed by Chris Dumez.
1633
1634         * NetworkProcess/NetworkLoadChecker.cpp:
1635         (WebKit::NetworkLoadChecker::checkRedirection):
1636         Set the resource error url as done by WebCore SubresourceLoader.
1637         * NetworkProcess/NetworkResourceLoader.cpp:
1638         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1639         Pass the resource request to dispatchWillSendRedirectedRequest now needs it.
1640         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1641         Make sure that m_networkLoad is not null before cancelling it since we might be checking a cached redirection.
1642         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
1643         Ensure the redirect response is coming from the Network before adding it to the cache.
1644         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
1645         Call willSendRedirectedRequest to make sure the cached redirect is validated.
1646         * NetworkProcess/NetworkResourceLoader.h:
1647
1648 2018-05-23  Carlos Garcia Campos  <cgarcia@igalia.com>
1649
1650         [GTK] WebDriver: implement AutomationSessionClient::didDisconnectFromRemote
1651         https://bugs.webkit.org/show_bug.cgi?id=185866
1652
1653         Reviewed by Brian Burg.
1654
1655         To handle the case of the session being closed by the browser, for example in case of a network process
1656         crash. This is currently causing WebDriver tests to timeout in the bot.
1657
1658         * UIProcess/API/glib/WebKitAutomationSession.cpp: Add an implementation of didDisconnectFromRemote() to notify
1659         the WebContext that the session will be closed.
1660         * UIProcess/API/glib/WebKitWebContext.cpp: Remove the automation session when closed.
1661         * UIProcess/API/glib/WebKitWebContextPrivate.h:
1662
1663 2018-05-22  Brent Fulgham  <bfulgham@apple.com>
1664
1665         Close access to "lsopen" for non-UI process
1666         https://bugs.webkit.org/show_bug.cgi?id=185890
1667         <rdar://problem/39686511>
1668
1669         Reviewed by Alexey Proskuryakov.
1670
1671         Close down access to 'lsopen' in the iOS sandboxes. These operations are
1672         performed by the UIProcess on behalf of these helper processes.
1673
1674         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
1675         * Resources/SandboxProfiles/ios/com.apple.WebKit.Storage.sb:
1676         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1677
1678 2018-05-22  Dean Jackson  <dino@apple.com>
1679
1680         Optimized path zoom animation needs a valid UIImage and CGRect
1681         https://bugs.webkit.org/show_bug.cgi?id=185883
1682         <rdar://problem/40306056>
1683
1684         Reviewed by Jon Lee.
1685
1686         Take the rectangle that was passed into the ResourceRequest and
1687         use it for the origin of an animation into QuickLook.
1688
1689         * Shared/WebCoreArgumentCoders.cpp:
1690         (IPC::ArgumentCoder<ResourceRequest>::encode):
1691         (IPC::ArgumentCoder<ResourceRequest>::decode):
1692         * UIProcess/Cocoa/DownloadClient.mm:
1693         (WebKit::DownloadClient::didStart):
1694         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
1695         (-[_WKPreviewControllerDelegate initWithSystemPreviewController:fromRect:]):
1696         (-[_WKPreviewControllerDelegate presentingViewController]):
1697         (-[_WKPreviewControllerDelegate previewController:frameForPreviewItem:inSourceView:]):
1698         (-[_WKPreviewControllerDelegate previewController:transitionImageForPreviewItem:contentRect:]):
1699         (WebKit::SystemPreviewController::start):
1700         (-[_WKPreviewControllerDelegate initWithSystemPreviewController:]): Deleted.
1701         * UIProcess/Downloads/DownloadProxy.h:
1702         (WebKit::DownloadProxy::systemPreviewDownloadRect const):
1703         * UIProcess/SystemPreviewController.h:
1704         * UIProcess/WebPageProxy.cpp:
1705         (WebKit::WebPageProxy::syncRootViewToScreen):
1706         * UIProcess/WebPageProxy.h:
1707
1708 2018-05-22  Sihui Liu  <sihui_liu@apple.com>
1709
1710         [iOS] TestWebKitAPI.WebKit.WKHTTPCookieStoreWithoutProcessPool fails because cookies use different files with/without processpool
1711         https://bugs.webkit.org/show_bug.cgi?id=185831
1712
1713         Reviewed by Chris Dumez.
1714
1715         Started to use uiProcessCookieStorageIdentifier for iOS: make sure cookies handled without 
1716         processpool would use the same storage file as when processpool exists.
1717
1718         * NetworkProcess/NetworkProcess.h:
1719         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1720         (WebKit::NetworkProcessCreationParameters::encode const):
1721         (WebKit::NetworkProcessCreationParameters::decode):
1722         * NetworkProcess/NetworkProcessCreationParameters.h:
1723         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1724         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1725         * Shared/WebProcessCreationParameters.cpp:
1726         (WebKit::WebProcessCreationParameters::encode const):
1727         (WebKit::WebProcessCreationParameters::decode):
1728         * Shared/WebProcessCreationParameters.h:
1729         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1730         (WebKit::WebProcessPool::platformInitializeWebProcess):
1731         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1732
1733 2018-05-22  Chris Dumez  <cdumez@apple.com>
1734
1735         Regression(AsyncPolicyDelegates): Box.app login Window is blank
1736         https://bugs.webkit.org/show_bug.cgi?id=185832
1737         <rdar://problem/40307871>
1738
1739         Reviewed by Geoffrey Garen.
1740
1741         Moved WeakObjCPtr.h header from WebKit/ to wtf/ so that it can be used in
1742         WebKitLegacy code.
1743
1744         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
1745         * UIProcess/API/Cocoa/WKBrowsingContextControllerInternal.h:
1746         * UIProcess/API/Cocoa/WKConnection.mm:
1747         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
1748         * UIProcess/API/Cocoa/WKProcessGroup.mm:
1749         * UIProcess/API/Cocoa/WKProcessPool.mm:
1750         * UIProcess/API/Cocoa/WKScriptMessage.mm:
1751         * UIProcess/API/Cocoa/WKWebView.mm:
1752         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1753         * UIProcess/API/Cocoa/_WKAutomationSession.mm:
1754         * UIProcess/API/Cocoa/_WKDownload.mm:
1755         * UIProcess/API/Cocoa/_WKElementAction.mm:
1756         * UIProcess/ApplicationStateTracker.h:
1757         * UIProcess/Cocoa/AutomationClient.h:
1758         * UIProcess/Cocoa/AutomationSessionClient.h:
1759         * UIProcess/Cocoa/DiagnosticLoggingClient.h:
1760         * UIProcess/Cocoa/DownloadClient.h:
1761         * UIProcess/Cocoa/FindClient.h:
1762         * UIProcess/Cocoa/FullscreenClient.h:
1763         * UIProcess/Cocoa/IconLoadingDelegate.h:
1764         * UIProcess/Cocoa/NavigationState.h:
1765         * UIProcess/Cocoa/UIDelegate.h:
1766         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1767         * UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm:
1768         * UIProcess/Cocoa/WebViewImpl.h:
1769         * UIProcess/ios/ViewGestureControllerIOS.mm:
1770         * UIProcess/ios/WKActionSheetAssistant.mm:
1771         * UIProcess/ios/WKContentViewInteraction.mm:
1772         * UIProcess/ios/WKPDFView.mm:
1773         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
1774         * UIProcess/ios/WKScrollView.mm:
1775         * UIProcess/mac/WKInspectorViewController.mm:
1776         * UIProcess/mac/WKInspectorWKWebView.mm:
1777         * WebKit.xcodeproj/project.pbxproj:
1778         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1779
1780 2018-05-22  Sihui Liu  <sihui_liu@apple.com>
1781
1782         Conversion between SecurityOriginData and DatabaseIdentifier is asymmetric when port is null
1783         https://bugs.webkit.org/show_bug.cgi?id=185715
1784
1785         Reviewed by Geoffrey Garen.
1786
1787         Add getter for origins in WKWebsiteDataRecord for testing.
1788
1789         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
1790         (-[WKWebsiteDataRecord _originsString]):
1791         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
1792
1793
1794 2018-05-22  Brady Eidson  <beidson@apple.com>
1795
1796         Rename the "Web content is visible" process assertion.
1797         https://bugs.webkit.org/show_bug.cgi?id=185878
1798
1799         Reviewed by Chris Dumez.
1800
1801         * UIProcess/ios/ProcessAssertionIOS.mm:
1802         (WebKit::ProcessAssertion::ProcessAssertion):
1803
1804 2018-05-22  Andy Estes  <aestes@apple.com>
1805
1806         [Wi-Fi Assertions] Drop assertions on process suspension
1807         https://bugs.webkit.org/show_bug.cgi?id=185844
1808         <rdar://problem/40352319>
1809
1810         Reviewed by Daniel Bates.
1811
1812         * NetworkProcess/NetworkProcess.cpp:
1813         (WebKit::NetworkProcess::actualPrepareToSuspend):
1814         (WebKit::NetworkProcess::processDidResume):
1815         * NetworkProcess/NetworkProcess.h:
1816         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1817         (WebKit::NetworkProcess::platformPrepareToSuspend):
1818         (WebKit::NetworkProcess::platformProcessDidResume):
1819
1820 2018-05-22  Brent Fulgham  <bfulgham@apple.com>
1821
1822         REGRESSION(r229093): Re-enable Network Extension support in the WebContent process (Take 2)
1823         https://bugs.webkit.org/show_bug.cgi?id=185874
1824         <rdar://problem/40454404>
1825
1826         Reviewed by Eric Carlson.
1827
1828         Add back a necessary XPC connection after locking down the network features in r229093.
1829
1830         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1831         * WebProcess/com.apple.WebProcess.sb.in:
1832
1833 2018-05-22  Ryan Haddad  <ryanhaddad@apple.com>
1834
1835         Unreviewed, rolling out r232052.
1836
1837         Breaks internal builds.
1838
1839         Reverted changeset:
1840
1841         "Use more C++17"
1842         https://bugs.webkit.org/show_bug.cgi?id=185176
1843         https://trac.webkit.org/changeset/232052
1844
1845 2018-05-22  Alberto Garcia  <berto@igalia.com>
1846
1847         [CMake] Properly detect compiler flags, needed libs, and fallbacks for usage of 64-bit atomic operations
1848         https://bugs.webkit.org/show_bug.cgi?id=182622
1849         <rdar://problem/40292317>
1850
1851         Reviewed by Michael Catanzaro.
1852
1853         Move the test to determine whether we need to link against
1854         libatomic to the common file WebKitCompilerFlags.cmake so it can
1855         also be used for JavaScriptCore.
1856
1857         * CMakeLists.txt:
1858
1859 2018-05-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1860
1861         Unreviewed, rolling out r231843.
1862
1863         Broke cross build
1864
1865         Reverted changeset:
1866
1867         "[CMake] Properly detect compiler flags, needed libs, and
1868         fallbacks for usage of 64-bit atomic operations"
1869         https://bugs.webkit.org/show_bug.cgi?id=182622
1870         https://trac.webkit.org/changeset/231843
1871
1872 2018-05-22  Carlos Garcia Campos  <cgarcia@igalia.com>
1873
1874         Crash when loading a SVG image
1875         https://bugs.webkit.org/show_bug.cgi?id=185819
1876
1877         Reviewed by Brent Fulgham.
1878
1879         This is happening in WebLoaderStrategy::scheduleLoad() when getting the value of
1880         FrameLoaderClient::pageID(). SVGImage uses the empty clients for the loader, and
1881         EmptyFrameLoaderClient::pageID() returns std::nullopt. The same happens with the frameID. This changed in
1882         r225934, when pageID() and frameID() were changed to return std::optional, EmptyFrameLoaderClient was updated to
1883         return std::nullopt instead of 0.
1884
1885         * WebProcess/Network/WebLoaderStrategy.cpp:
1886         (WebKit::WebLoaderStrategy::scheduleLoad): Use value_or(0) instead of value() to get pageID and frameID from
1887         FrameLoaderClient.
1888
1889 2018-05-21  Yusuke Suzuki  <utatane.tea@gmail.com>
1890
1891         Use more C++17
1892         https://bugs.webkit.org/show_bug.cgi?id=185176
1893
1894         Reviewed by JF Bastien.
1895
1896         * Configurations/Base.xcconfig:
1897         * DerivedSources.make:
1898
1899 2018-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1900
1901         [GTK][Wayland] UI process crash when closing the window
1902         https://bugs.webkit.org/show_bug.cgi?id=185818
1903
1904         Reviewed by Michael Catanzaro.
1905
1906         This happens when a page containing a text field is loaded but the focus remains in the url bar when the window
1907         is closed. This is because we are sending a notify-in to the IM context, but the focus is still in the URL
1908         bar. That confuses the wayland input method manager that tries to free the text of the web view IM context that has
1909         already been deleted.
1910
1911         * UIProcess/gtk/InputMethodFilter.cpp:
1912         (WebKit::InputMethodFilter::setEnabled): Only send notify-in if the view is actually focused.
1913
1914 2018-05-21  Ryosuke Niwa  <rniwa@webkit.org>
1915
1916         Remove unused and no-op WKContextSetCookieStorageDirectory
1917         https://bugs.webkit.org/show_bug.cgi?id=185857
1918
1919         Reviewed by Youenn Fablet.
1920
1921         Deleted C API which didn't do anything useful, and consequently not used by anyone.
1922
1923         * UIProcess/API/C/WKContext.cpp:
1924         (WKContextSetCookieStorageDirectory): Deleted.
1925         * UIProcess/API/C/WKContextPrivate.h:
1926         * UIProcess/WebProcessPool.h:
1927
1928 2018-05-21  Chris Nardi  <cnardi@chromium.org>
1929
1930         Remove dead exception in MediaList.appendMedium
1931         https://bugs.webkit.org/show_bug.cgi?id=185278
1932
1933         Reviewed by Chris Dumez.
1934
1935         Remove code pertaining to an exception being thrown by appendMedium().
1936
1937         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMediaList.cpp:
1938         (webkit_dom_media_list_append_medium):
1939
1940 2018-05-21  Aditya Keerthi  <akeerthi@apple.com>
1941
1942         [iOS] Click events only fire once when editing
1943         https://bugs.webkit.org/show_bug.cgi?id=185777
1944
1945         Reviewed by Tim Horton.
1946
1947         gestureRecognizerShouldBegin: was returning false for the single tap gesture when a node was being
1948         edited. This is an artifact of how the gesture was previously handled with the text selection assistant.
1949         This condition is now removed, allowing the single tap gesture to go through and correctly propagate the
1950         click event.
1951
1952         Also added an early return to _didGetTapHighlightForRequest: in order to prevent the tap highlight from
1953         being shown when the node is already being assisted.
1954
1955         * UIProcess/ios/WKContentViewInteraction.mm:
1956         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]):
1957         (-[WKContentView gestureRecognizerShouldBegin:]):
1958
1959 2018-05-21  Daniel Bates  <dabates@apple.com>
1960
1961         REGRESSION (r231107): CSP report-only policies are ignored for beacon, importScripts, fetch(), EventSource, and XHR
1962         https://bugs.webkit.org/show_bug.cgi?id=185789
1963         <rdar://problem/40380175>
1964
1965         Reviewed by Andy Estes.
1966
1967         Have NetworkLoadChecker implement the ContentSecurityPolicyClient interface and support logging
1968         console messages, sending CSP reports, and dispatching SecurityPolicyViolation events.
1969
1970         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1971         (WebKit::NetworkConnectionToWebProcess::loadPing):
1972         * NetworkProcess/NetworkLoadChecker.cpp:
1973         (WebKit::NetworkLoadChecker::NetworkLoadChecker): Modified to take a reference to the NetworkConnectionToWebProcess,
1974         the web page ID, the web frame ID, and the resource load identifier. These details are necessary
1975         in order to implement the ContentSecurityPolicyClient interface.
1976         (WebKit::NetworkLoadChecker::isAllowedByContentSecurityPolicy): Added.
1977         (WebKit::NetworkLoadChecker::continueCheckingRequest): Write in terms of isAllowedByContentSecurityPolicy().
1978         (WebKit::NetworkLoadChecker::contentSecurityPolicy): Pass ourself as the client so that we receive
1979         delegate callbacks.
1980         (WebKit::NetworkLoadChecker::addConsoleMessage): Added.
1981         (WebKit::NetworkLoadChecker::sendCSPViolationReport): Added.
1982         (WebKit::NetworkLoadChecker::enqueueSecurityPolicyViolationEvent): Added.
1983         * NetworkProcess/NetworkLoadChecker.h:
1984         * NetworkProcess/NetworkResourceLoader.cpp:
1985         (NetworkResourceLoader::enqueueSecurityPolicyViolationEvent): Added.
1986         * NetworkProcess/NetworkResourceLoader.h:
1987         * NetworkProcess/PingLoad.cpp:
1988         (WebKit::PingLoad::PingLoad): Modified to take a reference to the NetworkConnectionToWebProcess and pass
1989         this through to the NetworkLoadChecker along with the web page ID, web frame ID and resource load identifier.
1990         * NetworkProcess/PingLoad.h:
1991         * WebProcess/WebPage/WebPage.cpp:
1992         (WebKit::WebPage::enqueueSecurityPolicyViolationEvent): Added.
1993         * WebProcess/WebPage/WebPage.h:
1994         * WebProcess/WebPage/WebPage.messages.in: Add message EnqueueSecurityPolicyViolationEvent.
1995
1996 2018-05-21  Brian Burg  <bburg@apple.com>
1997
1998         Web Automation: always return an empty cookie list if document.cookieURL() is empty
1999         https://bugs.webkit.org/show_bug.cgi?id=185838
2000         <rdar://problem/37737526>
2001
2002         Reviewed by Tim Horton.
2003
2004         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2005         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
2006         This crashes in CFNetwork code because an empty cookie URL is not a valid input.
2007         Just return an empty list since there couldn't be any cookies returned.
2008
2009 2018-05-21  Brian Burg  <bburg@apple.com>
2010
2011         Web Automation: terminate the automation session if the network or storage process crashes
2012         https://bugs.webkit.org/show_bug.cgi?id=185827
2013         <rdar://problem/40424020>
2014
2015         Reviewed by Tim Horton.
2016
2017         If one of the processes crashes, the page may be in an undefined state and
2018         automation will fail in unpredictable ways. It's better to just give up immediately.
2019
2020         * UIProcess/WebProcessPool.cpp:
2021         (WebKit::WebProcessPool::networkProcessFailedToLaunch):
2022         (WebKit::WebProcessPool::storageProcessCrashed):
2023
2024 2018-05-21  Sihui Liu  <sihui_liu@apple.com>
2025
2026         Add a diskCacheSizeOverride accessor function on WKContextConfigurationRef
2027         https://bugs.webkit.org/show_bug.cgi?id=185826
2028         <rdar://problem/39732113>
2029
2030         Reviewed by Alex Christensen.
2031
2032         * UIProcess/API/C/WKContextConfigurationRef.cpp:
2033         (WKContextConfigurationDiskCacheSizeOverride):
2034         (WKContextConfigurationSetDiskCacheSizeOverride):
2035         * UIProcess/API/C/WKContextConfigurationRef.h:
2036
2037 2018-05-21  Jer Noble  <jer.noble@apple.com>
2038
2039         Complete fix for enabling modern EME by default
2040         https://bugs.webkit.org/show_bug.cgi?id=185770
2041         <rdar://problem/40368220>
2042
2043         Reviewed by Eric Carlson.
2044
2045         * Configurations/FeatureDefines.xcconfig:
2046
2047 2018-05-21  Sam Weinig  <sam@webkit.org>
2048
2049         Modernize RenderStyleConstants.h - Part 1
2050         https://bugs.webkit.org/show_bug.cgi?id=185809
2051
2052         Reviewed by Yusuke Suzuki.
2053
2054         * WebProcess/WebPage/ios/WebPageIOS.mm:
2055         (WebKit::WebPage::rangeForWebSelectionAtPosition):
2056         (WebKit::WebPage::getPositionInformation):
2057         Update for new enum names.
2058
2059 2018-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2060
2061         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.2 release.
2062
2063         * gtk/NEWS: Add release notes for 2.21.2.
2064
2065 2018-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2066
2067         Unreviewed, rolling out r222967.
2068
2069         It's not ready yet
2070
2071         Reverted changeset:
2072
2073         "[GTK][WPE] Add API to configure and enable resource load
2074         statistics"
2075         https://bugs.webkit.org/show_bug.cgi?id=177943
2076         https://trac.webkit.org/changeset/222967
2077
2078 2018-05-18  Commit Queue  <commit-queue@webkit.org>
2079
2080         Unreviewed, rolling out r231982.
2081         https://bugs.webkit.org/show_bug.cgi?id=185793
2082
2083         Caused layout test failures (Requested by realdawei on
2084         #webkit).
2085
2086         Reverted changeset:
2087
2088         "Complete fix for enabling modern EME by default"
2089         https://bugs.webkit.org/show_bug.cgi?id=185770
2090         https://trac.webkit.org/changeset/231982
2091
2092 2018-05-18  Brian Burg  <bburg@apple.com>
2093
2094         [Cocoa] Add missing nullability annotations to _WKAutomationSessionDelegate
2095         https://bugs.webkit.org/show_bug.cgi?id=185791
2096         <rdar://problem/40279891>
2097
2098         Reviewed by Tim Horton.
2099
2100         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h: If there is no dialog shown,
2101         then the delegate methods to return the dialog text may return a nil NSString.
2102
2103 2018-05-18  Youenn Fablet  <youenn@apple.com>
2104
2105         NetworkLoadChecker should cancel its content extension retrieval task when being destroyed
2106         https://bugs.webkit.org/show_bug.cgi?id=185661
2107         <rdar://problem/39985509>
2108
2109         Reviewed by Chris Dumez.
2110
2111         Make sure that the Content Extension retrieval callback checks that NetworkLoadChecker is alive.
2112         This allows stopping NetworkLoadChecker be ref counted.
2113         This in turns allows NetworkResourceLoader to delete its NetworkLoadChecker when being deleted as well.
2114         By doing so, we simplify the memory management of NetworkResourceLoader and NetworkLoadChecker.
2115
2116         * NetworkProcess/NetworkLoadChecker.cpp:
2117         (WebKit::NetworkLoadChecker::checkRequest):
2118         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
2119         * NetworkProcess/NetworkLoadChecker.h:
2120         (WebKit::NetworkLoadChecker::weakPtrFactory):
2121         * NetworkProcess/NetworkResourceLoader.cpp:
2122         * NetworkProcess/NetworkResourceLoader.h:
2123         * NetworkProcess/PingLoad.cpp:
2124         (WebKit::PingLoad::PingLoad):
2125         * NetworkProcess/PingLoad.h:
2126
2127 2018-05-18  Per Arne Vollan  <pvollan@apple.com>
2128
2129         WebProcess fails to launch
2130         https://bugs.webkit.org/show_bug.cgi?id=185140
2131
2132         Reviewed by Geoffrey Garen.
2133
2134         If the NSApplication runloop is not used in the WebContent process, launchServicesCheckIn() needs to be called
2135         in order for enableSandboxStyleFileQuarantine() to succeed. Determine at runtime if launchServicesCheckIn()
2136         should be called by checking if the NSApplication event loop is running.
2137
2138         * WebProcess/cocoa/WebProcessCocoa.mm:
2139         (WebKit::WebProcess::platformInitializeProcess):
2140
2141 2018-05-18  Jer Noble  <jer.noble@apple.com>
2142
2143         Complete fix for enabling modern EME by default
2144         https://bugs.webkit.org/show_bug.cgi?id=185770
2145         <rdar://problem/40368220>
2146
2147         Reviewed by Eric Carlson.
2148
2149         * Configurations/FeatureDefines.xcconfig:
2150
2151 2018-05-18  Brent Fulgham  <bfulgham@apple.com>
2152
2153         Convert ProcessPrivilege assertions to regular debug-only assertions
2154         https://bugs.webkit.org/show_bug.cgi?id=185775
2155         <rdar://problem/40372286>
2156
2157         Reviewed by Geoffrey Garen.
2158
2159         In Bug 184322 I added a number of RELEASE_ASSERT checks that certain
2160         UI-only calls were not being made in the WebContent process.
2161
2162         Measurements have shown that these RELEASE_ASSERTs have regressed performance
2163         by around 1% on some benchmarks, so we should convert them to normal asserts.
2164
2165         This patch changes the RELEASE_ASSERTs into ASSERTs.
2166
2167         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2168         (WebKit::WebProcessPool::platformInitializeWebProcess):
2169         * UIProcess/Cocoa/WebViewImpl.mm:
2170         (WebKit::WebViewImpl::WebViewImpl):
2171         (WebKit::WebViewImpl::becomeFirstResponder):
2172         (WebKit::WebViewImpl::pluginFocusOrWindowFocusChanged):
2173         (WebKit::WebViewImpl::validateUserInterfaceItem):
2174         (WebKit::WebViewImpl::startSpeaking):
2175         (WebKit::WebViewImpl::stopSpeaking):
2176         (WebKit::applicationFlagsForDrag):
2177         (WebKit::WebViewImpl::doneWithKeyEvent):
2178         * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm:
2179         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
2180         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
2181         (WebKit::PluginProcessProxy::enterFullscreen):
2182         (WebKit::PluginProcessProxy::beginModal):
2183         (WebKit::PluginProcessProxy::endModal):
2184         * UIProcess/mac/DisplayLink.cpp:
2185         (WebKit::DisplayLink::DisplayLink):
2186         (WebKit::DisplayLink::~DisplayLink):
2187         * UIProcess/mac/WebPageProxyMac.mm:
2188         (WebKit::WebPageProxy::getIsSpeaking):
2189         (WebKit::WebPageProxy::speak):
2190         (WebKit::WebPageProxy::stopSpeaking):
2191         (WebKit::WebPageProxy::startDisplayLink):
2192         * UIProcess/mac/WebPopupMenuProxyMac.mm:
2193         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
2194
2195 2018-05-18  Eric Carlson  <eric.carlson@apple.com>
2196
2197         Handle failure to extend sandbox gracefully
2198         https://bugs.webkit.org/show_bug.cgi?id=185779
2199         <rdar://problem/40316349>
2200
2201         Reviewed by Brent Fulgham.
2202
2203         * UIProcess/API/Cocoa/WKWebView.mm:
2204         (-[WKWebView _denyNextUserMediaRequest]): 
2205         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2206
2207         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2208         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): Don't append
2209         the request to m_grantedRequests if it failed.
2210         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess): Deny request if willCreateMediaStream
2211         fails.
2212         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2213
2214         * UIProcess/UserMediaProcessManager.cpp:
2215         (WebKit::UserMediaProcessManager::willCreateMediaStream): Don't try to extend sandbox if
2216         we fail to allocate all necessary handles.
2217         * UIProcess/UserMediaProcessManager.h:
2218         (WebKit::UserMediaProcessManager::denyNextUserMediaRequest): New, for testing.
2219
2220 2018-05-18  Antoine Quint  <graouts@apple.com>
2221
2222         [Web Animations] Turn Web Animations with CSS integration on for test runners
2223         https://bugs.webkit.org/show_bug.cgi?id=184819
2224         <rdar://problem/39597337>
2225
2226         Unreviewed. Rolling out the patch for this bug, it caused some flaky timeouts for animation suspension tests.
2227
2228         * Shared/WebPreferences.yaml:
2229
2230 2018-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2231
2232         [Extra zoom mode] Clearing text fields should dispatch input events of type "deleteContent"
2233         https://bugs.webkit.org/show_bug.cgi?id=185769
2234         <rdar://problem/40368261>
2235
2236         Reviewed by Tim Horton.
2237
2238         When setting the text of the currently focused element to the empty string, just delete the text instead of
2239         pretending to insert an empty string. This mimics deleting content using the delete key on macOS, and fires an
2240         input event with inputType "deleteContent" instead of "insertText".
2241
2242         Test: fast/forms/extrazoom/delete-content-in-text-field.html
2243
2244         * WebProcess/WebPage/WebPage.cpp:
2245         (WebKit::WebPage::setTextAsync):
2246
2247 2018-05-18  Keith Rollin  <krollin@apple.com>
2248
2249         Renamed "trackNetworkActivity" to "tracksResourceLoadMilestones"
2250         https://bugs.webkit.org/show_bug.cgi?id=185523
2251         <rdar://problem/40136361>
2252
2253         Reviewed by Geoffrey Garen.
2254
2255         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2256         (WebKit::networkActivityTrackingEnabled):
2257         * NetworkProcess/NetworkProcess.cpp:
2258         (WebKit::NetworkProcess::initializeNetworkProcess):
2259         * NetworkProcess/NetworkProcess.h:
2260         (WebKit::NetworkProcess::tracksResourceLoadMilestones const):
2261         (WebKit::NetworkProcess::trackNetworkActivity const): Deleted.
2262         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2263         (WebKit::NetworkProcessCreationParameters::encode const):
2264         (WebKit::NetworkProcessCreationParameters::decode):
2265         * NetworkProcess/NetworkProcessCreationParameters.h:
2266         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2267         (API::ProcessPoolConfiguration::copy):
2268         * UIProcess/API/APIProcessPoolConfiguration.h:
2269         * UIProcess/API/C/WKContextConfigurationRef.cpp:
2270         (WKContextConfigurationTracksResourceLoadMilestones):
2271         (WKContextConfigurationSetTracksResourceLoadMilestones):
2272         (WKContextConfigurationTrackNetworkActivity): Deleted.
2273         (WKContextConfigurationSetTrackNetworkActivity): Deleted.
2274         * UIProcess/API/C/WKContextConfigurationRef.h:
2275         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2276         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2277         (-[_WKProcessPoolConfiguration tracksResourceLoadMilestones]):
2278         (-[_WKProcessPoolConfiguration setTracksResourceLoadMilestones:]):
2279         (-[_WKProcessPoolConfiguration trackNetworkActivity]): Deleted.
2280         (-[_WKProcessPoolConfiguration setTrackNetworkActivity:]): Deleted.
2281         * UIProcess/WebProcessPool.cpp:
2282         (WebKit::WebProcessPool::ensureNetworkProcess):
2283
2284 2018-05-18  Chris Dumez  <cdumez@apple.com>
2285
2286         Avoid keeping the frame alive when ref'ing a WindowProxy
2287         https://bugs.webkit.org/show_bug.cgi?id=185737
2288         <rdar://problem/40004666>
2289
2290         Reviewed by Sam Weinig.
2291
2292         * WebProcess/Plugins/PluginView.cpp:
2293         (WebKit::PluginView::windowScriptNPObject):
2294
2295 2018-05-18  Youenn Fablet  <youenn@apple.com>
2296
2297         -Wmemset-elt-size warning in LibWebRTCSocket constructor
2298         https://bugs.webkit.org/show_bug.cgi?id=185555
2299         <rdar://problem/40217250>
2300
2301         Reviewed by Darin Adler.
2302
2303         GetOption implementation was broken in that it was not initializing properly its array of options.
2304         This patch fixes it by using an array of optional<int> which are initialized by default.
2305         When no value is set, we return the error code -1.
2306         In theory, we should go to NetworkProcess to get the actual value.
2307         Since GetOption is not used in practice, we just do this best effort implementation of storing previously set values.
2308
2309         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
2310         (WebKit::LibWebRTCSocket::LibWebRTCSocket):
2311         (WebKit::LibWebRTCSocket::GetOption):
2312         * WebProcess/Network/webrtc/LibWebRTCSocket.h:
2313
2314 2018-05-18  Antoine Quint  <graouts@apple.com>
2315
2316         [Web Animations] Turn Web Animations with CSS integration on for test runners
2317         https://bugs.webkit.org/show_bug.cgi?id=184819
2318         <rdar://problem/39597337>
2319
2320         Reviewed by Jon Lee.
2321
2322         * Shared/WebPreferences.yaml: Leave Web Animations off by default, it's up to clients
2323         to turn it on.
2324
2325 2018-05-18  Fujii Hironori  <Hironori.Fujii@sony.com>
2326
2327         [Curl] Remove unused SystemProxyWin.cpp
2328         https://bugs.webkit.org/show_bug.cgi?id=185224
2329
2330         Reviewed by Antti Koivisto.
2331
2332         SystemProxyWin is not used at the moment. Remove it.
2333
2334         * NetworkProcess/win/SystemProxyWin.cpp: Removed.
2335         * NetworkProcess/win/SystemProxyWin.h: Removed.
2336         * PlatformWin.cmake: Removed SystemProxyWin.cpp.
2337
2338 2018-05-17  Nan Wang  <n_wang@apple.com>
2339
2340         AX: [macOS] Expose the primary screen height through AX API
2341         https://bugs.webkit.org/show_bug.cgi?id=185742
2342
2343         Reviewed by Chris Fleizach.
2344
2345         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
2346         (-[WKAccessibilityWebPageObject accessibilityAttributeNames]):
2347         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):
2348
2349 2018-05-17  Alex Christensen  <achristensen@webkit.org>
2350
2351         Use CompletionHandlers for DelayedReplies
2352         https://bugs.webkit.org/show_bug.cgi?id=182269
2353
2354         Reviewed by Youenn Fablet.
2355
2356         DelayedReplies should be a noncopyable, non-refcountable type.  They should be
2357         called once and only once.  This is what CompletionHandlers are for.
2358
2359         No change in behavior.  Just cleaner code.
2360
2361         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2362         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
2363         * NetworkProcess/NetworkConnectionToWebProcess.h:
2364         * NetworkProcess/NetworkResourceLoader.cpp:
2365         (WebKit::NetworkResourceLoader::SynchronousLoadData::SynchronousLoadData):
2366         (WebKit::sendReplyToSynchronousRequest):
2367         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
2368         * NetworkProcess/NetworkResourceLoader.h:
2369         * Platform/IPC/HandleMessage.h:
2370         (IPC::callMemberFunctionImpl):
2371         (IPC::callMemberFunction):
2372         (IPC::handleMessageDelayed):
2373         * PluginProcess/PluginControllerProxy.cpp:
2374         (WebKit::PluginControllerProxy::setInitializationReply):
2375         (WebKit::PluginControllerProxy::takeInitializationReply):
2376         * PluginProcess/PluginControllerProxy.h:
2377         * PluginProcess/WebProcessConnection.cpp:
2378         (WebKit::WebProcessConnection::destroyPlugin):
2379         (WebKit::WebProcessConnection::createPlugin):
2380         (WebKit::WebProcessConnection::createPluginAsynchronously):
2381         * PluginProcess/WebProcessConnection.h:
2382         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
2383         (Messages::WebPage::GetPluginProcessConnection::send):
2384         (Messages::WebPage::TestMultipleAttributes::send):
2385         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::DelayedReply): Deleted.
2386         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::~DelayedReply): Deleted.
2387         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::send): Deleted.
2388         (Messages::WebPage::TestMultipleAttributes::DelayedReply::DelayedReply): Deleted.
2389         (Messages::WebPage::TestMultipleAttributes::DelayedReply::~DelayedReply): Deleted.
2390         (Messages::WebPage::TestMultipleAttributes::DelayedReply::send): Deleted.
2391         * Scripts/webkit/LegacyMessages-expected.h:
2392         * Scripts/webkit/MessageReceiver-expected.cpp:
2393         (Messages::WebPage::GetPluginProcessConnection::send):
2394         (Messages::WebPage::TestMultipleAttributes::send):
2395         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::DelayedReply): Deleted.
2396         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::~DelayedReply): Deleted.
2397         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::send): Deleted.
2398         (Messages::WebPage::TestMultipleAttributes::DelayedReply::DelayedReply): Deleted.
2399         (Messages::WebPage::TestMultipleAttributes::DelayedReply::~DelayedReply): Deleted.
2400         (Messages::WebPage::TestMultipleAttributes::DelayedReply::send): Deleted.
2401         * Scripts/webkit/Messages-expected.h:
2402         * Scripts/webkit/messages.py:
2403         * UIProcess/Network/NetworkProcessProxy.cpp:
2404         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
2405         (WebKit::NetworkProcessProxy::networkProcessCrashed):
2406         (WebKit::NetworkProcessProxy::networkProcessFailedToLaunch):
2407         (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
2408         * UIProcess/Network/NetworkProcessProxy.h:
2409         * UIProcess/Plugins/PluginProcessManager.cpp:
2410         (WebKit::PluginProcessManager::getPluginProcessConnection):
2411         * UIProcess/Plugins/PluginProcessManager.h:
2412         * UIProcess/Plugins/PluginProcessProxy.cpp:
2413         (WebKit::PluginProcessProxy::getPluginProcessConnection):
2414         (WebKit::PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch):
2415         (WebKit::PluginProcessProxy::didCreateWebProcessConnection):
2416         * UIProcess/Plugins/PluginProcessProxy.h:
2417         * UIProcess/Storage/StorageProcessProxy.cpp:
2418         (WebKit::StorageProcessProxy::getStorageProcessConnection):
2419         (WebKit::StorageProcessProxy::didClose):
2420         (WebKit::StorageProcessProxy::didCreateStorageToWebProcessConnection):
2421         * UIProcess/Storage/StorageProcessProxy.h:
2422         * UIProcess/WebPageProxy.cpp:
2423         (WebKit::ExceededDatabaseQuotaRecords::createRecord):
2424         (WebKit::WebPageProxy::receivedPolicyDecision):
2425         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
2426         (WebKit::WebPageProxy::createNewPage):
2427         (WebKit::WebPageProxy::runJavaScriptAlert):
2428         (WebKit::WebPageProxy::runJavaScriptConfirm):
2429         (WebKit::WebPageProxy::runJavaScriptPrompt):
2430         (WebKit::WebPageProxy::webGLPolicyForURL):
2431         (WebKit::WebPageProxy::resolveWebGLPolicyForURL):
2432         (WebKit::WebPageProxy::getToolbarsAreVisible):
2433         (WebKit::WebPageProxy::getMenuBarIsVisible):
2434         (WebKit::WebPageProxy::getStatusBarIsVisible):
2435         (WebKit::WebPageProxy::getWindowFrame):
2436         (WebKit::WebPageProxy::screenToRootView):
2437         (WebKit::WebPageProxy::rootViewToScreen):
2438         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
2439         (WebKit::WebPageProxy::exceededDatabaseQuota):
2440         (WebKit::WebPageProxy::reachedApplicationCacheOriginQuota):
2441         * UIProcess/WebPageProxy.h:
2442         * UIProcess/WebProcessPool.cpp:
2443         (WebKit::WebProcessPool::networkProcessCrashed):
2444         (WebKit::WebProcessPool::getNetworkProcessConnection):
2445         (WebKit::WebProcessPool::getStorageProcessConnection):
2446         * UIProcess/WebProcessPool.h:
2447         * UIProcess/WebProcessProxy.cpp:
2448         (WebKit::WebProcessProxy::getPluginProcessConnection):
2449         (WebKit::WebProcessProxy::getNetworkProcessConnection):
2450         (WebKit::WebProcessProxy::getStorageProcessConnection):
2451         * UIProcess/WebProcessProxy.h:
2452         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2453         (WebKit::WebSWContextManagerConnection::syncTerminateWorker):
2454         * WebProcess/Storage/WebSWContextManagerConnection.h:
2455         * WebProcess/WebPage/WebPage.h:
2456         * WebProcess/WebPage/ios/WebPageIOS.mm:
2457         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
2458
2459 2018-05-17  Jer Noble  <jer.noble@apple.com>
2460
2461         CRASH in -[WKFullScreenViewController _manager]
2462         https://bugs.webkit.org/show_bug.cgi?id=185745
2463         <rdar://problem/39195241>
2464
2465         Reviewed by Eric Carlson.
2466
2467         Protect against WKFullScreenViewController outliving WKWebView by making its
2468         _webView property weak. Additionally, add a sanity-check RetainPtr where _webView
2469         is referenced multiple times within a function.
2470
2471         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
2472         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2473         (-[WKFullScreenWindowController initWithWebView:]):
2474         (-[WKFullScreenWindowController enterFullScreen]):
2475         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
2476         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
2477         (-[WKFullScreenWindowController _completedExitFullScreen]):
2478         (-[WKFullScreenWindowController close]):
2479         (-[WKFullScreenWindowController webViewDidRemoveFromSuperviewWhileInFullscreen]):
2480         (-[WKFullScreenWindowController _exitFullscreenImmediately]):
2481         (-[WKFullScreenWindowController _isSecure]):
2482         (-[WKFullScreenWindowController _serverTrust]):
2483         (-[WKFullScreenWindowController _updateLocationInfo]):
2484         (-[WKFullScreenWindowController _manager]):
2485         (-[WKFullScreenWindowController _startToDismissFullscreenChanged:]):
2486
2487 2018-05-17  Brent Fulgham  <bfulgham@apple.com>
2488
2489         Correct default for StorageAccess API
2490         https://bugs.webkit.org/show_bug.cgi?id=185748
2491         <rdar://problem/40220659>
2492
2493         Reviewed by Dean Jackson.
2494
2495         Flip the default state to 'true' so that the new "sticky" state
2496         for Storage Access API and attributing user interaction for
2497         Storage Access API use is applied by default.
2498
2499         * Shared/WebPreferences.yaml:
2500
2501 2018-05-17  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2502
2503         [WPE] Implement and enable FULLSCREEN_API
2504         https://bugs.webkit.org/show_bug.cgi?id=185676
2505
2506         Reviewed by Žan Doberšek.
2507
2508         Do the initial implementation of FULLSCREEN_API for WPE and
2509         enable the CMake option by default.
2510
2511         Most of the layout tests (55 of 58) are passing and the feature
2512         seems to work fine on different websites that use it.
2513
2514         * UIProcess/API/wpe/PageClientImpl.cpp:
2515         (WebKit::PageClientImpl::fullScreenManagerProxyClient):
2516         (WebKit::PageClientImpl::closeFullScreenManager):
2517         (WebKit::PageClientImpl::isFullScreen):
2518         (WebKit::PageClientImpl::enterFullScreen):
2519         (WebKit::PageClientImpl::exitFullScreen):
2520         (WebKit::PageClientImpl::beganEnterFullScreen):
2521         (WebKit::PageClientImpl::beganExitFullScreen):
2522         * UIProcess/API/wpe/PageClientImpl.h:
2523         * UIProcess/API/wpe/WPEView.h:
2524         (WKWPE::View::isFullScreen):
2525         (WKWPE::View::setFullScreen):
2526
2527 2018-05-17  Jiewen Tan  <jiewen_tan@apple.com>
2528
2529         Convert CertificateInfo into Credential in UI Process instead of Networking Process
2530         https://bugs.webkit.org/show_bug.cgi?id=185662
2531         <rdar://problem/40275561>
2532
2533         Reviewed by Alex Christensen.
2534
2535         Right now we convert CertificateInfo into Credential in the very last stage of client certificate authentication process
2536         when it reaches Networking Process. This patch moves that conversion earlier in UI Process such that we don't have to
2537         pass both Credential and CertificateInfo to Networking Process.
2538
2539         CertificateInfo is only used in macOS for C API specifically. WK2 includes macOS/iOS relies on NSURLCredential/WebCore::Credential
2540         solely. WK2 has already exercised the ability of using WebCore::Credential to do client certficate authentication. This patch therefore
2541         takes advantage of that. It converts CertficateInfo objects into Credential objects right after WebCredential is initialized, and then merge
2542         any code paths that utilizes CertficateInfo into ones that uses WebCore::Credential.
2543
2544         Covered by existing tests.
2545
2546         * Shared/Authentication/AuthenticationManager.cpp:
2547         (WebKit::AuthenticationManager::useCredentialForChallenge):
2548         (WebKit::AuthenticationManager::useCredentialForSingleChallenge):
2549         (WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge): Deleted.
2550         * Shared/Authentication/AuthenticationManager.h:
2551         * Shared/Authentication/AuthenticationManager.messages.in:
2552         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
2553         (WebKit::AuthenticationChallengeProxy::useCredential):
2554         * UIProcess/Authentication/WebCredential.cpp:
2555         (WebKit::WebCredential::WebCredential):
2556         (WebKit::WebCredential::certificateInfo): Deleted.
2557         * UIProcess/Authentication/WebCredential.h:
2558         (WebKit::WebCredential::create):
2559         * UIProcess/Authentication/mac/WebCredentialMac.mm: Renamed from Source/WebKit/Shared/Authentication/mac/AuthenticationManager.mac.mm.
2560         (WebKit::leafCertificate):
2561         (WebKit::chain):
2562         (WebKit::WebCredential::WebCredential):
2563         * WebKit.xcodeproj/project.pbxproj:
2564
2565 2018-05-17  Jeremy Jones  <jeremyj@apple.com>
2566
2567         Ensure valid rects for fullsceen animation.
2568         https://bugs.webkit.org/show_bug.cgi?id=185736
2569         rdar://problem/40320174
2570
2571         Reviewed by Jer Noble.
2572
2573         Protect against zero width and height since those can make for NANs in the animation transforms.
2574
2575         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2576         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
2577         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
2578
2579 2018-05-17  Jer Noble  <jer.noble@apple.com>
2580
2581         Turn Modern EME API on by default and remove it as an experimental feature
2582         https://bugs.webkit.org/show_bug.cgi?id=185693
2583         <rdar://problem/39954396>
2584
2585         Reviewed by Eric Carlson.
2586
2587         * Shared/WebPreferences.yaml:
2588
2589 2018-05-17  Dean Jackson  <dino@apple.com>
2590
2591         Safari optimized flow should be releasing viewer to prevent memory growth with subsequent launches/closes
2592         https://bugs.webkit.org/show_bug.cgi?id=185722
2593         <rdar://problem/40247351>
2594
2595         Reviewed by Antoine Quint.
2596
2597         I made a rookie mistake in the original patch: I was holding a strong
2598         reference to "self" in a block, which was causing a retain cycle.
2599         Replace that with a WeakObjCPtr.
2600
2601         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2602         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
2603
2604 2018-05-16  Brent Fulgham  <bfulgham@apple.com>
2605
2606         REGRESSION(r229093)[macOS] Allow network-outbound for syslog use
2607         https://bugs.webkit.org/show_bug.cgi?id=185703
2608         <rdar://problem/39778918>
2609
2610         Reviewed by Eric Carlson.
2611
2612         In r229093 I removed the 'network-outbound' permission for syslog use.
2613         Further testing has shown that this is still needed for subsystem
2614         logging in our bundle loading code.
2615
2616         This patch re-enabled network-outbound for syslog.
2617
2618         * WebProcess/com.apple.WebProcess.sb.in:
2619
2620 2018-05-16  Andy VanWagoner  <andy@vanwagoner.family>
2621
2622         Add support for Intl NumberFormat formatToParts
2623         https://bugs.webkit.org/show_bug.cgi?id=185375
2624
2625         Reviewed by Yusuke Suzuki.
2626
2627         Add flag for NumberFormat formatToParts.
2628
2629         * Configurations/FeatureDefines.xcconfig:
2630
2631 2018-05-16  Andy Estes  <aestes@apple.com>
2632
2633         [Wi-Fi Assertions] Adopt WiFiAssertionHolderAdditions
2634         https://bugs.webkit.org/show_bug.cgi?id=185685
2635         <rdar://problem/40136681>
2636
2637         Reviewed by Sam Weinig.
2638
2639         * NetworkProcess/cocoa/WiFiAssertionHolder.cpp:
2640         (WebKit::WiFiAssertionHolder::WiFiAssertionHolder):
2641         (WebKit::WiFiAssertionHolder::~WiFiAssertionHolder):
2642         (WebKit::ensureWiFiManagerClient): Deleted.
2643
2644 2018-05-16  Fujii Hironori  <Hironori.Fujii@sony.com>
2645
2646         [Win] Implement WebPage::handleEditingKeyboardEvent
2647         https://bugs.webkit.org/show_bug.cgi?id=185327
2648
2649         Reviewed by Alexey Proskuryakov.
2650
2651         * WebProcess/WebPage/win/WebPageWin.cpp:
2652         (WebKit::WebPage::handleEditingKeyboardEvent): Copied from WebKitLegacy.
2653
2654 2018-05-16  Sihui Liu  <sihui_liu@apple.com>
2655
2656         Session cookies aren't reliably set when using default WKWebSiteDataStore
2657         https://bugs.webkit.org/show_bug.cgi?id=185624
2658         <rdar://problem/39111626>
2659
2660         Reviewed by Geoffrey Garen.
2661
2662         Session cookies of default session were set in UI Process when there was no process pool, 
2663         but they were not synced (or synced slowly to) Network Process. To make these cookies visible
2664         as soon as they were set through API, we could manually set those cookies in Network Process
2665         during its initilization. 
2666
2667         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2668         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2669         * UIProcess/API/APIHTTPCookieStore.cpp:
2670         (API::HTTPCookieStore::cookies):
2671         (API::HTTPCookieStore::setCookie):
2672         (API::HTTPCookieStore::deleteCookie):
2673         * UIProcess/WebProcessPool.cpp:
2674         (WebKit::WebProcessPool::ensureNetworkProcess):
2675         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
2676         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2677         (WebKit::WebsiteDataStore::clearPendingCookies):
2678         * UIProcess/WebsiteData/WebsiteDataStore.h:
2679
2680 2018-05-16  Chris Nardi  <cnardi@chromium.org>
2681
2682         Remove Document#selectedStylesheetSet/preferredStylesheetSet
2683         https://bugs.webkit.org/show_bug.cgi?id=185381
2684
2685         Reviewed by Darin Adler.
2686
2687         Make API methods for Document#selectedStylesheetSet/preferredStylesheetSet do nothing.
2688
2689         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.h:
2690         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
2691         (webkit_dom_document_set_property):
2692         (webkit_dom_document_get_property):
2693         (webkit_dom_document_get_preferred_stylesheet_set):
2694         (webkit_dom_document_get_selected_stylesheet_set):
2695         (webkit_dom_document_set_selected_stylesheet_set):
2696
2697 2018-05-16  Alberto Garcia  <berto@igalia.com>
2698
2699         [CMake] Properly detect compiler flags, needed libs, and fallbacks for usage of 64-bit atomic operations
2700         https://bugs.webkit.org/show_bug.cgi?id=182622
2701
2702         Reviewed by Michael Catanzaro.
2703
2704         Move the test to determine whether we need to link against
2705         libatomic to the common file WebKitCompilerFlags.cmake so it can
2706         also be used for JavaScriptCore.
2707
2708         * CMakeLists.txt:
2709
2710 2018-05-15  Yusuke Suzuki  <utatane.tea@gmail.com>
2711
2712         [JSC] Check TypeInfo first before calling getCallData when we would like to check whether given object is a function
2713         https://bugs.webkit.org/show_bug.cgi?id=185601
2714
2715         Reviewed by Saam Barati.
2716
2717         * WebProcess/Plugins/Netscape/JSNPObject.h:
2718
2719 2018-05-15  Sihui Liu  <sihui_liu@apple.com>
2720
2721         StorageManager::deleteLocalStorageOriginsModifiedSince: database files get deleted before database connections close
2722         https://bugs.webkit.org/show_bug.cgi?id=185671
2723
2724         Reviewed by Geoffrey Garen.
2725
2726         We should delete database files before closing databases.
2727
2728         * UIProcess/WebStorage/LocalStorageDatabase.cpp:
2729         (WebKit::LocalStorageDatabase::updateDatabaseWithChangedItems):
2730         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
2731         (WebKit::LocalStorageDatabaseTracker::databasesModifiedSince):
2732         (WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince): Deleted.
2733         * UIProcess/WebStorage/LocalStorageDatabaseTracker.h:
2734         * UIProcess/WebStorage/StorageManager.cpp:
2735         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
2736
2737 2018-05-15  Dean Jackson  <dino@apple.com>
2738
2739         Launch System Preview as the download starts, rather than waiting for a response
2740         https://bugs.webkit.org/show_bug.cgi?id=185669
2741         <rdar://problem/40278181>
2742
2743         Reviewed by Tim Horton.
2744
2745         We were waiting for the RequestResponse to get a MIME-type before
2746         launching the system preview. This causes an annoying delay.
2747
2748         Instead, assume that the system preview is one of the handled
2749         mime types and launch the viewer immediately. If it gets something it
2750         didn't expect, it will show an error.
2751
2752         * UIProcess/Cocoa/DownloadClient.mm:
2753         (WebKit::DownloadClient::didStart):
2754         (WebKit::DownloadClient::didReceiveResponse):
2755         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2756         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
2757         (WebKit::SystemPreviewController::start): Small cleanup to ensure we
2758         don't try to present twice (this shouldn't happen).
2759
2760 2018-05-15  Dean Jackson  <dino@apple.com>
2761
2762         Post-review cleanup for 185459
2763         https://bugs.webkit.org/show_bug.cgi?id=185665
2764         <rdar://problem/40276689>
2765
2766         Reviewed by Tim Horton.
2767
2768         Jon made some comments in 185459 that I'm addressing here.
2769
2770         * UIProcess/Cocoa/DownloadClient.h:
2771         * UIProcess/Cocoa/DownloadClient.mm: Guard the activity token for iOS
2772         in a way that means it will still work ok on macOS.
2773         (WebKit::DownloadClient::didStart):
2774         (WebKit::DownloadClient::processDidCrash):
2775         (WebKit::DownloadClient::didFinish):
2776         (WebKit::DownloadClient::didFail):
2777         (WebKit::DownloadClient::didCancel):
2778         (WebKit::DownloadClient::takeActivityToken):
2779         (WebKit::DownloadClient::releaseActivityTokenIfNecessary):
2780         (WebKit::DownloadClient::releaseActivityToken): Deleted.
2781
2782         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Add an early return.
2783         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
2784
2785 2018-05-15  Tadeu Zagallo  <tzagallo@apple.com>
2786
2787         Update touch event tracking types on every touch
2788         https://bugs.webkit.org/show_bug.cgi?id=184250
2789         <rdar://problem/39145092>
2790
2791         Reviewed by Geoffrey Garen.
2792
2793         The tracking types for touch events were only update on touchstart, which meant that event
2794         listeners added after the touchstart would always be treated as passive, even if explicitly
2795         setting passive to false.
2796
2797         * UIProcess/WebPageProxy.cpp:
2798         (WebKit::WebPageProxy::handleTouchEventSynchronously):
2799         (WebKit::WebPageProxy::handleTouchEvent):
2800
2801 2018-05-15  Per Arne Vollan  <pvollan@apple.com>
2802
2803         Pause display links when window is not visible.
2804         https://bugs.webkit.org/show_bug.cgi?id=185627
2805         <rdar://problem/39401106>
2806
2807         Reviewed by Simon Fraser.
2808
2809         Pause/resume display links created in the UI process when the window is hidden/shown.
2810
2811         * UIProcess/WebPageProxy.cpp:
2812         (WebKit::WebPageProxy::dispatchActivityStateChange):
2813         * UIProcess/mac/DisplayLink.cpp:
2814         (WebKit::DisplayLink::pause):
2815         (WebKit::DisplayLink::resume):
2816         * UIProcess/mac/DisplayLink.h:
2817
2818 2018-05-15  Dean Jackson  <dino@apple.com>
2819
2820         Provide UIView and UIImage for zoom transition
2821         https://bugs.webkit.org/show_bug.cgi?id=185655
2822         <rdar://problem/40267224>
2823
2824         Reviewed by Antoine Quint.
2825
2826         Provide a UIView* for the frameForPreviewItem to use as a source view.
2827         Also implement the transitionImageForPreviewItem delegate, even though
2828         we're returning nil.
2829
2830         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2831         (-[_WKPreviewControllerDelegate previewController:frameForPreviewItem:inSourceView:]):
2832         (-[_WKPreviewControllerDelegate previewController:transitionImageForPreviewItem:contentRect:]):
2833
2834 2018-05-15  Daniel Bates  <dabates@apple.com>
2835
2836         Fix the Apple Internal build
2837
2838         Make a similar change to WebKit as I did for LegacyWebKit in r231777. See <rdar://problem/40237873> for more details.
2839
2840         * UIProcess/mac/WKFullScreenWindowController.mm:
2841         (-[WKFullScreenWindowController enterFullScreen:]):
2842         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
2843         (-[WKFullScreenWindowController exitFullScreen]):
2844         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
2845         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
2846         (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]):
2847         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
2848         (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]):
2849
2850 2018-05-15  Megan Gardner  <megan_gardner@apple.com>
2851
2852         Clear selections from web content with single tap
2853         https://bugs.webkit.org/show_bug.cgi?id=185634
2854
2855         Reviewed by Tim Horton.
2856         
2857         With the switch to the single text selection assistant, we were not correctly clearing the selection when a
2858         single tap happened.
2859
2860         * UIProcess/ios/WKContentViewInteraction.mm:
2861         (-[WKContentView _singleTapCommited:]):
2862
2863 2018-05-15  Antoine Quint  <graouts@apple.com>
2864
2865         [Web Animations] Expose Web Animations CSS integration as an experimental feature
2866         https://bugs.webkit.org/show_bug.cgi?id=185647
2867
2868         Reviewed by Dean Jackson.
2869
2870         Rename the Web Animations CSS integration flag.
2871
2872         * Shared/WebPreferences.yaml:
2873         * UIProcess/API/C/WKPreferences.cpp:
2874         (WKPreferencesSetWebAnimationsCSSIntegrationEnabled):
2875         (WKPreferencesGetWebAnimationsCSSIntegrationEnabled):
2876         (WKPreferencesSetCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): Deleted.
2877         (WKPreferencesGetCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): Deleted.
2878         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2879         * UIProcess/API/Cocoa/WKPreferences.mm:
2880         (-[WKPreferences _setWebAnimationsCSSIntegrationEnabled:]):
2881         (-[WKPreferences _webAnimationsCSSIntegrationEnabled]):
2882         (-[WKPreferences _setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled:]): Deleted.
2883         (-[WKPreferences _cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled]): Deleted.
2884         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2885         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2886         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2887         (WebKit::InjectedBundle::setWebAnimationsCSSIntegrationEnabled):
2888         (WebKit::InjectedBundle::setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): Deleted.
2889         * WebProcess/InjectedBundle/InjectedBundle.h:
2890
2891 2018-05-15  Dean Jackson  <dino@apple.com>
2892
2893         Update animation when presenting QuickLook
2894         https://bugs.webkit.org/show_bug.cgi?id=185648
2895         <rdar://problem/39652624>
2896
2897         Reviewed by Antoine Quint.
2898
2899         Implement the QuickLook delegate on _WKPreviewControllerDelegate that
2900         produces a zoom-like animation when the QLPreviewController appears.
2901
2902         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2903         (-[_WKPreviewControllerDelegate previewController:frameForPreviewItem:inSourceView:]):
2904         * UIProcess/SystemPreviewController.h: Add a reference back to the page, so that
2905         the delegate implementation can access the presentingViewController.
2906         (WebKit::SystemPreviewController::page):
2907
2908 2018-05-14  Dean Jackson  <dino@apple.com>
2909
2910         Download and present System Preview
2911         https://bugs.webkit.org/show_bug.cgi?id=185459
2912         <rdar://problem/40079228>
2913
2914         Reviewed by Tim Horton.
2915
2916         Extend DownloadClient so that it can handle the case where
2917         the download was triggered by a System Preview. In this situation
2918         the result (and progress) are piped into QuickLook via the SystemPreviewController.
2919
2920         The DownloadProxy class is also extended to handle the destination
2921         filename and the size of the content.
2922
2923         Lastly, SystemPreviewController is updated to have a start(), show()
2924         and cancel() interface, and no longer adjusts page navigation.
2925
2926         * UIProcess/Cocoa/DownloadClient.h:
2927         * UIProcess/Cocoa/DownloadClient.mm: Handle the SystemPreview case, which
2928         doesn't have a download delegate, but instead needs to communicate with
2929         the SystemPreviewController, if one exists.
2930         (WebKit::DownloadClient::didStart):
2931         (WebKit::DownloadClient::didReceiveResponse):
2932         (WebKit::DownloadClient::didReceiveData):
2933         (WebKit::DownloadClient::didCreateDestination):
2934         (WebKit::DownloadClient::processDidCrash):
2935         (WebKit::DownloadClient::decideDestinationWithSuggestedFilename):
2936         (WebKit::DownloadClient::didFinish):
2937         (WebKit::DownloadClient::didFail):
2938         (WebKit::DownloadClient::didCancel):
2939         (WebKit::DownloadClient::releaseActivityToken):
2940
2941         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Implement the new API.
2942         (-[_WKPreviewControllerDataSource initWithMIMEType:]):
2943         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
2944         (-[_WKPreviewControllerDataSource setProgress:]):
2945         (-[_WKPreviewControllerDataSource finish:]):
2946         (-[_WKPreviewControllerDelegate previewControllerDidDismiss:]):
2947         (WebKit::SystemPreviewController::start):
2948         (WebKit::SystemPreviewController::updateProgress):
2949         (WebKit::SystemPreviewController::finish):
2950         (WebKit::SystemPreviewController::cancel):
2951         (-[_WKPreviewControllerDataSource initWithURL:]): Deleted.
2952         (-[_WKPreviewControllerDelegate previewControllerWillDismiss:]): Deleted.
2953         (WebKit::SystemPreviewController::canPreview const): Deleted.
2954         (WebKit::SystemPreviewController::showPreview): Deleted.
2955         * UIProcess/Downloads/DownloadProxy.h: Track the destination file by name
2956         and size. Also expose a helper to identify system preview downloads.
2957         (WebKit::DownloadProxy::destinationFilename const):
2958         (WebKit::DownloadProxy::setDestinationFilename):
2959         (WebKit::DownloadProxy::expectedContentLength const):
2960         (WebKit::DownloadProxy::setExpectedContentLength):
2961         (WebKit::DownloadProxy::bytesLoaded const):
2962         (WebKit::DownloadProxy::setBytesLoaded):
2963         (WebKit::DownloadProxy::isSystemPreviewDownload const):
2964
2965         * UIProcess/SystemPreviewController.cpp: New API.
2966         (WebKit::SystemPreviewController::canPreview const):
2967         (WebKit::SystemPreviewController::sendPageBack): Deleted.
2968         (WebKit::SystemPreviewController::showPreview): Deleted.
2969         * UIProcess/SystemPreviewController.h:
2970
2971         * UIProcess/WebPageProxy.cpp:
2972         (WebKit::m_configurationPreferenceValues):
2973         (WebKit::WebPageProxy::reattachToWebProcess):
2974         (WebKit::WebPageProxy::resetState):
2975         * UIProcess/WebPageProxy.h:
2976
2977 2018-05-14  Brady Eidson  <beidson@apple.com>
2978
2979         Add an API test to guard against regressions while re-entering setDefersLoading:.
2980         <rdar://problem/37033737> and https://bugs.webkit.org/show_bug.cgi?id=185630
2981
2982         Reviewed by Chris Dumez.
2983
2984         * UIProcess/API/Cocoa/WKWebView.mm:
2985         (-[WKWebView _setDefersLoadingForTesting:]):
2986         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2987
2988         * UIProcess/WebPageProxy.cpp:
2989         (WebKit::WebPageProxy::setDefersLoadingForTesting):
2990         * UIProcess/WebPageProxy.h:
2991         * WebProcess/WebPage/WebPage.messages.in:
2992
2993 2018-05-14  Tim Horton  <timothy_horton@apple.com>
2994
2995         Use the system font by default in extra zoom mode
2996         https://bugs.webkit.org/show_bug.cgi?id=185638
2997         <rdar://problem/40230277>
2998
2999         Reviewed by Wenson Hsieh.
3000
3001         * Shared/WebPreferencesDefaultValues.h:
3002
3003 2018-05-14  Michael Catanzaro  <mcatanzaro@igalia.com>
3004
3005         Unreviewed, rolling out r231755.
3006
3007         Change is not correct
3008
3009         Reverted changeset:
3010
3011         "-Wmemset-elt-size warning in LibWebRTCSocket constructor"
3012         https://bugs.webkit.org/show_bug.cgi?id=185555
3013         https://trac.webkit.org/changeset/231755
3014
3015 2018-05-14  Wenson Hsieh  <wenson_hsieh@apple.com>
3016
3017         [Extra zoom mode] Google search results are excessively zoomed in
3018         https://bugs.webkit.org/show_bug.cgi?id=185347
3019         <rdar://problem/39999778>
3020
3021         Reviewed by Tim Horton.
3022
3023         Adds a new experimental feature for the "disabled-adaptations" meta tag, and adds plumbing in WebKit to
3024         propagate disabled adaptation changes to the ViewportConfiguration. The experimental feature is on by default in
3025         extra zoom mode.
3026
3027         * Shared/WebPreferences.yaml:
3028         * Shared/WebPreferencesDefaultValues.h:
3029         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3030         (WebKit::WebChromeClient::dispatchDisabledAdaptationsDidChange const):
3031         * WebProcess/WebCoreSupport/WebChromeClient.h:
3032         * WebProcess/WebPage/WebPage.cpp:
3033         (WebKit::WebPage::disabledAdaptationsDidChange):
3034         * WebProcess/WebPage/WebPage.h:
3035
3036 2018-05-14  Chris Dumez  <cdumez@apple.com>
3037
3038         Overly aggressive timer throttling in service workers
3039         https://bugs.webkit.org/show_bug.cgi?id=185575
3040         <rdar://problem/40219038>
3041
3042         Reviewed by Geoff Garen.
3043
3044         After ~30 seconds, the system would put the service worker process in "App Nap",
3045         causing its timers to get aggressively throttled. This happens because the
3046         service worker processes are WebProcesses that have no visible WebPages.
3047
3048         To address the issue, we now disable process suppression for all service worker
3049         processes. This causes those processes to construct a UserActivity which prevents
3050         App Nap.
3051
3052         This patch also refactors the code a bit to avoid duplication. The ProcessSuppression
3053         suppression logic in now all on ChildProcessProxy / ChildProcess.
3054
3055         * NetworkProcess/NetworkProcess.messages.in:
3056         * PluginProcess/PluginProcess.messages.in:
3057         * Shared/ChildProcess.messages.in:
3058         * UIProcess/ChildProcessProxy.cpp:
3059         (WebKit::ChildProcessProxy::setProcessSuppressionEnabled):
3060         * UIProcess/ChildProcessProxy.h:
3061         * UIProcess/Network/NetworkProcessProxy.h:
3062         * UIProcess/Network/mac/NetworkProcessProxyMac.mm: Removed.
3063         * UIProcess/Plugins/PluginProcessProxy.h:
3064         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
3065         * UIProcess/ServiceWorkerProcessProxy.cpp:
3066         (WebKit::ServiceWorkerProcessProxy::didFinishLaunching):
3067         * UIProcess/ServiceWorkerProcessProxy.h:
3068         * UIProcess/WebProcessProxy.h:
3069         * WebKit.xcodeproj/project.pbxproj:
3070         * WebProcess/WebProcess.messages.in:
3071
3072 2018-05-14  Andy Estes  <aestes@apple.com>
3073
3074         [Wi-Fi Assertions] Allow clients to specify a context identifier
3075         https://bugs.webkit.org/show_bug.cgi?id=185620
3076         <rdar://problem/39915196>
3077
3078         Reviewed by Brady Eidson.
3079
3080         Added an SPI on _WKProcessPoolConfiguration that allows clients to specify a
3081         context identifier.
3082
3083         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3084         (WebKit::NetworkProcessCreationParameters::encode const):
3085         (WebKit::NetworkProcessCreationParameters::decode):
3086         * NetworkProcess/NetworkProcessCreationParameters.h:
3087         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3088         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
3089         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3090         (API::ProcessPoolConfiguration::copy):
3091         * UIProcess/API/APIProcessPoolConfiguration.h:
3092         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3093         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3094         (-[_WKProcessPoolConfiguration wirelessContextIdentifier]):
3095         (-[_WKProcessPoolConfiguration setWirelessContextIdentifier:]):
3096         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3097         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3098
3099 2018-05-11  Brian Burg  <bburg@apple.com>
3100
3101         Web Automation: Automation.getBrowsingContext returns window origin that differs from window.screenX/Y
3102         https://bugs.webkit.org/show_bug.cgi?id=185571
3103         <rdar://problem/40180785>
3104
3105         Reviewed by Timothy Hatcher.
3106
3107         This code path was refactored to use completion handlers. It seems that the window.screenX/Y
3108         code path converts back to user coordinates but the WebDriver code path does not. Make them
3109         consistent since that is how it is spec'd and tested.
3110
3111         * UIProcess/WebPageProxy.cpp:
3112         (WebKit::WebPageProxy::getWindowFrameWithCallback):
3113         Convert the window frame to user coordinate space so it's the same as window.screenY.
3114
3115 2018-05-14  Brian Burg  <bburg@apple.com>
3116
3117         WebDriver: W3C test case actions/key.py::test_lone_keyup_sends_no_events is failing
3118         https://bugs.webkit.org/show_bug.cgi?id=185577
3119         <rdar://problem/40185478>
3120
3121         Reviewed by Timothy Hatcher.
3122
3123         This test is failing because it expects Release Actions to not emit any
3124         events if nothing has changed from the initial state. Because the two code paths
3125         for creating empty states don't actually produce the same empty state, a difference
3126         in location was detected between the two empty states. This generates a mousemove.
3127
3128         To fix this, unify the code that creates an empty state. For mouse input sources, always
3129         initialize the location to (0, 0) so that the mouse input source always has
3130         a location that is valid to click at.
3131
3132         * UIProcess/Automation/SimulatedInputDispatcher.h:
3133         Extract the type enum out of the class to avoid circular definitions of
3134         SimulatedInputSource and SimulatedInputSourceState.
3135
3136         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
3137         (WebKit::SimulatedInputSourceState::emptyStateForSourceType):
3138         Take the input source type when generating an empty state. We always want location
3139         set for a mouse input source, but not set it for other input sources like keys.
3140
3141         (WebKit::SimulatedInputKeyFrame::keyFrameToResetInputSources):
3142         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
3143         (WebKit::SimulatedInputSource::create):
3144         (WebKit::SimulatedInputSource::SimulatedInputSource):
3145         (WebKit::SimulatedInputSourceState::emptyState): Deleted.
3146         * UIProcess/Automation/WebAutomationSession.cpp:
3147         (WebKit::WebAutomationSession::WebAutomationSession):
3148         (WebKit::WebAutomationSession::inputSourceForType const):
3149         (WebKit::simulatedInputSourceTypeFromProtocolSourceType):
3150         (WebKit::WebAutomationSession::performInteractionSequence):
3151         * UIProcess/Automation/WebAutomationSession.h:
3152
3153 2018-05-14  Michael Catanzaro  <mcatanzaro@igalia.com>
3154
3155         -Wmemset-elt-size warning in LibWebRTCSocket constructor
3156         https://bugs.webkit.org/show_bug.cgi?id=185555
3157
3158         Reviewed by Youenn Fablet.
3159
3160         Add missing multiplication.
3161
3162         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
3163         (WebKit::LibWebRTCSocket::LibWebRTCSocket):
3164
3165 2018-05-14  Zan Dobersek  <zdobersek@igalia.com>
3166
3167         [GTK] REGRESSION(r231170) Build broken with Clang 5.0
3168         https://bugs.webkit.org/show_bug.cgi?id=185198
3169
3170         Reviewed by Michael Catanzaro.
3171
3172         * Shared/RTCNetwork.h: With std::optional forward declaration gone,
3173         explicitly include the WTF Optional.h header.
3174
3175 2018-05-13  Dean Jackson  <dino@apple.com>
3176
3177         WebKit2_Sim-7606.1.17.4 introduced dep cycle
3178         https://bugs.webkit.org/show_bug.cgi?id=185588
3179         <rdar://problem/40196581>
3180
3181         Reviewed by Tim Horton.
3182
3183         Soft link AssetViewer.framework to avoid a dependency cycle.
3184
3185         * Configurations/WebKit.xcconfig:
3186         * UIProcess/ios/WKSystemPreviewView.mm:
3187         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
3188
3189 2018-05-11  Daniel Bates  <dabates@apple.com>
3190
3191         X-Frame-Options: SAMEORIGIN needs to check all ancestor frames
3192         https://bugs.webkit.org/show_bug.cgi?id=185567
3193         <rdar://problem/40175008>
3194
3195         Reviewed by Brent Fulgham.
3196
3197         Change the behavior of "X-Frame-Options: SAMEORIGIN" to ensure that all ancestors frames
3198         are same-origin with the document that delivered this header. This prevents an intermediary
3199         malicious frame from clickjacking a child frame whose document is same-origin with the top-
3200         level frame. It also makes the behavior of X-Frame-Options in WebKit more closely match
3201         the behavior of X-Frame-Options in other browsers, including Chrome and Firefox.
3202         
3203         Currently a document delivered with "X-Frame-Options: SAMEORIGIN" must only be same-origin
3204         with the top-level frame's document in order to be displayed. This prevents clickjacking by
3205         a malicious page that embeds a page delivered with "X-Frame-Options: SAMEORIGIN". However,
3206         it does not protect against clickjacking of the "X-Frame-Options: SAMEORIGIN" page (victim)
3207         if embedded by an intermediate malicious iframe, say a "rogue ad", that was embedded in a
3208         document same origin with the victim page. We should protect against such attacks.
3209
3210         * NetworkProcess/NetworkResourceLoader.cpp:
3211         (WebKit::NetworkResourceLoader::shouldInterruptLoadForXFrameOptions):
3212
3213 2018-05-11  Dean Jackson  <dino@apple.com>
3214
3215         WKWebViewContentProvider should know what MIME type it was created to handle
3216         https://bugs.webkit.org/show_bug.cgi?id=185574
3217         <rdar://problem/40183049>
3218
3219         Reviewed by Tim Horton.
3220
3221         Pass the MIME type of the downloaded asset into the WKWebViewContentProvider's
3222         init method, so it can choose to do something based on that information. The
3223         PDF and LegacyPDF views don't care because they, clearly, only handle PDF. But
3224         a WKSystemPreviewView can handle multiple types.
3225
3226         * UIProcess/API/Cocoa/WKWebView.mm:
3227         (-[WKWebView _setHasCustomContentView:loadedMIMEType:]): Send the MIME type on
3228         to the WKWebViewContentProvider.
3229         * UIProcess/Cocoa/WKWebViewContentProvider.h: Add a new parameter to web_initWithFrame.
3230         * UIProcess/ios/WKLegacyPDFView.mm:
3231         (-[WKLegacyPDFView web_initWithFrame:webView:mimeType:]):
3232         (-[WKLegacyPDFView web_initWithFrame:webView:]): Deleted.
3233         * UIProcess/ios/WKPDFView.mm:
3234         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
3235         (-[WKPDFView web_initWithFrame:webView:]): Deleted.
3236         * UIProcess/ios/WKSystemPreviewView.mm:
3237         (-[WKSystemPreviewView web_initWithFrame:webView:mimeType:]):
3238         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]): Actually use
3239         the MIME type to tell QuickLook what it will be getting, rather than basing it on
3240         the file extension.
3241         (-[WKSystemPreviewView web_initWithFrame:webView:]): Deleted.
3242
3243 2018-05-11  Brent Fulgham  <bfulgham@apple.com>
3244
3245         Allow the WebContent process to read global ViewBridge preferences
3246         https://bugs.webkit.org/show_bug.cgi?id=185569
3247         <rdar://problem/40164339>
3248
3249         Reviewed by Eric Carlson.
3250
3251         Allow reads of the global /Library/Preferences/com.apple.ViewBridge.plist preference file.
3252
3253         * WebProcess/com.apple.WebProcess.sb.in:
3254
3255 2018-05-11  Megan Gardner  <megan_gardner@apple.com>
3256
3257         Cleanup canPerformActionForWebView in relation to the webSelectionAssistant being removed
3258         https://bugs.webkit.org/show_bug.cgi?id=185536
3259
3260         Reviewed by Tim Horton.
3261         
3262         The _webSelectionAssistant is now always nil, therefor many of these checks are unnecessary.
3263         Remove the check for a webSelection and clean up the logic surrounding those checks.
3264
3265         * UIProcess/ios/WKContentViewInteraction.mm:
3266         (-[WKContentView canPerformActionForWebView:withSender:]):
3267
3268 2018-05-11  Brady Eidson  <beidson@apple.com>
3269
3270         Followup to: Make sure history navigations reuse the existing process when necessary.
3271         https://bugs.webkit.org/show_bug.cgi?id=185532
3272
3273         Reviewed by Andy Estes.
3274
3275         * UIProcess/WebProcessPool.cpp:
3276         (WebKit::WebProcessPool::processForNavigationInternal): When re-using the same process,
3277           don't change the policy action.
3278
3279 2018-05-11  Charles Vazac  <cvazac@gmail.com>
3280
3281         Runtime feature flag for Server-Timing
3282         https://bugs.webkit.org/show_bug.cgi?id=184758
3283
3284         Reviewed by Youenn Fablet.
3285
3286         * Shared/WebPreferences.yaml: Added ServerTimingEnabled.
3287         * UIProcess/API/C/WKPreferences.cpp:
3288         (WKPreferencesGetServerTimingEnabled):
3289         * UIProcess/API/C/WKPreferencesRefPrivate.h: WK_EXPORT for WKPreferencesSetServerTimingEnabled.
3290         * WebProcess/Storage/WebSWContextManagerConnection.cpp: Call setServerTimingEnabled.
3291
3292 2018-05-11  Antti Koivisto  <antti@apple.com>
3293
3294         Network process should not stat() all cache files on startup to find their sizes
3295         https://bugs.webkit.org/show_bug.cgi?id=185542
3296         <rdar://problem/40092953>
3297
3298         Reviewed by Chris Dumez.
3299
3300         This is done to compute how much disk space a cache is using. While the operation happens
3301         in a background priority thread it is still quite a bit of work.
3302
3303         Large bodies are saved in separate blob files so record file sizes are capped. We can avoid work by
3304         estimating their size instead of counting it exactly.
3305
3306         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3307         (WebKit::NetworkCache::estimateRecordsSize):
3308         (WebKit::NetworkCache::Storage::synchronize):
3309
3310             Use size estimation if blob storage is in use.
3311             Remove the code that would delete empty files. Normal cache shrinking handles this.
3312
3313         (WebKit::NetworkCache::Storage::shouldStoreBodyAsBlob):
3314
3315 2018-05-11  Brady Eidson  <beidson@apple.com>
3316
3317         Make sure history navigations reuse the existing process when necessary.
3318         <rdar://problem/39746516> and https://bugs.webkit.org/show_bug.cgi?id=185532
3319
3320         Reviewed by Ryosuke Niwa.
3321
3322         If a view navigates to either a data: or blob: URL, it reuses the existing process.
3323  
3324         In such cases we need to also ensure that history navigations back will also reuse the existing process.
3325
3326         * Shared/NavigationActionData.cpp:
3327         (WebKit::NavigationActionData::encode const):
3328         (WebKit::NavigationActionData::decode):
3329         * Shared/NavigationActionData.h:
3330
3331         * UIProcess/API/APINavigation.h:
3332         (API::Navigation::setTargetItem):
3333
3334         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3335         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3336         (-[_WKProcessPoolConfiguration pageCacheEnabled]):
3337         (-[_WKProcessPoolConfiguration setPageCacheEnabled:]):
3338
3339         * UIProcess/WebPageProxy.cpp:
3340         (WebKit::WebPageProxy::receivedPolicyDecision):
3341         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3342
3343         * UIProcess/WebProcessPool.cpp:
3344         (WebKit::WebProcessPool::processForNavigationInternal): If the current and target back/forward items both
3345           came from the same process, then reuse the existing process.
3346
3347         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3348         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3349
3350 2018-05-10  Brent Fulgham  <bfulgham@apple.com>
3351
3352         REGRESSION(r231057): Encrypted media content playback failures
3353         https://bugs.webkit.org/show_bug.cgi?id=185537
3354         <rdar://problem/40038478>
3355
3356         Reviewed by Eric Carlson.
3357
3358         Put access to the SecurityServer back in the sandbox so we can validate the
3359         signatures of media encoder/decoders.
3360
3361         * WebProcess/com.apple.WebProcess.sb.in:
3362
3363 2018-05-11  Youenn Fablet  <youenn@apple.com>
3364
3365         NetworkCORSPreflightChecker should proceed when having a ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested challenge
3366         https://bugs.webkit.org/show_bug.cgi?id=185522
3367         <rdar://problem/39987152>
3368
3369         Reviewed by Brent Fulgham.
3370
3371         In case of such challenge, refuse to proceed with authentication since preflight is not using credentials.
3372         Previously, we were failing right away which is not right in case preflight is the request triggering the connection.
3373
3374         Manually tested.
3375
3376         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
3377         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
3378
3379 2018-05-10  Daniel Bates  <dabates@apple.com>
3380
3381         Use PlatformStrategies to switch between WebKit and WebKitLegacy checking of CSP frame-ancestors and X-Frame-Options
3382         https://bugs.webkit.org/show_bug.cgi?id=185412
3383
3384         Reviewed by Ryosuke Niwa.
3385
3386         Update code for renaming and write in terms of WebLoaderStrategy::shouldPerformSecurityChecks()
3387         instead of explicitly querying RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess().
3388
3389         * WebProcess/Network/WebLoaderStrategy.cpp:
3390         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3391         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
3392         (WebKit::WebLoaderStrategy::startPingLoad):
3393         (WebKit::WebLoaderStrategy::preconnectTo):
3394         (WebKit::WebLoaderStrategy::shouldPerformSecurityChecks const):
3395         (WebKit::WebLoaderStrategy::havePerformedSecurityChecks const):
3396         (WebKit::WebLoaderStrategy::isDoingLoadingSecurityChecks const): Deleted.
3397         * WebProcess/Network/WebLoaderStrategy.h:
3398         * WebProcess/WebPage/WebPage.cpp:
3399
3400 2018-05-10  Timothy Horton  <timothy_horton@apple.com>
3401
3402         Fix the build after r231393
3403         ​https://bugs.webkit.org/show_bug.cgi?id=185519
3404         <rdar://problem/40131741>
3405
3406         * Configurations/WebKit.xcconfig:
3407
3408 2018-05-10  John Wilander  <wilander@apple.com>
3409
3410         Storage Access API: Extend lifetime of cookies on successful user approval
3411         https://bugs.webkit.org/show_bug.cgi?id=185534
3412         <rdar://problem/40064547>
3413
3414         Reviewed by Brent Fulgham.
3415
3416         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
3417         (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
3418             Picks up the experimental feature flag.
3419         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3420         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessInternal):
3421             Now updates the domain's user interaction timestamp if the user was
3422             prompted for this access.
3423         * UIProcess/WebResourceLoadStatisticsStore.h:
3424
3425 2018-05-10  Chris Dumez  <cdumez@apple.com>
3426
3427         [iOS] Release page load process assertion if the screen is locked
3428         https://bugs.webkit.org/show_bug.cgi?id=185333
3429
3430         Reviewed by Geoff Garen.
3431
3432         We normally take a background process assertion during page loads to allow them to complete
3433         even if the tab / app is backgrounded. We should however avoid doing so when the backgrounding
3434         is caused by the screen locking. Keeping the process assertion in this case would prevent the
3435         whole device from sleeping longer than it should, thus negatively impacting power.
3436
3437         * UIProcess/Cocoa/NavigationState.h:
3438         * UIProcess/Cocoa/NavigationState.mm:
3439         (WebKit::NavigationState::NavigationState):
3440         (WebKit::NavigationState::releaseNetworkActivityToken):
3441         (WebKit::NavigationState::didChangeIsLoading):
3442         * UIProcess/ios/WebPageProxyIOS.mm:
3443         (WebKit::WebPageProxy::applicationDidEnterBackground):
3444
3445 2018-05-10  Megan Gardner  <megan_gardner@apple.com>
3446
3447         Remove Unused Chinese/Japanese Reanalyze code
3448         https://bugs.webkit.org/show_bug.cgi?id=185529
3449
3450         Reviewed by Wenson Hsieh.
3451         
3452         The code for this has actually been completely removed from UIKit. This is unreachable 
3453         dead code that should be removed if just for cleanliness. 
3454
3455         * Platform/spi/ios/UIKitSPI.h:
3456         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3457         * UIProcess/ios/WKContentViewInteraction.h:
3458         * UIProcess/ios/WKContentViewInteraction.mm:
3459         (-[WKContentView canPerformActionForWebView:withSender:]):
3460         (-[WKContentView _reanalyzeForWebView:]): Deleted.
3461
3462 2018-05-10  Chris Dumez  <cdumez@apple.com>
3463
3464         [iOS] Apps that are not visible may not get suspended if they trigger page loads while in the background
3465         https://bugs.webkit.org/show_bug.cgi?id=185318
3466
3467         Reviewed by Geoffrey Garen.
3468
3469         Whenever there is a page load going on, w