Wrap legacy WebRTC API in runtime flag
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2017-03-16  Youenn Fablet  <youenn@apple.com>
2
3         Wrap legacy WebRTC API in runtime flag
4         https://bugs.webkit.org/show_bug.cgi?id=169646
5
6         Reviewed by Alex Christensen.
7
8         Adding preference to legacy API.
9
10         * Shared/WebPreferencesDefinitions.h:
11         * UIProcess/API/C/WKPreferences.cpp:
12         (WKPreferencesSetWebRTCLegacyAPIEnabled):
13         (WKPreferencesGetWebRTCLegacyAPIEnabled):
14         * UIProcess/API/C/WKPreferencesRef.h:
15         * WebProcess/InjectedBundle/InjectedBundle.cpp:
16         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
17         * WebProcess/WebPage/WebPage.cpp:
18         (WebKit::WebPage::updatePreferences):
19
20 2017-03-16  Brady Eidson  <beidson@apple.com>
21
22         Update the WKHTTPCookieStore API to be simpler and add observers.
23         <rdar://problem/31096000> and https://bugs.webkit.org/show_bug.cgi?id=169776
24
25         Reviewed by Alex Christensen.
26         
27         When reviewing the API internally we realized the NSHTTPCookieStorage model doesn't
28         necessarily fit perfectly, and that to handle partitioned cookies going forward we
29         need to be much simpler right now.
30         
31         We also realized that we should implement the "cookie store changed" observer for
32         any clients that might be providing a cookie viewing API.
33         
34         * UIProcess/API/APIHTTPCookieStore.cpp:
35         (API::HTTPCookieStore::~HTTPCookieStore):
36         (API::HTTPCookieStore::deleteCookie):
37         (API::APIWebCookieManagerProxyObserver::APIWebCookieManagerProxyObserver):
38         (API::HTTPCookieStore::registerObserver):
39         (API::HTTPCookieStore::unregisterObserver):
40         (API::HTTPCookieStore::cookiesDidChange):
41         (API::HTTPCookieStore::cookieManagerDestroyed):
42         (API::HTTPCookieStore::registerForNewProcessPoolNotifications):
43         (API::HTTPCookieStore::unregisterForNewProcessPoolNotifications):
44         (API::HTTPCookieStore::setCookies): Deleted.
45         (API::HTTPCookieStore::removeCookiesSinceDate): Deleted.
46         (API::HTTPCookieStore::setHTTPCookieAcceptPolicy): Deleted.
47         (API::HTTPCookieStore::getHTTPCookieAcceptPolicy): Deleted.
48         * UIProcess/API/APIHTTPCookieStore.h:
49         
50         * UIProcess/API/Cocoa/WKHTTPCookieStore.h:
51         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
52         (WKHTTPCookieStoreObserver::WKHTTPCookieStoreObserver):
53         (-[WKHTTPCookieStore dealloc]):
54         (-[WKHTTPCookieStore allCookies:]):
55         (-[WKHTTPCookieStore addObserver:]):
56         (-[WKHTTPCookieStore removeObserver:]):
57         (-[WKHTTPCookieStore fetchCookies:]): Deleted.
58         (-[WKHTTPCookieStore fetchCookiesForURL:completionHandler:]): Deleted.
59         (-[WKHTTPCookieStore setCookies:forURL:mainDocumentURL:completionHandler:]): Deleted.
60         (-[WKHTTPCookieStore removeCookiesSinceDate:completionHandler:]): Deleted.
61         (-[WKHTTPCookieStore setCookieAcceptPolicy:completionHandler:]): Deleted.
62         (kitCookiePolicyToNSCookiePolicy): Deleted.
63         (-[WKHTTPCookieStore fetchCookieAcceptPolicy:]): Deleted.
64
65         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
66         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
67
68         * UIProcess/WebCookieManagerProxy.cpp:
69         (WebKit::WebCookieManagerProxy::~WebCookieManagerProxy):
70         (WebKit::WebCookieManagerProxy::processPoolDestroyed):
71         (WebKit::WebCookieManagerProxy::registerObserver):
72         (WebKit::WebCookieManagerProxy::unregisterObserver):
73         (WebKit::WebCookieManagerProxy::cookiesDidChange):
74         (WebKit::WebCookieManagerProxy::setCookieObserverCallback): Deleted.
75         * UIProcess/WebCookieManagerProxy.h:
76         (WebKit::WebCookieManagerProxy::Observer::~Observer):
77
78         Add the ability for interested clients to listen for the creation of new WebProcessPools,
79         which is needed by APIHTTPCookieStore:
80         * UIProcess/WebProcessPool.cpp:
81         (WebKit::generateListenerIdentifier):
82         (WebKit::processPoolCreationListenerFunctionMap):
83         (WebKit::WebProcessPool::registerProcessPoolCreationListener):
84         (WebKit::WebProcessPool::unregisterProcessPoolCreationListener):
85         (WebKit::WebProcessPool::create):
86         * UIProcess/WebProcessPool.h:
87
88         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
89         (WebKit::WebsiteDataStore::processPoolForCookieStorageNotifications):
90         (WebKit::WebsiteDataStore::isAssociatedProcessPool):
91         (WebKit::WebsiteDataStore::processPools):
92         * UIProcess/WebsiteData/WebsiteDataStore.h:
93
94 2017-03-16  Brian Burg  <bburg@apple.com>
95
96         [iOS WK2] Web Automation: implement platform methods for simulating keyboard events
97         https://bugs.webkit.org/show_bug.cgi?id=169487
98         <rdar://problem/28360564>
99
100         Reviewed by Joseph Pecoraro.
101
102         Reimplement platformSimulateKey{Stroke, Sequence} to simulate events coming from UIKit.
103         These events are sent directly into WebCore without going through the keyboard system,
104         since we don't need to show the keyboard when simulating keystrokes. For example, the
105         keystrokes may not be representable given the current keyboard layout and system language.
106
107         * UIProcess/Automation/WebAutomationSession.cpp:
108         * UIProcess/Automation/WebAutomationSession.h:
109         Un-stub implementations that now exist for iOS.
110
111         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm: Added.
112
113         (WebKit::WebAutomationSession::sendSynthesizedEventsToPage): Added.
114         This is similar to the Mac version, but it sends events directly into WebPageProxy
115         instead of sending them to the NSWindow containing the WebView.
116
117         (WebKit::WebAutomationSession::platformSimulateKeyStroke):
118         Use a somewhat different strategy for determining the charCode/keyCode since we cannot
119         rely on the system keyboard / input manager to generate and deliver real key events.
120         Compared to the Mac platform method, this requires setting up fewer fields and does
121         not use AppKit's current modifier state to determine the effect of sticky modifiers.
122
123         (WebKit::WebAutomationSession::platformSimulateKeySequence):
124         This is almost verbatim from the Mac platform method but uses a different event class.
125
126         * WebKit2.xcodeproj/project.pbxproj: Add new file.
127
128 2017-03-16  Youenn Fablet  <youenn@apple.com>
129
130         [mac-wk2 debug] LayoutTest webrtc/video-mute.html is timing out
131         https://bugs.webkit.org/show_bug.cgi?id=169758
132
133         Reviewed by Eric Carlson.
134
135         Test is timing out due to the UIProcess requesting to disable/enable ICE candidate filtering
136         on a page whose preference is set to not enabling ICE candidate filtering.
137         Current fix is to act upon what UI process asks if the page preference is to enable ICE candidate filtering.
138         If ICE candidate filtering preference is disable for that page (WebKitTestRunner case), no disabling/enabling is done at all. 
139
140         * UIProcess/UserMediaProcessManager.cpp:
141         (WebKit::UserMediaProcessManager::endedCaptureSession):
142         * WebProcess/WebPage/WebPage.cpp:
143         (WebKit::m_backgroundCPULimit):
144         (WebKit::m_backgroundCPULimit):
145         (WebKit::WebPage::disableICECandidateFiltering):
146         (WebKit::WebPage::enableICECandidateFiltering):
147         * WebProcess/WebPage/WebPage.h:
148
149 2017-03-16  Alex Christensen  <achristensen@webkit.org>
150
151         Clean up WKContentExtension API
152         https://bugs.webkit.org/show_bug.cgi?id=169772
153
154         Reviewed by Geoffrey Garen.
155
156         Based on feedback I have decided to do the following:
157         1. Rename lookup to lookUp because look and up are two words.
158         2. Change the parameter of removeContentExtension to a WKContentExtension* to match addContentExtension.
159         3. Add an identifier property accessor to WKContentExtension.
160         4. Change the order of the new error types.  This wasn't exactly based on any feedback, but they look more organized now.
161
162         * UIProcess/API/Cocoa/WKContentExtension.h:
163         * UIProcess/API/Cocoa/WKContentExtension.mm:
164         (-[WKContentExtension identifier]):
165         * UIProcess/API/Cocoa/WKContentExtensionStore.h:
166         * UIProcess/API/Cocoa/WKContentExtensionStore.mm:
167         (toWKErrorCode):
168         (-[WKContentExtensionStore lookUpContentExtensionForIdentifier:completionHandler:]):
169         (-[WKContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]): Deleted.
170         * UIProcess/API/Cocoa/WKError.h:
171         * UIProcess/API/Cocoa/WKError.mm:
172         (localizedDescriptionForErrorCode):
173         * UIProcess/API/Cocoa/WKUserContentController.h:
174         * UIProcess/API/Cocoa/WKUserContentController.mm:
175         (-[WKUserContentController removeContentExtension:]):
176         * UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm:
177         (toUserContentExtensionStoreError):
178         (-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]):
179
180 2017-03-16  Tomas Popela  <tpopela@redhat.com>
181
182         Fix uninitialized public members in Webkit2/UIProcess/API/gtk
183         https://bugs.webkit.org/show_bug.cgi?id=169602
184
185         Reviewed by Michael Catanzaro.
186
187         Found by Coverity scan.
188
189         * UIProcess/API/gtk/WebKitMimeInfo.cpp:
190         * UIProcess/API/gtk/WebKitSettings.cpp:
191         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
192
193 2017-03-16  Zan Dobersek  <zdobersek@igalia.com>
194
195         Unreviewed follow-up to r213787. Move the DatabaseProcess build targets
196         to the top of WebKit2_SOURCES list in order to maintain the alphabetical
197         order.
198
199         * CMakeLists.txt:
200
201 2017-03-15  Alex Christensen  <achristensen@webkit.org>
202
203         Fix CMake build.
204
205         * PlatformMac.cmake:
206
207 2017-03-15  Jer Noble  <jer.noble@apple.com>
208
209         Optionally capture audio in the UIProcess
210         https://bugs.webkit.org/show_bug.cgi?id=169609
211
212         Reviewed by Alex Christensen.
213
214         Add a new class pair, UserMediaCaptureManager/Proxy, to allow a RealtimeMediaSource
215         requested in a WebProcess to be created in the UIProcess and push its audio data across the
216         process boundary to its clients in the WebProcess. Because these classes are clients of the
217         RealtimeMediaSourceCenter::singleton(), they must be a singleton in the WebProcess as well,
218         so they are attached to the WebProcess class in the web process and to WebProcessProxy in
219         the UIProcess.
220
221         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: Added.
222         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::SourceProxy):
223         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::~SourceProxy):
224         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::source):
225         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::description):
226         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::numberOfFrames):
227         (WebKit::UserMediaCaptureManagerProxy::UserMediaCaptureManagerProxy):
228         (WebKit::UserMediaCaptureManagerProxy::~UserMediaCaptureManagerProxy):
229         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
230         (WebKit::UserMediaCaptureManagerProxy::startProducingData):
231         (WebKit::UserMediaCaptureManagerProxy::stopProducingData):
232         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
233         (WebKit::UserMediaCaptureManagerProxy::process):
234         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in: Added.
235         * WebProcess/cocoa/UserMediaCaptureManager.cpp: Added.
236         (WebKit::nextSessionID):
237         (WebKit::UserMediaCaptureManager::Source::Source):
238         (WebKit::UserMediaCaptureManager::Source::~Source):
239         (WebKit::UserMediaCaptureManager::Source::setCapabilities):
240         (WebKit::UserMediaCaptureManager::Source::setSettings):
241         (WebKit::UserMediaCaptureManager::Source::description):
242         (WebKit::UserMediaCaptureManager::Source::setStorage):
243         (WebKit::UserMediaCaptureManager::Source::setRingBufferFrameBounds):
244         (WebKit::UserMediaCaptureManager::Source::audioSamplesAvailable):
245         (WebKit::UserMediaCaptureManager::UserMediaCaptureManager):
246         (WebKit::UserMediaCaptureManager::~UserMediaCaptureManager):
247         (WebKit::UserMediaCaptureManager::supplementName):
248         (WebKit::UserMediaCaptureManager::initialize):
249         (WebKit::UserMediaCaptureManager::createMediaSourceForCaptureDeviceWithConstraints):
250         (WebKit::UserMediaCaptureManager::sourceStopped):
251         (WebKit::UserMediaCaptureManager::sourceMutedChanged):
252         (WebKit::UserMediaCaptureManager::sourceEnabledChanged):
253         (WebKit::UserMediaCaptureManager::sourceSettingsChanged):
254         (WebKit::UserMediaCaptureManager::storageChanged):
255         (WebKit::UserMediaCaptureManager::ringBufferFrameBoundsChanged):
256         (WebKit::UserMediaCaptureManager::audioSamplesAvailable):
257         (WebKit::UserMediaCaptureManager::startProducingData):
258         (WebKit::UserMediaCaptureManager::stopProducingData):
259         * WebProcess/cocoa/UserMediaCaptureManager.h: Added.
260         * WebProcess/cocoa/UserMediaCaptureManager.messages.in: Added.
261
262         Initialize UserMediaCaptureManager/Proxy:
263
264         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
265         (WebKit::WebProcessPool::platformInitializeWebProcess):
266         * UIProcess/WebProcessProxy.cpp:
267         (WebKit::WebProcessProxy::WebProcessProxy):
268         * UIProcess/WebProcessProxy.h:
269         * WebProcess/WebProcess.cpp:
270         (WebKit::WebProcess::WebProcess):
271
272         WebUserMediaClientMac is no longer necessary now that the UserMediaCaptureManager overrides
273         the factories:
274
275         * WebProcess/WebCoreSupport/WebUserMediaClient.cpp:
276         (WebKit::WebUserMediaClient::WebUserMediaClient):
277         (WebKit::WebUserMediaClient::initializeFactories): Deleted.
278
279         Add a new preference and WebProcessCreationParameters member to control whether
280         capturing is done in the UIProcess:
281
282         * Shared/WebPreferencesDefinitions.h:
283         * Shared/WebProcessCreationParameters.cpp:
284         (WebKit::WebProcessCreationParameters::encode):
285         (WebKit::WebProcessCreationParameters::decode):
286         * Shared/WebProcessCreationParameters.h:
287
288         Add new files to the project:
289
290         * DerivedSources.make:
291         * WebKit2.xcodeproj/project.pbxproj:
292
293 2017-03-15  Tim Horton  <timothy_horton@apple.com>
294
295         Null deref under callAfterNextPresentationUpdate
296         https://bugs.webkit.org/show_bug.cgi?id=169710
297         <rdar://problem/30987863>
298
299         Reviewed by Simon Fraser.
300
301         * UIProcess/WebPageProxy.cpp:
302         (WebKit::WebPageProxy::callAfterNextPresentationUpdate):
303         Call the callback with an error if we don't have a web process or drawing area.
304
305 2017-03-15  Chris Dumez  <cdumez@apple.com>
306
307         Document state (e.g. form data) is lost after a tab is terminated in the background for power reasons
308         https://bugs.webkit.org/show_bug.cgi?id=169635
309         <rdar://problem/31046729>
310
311         Reviewed by Andreas Kling.
312
313         Document state (e.g. form data) was lost after a tab was terminated in the background for power
314         reasons. To address the issue, we now save the document state whenever a page is backgrounded.
315         This document state automatically gets restored when reloading the page after termination.
316
317         * WebProcess/WebPage/WebPage.cpp:
318         (WebKit::WebPage::visibilityDidChange):
319         (WebKit::WebPage::setActivityState):
320         * WebProcess/WebPage/WebPage.h:
321
322 2017-03-15  Wenson Hsieh  <wenson_hsieh@apple.com>
323
324         WebContent crash due to bad variant access in WebKit: WebKit::WebPage::expandedRangeFromHandle
325         https://bugs.webkit.org/show_bug.cgi?id=169657
326         <rdar://problem/30631070>
327
328         Reviewed by Tim Horton.
329
330         In WebPageIOS.mm, the call to unionDOMRanges from WebPage::expandedRangeFromHandle invokes
331         Range::compareBoundaryPoints, assuming that the return value is not an exception, and then attempts to perform
332         integer comparison on the result. This is one speculative cause of the web content crash in the radar.
333
334         There isn't a known way to reproduce this crash.
335
336         * WebProcess/WebPage/ios/WebPageIOS.mm:
337         (WebKit::unionDOMRanges):
338
339 2017-03-15  Tim Horton  <timothy_horton@apple.com>
340
341         Un-deprecate the original PDFPlugin
342         https://bugs.webkit.org/show_bug.cgi?id=169655
343
344         Reviewed by Anders Carlsson.
345
346         * Shared/mac/PDFKitImports.h:
347         * WebKit2.xcodeproj/project.pbxproj:
348         * WebProcess/Plugins/PDF/DeprecatedPDFLayerControllerSPI.h: Removed.
349         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.h: Removed.
350         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm: Removed.
351         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:
352         * WebProcess/Plugins/PDF/PDFPlugin.h:
353         * WebProcess/Plugins/PDF/PDFPlugin.mm:
354         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
355         The transition to the non-deprecated PDFPlugin never happened,
356         and we have a very different plan now.
357
358 2017-03-15  Alex Christensen  <achristensen@webkit.org>
359
360         Compiled content extensions should include the JSON source
361         https://bugs.webkit.org/show_bug.cgi?id=169643
362
363         Reviewed by Geoffrey Garen.
364
365         * UIProcess/API/APIContentExtensionStore.cpp:
366         (API::ContentExtensionStore::ContentExtensionStore):
367         (API::ContentExtensionMetaData::fileSize):
368         (API::encodeContentExtensionMetaData):
369         (API::decodeContentExtensionMetaData):
370         (API::compiledToFile):
371         (API::createExtension):
372         (API::ContentExtensionStore::getContentExtensionSource):
373         * UIProcess/API/APIContentExtensionStore.h:
374         * UIProcess/API/Cocoa/WKContentExtensionStore.mm:
375         (toWKErrorCode):
376         (-[WKContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]):
377         (-[WKContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
378         (-[WKContentExtensionStore _getContentExtensionSourceForIdentifier:completionHandler:]):
379         * UIProcess/API/Cocoa/WKContentExtensionStorePrivate.h:
380         * UIProcess/API/Cocoa/WKError.h:
381         * UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:
382         * UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm:
383         (toUserContentExtensionStoreError):
384         (-[_WKUserContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
385         (-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]):
386         (-[_WKUserContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
387
388 2017-03-15  Dean Jackson  <dino@apple.com>
389
390         Sort Xcode project files
391         https://bugs.webkit.org/show_bug.cgi?id=169669
392
393         Reviewed by Antoine Quint.
394
395         * WebKit2.xcodeproj/project.pbxproj:
396
397 2017-03-14  Andy Estes  <aestes@apple.com>
398
399         [iOS] -[WKWebView _dataForDisplayedPDF] returns nil when called before an encrypted PDF has been unlocked
400         https://bugs.webkit.org/show_bug.cgi?id=169653
401         <rdar://problem/24137675>
402
403         Reviewed by Tim Horton.
404
405         * UIProcess/ios/WKPDFView.mm:
406         (-[WKPDFView pdfDocument]): Changed to return _cgPDFDocument directly instead of via the
407         UIPDFDocument, which is only created after the PDF has been unlocked.
408
409 2017-03-14  Tim Horton  <timothy_horton@apple.com>
410
411         Let PDFLayerController drive cursor updates so that it's correct more often
412         https://bugs.webkit.org/show_bug.cgi?id=169626
413         <rdar://problem/30762943>
414
415         Reviewed by Simon Fraser.
416
417         * WebProcess/Plugins/PDF/DeprecatedPDFLayerControllerSPI.h:
418         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.h:
419         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
420         (-[WKPDFLayerControllerDelegate setMouseCursor:]):
421         (WebKit::PDFPlugin::handleMouseEvent):
422         (WebKit::PDFPlugin::handleMouseEnterEvent):
423         (WebKit::pdfLayerControllerCursorTypeToCursor):
424         (WebKit::PDFPlugin::notifyCursorChanged):
425         Disable updateCursor and use the setMouseCursor delegate method when possible.
426
427 2017-03-14  Andrew Gold  <agold@apple.com>
428
429         Extend WKPreferences to include preferences for testing MediaCapture.
430         https://bugs.webkit.org/show_bug.cgi?id=169560
431
432         Reviewed by Youenn Fablet.
433
434         * UIProcess/API/Cocoa/WKPreferences.mm:
435         (-[WKPreferences _mockCaptureDevicesEnabled]):
436         (-[WKPreferences _setMockCaptureDevicesEnabled:]):
437         (-[WKPreferences _mediaCaptureRequiresSecureConnection]):
438         (-[WKPreferences _setMediaCaptureRequiresSecureConnection:]):
439         (-[WKPreferences _enumeratingAllNetworkInterfacesEnabled]):
440         (-[WKPreferences _setEnumeratingAllNetworkInterfacesEnabled:]):
441         (-[WKPreferences _iceCandidateFiltertingEnabled]):
442         (-[WKPreferences _setICECandidateFilteringEnabled:]):
443         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
444
445 2017-03-14  Brady Eidson  <beidson@apple.com>
446
447         Rename WKHTTPCookieStorage to WKHTTPCookieStore.
448         https://bugs.webkit.org/show_bug.cgi?id=169630
449
450         Reviewed by Tim Horton.
451
452         * CMakeLists.txt:
453         
454         * Shared/API/APIObject.h:
455         * Shared/Cocoa/APIObject.mm:
456         (API::Object::newObject):
457         
458         * UIProcess/API/APIHTTPCookieStore.cpp: Renamed from Source/WebKit2/UIProcess/API/APIHTTPCookieStorage.cpp.
459         (API::HTTPCookieStore::HTTPCookieStore):
460         (API::HTTPCookieStore::~HTTPCookieStore):
461         (API::HTTPCookieStore::cookies):
462         (API::HTTPCookieStore::setCookie):
463         (API::HTTPCookieStore::setCookies):
464         (API::HTTPCookieStore::deleteCookie):
465         (API::HTTPCookieStore::removeCookiesSinceDate):
466         (API::HTTPCookieStore::setHTTPCookieAcceptPolicy):
467         (API::HTTPCookieStore::getHTTPCookieAcceptPolicy):
468         * UIProcess/API/APIHTTPCookieStore.h: Renamed from Source/WebKit2/UIProcess/API/APIHTTPCookieStorage.h.
469         
470         * UIProcess/API/APIWebsiteDataStore.cpp:
471         (API::WebsiteDataStore::httpCookieStore):
472         (API::WebsiteDataStore::httpCookieStorage): Deleted.
473         * UIProcess/API/APIWebsiteDataStore.h:
474         
475         * UIProcess/API/Cocoa/WKHTTPCookieStore.h: Renamed from Source/WebKit2/UIProcess/API/Cocoa/WKHTTPCookieStorage.h.
476         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm: Renamed from Source/WebKit2/UIProcess/API/Cocoa/WKHTTPCookieStorage.mm.
477         (coreCookiesToNSCookies):
478         (-[WKHTTPCookieStore dealloc]):
479         (-[WKHTTPCookieStore fetchCookies:]):
480         (-[WKHTTPCookieStore fetchCookiesForURL:completionHandler:]):
481         (-[WKHTTPCookieStore setCookie:completionHandler:]):
482         (-[WKHTTPCookieStore deleteCookie:completionHandler:]):
483         (-[WKHTTPCookieStore setCookies:forURL:mainDocumentURL:completionHandler:]):
484         (-[WKHTTPCookieStore removeCookiesSinceDate:completionHandler:]):
485         (-[WKHTTPCookieStore setCookieAcceptPolicy:completionHandler:]):
486         (kitCookiePolicyToNSCookiePolicy):
487         (-[WKHTTPCookieStore fetchCookieAcceptPolicy:]):
488         (-[WKHTTPCookieStore _apiObject]):
489         * UIProcess/API/Cocoa/WKHTTPCookieStoreInternal.h: Renamed from Source/WebKit2/UIProcess/API/Cocoa/WKHTTPCookieStorageInternal.h.
490         (WebKit::wrapper):
491         
492         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
493         (-[WKWebsiteDataStore _httpCookieStore]):
494         (-[WKWebsiteDataStore _httpCookieStorage]): Deleted.
495         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
496         
497         * UIProcess/WebProcessPool.cpp:
498         * UIProcess/WebProcessPool.h:
499         
500         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
501         (WebKit::WebsiteDataStore::processPoolForCookieStorageOperations):
502         
503         * WebKit2.xcodeproj/project.pbxproj:
504
505 2017-03-14  Anders Carlsson  <andersca@apple.com>
506
507         Propagate PassKit errors
508         https://bugs.webkit.org/show_bug.cgi?id=169633
509         rdar://problem/31043392
510
511         Reviewed by Dean Jackson.
512
513         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
514         (WebKit::toNSError):
515
516 2017-03-06  Jer Noble  <jer.noble@apple.com>
517
518         Refactor: Allow WebKit2 to override the creation of RealtimeMediaSources
519         https://bugs.webkit.org/show_bug.cgi?id=169227
520
521         Reviewed by Eric Carlson.
522
523         * WebKit2.xcodeproj/project.pbxproj:
524         * WebProcess/WebCoreSupport/WebUserMediaClient.cpp:
525         (WebKit::WebUserMediaClient::WebUserMediaClient):
526         (WebKit::WebUserMediaClient::initializeFactories): Add empty non-Cocoa implementation.
527         * WebProcess/WebCoreSupport/WebUserMediaClient.h:
528         * WebProcess/WebCoreSupport/cocoa/WebUserMediaClientMac.mm: Added.
529         (WebKit::WebUserMediaClient::initializeFactories): Initialize a (for now) pass-through factory.
530
531 2017-03-14  Dean Jackson  <dino@apple.com>
532
533         Rename LayerTypeWebGLLayer and use it for both WebGL and WebGPU
534         https://bugs.webkit.org/show_bug.cgi?id=169628
535         <rdar://problems/31047025>
536
537         Reviewed by Simon Fraser.
538
539         Rename LayerTypeWebGLLayer to LayerTypeContentsProvidedLayer
540         and use it for both WebGLLayer and WebGPULayer, to avoid
541         code duplication.
542
543         * Shared/mac/RemoteLayerBackingStore.mm:
544         (WebKit::RemoteLayerBackingStore::drawInContext):
545         * Shared/mac/RemoteLayerTreeTransaction.mm:
546         (WebKit::RemoteLayerTreeTransaction::description):
547         * UIProcess/ios/RemoteLayerTreeHostIOS.mm:
548         (WebKit::RemoteLayerTreeHost::createLayer):
549         * UIProcess/mac/RemoteLayerTreeHost.mm:
550         (WebKit::RemoteLayerTreeHost::createLayer):
551         * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm:
552         (WebKit::PlatformCALayerRemoteCustom::PlatformCALayerRemoteCustom):
553         (WebKit::PlatformCALayerRemoteCustom::clone):
554
555 2017-03-13  Jer Noble  <jer.noble@apple.com>
556
557         Make classes used by Media Stream encode/decode friendly
558         https://bugs.webkit.org/show_bug.cgi?id=169567
559
560         Reviewed by Eric Carlson.
561
562         Make the encoder and decoder for MediaConstraintsData a little less wordy.
563
564         * Shared/WebCoreArgumentCoders.cpp:
565         (IPC::ArgumentCoder<MediaConstraintsData>::encode):
566         (IPC::ArgumentCoder<MediaConstraintsData>::decode):
567
568 2017-03-14  Jer Noble  <jer.noble@apple.com>
569
570         Adapt CARingBuffer to be usable across processes
571         https://bugs.webkit.org/show_bug.cgi?id=169591
572
573         Reviewed by Alex Christensen.
574
575         Add a new class which wraps a SharedMemory object and uses that shared memory as the
576         backing store of a CARingBuffer. This backing store can be set to "read only", which
577         prevents the backing from being de- or re-allocated.
578
579         * WebKit2.xcodeproj/project.pbxproj:
580         * Shared/Cocoa/SharedRingBufferStorage.cpp: Added.
581         (WebKit::SharedRingBufferStorage::setStorage):
582         (WebKit::SharedRingBufferStorage::setReadOnly):
583         (WebKit::SharedRingBufferStorage::allocate):
584         (WebKit::SharedRingBufferStorage::deallocate):
585         (WebKit::SharedRingBufferStorage::data):
586         * Shared/Cocoa/SharedRingBufferStorage.h: Added.
587         (WebKit::SharedRingBufferStorage::SharedRingBufferStorage):
588         (WebKit::SharedRingBufferStorage::invalidate):
589         (WebKit::SharedRingBufferStorage::storage):
590         (WebKit::SharedRingBufferStorage::readOnly):
591
592 2017-03-14  Eric Carlson  <eric.carlson@apple.com>
593
594         [iOS] The web process should inherit application state from UI process
595         https://bugs.webkit.org/show_bug.cgi?id=169156
596         <rdar://problem/30845473>
597
598         Reviewed by Brady Eidson.
599         
600         Move PID proxy setup to platformInitializeWebProcess as suggested in 
601         post-landing feedback.
602
603         * WebProcess/WebPage/ios/WebPageIOS.mm:
604         (WebKit::WebPage::platformInitialize):
605         * WebProcess/cocoa/WebProcessCocoa.mm:
606         (WebKit::WebProcess::platformInitializeWebProcess):
607
608 2017-03-14  Ryan Haddad  <ryanhaddad@apple.com>
609
610         Unreviewed, rolling out r213915.
611
612         Caused WK2 LayoutTests to exit early with timeouts.
613
614         Reverted changeset:
615
616         "Fix uninitialized public members in NetworkProcess"
617         https://bugs.webkit.org/show_bug.cgi?id=169598
618         http://trac.webkit.org/changeset/213915
619
620 2017-03-14  Brady Eidson  <beidson@apple.com>
621
622         REGRESSION (r213877): WebKit2.CookieManager fails.
623         https://bugs.webkit.org/show_bug.cgi?id=169581
624
625         Reviewed by Tim Horton.
626
627         * UIProcess/WebCookieManagerProxy.cpp:
628         (WebKit::WebCookieManagerProxy::processPoolDestroyed): Invalidate the new sets of callbacks.
629         (WebKit::WebCookieManagerProxy::processDidClose): Ditto.
630
631 2017-03-14  Tomas Popela  <tpopela@redhat.com>
632
633         Fix uninitialized public members in NetworkProcess
634         https://bugs.webkit.org/show_bug.cgi?id=169598
635
636         Reviewed by Alex Christensen.
637
638         * NetworkProcess/NetworkProcess.cpp:
639         (WebKit::NetworkProcess::NetworkProcess):
640         * NetworkProcess/NetworkProcessCreationParameters.h:
641         * NetworkProcess/cache/NetworkCacheStorage.cpp:
642         * UIProcess/WebProcessPool.cpp:
643         (WebKit::WebProcessPool::WebProcessPool):
644         * UIProcess/soup/WebProcessPoolSoup.cpp:
645         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
646
647 2017-03-10  Ada Chan  <adachan@apple.com>
648
649         [Mac] Add API to get the NSURLProtectionSpace from WKProtectionSpaceRef
650         https://bugs.webkit.org/show_bug.cgi?id=169494
651         <rdar://problem/11872163>
652
653         Reviewed by Dan Bernstein.
654
655         * UIProcess/API/C/mac/WKProtectionSpaceNS.h: Added.
656         * UIProcess/API/C/mac/WKProtectionSpaceNS.mm: Added.
657         (WKProtectionSpaceCopyNSURLProtectionSpace):
658         * WebKit2.xcodeproj/project.pbxproj:
659
660 2017-03-14  Wenson Hsieh  <wenson_hsieh@apple.com>
661
662         [WK2] Adopt updated data operation interfaces for data interaction
663         https://bugs.webkit.org/show_bug.cgi?id=169414
664         <rdar://problem/30948186>
665
666         Reviewed by Tim Horton.
667
668         Plumb additional information about the data interaction caret over to the UI process after handling a data
669         interaction action in the web process.
670
671         * UIProcess/WebPageProxy.cpp:
672         (WebKit::WebPageProxy::didPerformDragControllerAction):
673         (WebKit::WebPageProxy::resetCurrentDragInformation):
674         * UIProcess/WebPageProxy.h:
675         (WebKit::WebPageProxy::currentDragCaretRect):
676         (WebKit::WebPageProxy::resetCurrentDragInformation): Deleted.
677         * UIProcess/WebPageProxy.messages.in:
678         * UIProcess/ios/WKContentViewInteraction.h:
679         * WebProcess/WebPage/WebPage.cpp:
680         (WebKit::WebPage::performDragControllerAction):
681
682 2017-03-14  Wenson Hsieh  <wenson_hsieh@apple.com>
683
684         [WK2] Data interaction tests occasionally hit assertions in debug builds
685         https://bugs.webkit.org/show_bug.cgi?id=169002
686         <rdar://problem/30994806>
687
688         Reviewed by Tim Horton.
689
690         Renames setIgnoreCompositionSelectionChange to setIgnoreSelectionChanges. See WebCore ChangeLog for more details.
691
692         * Shared/EditorState.cpp:
693         (WebKit::EditorState::encode):
694         (WebKit::EditorState::decode):
695         * Shared/EditorState.h:
696         * UIProcess/gtk/WebPageProxyGtk.cpp:
697         * UIProcess/ios/WebPageProxyIOS.mm:
698         (WebKit::WebPageProxy::editorStateChanged):
699         * UIProcess/mac/WebPageProxyMac.mm:
700         (WebKit::WebPageProxy::editorStateChanged):
701         * WebProcess/WebPage/WebPage.cpp:
702         (WebKit::WebPage::editorState):
703         (WebKit::WebPage::performDragControllerAction):
704         (WebKit::WebPage::setComposition):
705         (WebKit::WebPage::didChangeSelection):
706         * WebProcess/WebPage/ios/FindControllerIOS.mm:
707         (WebKit::setSelectionChangeUpdatesEnabledInAllFrames):
708         (WebKit::FindController::willFindString):
709         (WebKit::FindController::didFailToFindString):
710         (WebKit::FindController::didHideFindIndicator):
711         (WebKit::setCompositionSelectionChangeEnabledInAllFrames): Deleted.
712         * WebProcess/WebPage/ios/WebPageIOS.mm:
713         (WebKit::WebPage::updateSelectionAppearance):
714         (WebKit::WebPage::replaceSelectedText):
715         (WebKit::WebPage::replaceDictatedText):
716
717 2017-03-14  Carlos Garcia Campos  <cgarcia@igalia.com>
718
719         Unreviewed. Fix syntax error in GTK+ API docs.
720
721         * UIProcess/API/gtk/WebKitWebView.cpp:
722         (webkit_web_view_class_init):
723
724 2017-03-13  Brady Eidson  <beidson@apple.com>
725
726         WKWebView provides no access to cookies.
727         https://bugs.webkit.org/show_bug.cgi?id=140191
728
729         Reviewed by Tim Horton.
730
731         This adds a new WKHTTPCookieManager SPI.
732         It follows the NSHTTPCookieStorage API but asynchronous (with completion handlers).
733         
734         * CMakeLists.txt:
735         * WebKit2.xcodeproj/project.pbxproj:
736
737         * Shared/API/APIObject.h:
738         * Shared/Cocoa/APIObject.mm:
739         (API::Object::newObject):
740
741         * UIProcess/API/APIHTTPCookieStorage.cpp: Added.
742         (API::HTTPCookieStorage::HTTPCookieStorage):
743         (API::HTTPCookieStorage::~HTTPCookieStorage):
744         (API::HTTPCookieStorage::cookies):
745         (API::HTTPCookieStorage::setCookie):
746         (API::HTTPCookieStorage::setCookies):
747         (API::HTTPCookieStorage::deleteCookie):
748         (API::HTTPCookieStorage::removeCookiesSinceDate):
749         (API::HTTPCookieStorage::setHTTPCookieAcceptPolicy):
750         (API::HTTPCookieStorage::getHTTPCookieAcceptPolicy):
751         * UIProcess/API/APIHTTPCookieStorage.h: Added.
752
753         * UIProcess/API/APIWebsiteDataStore.cpp:
754         (API::WebsiteDataStore::defaultDataStore):
755         (API::WebsiteDataStore::httpCookieStorage):
756         * UIProcess/API/APIWebsiteDataStore.h:
757
758         * UIProcess/API/C/WKCookieManager.cpp:
759         (WKCookieManagerDeleteAllCookiesModifiedAfterDate):
760         (WKCookieManagerSetHTTPCookieAcceptPolicy):
761         (WKCookieManagerGetHTTPCookieAcceptPolicy):
762
763         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
764         (WKWebsiteDataStoreGetDefaultDataStore):
765
766         * UIProcess/API/Cocoa/WKProcessPool.mm:
767         (-[WKProcessPool _setCookieAcceptPolicy:]):
768
769         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
770         (+[WKWebsiteDataStore defaultDataStore]):
771         (-[WKWebsiteDataStore _httpCookieStorage]):
772         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
773         
774         * UIProcess/API/Cocoa/WKHTTPCookieStorage.h:
775         * UIProcess/API/Cocoa/WKHTTPCookieStorage.mm: Added.
776         (coreCookiesToNSCookies):
777         (-[WKHTTPCookieStorage dealloc]):
778         (-[WKHTTPCookieStorage fetchCookies:]):
779         (-[WKHTTPCookieStorage fetchCookiesForURL:completionHandler:]):
780         (-[WKHTTPCookieStorage setCookie:completionHandler:]):
781         (-[WKHTTPCookieStorage deleteCookie:completionHandler:]):
782         (-[WKHTTPCookieStorage setCookies:forURL:mainDocumentURL:completionHandler:]):
783         (-[WKHTTPCookieStorage removeCookiesSinceDate:completionHandler:]):
784         (-[WKHTTPCookieStorage setCookieAcceptPolicy:completionHandler:]):
785         (kitCookiePolicyToNSCookiePolicy):
786         (-[WKHTTPCookieStorage fetchCookieAcceptPolicy:]):
787         (-[WKHTTPCookieStorage _apiObject]):
788         * UIProcess/API/Cocoa/WKHTTPCookieStorageInternal.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h.
789         (WebKit::wrapper):
790
791         * UIProcess/Automation/WebAutomationSession.cpp:
792         (WebKit::WebAutomationSession::addSingleCookie):
793
794         * UIProcess/WebCookieManagerProxy.cpp:
795         (WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
796         (WebKit::WebCookieManagerProxy::deleteCookiesForHostname):
797         (WebKit::WebCookieManagerProxy::deleteAllCookies):
798         (WebKit::WebCookieManagerProxy::deleteCookie):
799         (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
800         (WebKit::WebCookieManagerProxy::setCookie):
801         (WebKit::WebCookieManagerProxy::setCookies):
802         (WebKit::WebCookieManagerProxy::getAllCookies):
803         (WebKit::WebCookieManagerProxy::getCookies):
804         (WebKit::WebCookieManagerProxy::didSetCookies):
805         (WebKit::WebCookieManagerProxy::didGetCookies):
806         (WebKit::WebCookieManagerProxy::didDeleteCookies):
807         (WebKit::WebCookieManagerProxy::startObservingCookieChanges):
808         (WebKit::WebCookieManagerProxy::stopObservingCookieChanges):
809         (WebKit::WebCookieManagerProxy::setCookieObserverCallback):
810         (WebKit::WebCookieManagerProxy::cookiesDidChange):
811         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
812         (WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
813         (WebKit::WebCookieManagerProxy::didGetHTTPCookieAcceptPolicy):
814         (WebKit::WebCookieManagerProxy::didSetHTTPCookieAcceptPolicy):
815         * UIProcess/WebCookieManagerProxy.h:
816         * UIProcess/WebCookieManagerProxy.messages.in:
817
818         * UIProcess/WebFrameProxy.h:
819         
820         * UIProcess/WebProcessPool.cpp:
821         * UIProcess/WebProcessPool.h:
822         
823         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
824         (WebKit::WebsiteDataStore::processPoolForCookieStorageOperations):
825         (WebKit::WebsiteDataStore::processPools):
826         * UIProcess/WebsiteData/WebsiteDataStore.h:
827         
828         * WebProcess/Cookies/WebCookieManager.cpp:
829         (WebKit::WebCookieManager::deleteCookie):
830         (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
831         (WebKit::WebCookieManager::getAllCookies):
832         (WebKit::WebCookieManager::getCookies):
833         (WebKit::WebCookieManager::setCookie):
834         (WebKit::WebCookieManager::setCookies):
835         (WebKit::WebCookieManager::setHTTPCookieAcceptPolicy):
836         * WebProcess/Cookies/WebCookieManager.h:
837         * WebProcess/Cookies/WebCookieManager.messages.in:
838
839 2017-03-13  John Wilander  <wilander@apple.com>
840
841         Resource Load Statistics: More efficient network process messaging + Fix bug in user interaction reporting
842         https://bugs.webkit.org/show_bug.cgi?id=169506
843
844         Reviewed by Alex Christensen.
845
846         * NetworkProcess/NetworkProcess.cpp:
847         (WebKit::NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
848             Now takes two vectors – domainsToRemove and domainsToAdd.
849         * NetworkProcess/NetworkProcess.h:
850         * NetworkProcess/NetworkProcess.messages.in:
851             The message now takes two vectors – domainsToRemove and domainsToAdd.
852         * UIProcess/Network/NetworkProcessProxy.cpp:
853         (WebKit::NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
854             Now takes two vectors – domainsToRemove and domainsToAdd.
855         * UIProcess/Network/NetworkProcessProxy.h:
856         * UIProcess/Network/NetworkProcessProxy.messages.in:
857             The message now takes two vectors – domainsToRemove and domainsToAdd.
858         * UIProcess/WebResourceLoadStatisticsManager.cpp:
859         (WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
860             Now converts to the two vectors needed by
861             WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler().
862         * UIProcess/WebResourceLoadStatisticsStore.cpp:
863         (WebKit::WebResourceLoadStatisticsStore::classifyResource):
864             No longer explicitly calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
865         (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
866             Changed the order of two blocks to not build a vector if we are to return early.
867         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
868             Now calls WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler().
869         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
870             Now takes a handler with two vectors – domainsToRemove and domainsToAdd.
871         * UIProcess/WebResourceLoadStatisticsStore.h:
872         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
873         (WebKit::WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
874             Now takes two vectors – domainsToRemove and domainsToAdd.
875         (WebKit::WebsiteDataStore::registerSharedResourceLoadObserver):
876             Now submits a handler that takes two vectors – domainsToRemove and domainsToAdd.
877         * UIProcess/WebsiteData/WebsiteDataStore.h:
878
879 2017-03-13  Dean Jackson  <dino@apple.com>
880
881         Respect the runtime flag for WebGPU, default feature to off, and print a warning
882         https://bugs.webkit.org/show_bug.cgi?id=169564
883         <rdar://problems/31018864>
884
885         Reviewed by Tim Horton.
886
887         Make sure WebGPU respects its runtime feature flag. Also, since
888         this implementation doesn't validate content, it should default
889         to being disabled.
890
891         * Shared/WebPreferencesDefinitions.h:
892
893 2017-03-13  Anders Carlsson  <andersca@apple.com>
894
895         Fix more build warnings.
896
897         * UIProcess/mac/WKWebInspectorWKWebView.mm:
898         (WebKit::runOpenPanel):
899         * UIProcess/mac/WebInspectorProxyMac.mm:
900         (WebKit::WebInspectorProxy::platformSave):
901
902 2017-03-13  Anders Carlsson  <andersca@apple.com>
903
904         Fix build warnings.
905
906         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
907         (WebKit::RemoteWebInspectorProxy::platformSave):
908
909 2017-03-13  Yusuke Suzuki  <utatane.tea@gmail.com>
910
911         [WTF] Clean up RunLoop and WorkQueue with Seconds and Function
912         https://bugs.webkit.org/show_bug.cgi?id=169537
913
914         Reviewed by Sam Weinig.
915
916         * Shared/ChildProcess.cpp:
917         (WebKit::didCloseOnConnectionWorkQueue):
918         * UIProcess/Storage/LocalStorageDatabase.cpp:
919         * WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp:
920         (WebKit::AcceleratedSurfaceX11::resize):
921
922 2017-03-13  Chris Dumez  <cdumez@apple.com>
923
924         Allow termination of background WebProcesses that go over a given CPU usage threshold
925         https://bugs.webkit.org/show_bug.cgi?id=169456
926         <rdar://problem/30960968>
927
928         Reviewed by Andreas Kling.
929
930         Allow termination of background WebProcesses that go over a given CPU usage threshold.
931         This can be enabled client side via the WKPageConfigurationSetBackgroundCPULimit()
932         SPI. The client provides the actual CPU threshold it wants to use at page level.
933
934         If such limit is set, whenever a WebContent process has no visible pages, we start
935         monitoring its CPU usage over 15 minutes periods. At the end of each period, we
936         check if the process' average CPU usage over this period was greater than the
937         background CPU limit. If it greater, the WebContent process send an IPC message to
938         the UIProcess letting it know that it exceeded the CPU limit. The UI process will
939         then log a message and terminate the process unless it has any audio playing.
940
941         Once a WebProcess has been terminated, we do not let the client know until one of its
942         pages becomes visible again. When this happens, we call the processDidCrash
943         delegate and Safari will take care of reloading the tab and showing the crash
944         banner then. This is done because we do not want to reload content that is
945         using a lot of CPU while in the background.
946
947         * Shared/WebPageCreationParameters.cpp:
948         (WebKit::WebPageCreationParameters::encode):
949         (WebKit::WebPageCreationParameters::decode):
950         * Shared/WebPageCreationParameters.h:
951         Add backgroundCPULimit to WebPageCreationParameters.
952
953         * UIProcess/API/APIPageConfiguration.cpp:
954         (API::PageConfiguration::copy):
955         * UIProcess/API/APIPageConfiguration.h:
956         (API::PageConfiguration::backgroundCPULimit):
957         (API::PageConfiguration::setBackgroundCPULimit):
958         Add backgroundCPULimit to APIPageConfiguration.
959
960         * UIProcess/API/C/WKPageConfigurationRef.cpp:
961         (WKPageConfigurationSetBackgroundCPULimit):
962         * UIProcess/API/C/WKPageConfigurationRef.h:
963         Add SPI to set background CPU limit.
964
965         * UIProcess/WebPageProxy.cpp:
966         (WebKit::WebPageProxy::reattachToWebProcess):
967         Reset m_wasTerminatedDueToResourceExhaustionWhileInBackground flag
968         as the process was restarted.
969
970         (WebKit::WebPageProxy::dispatchActivityStateChange):
971         When the visibility state changes for a page that was terminated
972         while in the background due to exceeded CPU limit, notify the
973         client that the process crashed via the processDidCrash delegate.
974         Safari will use this delegate to reload the tab and show the crash
975         banner.
976
977         (WebKit::WebPageProxy::terminateProcess):
978         Add parameter to terminateProcess() to provide the reason. If the
979         page was terminated due to reaching CPU limit, set a flag so we
980         can delay calling processDidCrash until the page becomes visible
981         again.
982
983         (WebKit::WebPageProxy::creationParameters):
984         Set backgroundCPULimit on the WebPageCreationParameters.
985
986         * UIProcess/WebPageProxy.h:
987
988         * UIProcess/WebProcessProxy.cpp:
989         (WebKit::pagesCopy):
990         Add utility function to copy the list of pages to a Vector.
991
992         (WebKit::WebProcessProxy::didExceedBackgroundCPULimit):
993         When we get an IPC message from a WebContent process to let us
994         know that the process exceeded the background CPU limit, we log
995         a message and we terminate it if it has no audio playing.
996
997         * UIProcess/WebProcessProxy.h:
998
999         * UIProcess/WebProcessProxy.messages.in:
1000         Add DidExceedBackgroundCPULimit IPC message so the WebContent process
1001         can let us know when it goes over the background CPU limit.
1002
1003         * WebProcess/WebPage/WebPage.cpp:
1004         (WebKit::m_backgroundCPULimit):
1005         (WebKit::WebPage::setActivityState):
1006         Notify the WebProcess whenever the activity state of a WebPage changes.
1007         The WebProcess currently uses this information to determine when the
1008         visibility of a page changes. This is needed as we only want to monitor
1009         CPU usage of *background* WebContent processes (processes that have no
1010         visible WebPage).
1011
1012         * WebProcess/WebPage/WebPage.h:
1013         (WebKit::WebPage::backgroundCPULimit):
1014
1015         * WebProcess/WebProcess.cpp:
1016         (WebKit::WebProcess::createWebPage):
1017         (WebKit::WebProcess::removeWebPage):
1018         Call updateBackgroundCPULimit() whenever a WebPage is added or removed
1019         since the limit is per page.
1020
1021         (WebKit::WebProcess::updateBackgroundCPULimit):
1022         (WebKit::WebProcess::updateBackgroundCPUMonitorState):
1023         No-ops on other platforms than Mac at the moment.
1024
1025         (WebKit::WebProcess::pageActivityStateDidChange):
1026         Call updateBackgroundCPUMonitorState() whenever the visibility of the
1027         WebPage changes as we only monitor the CPU usage of *background* WebContent
1028         processes.
1029
1030         (WebKit::WebProcess::hasVisibleWebPage):
1031         Add utility function to determine if there is any visible WebPage in this
1032         WebContent process. If the function returns false, then we consider the
1033         WebContent process to be a *background* WebContent process.
1034
1035         * WebProcess/WebProcess.h:
1036
1037         * WebProcess/cocoa/WebProcessCocoa.mm:
1038         (WebKit::WebProcess::updateBackgroundCPULimit):
1039         Compute the WebProcess' background CPU limit given the limit set for each
1040         of its WebPages. We use the largest (i.e. most permissive) background CPU
1041         limit among all the pages.
1042
1043         (WebKit::WebProcess::updateBackgroundCPUMonitorState):
1044         Update the state of the background CPU monitor. This is called whenever
1045         the background CPU limit of the process changes or whenever the visibility
1046         of a WebPage changes.
1047
1048 2017-03-13  Michael Saboff  <msaboff@apple.com>
1049
1050         Add iOS plumbing to WebProcess to enable JavaScriptCore configuration and logging
1051         https://bugs.webkit.org/show_bug.cgi?id=169489
1052
1053         Reviewed by Geoffrey Garen.
1054
1055         Added new preference for enabling the use of a JavaScript configuration file
1056         in iOS builds.  The preference is used to enable the processing of the
1057         configuration file.
1058
1059         (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
1060         * UIProcess/API/APIWebsiteDataStore.cpp:
1061         (API::WebsiteDataStore::defaultJavaScriptConfigurationDirectory):
1062         * UIProcess/API/APIWebsiteDataStore.h:
1063         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
1064         (API::WebsiteDataStore::defaultJavaScriptConfigurationDirectory):
1065         (API::WebsiteDataStore::tempDirectoryFileSystemRepresentation):
1066         (API::WebsiteDataStore::defaultDataStoreConfiguration):
1067         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1068         (WebKit::WebProcessPool::setJavaScriptConfigurationFileEnabledFromDefaults):
1069         * UIProcess/WebProcessPool.cpp:
1070         (WebKit::WebProcessPool::createNewWebProcess):
1071         * UIProcess/WebProcessPool.h:
1072
1073 2017-03-13  Zan Dobersek  <zdobersek@igalia.com>
1074
1075         [WK2] Move AcceleratedSurface files under WebProcess/WebPage/CoordinatedGraphics
1076         https://bugs.webkit.org/show_bug.cgi?id=169348
1077
1078         Reviewed by Carlos Garcia Campos.
1079
1080         Move the AcceleratedSurface header and implementation files under the
1081         WebProcess/WebPage directory since that class is not specific to the
1082         GTK+ port.
1083
1084         * PlatformGTK.cmake:
1085         * WebProcess/WebPage/AcceleratedSurface.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/gtk/AcceleratedSurface.cpp.
1086         (WebKit::AcceleratedSurface::create):
1087         (WebKit::AcceleratedSurface::AcceleratedSurface):
1088         (WebKit::AcceleratedSurface::resize):
1089         * WebProcess/WebPage/AcceleratedSurface.h: Renamed from Source/WebKit2/WebProcess/WebPage/gtk/AcceleratedSurface.h.
1090         (WebKit::AcceleratedSurface::window):
1091         (WebKit::AcceleratedSurface::surfaceID):
1092         (WebKit::AcceleratedSurface::shouldPaintMirrored):
1093
1094 2017-03-13  Konstantin Tokarev  <annulen@yandex.ru>
1095
1096         [cmake] [WK2] Guard flags intended for GCC-like compilers with COMPILER_IS_GCC_OR_CLANG
1097         https://bugs.webkit.org/show_bug.cgi?id=169551
1098
1099         Reviewed by Yusuke Suzuki.
1100
1101         This change allows building WK2 code with MSVC.
1102
1103         * CMakeLists.txt:
1104
1105 2017-03-13  Chris Dumez  <cdumez@apple.com>
1106
1107         [WK2] Only report background WebProcesses as unresponsive in the background after 90 seconds
1108         https://bugs.webkit.org/show_bug.cgi?id=169425
1109         <rdar://problem/30954003>
1110
1111         Reviewed by Andreas Kling.
1112
1113         The background responsiveness checking was previously relying on the
1114         isResponsive(std::function<void(bool)>) API which uses the ResponsivenessTimer
1115         and has a timeout of 3 seconds. We believe this is too aggressive for background
1116         tabs. Update BackgroundResponsiveTimer to stop relying on ResponsivenessTimer
1117         and have its own timeout Timer which a delay of 90 seconds instead.
1118
1119         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
1120         (-[WKObservablePageState _webProcessIsResponsive]):
1121         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
1122         (-[WKBrowsingContextController _webProcessIsResponsive]):
1123         * UIProcess/API/Cocoa/WKWebView.mm:
1124         (-[WKWebView _webProcessIsResponsive]):
1125         * UIProcess/BackgroundProcessResponsivenessTimer.cpp:
1126         (WebKit::BackgroundProcessResponsivenessTimer::BackgroundProcessResponsivenessTimer):
1127         (WebKit::BackgroundProcessResponsivenessTimer::~BackgroundProcessResponsivenessTimer):
1128         (WebKit::BackgroundProcessResponsivenessTimer::updateState):
1129         (WebKit::BackgroundProcessResponsivenessTimer::didReceiveBackgroundResponsivenessPong):
1130         (WebKit::BackgroundProcessResponsivenessTimer::invalidate):
1131         (WebKit::BackgroundProcessResponsivenessTimer::processTerminated):
1132         (WebKit::BackgroundProcessResponsivenessTimer::responsivenessCheckTimerFired):
1133         (WebKit::BackgroundProcessResponsivenessTimer::timeoutTimerFired):
1134         (WebKit::BackgroundProcessResponsivenessTimer::setResponsive):
1135         (WebKit::BackgroundProcessResponsivenessTimer::shouldBeActive):
1136         (WebKit::BackgroundProcessResponsivenessTimer::scheduleNextResponsivenessCheck):
1137         (WebKit::BackgroundProcessResponsivenessTimer::client):
1138         * UIProcess/BackgroundProcessResponsivenessTimer.h:
1139         (WebKit::BackgroundProcessResponsivenessTimer::isResponsive):
1140         * UIProcess/ResponsivenessTimer.h:
1141         (WebKit::ResponsivenessTimer::isResponsive):
1142         * UIProcess/WebPageProxy.cpp:
1143         (WebKit::WebPageProxy::resetStateAfterProcessExited):
1144         (WebKit::WebPageProxy::updateBackingStoreDiscardableState):
1145         * UIProcess/WebProcessProxy.cpp:
1146         (WebKit::WebProcessProxy::WebProcessProxy):
1147         (WebKit::WebProcessProxy::shutDown):
1148         (WebKit::WebProcessProxy::isResponsive):
1149         (WebKit::WebProcessProxy::didReceiveBackgroundResponsivenessPing):
1150         (WebKit::WebProcessProxy::processTerminated):
1151         (WebKit::WebProcessProxy::updateBackgroundResponsivenessTimer):
1152         * UIProcess/WebProcessProxy.h:
1153         * UIProcess/WebProcessProxy.messages.in:
1154         * WebProcess/WebProcess.cpp:
1155         (WebKit::WebProcess::backgroundResponsivenessPing):
1156         * WebProcess/WebProcess.h:
1157         * WebProcess/WebProcess.messages.in:
1158
1159 2017-03-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1160
1161         Web Automation: automation commands hang when trying to navigate go/back and it's not possible
1162         https://bugs.webkit.org/show_bug.cgi?id=169407
1163
1164         Reviewed by Michael Catanzaro.
1165
1166         Trying to navigate back or forward when there are no back/forward items makes the automation commands to hang, because
1167         navigation callback is never called. WebPageProxy returns nullptr to indicate no navigation will take place. In
1168         that case we can consider that the operation succeeded.
1169
1170         * UIProcess/Automation/WebAutomationSession.cpp:
1171         (WebKit::WebAutomationSession::goBackInBrowsingContext):
1172         (WebKit::WebAutomationSession::goForwardInBrowsingContext):
1173
1174 2017-03-13  Zan Dobersek  <zdobersek@igalia.com>
1175
1176         [WK2][CMake] Remove the intermediate NetworkProcess_COMMON_SOURCES variable
1177         https://bugs.webkit.org/show_bug.cgi?id=169524
1178
1179         Reviewed by Michael Catanzaro.
1180
1181         The NetworkProcess-specific source files listed in the
1182         NetworkProcess_COMMON_SOURCES variable definition should be directly
1183         inlined into the list with which the WebKit2_SOURCE variable is defined.
1184         The NetworkProcess_COMMON_SOURCES variable is appended to the
1185         WebKit2_SOURCES variable anyway, and is not used anywhere else. The
1186         separate variable was previously use to support configurations that
1187         allowed disabling NetworkProcess.
1188
1189         * CMakeLists.txt:
1190
1191 2017-03-13  Dean Jackson  <dino@apple.com>
1192
1193         WebGPU remote layer hosting
1194         https://bugs.webkit.org/show_bug.cgi?id=169539
1195         <rdar://problem/31005380>
1196
1197         Reviewed by Jon Lee.
1198
1199         Implement the host-side part of WebGPULayer.
1200
1201         * Shared/mac/RemoteLayerBackingStore.mm: Add support for LayerTypeWebGPULayer.
1202         (WebKit::RemoteLayerBackingStore::drawInContext):
1203         * Shared/mac/RemoteLayerTreeTransaction.mm: Ditto.
1204         (WebKit::RemoteLayerTreeTransaction::description):
1205         * UIProcess/ios/RemoteLayerTreeHostIOS.mm: Ditto.
1206         (WebKit::RemoteLayerTreeHost::createLayer):
1207         * UIProcess/mac/RemoteLayerTreeHost.mm: Ditto.
1208         (WebKit::RemoteLayerTreeHost::createLayer):
1209         * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm: Ditto.
1210         (WebKit::PlatformCALayerRemoteCustom::PlatformCALayerRemoteCustom):
1211         (WebKit::PlatformCALayerRemoteCustom::clone):
1212
1213 2017-03-13  Zan Dobersek  <zdobersek@igalia.com>
1214
1215         Unreviewed GTK+ build fix. Use WTF::Function<> for the
1216         WebPageProxy::getContentsAsMHTMLData() parameter, fixing
1217         configurations that support enabling ENABLE(MHTML).
1218
1219         * UIProcess/WebPageProxy.cpp:
1220         (WebKit::WebPageProxy::getContentsAsMHTMLData):
1221         * UIProcess/WebPageProxy.h:
1222
1223 2017-03-12  Dan Bernstein  <mitz@apple.com>
1224
1225         [Cocoa] Incorrect availability annotations in WKUserContentController.h
1226         https://bugs.webkit.org/show_bug.cgi?id=169536
1227
1228         Reviewed by Alexey Proskuryakov.
1229
1230         * UIProcess/API/Cocoa/WKUserContentController.h: Use WK_MAC_TBA for macOS availability.
1231
1232 2017-03-12  Brady Eidson  <beidson@apple.com>
1233
1234         Transition GenericCallback from std::function to WTF::Function.
1235         https://bugs.webkit.org/show_bug.cgi?id=169530
1236
1237         Reviewed by Dean Jackson.
1238
1239         * UIProcess/GenericCallback.h:
1240         (WebKit::GenericCallback::create):
1241         (WebKit::GenericCallback::performCallbackWithReturnValue):
1242         (WebKit::GenericCallback::GenericCallback):
1243         (WebKit::CallbackMap::put):
1244
1245         * UIProcess/WebCookieManagerProxy.cpp:
1246         (WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
1247         (WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
1248         * UIProcess/WebCookieManagerProxy.h:
1249
1250         * UIProcess/WebFrameProxy.cpp:
1251         (WebKit::WebFrameProxy::getWebArchive):
1252         (WebKit::WebFrameProxy::getMainResourceData):
1253         (WebKit::WebFrameProxy::getResourceData):
1254         * UIProcess/WebFrameProxy.h:
1255
1256         * UIProcess/WebPageProxy.cpp:
1257         (WebKit::WebPageProxy::getSelectionAsWebArchiveData):
1258         (WebKit::WebPageProxy::getMainResourceDataOfFrame):
1259         (WebKit::WebPageProxy::getResourceDataFromFrame):
1260         (WebKit::WebPageProxy::getWebArchiveOfFrame):
1261         * UIProcess/WebPageProxy.h:
1262
1263         * UIProcess/WebProcessPool.cpp:
1264         (WebKit::WebProcessPool::getStatistics):
1265         * UIProcess/WebProcessPool.h:
1266
1267 2017-03-12  Adrian Perez de Castro  <aperez@igalia.com>
1268
1269         [GTK] Unbreak build with GTK+ >=3.20 after r213772
1270         https://bugs.webkit.org/show_bug.cgi?id=169533
1271
1272         Reviewed by Michael Catanzaro.
1273
1274         * UIProcess/API/gtk/WebKitWebView.cpp:
1275         (webkitWebViewRunFileChooser): Add missing cast.
1276
1277 2017-03-12  Adrian Perez de Castro  <aperez@igalia.com>
1278
1279         [GTK] File choosers should run as modal by default if possible
1280         https://bugs.webkit.org/show_bug.cgi?id=169526
1281
1282         Reviewed by Michael Catanzaro.
1283
1284         * UIProcess/API/gtk/WebKitWebView.cpp:
1285         (webkitWebViewRunFileChooser): If a top-level window containing the web view is found, call
1286         gtk_native_dialog_set_modal() to configure the dialog accordingly.
1287
1288 2017-03-12  Dan Bernstein  <mitz@apple.com>
1289
1290         [iOS] Some more -respondsToSelector: checks are unnecessary
1291         https://bugs.webkit.org/show_bug.cgi?id=169525
1292
1293         Reviewed by Tim Horton.
1294
1295         * Platform/spi/ios/UIKitSPI.h: Moved redeclarations of methods that are declared in the
1296           Apple internal SDK into the #if !USE(APPLE_INTERNAL_SDK) section.
1297
1298         * UIProcess/API/Cocoa/WKWebView.mm:
1299         (-[WKWebView _initializeWithConfiguration:]): Replaced unnecessary -respondsToSelector:
1300           check with compile-time check for the deployment target.
1301         (-[WKWebView _computedContentInset]): Ditto.
1302         (activeMinimumLayoutSize): Ditto.
1303         (-[WKWebView safeAreaInsetsDidChange]): Ditto.
1304
1305 2017-03-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
1306
1307         Enable async image decoding for large images
1308         https://bugs.webkit.org/show_bug.cgi?id=165039
1309
1310         Reviewed by Simon Fraser.
1311
1312         Add WK2 preferences for setting/getting LargeImageAsyncDecoding and
1313         AnimatedImageAsyncDecoding.
1314         
1315         * UIProcess/API/C/WKPreferences.cpp:
1316         (WKPreferencesSetLargeImageAsyncDecodingEnabled):
1317         (WKPreferencesGetLargeImageAsyncDecodingEnabled):
1318         (WKPreferencesSetAnimatedImageAsyncDecodingEnabled):
1319         (WKPreferencesGetAnimatedImageAsyncDecodingEnabled):
1320         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1321
1322 2017-03-11  Alex Christensen  <achristensen@webkit.org>
1323
1324         Rollout r213746
1325         https://bugs.webkit.org/show_bug.cgi?id=169497
1326
1327         That change broke a bunch of tests in storage/indexeddb.
1328
1329         * NetworkProcess/NetworkProcess.cpp:
1330         (WebKit::NetworkProcess::initializeNetworkProcess):
1331         (WebKit::NetworkProcess::ensurePrivateBrowsingSession):
1332         * NetworkProcess/RemoteNetworkingContext.h:
1333         * NetworkProcess/mac/RemoteNetworkingContext.mm:
1334         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
1335         * NetworkProcess/soup/RemoteNetworkingContextSoup.cpp: Copied from WebKit2/NetworkProcess/soup/RemoteNetworkingContextSoup.cpp.
1336         * PlatformGTK.cmake:
1337
1338 2017-03-11  Brady Eidson  <beidson@apple.com>
1339
1340         Cleanup "addCookie" and its sole user.
1341         https://bugs.webkit.org/show_bug.cgi?id=169486
1342
1343         Reviewed by Brian Burg.
1344
1345         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1346         (WebKit::NetworkConnectionToWebProcess::addCookie): Deleted.
1347         * NetworkProcess/NetworkConnectionToWebProcess.h:
1348         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1349
1350         * Shared/WebCoreArgumentCoders.cpp:
1351         (IPC::ArgumentCoder<Cookie>::encode): Deleted.
1352         (IPC::ArgumentCoder<Cookie>::decode): Deleted.
1353         * Shared/WebCoreArgumentCoders.h:
1354
1355         * UIProcess/Automation/WebAutomationSession.cpp:
1356         (WebKit::WebAutomationSession::addSingleCookie):
1357
1358         * UIProcess/WebCookieManagerProxy.cpp:
1359         (WebKit::WebCookieManagerProxy::setCookies):
1360         (WebKit::WebCookieManagerProxy::addCookie): Deleted.
1361         * UIProcess/WebCookieManagerProxy.h:
1362
1363         * WebProcess/Cookies/WebCookieManager.cpp:
1364         (WebKit::WebCookieManager::setCookies):
1365         (WebKit::WebCookieManager::addCookie): Deleted.
1366         * WebProcess/Cookies/WebCookieManager.h:
1367         * WebProcess/Cookies/WebCookieManager.messages.in:
1368
1369         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1370         (WebKit::WebPlatformStrategies::addCookie): Deleted.
1371         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
1372
1373 2017-03-10  Alex Christensen  <achristensen@webkit.org>
1374
1375         Fix watch and tv builds after r213294
1376         https://bugs.webkit.org/show_bug.cgi?id=169508
1377
1378         Reviewed by Dan Bernstein.
1379
1380         * Configurations/FeatureDefines.xcconfig:
1381
1382 2017-03-10  Alex Christensen  <achristensen@webkit.org>
1383
1384         Add SPI to set NSURLSessionConfiguration.allowsCellularAccess from _WKProcessPoolConfiguration
1385         https://bugs.webkit.org/show_bug.cgi?id=169500
1386         <rdar://problem/29599569>
1387
1388         Reviewed by Joseph Pecoraro.
1389
1390         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1391         (WebKit::NetworkProcessCreationParameters::encode):
1392         (WebKit::NetworkProcessCreationParameters::decode):
1393         * NetworkProcess/NetworkProcessCreationParameters.h:
1394         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1395         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1396         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1397         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1398         (WebKit::globalAllowsCellularAccess):
1399         (WebKit::NetworkSessionCocoa::setAllowsCellularAccess):
1400         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1401         * UIProcess/API/APIProcessPoolConfiguration.h:
1402         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1403         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1404         (-[_WKProcessPoolConfiguration allowsCellularAccess]):
1405         (-[_WKProcessPoolConfiguration setAllowsCellularAccess:]):
1406
1407 2017-03-10  Alex Christensen  <achristensen@webkit.org>
1408
1409         Don't compile RemoteNetworkingContext when using NetworkSession
1410         https://bugs.webkit.org/show_bug.cgi?id=169497
1411
1412         Reviewed by Andy Estes.
1413
1414         RemoteNetworkingContext is only really used because PingHandle requires a NetworkingContext.
1415         When using NetworkSession, we use PingLoad instead of PingHandle, so there's no reason to 
1416         ensure there's a RemoteNetworkingContext corresponding to new private sessions when they're never used.
1417
1418         * NetworkProcess/NetworkProcess.cpp:
1419         (WebKit::NetworkProcess::initializeNetworkProcess):
1420         (WebKit::NetworkProcess::ensurePrivateBrowsingSession):
1421         * NetworkProcess/RemoteNetworkingContext.h:
1422         * NetworkProcess/mac/RemoteNetworkingContext.mm:
1423         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
1424         * NetworkProcess/soup/RemoteNetworkingContextSoup.cpp: Removed.
1425         * PlatformGTK.cmake:
1426         GTK only uses NetworkSession, so RemoteNetworkingContextSoup is no longer necessary.
1427
1428 2017-03-10  Brent Fulgham  <bfulgham@apple.com>
1429
1430         [WebRTC][WK2][iOS] Support com.apple.coremedia.compressionsession for more WebRTC Cases
1431         https://bugs.webkit.org/show_bug.cgi?id=169480
1432         <rdar://problem/30978577>
1433
1434         Reviewed by Youenn Fablet.
1435
1436         Always allow 'com.apple.coremedia.compressionsession' since it is also needed when sending
1437         canvas data across a peer connection.
1438
1439         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1440
1441 2017-03-10  Andy Estes  <aestes@apple.com>
1442
1443         [QuickLook] Add WKNavigationDelegate SPI to notify when a password is requested
1444         https://bugs.webkit.org/show_bug.cgi?id=169459
1445         <rdar://problem/30621913>
1446
1447         Reviewed by Alex Christensen.
1448
1449         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1450         * UIProcess/Cocoa/NavigationState.h:
1451         * UIProcess/Cocoa/NavigationState.mm:
1452         (WebKit::NavigationState::setNavigationDelegate):
1453         (WebKit::NavigationState::didRequestPasswordForQuickLookDocument):
1454         * UIProcess/ios/PageClientImplIOS.mm:
1455         (WebKit::PageClientImpl::requestPasswordForQuickLookDocument):
1456
1457 2017-03-09  Simon Fraser  <simon.fraser@apple.com>
1458
1459         [iOS WK2] Layer content blurry with nested perspective and transforms
1460         https://bugs.webkit.org/show_bug.cgi?id=169457
1461         rdar://problem/29879484
1462
1463         Reviewed by Tim Horton.
1464         
1465         We set rasterizationScale on CALayers to the same values as contentsScale, to
1466         avoid blurry layers when CA rasterizes, which often happens with nested perspective
1467         transforms.
1468         
1469         However, in UI-side compositing, if the page is not zoomed, we never applied the
1470         rasterizationScale in the UI process. This happened because the PlatformCALayerRemote
1471         constructor set m_properties.contentsScale, but did not set the dirty bit that
1472         triggers the application of contentsScale and rasterizationScale in RemoteLayerTreePropertyApplier.
1473         The fix is to set this dirty bit.
1474         
1475         The rest of the changes are for testing. Internals now exposes layerIDForElement()
1476         for returns an internal (non-stable-across-loads) layerID, which can be passed
1477         to UIScriptController.propertiesOfLayerWithID() in the UI process, which inspects
1478         the built layer (UIView) hierarchy. propertiesOfLayerWithID() returns a dictionary
1479         which the test can dump as JSON, or pull values out of.
1480         
1481         A few #pragma once cleanups also.
1482
1483         * UIProcess/API/Cocoa/WKWebView.mm:
1484         (-[WKWebView _propertiesOfLayerWithID:]):
1485         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1486         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
1487         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
1488         (WebKit::RemoteLayerTreeDrawingAreaProxy::layerWithIDForTesting):
1489         * UIProcess/mac/RemoteLayerTreeHost.h:
1490         * UIProcess/mac/RemoteLayerTreeHost.mm:
1491         (WebKit::RemoteLayerTreeHost::layerWithIDForTesting):
1492         * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
1493         (WebKit::PlatformCALayerRemote::PlatformCALayerRemote):
1494
1495 2017-03-10  Commit Queue  <commit-queue@webkit.org>
1496
1497         Unreviewed, rolling out r213618.
1498         https://bugs.webkit.org/show_bug.cgi?id=169475
1499
1500         Suspect this is the cause of a large memory regression
1501         (Requested by jonlee_ on #webkit).
1502
1503         Reverted changeset:
1504
1505         "Enable async image decoding for large images"
1506         https://bugs.webkit.org/show_bug.cgi?id=165039
1507         http://trac.webkit.org/changeset/213618
1508
1509 2017-03-10  Zan Dobersek  <zdobersek@igalia.com>
1510
1511         [WK2] Guard GLib-specific typedefs in InjectedBundle.h with USE(GLIB)
1512         https://bugs.webkit.org/show_bug.cgi?id=169464
1513
1514         Reviewed by Carlos Garcia Campos.
1515
1516         * WebProcess/InjectedBundle/InjectedBundle.h: Use the more appropriate
1517         USE(GLIB) guard for the two typedefs revolving around GModule, instead
1518         of the PLATFORM(GTK) guard.
1519
1520 2017-03-09  Tomas Popela  <tpopela@redhat.com>
1521
1522         Unreviewed, fix documentation typos
1523
1524         * UIProcess/API/gtk/WebKitAuthenticationRequest.cpp:
1525         * UIProcess/API/gtk/WebKitContextMenuActions.h:
1526         * UIProcess/API/gtk/WebKitContextMenuItem.cpp:
1527         * UIProcess/API/gtk/WebKitDownload.cpp:
1528         (webkitDownloadNotifyProgress):
1529         * UIProcess/API/gtk/WebKitEditorState.cpp:
1530         * UIProcess/API/gtk/WebKitEditorState.h:
1531         * UIProcess/API/gtk/WebKitError.h:
1532         * UIProcess/API/gtk/WebKitFileChooserRequest.cpp:
1533         * UIProcess/API/gtk/WebKitFindController.cpp:
1534         * UIProcess/API/gtk/WebKitGeolocationPermissionRequest.cpp:
1535         * UIProcess/API/gtk/WebKitHitTestResult.cpp:
1536         * UIProcess/API/gtk/WebKitPolicyDecision.cpp:
1537         * UIProcess/API/gtk/WebKitPrintOperation.h:
1538         * UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp:
1539         * UIProcess/API/gtk/WebKitSecurityManager.cpp:
1540         * UIProcess/API/gtk/WebKitSettings.cpp:
1541         (webkit_settings_class_init):
1542         * UIProcess/API/gtk/WebKitUserMediaPermissionRequest.cpp:
1543         (webkitUserMediaPermissionRequestAllow):
1544         * UIProcess/API/gtk/WebKitWebContext.cpp:
1545         * UIProcess/API/gtk/WebKitWebInspector.cpp:
1546         (webkit_web_inspector_class_init):
1547         * UIProcess/API/gtk/WebKitWebView.cpp:
1548         (webkit_web_view_class_init):
1549         * UIProcess/API/gtk/WebKitWebView.h:
1550         * UIProcess/API/gtk/WebKitWebsiteDataManager.cpp:
1551         * WebProcess/InjectedBundle/API/gtk/WebKitFrame.cpp:
1552         * WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:
1553         * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:
1554         (webkit_web_page_class_init):
1555
1556 2017-03-09  Alex Christensen  <achristensen@webkit.org>
1557
1558         Fix CMake build
1559
1560         * PlatformMac.cmake:
1561
1562 2017-03-09  Alex Christensen  <achristensen@webkit.org>
1563
1564         Fix GTK build after r213696
1565
1566         * CMakeLists.txt:
1567         * PlatformMac.cmake:
1568
1569 2017-03-09  Brian Nicholson  <bnicholson@mozilla.com> and Alex Christensen  <achristensen@webkit.org>
1570
1571         Expose public APIs for content filters
1572         https://bugs.webkit.org/show_bug.cgi?id=150479
1573
1574         Reviewed by Brady Eidson and Geoff Garen.
1575
1576         This takes _WKUserContentExtensionStore and _WKUserContentFilter and turns them into the consistently-named public API
1577         WKContentExtensionStore and WKContentExtension respectively with the same design and functionaly of the original SPI.
1578         We also added public functions to WKUserContentController corresponding to existing private functions.
1579
1580         The old SPI ObjC classes are now just wrappers around the new ObjC classes, which are wrappers around C++ objects in the API namespace.
1581         
1582         The peak-memory-reducing optimization of having NS_RELEASES_ARGUMENT in _compileContentExtensionForIdentifier is kept for Safari,
1583         but the public API doesn't need such an optimization.  The public compileContentExtensionForIdentifier will not deallocate the input
1584         NSString during compiling.
1585         
1586         We moved the error codes into the WKErrorDomain, which requires changing the values of the error codes and domain, but source
1587         compiled that uses the SPI before and after should still work.  Using new applications with old frameworks or vice versa will
1588         have unexpected error codes, though.
1589
1590         * Shared/API/APIObject.h:
1591         * Shared/API/c/WKDeprecatedFunctions.cpp:
1592         (WKPageGroupAddUserContentFilter):
1593         (WKPageGroupRemoveUserContentFilter):
1594         * Shared/Cocoa/APIObject.mm:
1595         (API::Object::newObject):
1596         * UIProcess/API/APIContentExtension.cpp: Copied from UIProcess/API/APIUserContentExtension.cpp.
1597         (API::ContentExtension::ContentExtension):
1598         (API::ContentExtension::~ContentExtension):
1599         (API::UserContentExtension::UserContentExtension): Deleted.
1600         (API::UserContentExtension::~UserContentExtension): Deleted.
1601         * UIProcess/API/APIContentExtension.h: Copied from UIProcess/API/APIUserContentExtension.h.
1602         * UIProcess/API/APIContentExtensionStore.cpp: Copied from UIProcess/API/APIUserContentExtensionStore.cpp.
1603         (API::ContentExtensionStore::defaultStore):
1604         (API::ContentExtensionStore::storeWithPath):
1605         (API::ContentExtensionStore::ContentExtensionStore):
1606         (API::ContentExtensionStore::~ContentExtensionStore):
1607         (API::compiledToFile):
1608         (API::createExtension):
1609         (API::ContentExtensionStore::lookupContentExtension):
1610         (API::ContentExtensionStore::compileContentExtension):
1611         (API::ContentExtensionStore::removeContentExtension):
1612         (API::ContentExtensionStore::synchronousRemoveAllContentExtensions):
1613         (API::ContentExtensionStore::invalidateContentExtensionVersion):
1614         (API::contentExtensionStoreErrorCategory):
1615         (API::UserContentExtensionStore::defaultStore): Deleted.
1616         (API::UserContentExtensionStore::storeWithPath): Deleted.
1617         (API::UserContentExtensionStore::UserContentExtensionStore): Deleted.
1618         (API::UserContentExtensionStore::~UserContentExtensionStore): Deleted.
1619         (API::UserContentExtensionStore::lookupContentExtension): Deleted.
1620         (API::UserContentExtensionStore::compileContentExtension): Deleted.
1621         (API::UserContentExtensionStore::removeContentExtension): Deleted.
1622         (API::UserContentExtensionStore::synchronousRemoveAllContentExtensions): Deleted.
1623         (API::UserContentExtensionStore::invalidateContentExtensionVersion): Deleted.
1624         (API::userContentExtensionStoreErrorCategory): Deleted.
1625         * UIProcess/API/APIContentExtensionStore.h: Copied from UIProcess/API/APIUserContentExtensionStore.h.
1626         (API::make_error_code):
1627         * UIProcess/API/APIUserContentExtension.cpp: Removed.
1628         * UIProcess/API/APIUserContentExtension.h: Removed.
1629         * UIProcess/API/APIUserContentExtensionStore.cpp: Removed.
1630         * UIProcess/API/APIUserContentExtensionStore.h: Removed.
1631         * UIProcess/API/C/WKAPICast.h:
1632         * UIProcess/API/C/WKPageGroup.cpp:
1633         * UIProcess/API/C/WKUserContentControllerRef.cpp:
1634         (WKUserContentControllerAddUserContentFilter):
1635         (WKUserContentControllerRemoveAllUserContentFilters):
1636         * UIProcess/API/C/WKUserContentExtensionStoreRef.cpp:
1637         (WKUserContentExtensionStoreGetTypeID):
1638         * UIProcess/API/Cocoa/APIUserContentExtensionStoreCocoa.mm:
1639         (API::ContentExtensionStore::defaultStorePath):
1640         (API::UserContentExtensionStore::defaultStorePath): Deleted.
1641         * UIProcess/API/Cocoa/WKContentExtension.h: Copied from UIProcess/API/Cocoa/_WKUserContentFilter.h.
1642         * UIProcess/API/Cocoa/WKContentExtension.mm: Copied from UIProcess/API/Cocoa/_WKUserContentFilter.mm.
1643         (-[WKContentExtension dealloc]):
1644         (-[WKContentExtension _apiObject]):
1645         (-[_WKUserContentFilter dealloc]): Deleted.
1646         (-[_WKUserContentFilter _apiObject]): Deleted.
1647         * UIProcess/API/Cocoa/WKContentExtensionInternal.h: Copied from UIProcess/API/Cocoa/_WKUserContentFilterInternal.h.
1648         (WebKit::wrapper):
1649         * UIProcess/API/Cocoa/WKContentExtensionStore.h: Copied from UIProcess/API/Cocoa/_WKUserContentExtensionStore.h.
1650         * UIProcess/API/Cocoa/WKContentExtensionStore.mm: Copied from UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm.
1651         (-[WKContentExtensionStore dealloc]):
1652         (+[WKContentExtensionStore defaultStore]):
1653         (+[WKContentExtensionStore storeWithURL:]):
1654         (-[WKContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
1655         (-[WKContentExtensionStore _compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:releasesArgument:]):
1656         (-[WKContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]):
1657         (-[WKContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
1658         (-[WKContentExtensionStore _apiObject]):
1659         (-[WKContentExtensionStore _removeAllContentExtensions]):
1660         (-[WKContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]):
1661         (-[WKContentExtensionStore _compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
1662         (-[_WKUserContentExtensionStore dealloc]): Deleted.
1663         (+[_WKUserContentExtensionStore defaultStore]): Deleted.
1664         (+[_WKUserContentExtensionStore storeWithURL:]): Deleted.
1665         (-[_WKUserContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]): Deleted.
1666         (-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]): Deleted.
1667         (-[_WKUserContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]): Deleted.
1668         (-[_WKUserContentExtensionStore _apiObject]): Deleted.
1669         (-[_WKUserContentExtensionStore _removeAllContentExtensions]): Deleted.
1670         (-[_WKUserContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]): Deleted.
1671         * UIProcess/API/Cocoa/WKContentExtensionStoreInternal.h: Copied from UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h.
1672         (WebKit::wrapper):
1673         * UIProcess/API/Cocoa/WKContentExtensionStorePrivate.h: Copied from UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h.
1674         * UIProcess/API/Cocoa/WKError.h:
1675         * UIProcess/API/Cocoa/WKError.mm:
1676         (localizedDescriptionForErrorCode):
1677         * UIProcess/API/Cocoa/WKUserContentController.h:
1678         * UIProcess/API/Cocoa/WKUserContentController.mm:
1679         (-[WKUserContentController addContentExtension:]):
1680         (-[WKUserContentController removeContentExtension:]):
1681         (-[WKUserContentController removeAllContentExtensions]):
1682         (-[WKUserContentController _addUserContentFilter:]):
1683         (-[WKUserContentController _removeUserContentFilter:]):
1684         (-[WKUserContentController _removeAllUserContentFilters]):
1685         * UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:
1686         * UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm:
1687         (+[_WKUserContentExtensionStore defaultStore]):
1688         (+[_WKUserContentExtensionStore storeWithURL:]):
1689         (-[_WKUserContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
1690         (-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]):
1691         (-[_WKUserContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
1692         (-[_WKUserContentExtensionStore _apiObject]):
1693         (-[_WKUserContentExtensionStore _removeAllContentExtensions]):
1694         (-[_WKUserContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]):
1695         (-[_WKUserContentExtensionStore _initWithWKContentExtensionStore:]):
1696         (-[_WKUserContentExtensionStore dealloc]): Deleted.
1697         * UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h:
1698         (WebKit::wrapper): Deleted.
1699         * UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h:
1700         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
1701         (-[_WKUserContentFilter _apiObject]):
1702         (-[_WKUserContentFilter _initWithWKContentExtension:]):
1703         (-[_WKUserContentFilter dealloc]): Deleted.
1704         * UIProcess/API/Cocoa/_WKUserContentFilterInternal.h:
1705         (WebKit::wrapper): Deleted.
1706         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h: Added.
1707         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
1708         (WebKit::WebUserContentControllerProxy::addProcess):
1709         (WebKit::WebUserContentControllerProxy::addContentExtension):
1710         (WebKit::WebUserContentControllerProxy::removeContentExtension):
1711         (WebKit::WebUserContentControllerProxy::removeAllContentExtensions):
1712         (WebKit::WebUserContentControllerProxy::addUserContentExtension): Deleted.
1713         (WebKit::WebUserContentControllerProxy::removeUserContentExtension): Deleted.
1714         (WebKit::WebUserContentControllerProxy::removeAllUserContentExtensions): Deleted.
1715         * UIProcess/UserContent/WebUserContentControllerProxy.h:
1716         * UIProcess/WebPageGroup.cpp:
1717         * WebKit2.xcodeproj/project.pbxproj:
1718         * WebProcess/UserContent/WebUserContentController.cpp:
1719         (WebKit::WebUserContentController::addContentExtensions):
1720         (WebKit::WebUserContentController::removeContentExtension):
1721         (WebKit::WebUserContentController::removeAllContentExtensions):
1722         (WebKit::WebUserContentController::addUserContentExtensions): Deleted.
1723         (WebKit::WebUserContentController::removeUserContentExtension): Deleted.
1724         (WebKit::WebUserContentController::removeAllUserContentExtensions): Deleted.
1725         * WebProcess/UserContent/WebUserContentController.h:
1726         * WebProcess/UserContent/WebUserContentController.messages.in:
1727         * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm:
1728         (WebKit::blockedByContentFilterError):
1729
1730 2017-03-09  Brady Eidson  <beidson@apple.com>
1731
1732         Fix some debug builds after r213686
1733
1734         Unreviewed.
1735
1736         * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm:
1737         (WebKit::WebURLSchemeHandlerCocoa::WebURLSchemeHandlerCocoa): Remove the 32-bit NOT_REACHED protection for now.
1738
1739 2017-03-09  Keith Miller  <keith_miller@apple.com>
1740
1741         WebAssembly: Enable fast memory for WK2
1742         https://bugs.webkit.org/show_bug.cgi?id=169437
1743
1744         Reviewed by Tim Horton.
1745
1746         I forgot to do this when I enabled implemented fast memory
1747         for wasm.
1748
1749         * WebProcess/WebProcess.cpp:
1750         (WebKit::WebProcess::initializeWebProcess):
1751
1752 2017-03-09  Michael Saboff  <msaboff@apple.com>
1753
1754         Add plumbing to WebProcess to enable JavaScriptCore configuration and logging
1755         https://bugs.webkit.org/show_bug.cgi?id=169387
1756
1757         Reviewed by Filip Pizlo.
1758
1759         Added a path and sandbox extension for JavaScript configuration directory.
1760         These are sent to the Web process on startup along with other parameters.
1761         When JavaScript configuration file processing is enabled, the WebProcess
1762         will look for the file WebContent.config in that directory and configure
1763         JavaScriptCore with its contents.
1764
1765         The directory location is for Mac is ~/Library/WebKit/JavaScriptConfig and
1766         the location on iOS is <process-container-path>/Library/WebKit/JavaScriptConfig.
1767         JavaScript configuration file processing is controlled via a boolean kept in
1768         the WebProcess pool.  For Debug builds, config file processing is enabled.
1769         For Release builds it is disabled.
1770
1771         * Shared/WebProcessCreationParameters.cpp:
1772         (WebKit::WebProcessCreationParameters::encode):
1773         (WebKit::WebProcessCreationParameters::decode):
1774         * Shared/WebProcessCreationParameters.h:
1775         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1776         (API::ProcessPoolConfiguration::createWithLegacyOptions):
1777         (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
1778         (API::ProcessPoolConfiguration::copy):
1779         * UIProcess/API/APIProcessPoolConfiguration.h:
1780         * UIProcess/API/C/WKContext.cpp:
1781         (WKContextJavaScriptConfigurationFileEnabled):
1782         (WKContextSetJavaScriptConfigurationFileEnabled):
1783         * UIProcess/API/C/WKContext.h:
1784         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1785         (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory):
1786         * UIProcess/gtk/WebProcessPoolGtk.cpp:
1787         (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory):
1788         * UIProcess/WebProcessPool.cpp:
1789         (WebKit::legacyWebsiteDataStoreConfiguration):
1790         (WebKit::WebProcessPool::createNewWebProcess):
1791         (WebKit::WebProcessPool::setJavaScriptConfigurationFileEnabled):
1792         * UIProcess/WebProcessPool.h:
1793         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1794         (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
1795         * UIProcess/WebsiteData/WebsiteDataStore.h:
1796         (WebKit::WebsiteDataStore::resolvedJavaScriptConfigurationDirectory):
1797         * WebProcess/cocoa/WebProcessCocoa.mm:
1798         (WebKit::WebProcess::platformInitializeWebProcess):
1799
1800 2017-03-09  John Wilander  <wilander@apple.com>
1801
1802         Resource Load Statistics: Remove statistics data as part of full website data removal
1803         https://bugs.webkit.org/show_bug.cgi?id=169448
1804
1805         Reviewed by Alex Christensen.
1806
1807         * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
1808         (WKResourceLoadStatisticsManagerClearInMemoryAndPersistentStore):
1809             Infrastructure for test.
1810         * UIProcess/API/C/WKResourceLoadStatisticsManager.h:
1811         * UIProcess/WebResourceLoadStatisticsManager.cpp:
1812         (WebKit::WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStore):
1813             Infrastructure for test.
1814         * UIProcess/WebResourceLoadStatisticsManager.h:
1815         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1816         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
1817             Change due to the break-out of
1818             WebResourceLoadStatisticsStore::writeStoreToDisk().
1819         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
1820             Now sets m_writePersistentStoreHandler in
1821             WebCore::ResourceLoadStatisticsStore.
1822         (WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk):
1823             Separated out this function to make it available for the function set as
1824             m_writePersistentStoreHandler in WebCore::ResourceLoadStatisticsStore.
1825         * UIProcess/WebResourceLoadStatisticsStore.h:
1826         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1827         (WebKit::WebsiteDataStore::removeData):
1828             Both WebsiteDataStore::removeData() functions now cover resource load
1829             statistics.
1830
1831 2017-03-09  Brady Eidson  <beidson@apple.com>
1832
1833         Add WKURLSchemeHandler API for handling custom protocols.
1834         https://bugs.webkit.org/show_bug.cgi?id=169422
1835
1836         Reviewed by Tim Horton.
1837
1838         This introduces two new protocols to the WK2 API surface:
1839         - WKURLSchemeHandler
1840         - WKURLSchemeHandlerTask
1841         
1842         By registering an object that conforms to the WKURLSchemeHandler protocol with a WKWebViewConfiguration an application will
1843         be handed an object conforming to WKURLSchemeHandlerTask for each resource load in that WKWebView with a custom URL scheme.
1844         
1845         Using that id <WKURLSchemeHandlerTask>, the application can communicate the data for the resource back to WebKit.
1846         
1847         * Shared/API/APIObject.h:
1848         * Shared/Cocoa/APIObject.mm:
1849         (API::Object::newObject):
1850
1851         * Shared/WebPageCreationParameters.cpp:
1852         (WebKit::WebPageCreationParameters::encode):
1853         (WebKit::WebPageCreationParameters::decode):
1854         * Shared/WebPageCreationParameters.h:
1855
1856         * UIProcess/API/APIURLSchemeHandlerTask.cpp: 
1857         (API::URLSchemeHandlerTask::create):
1858         (API::URLSchemeHandlerTask::URLSchemeHandlerTask):
1859         * UIProcess/API/APIURLSchemeHandlerTask.h: 
1860
1861         Add the WKURLSchemeHandler @protocol:
1862         * UIProcess/API/Cocoa/WKURLSchemeHandler.h: Added.
1863
1864         Add the WKURLSchemeHandlerTask @protocol, as well as WebKit's concrete implementation of it:
1865         * UIProcess/API/Cocoa/WKURLSchemeHandlerTask.h: Added.
1866         * UIProcess/API/Cocoa/WKURLSchemeHandlerTask.mm: Added.
1867         (raiseExceptionIfNecessary):
1868         (-[WKURLSchemeHandlerTaskImpl request]):
1869         (-[WKURLSchemeHandlerTaskImpl didReceiveResponse:]):
1870         (-[WKURLSchemeHandlerTaskImpl didReceiveData:]):
1871         (-[WKURLSchemeHandlerTaskImpl didFinish]):
1872         (-[WKURLSchemeHandlerTaskImpl didFailWithError:]):
1873         (-[WKURLSchemeHandlerTaskImpl _apiObject]):
1874         * UIProcess/API/Cocoa/WKURLSchemeHandlerTaskInternal.h: 
1875         (WebKit::wrapper):
1876
1877         * UIProcess/API/Cocoa/WKWebView.h:
1878         * UIProcess/API/Cocoa/WKWebView.mm:
1879         (-[WKWebView _initializeWithConfiguration:]):
1880         (-[WKWebView urlSchemeHandlerForURLScheme:]):
1881         (+[WKWebView handlesURLScheme:]):
1882
1883         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
1884         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1885         (-[WKWebViewConfiguration copyWithZone:]):
1886         (-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]):
1887         (-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]):
1888         (-[WKWebViewConfiguration _urlSchemeHandlers]):
1889         * UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h:
1890
1891         * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.h: 
1892         (WebKit::WebURLSchemeHandlerCocoa::apiHandler):
1893         * UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm: Added.
1894         (WebKit::WebURLSchemeHandlerCocoa::create):
1895         (WebKit::WebURLSchemeHandlerCocoa::WebURLSchemeHandlerCocoa):
1896         (WebKit::WebURLSchemeHandlerCocoa::platformStartTask):
1897         (WebKit::WebURLSchemeHandlerCocoa::platformStopTask):
1898
1899         * UIProcess/WebPageProxy.cpp:
1900         (WebKit::WebPageProxy::creationParameters):
1901         (WebKit::WebPageProxy::setURLSchemeHandlerForScheme):
1902         (WebKit::WebPageProxy::urlSchemeHandlerForScheme):
1903         (WebKit::WebPageProxy::startURLSchemeHandlerTask):
1904         (WebKit::WebPageProxy::stopURLSchemeHandlerTask):
1905         * UIProcess/WebPageProxy.h:
1906         * UIProcess/WebPageProxy.messages.in:
1907
1908         * UIProcess/WebURLSchemeHandler.cpp: 
1909         (WebKit::generateWebURLSchemeHandlerIdentifier):
1910         (WebKit::WebURLSchemeHandler::WebURLSchemeHandler):
1911         (WebKit::WebURLSchemeHandler::~WebURLSchemeHandler):
1912         (WebKit::WebURLSchemeHandler::startTask):
1913         (WebKit::WebURLSchemeHandler::stopTask):
1914         * UIProcess/WebURLSchemeHandler.h: 
1915         (WebKit::WebURLSchemeHandler::identifier):
1916
1917         * UIProcess/WebURLSchemeHandlerTask.cpp: Added.
1918         (WebKit::WebURLSchemeHandlerTask::create):
1919         (WebKit::WebURLSchemeHandlerTask::WebURLSchemeHandlerTask):
1920         (WebKit::WebURLSchemeHandlerTask::didReceiveResponse):
1921         (WebKit::WebURLSchemeHandlerTask::didReceiveData):
1922         (WebKit::WebURLSchemeHandlerTask::didComplete):
1923         (WebKit::WebURLSchemeHandlerTask::pageDestroyed):
1924         (WebKit::WebURLSchemeHandlerTask::stop):
1925         * UIProcess/WebURLSchemeHandlerTask.h: Added.
1926         (WebKit::WebURLSchemeHandlerTask::identifier):
1927         (WebKit::WebURLSchemeHandlerTask::request):
1928
1929         * WebProcess/Network/WebLoaderStrategy.cpp:
1930         (WebKit::WebLoaderStrategy::scheduleLoad):
1931         (WebKit::WebLoaderStrategy::remove):
1932         * WebProcess/Network/WebLoaderStrategy.h:
1933
1934         * WebProcess/WebPage/WebPage.cpp:
1935         (WebKit::WebPage::urlSchemeHandlerForScheme):
1936         (WebKit::WebPage::registerURLSchemeHandler):
1937         (WebKit::WebPage::urlSchemeHandlerTaskDidReceiveResponse):
1938         (WebKit::WebPage::urlSchemeHandlerTaskDidReceiveData):
1939         (WebKit::WebPage::urlSchemeHandlerTaskDidComplete):
1940         * WebProcess/WebPage/WebPage.h:
1941         * WebProcess/WebPage/WebPage.messages.in:
1942
1943         * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp: Added.
1944         (WebKit::WebURLSchemeHandlerProxy::WebURLSchemeHandlerProxy):
1945         (WebKit::WebURLSchemeHandlerProxy::~WebURLSchemeHandlerProxy):
1946         (WebKit::WebURLSchemeHandlerProxy::startNewTask):
1947         (WebKit::WebURLSchemeHandlerProxy::taskDidReceiveResponse):
1948         (WebKit::WebURLSchemeHandlerProxy::taskDidReceiveData):
1949         (WebKit::WebURLSchemeHandlerProxy::taskDidComplete):
1950         * WebProcess/WebPage/WebURLSchemeHandlerProxy.h:
1951         (WebKit::WebURLSchemeHandlerProxy::identifier):
1952         (WebKit::WebURLSchemeHandlerProxy::page):
1953
1954         * WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.cpp: Added.
1955         (WebKit::WebURLSchemeHandlerTaskProxy::WebURLSchemeHandlerTaskProxy):
1956         (WebKit::WebURLSchemeHandlerTaskProxy::startLoading):
1957         (WebKit::WebURLSchemeHandlerTaskProxy::stopLoading):
1958         (WebKit::WebURLSchemeHandlerTaskProxy::didReceiveResponse):
1959         (WebKit::WebURLSchemeHandlerTaskProxy::didReceiveData):
1960         (WebKit::WebURLSchemeHandlerTaskProxy::didComplete):
1961         * WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.h:
1962         (WebKit::WebURLSchemeHandlerTaskProxy::request):
1963
1964         * WebKit2.xcodeproj/project.pbxproj:
1965         * CMakeLists.txt:
1966
1967 2017-03-09  Joseph Pecoraro  <pecoraro@apple.com>
1968
1969         Unreviewed follow-up to r213682.
1970
1971         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1972         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
1973         Forward declare SPIs to address possible build errors.
1974
1975 2017-03-09  Andrew Gold  <agold@apple.com>
1976
1977         WKWebView should provide a way for clients to know the specific media state.
1978         https://bugs.webkit.org/show_bug.cgi?id=169140
1979         <rdar://problem/30838285>
1980
1981         Reviewed by Alex Christensen.
1982
1983         Instead of notifying the UIDelegate only when a capture begins and ends, 
1984         we now notify the UIDelegate of any change in capture state.
1985
1986         * UIProcess/API/APIUIClient.h:
1987
1988         (API::UIClient::mediaCaptureStateDidChange):
1989         (API::UIClient::didBeginCaptureSession): Deleted.
1990         (API::UIClient::didEndCaptureSession): Deleted.
1991
1992         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1993
1994         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1995
1996         * UIProcess/Cocoa/UIDelegate.h:
1997         * UIProcess/Cocoa/UIDelegate.mm:
1998         (WebKit::UIDelegate::setDelegate):
1999         (WebKit::UIDelegate::UIClient::mediaCaptureStateDidChange):
2000         (WebKit::UIDelegate::UIClient::didBeginCaptureSession): Deleted.
2001         (WebKit::UIDelegate::UIClient::didEndCaptureSession): Deleted.
2002
2003         * UIProcess/WebPageProxy.cpp:
2004         (WebKit::WebPageProxy::isPlayingMediaDidChange):
2005
2006 2017-03-09  Joseph Pecoraro  <pecoraro@apple.com>
2007
2008         Web Inspector: Show HTTP protocol version and other Network Load Metrics (IP Address, Priority, Connection ID)
2009         https://bugs.webkit.org/show_bug.cgi?id=29687
2010         <rdar://problem/19281586>
2011
2012         Reviewed by Matt Baker and Brian Burg.
2013
2014         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2015         (toNetworkLoadPriority):
2016         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
2017         * Shared/WebCoreArgumentCoders.h:
2018         Additional optional metrics on NetworkLoadMetrics.
2019
2020 2017-03-09  Daniel Bates  <dabates@apple.com>
2021
2022         Guard Credential Management implementation behind a runtime enabled feature flag
2023         https://bugs.webkit.org/show_bug.cgi?id=169364
2024         <rdar://problem/30957425>
2025
2026         Reviewed by Brent Fulgham.
2027
2028         Add WebKit2 preference for Credential Management (disabled by default).
2029
2030         * Shared/WebPreferencesDefinitions.h:
2031         * UIProcess/API/C/WKPreferences.cpp:
2032         (WKPreferencesSetCredentialManagementEnabled): Added.
2033         (WKPreferencesGetCredentialManagementEnabled): Added.
2034         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2035         * WebProcess/WebPage/WebPage.cpp:
2036         (WebKit::WebPage::updatePreferences):
2037
2038 2017-03-09  Andy Estes  <aestes@apple.com>
2039
2040         [iOS] Add SPI to print to a single tall PDF page
2041         https://bugs.webkit.org/show_bug.cgi?id=169439
2042         <rdar://problem/30120532>
2043
2044         Reviewed by Tim Horton.
2045
2046         * Shared/PrintInfo.cpp:
2047         (WebKit::PrintInfo::encode): Encoded snapshotFirstPage.
2048         (WebKit::PrintInfo::decode): Decoded snapshotFirstPage.
2049         (WebKit::PrintInfo::PrintInfo): Deleted.
2050         * Shared/PrintInfo.h: Initialized member variables in place instead of in a default ctor.
2051         * UIProcess/_WKWebViewPrintFormatter.h: Declared BOOL property snapshotFirstPage.
2052         * UIProcess/_WKWebViewPrintFormatter.mm:
2053         (-[_WKWebViewPrintFormatter _setSnapshotPaperRect:]): Added to set a custom paper size.
2054         (-[_WKWebViewPrintFormatter rectForPageAtIndex:]): Returned the custom paper rect if
2055         snapshotFirstPage is true.
2056         * UIProcess/_WKWebViewPrintFormatterInternal.h: 
2057         * UIProcess/ios/WKContentView.mm:
2058         (-[WKContentView _wk_pageCountForPrintFormatter:]): Computed the custom paper size to be the
2059         smaller of the document height and the maximum PDF page height.
2060         * UIProcess/ios/WKPDFView.mm:
2061         (-[WKPDFView _wk_pageCountForPrintFormatter:]): Changed to return a maximum page size of 1
2062         if snapshotFirstPage is true.
2063         * WebProcess/WebPage/ios/WebPageIOS.mm:
2064         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF): Ditto.
2065
2066 2017-03-09  Anders Carlsson  <andersca@apple.com>
2067
2068         Add delegate support to WebCore
2069         https://bugs.webkit.org/show_bug.cgi?id=169427
2070         Part of rdar://problem/28880714.
2071
2072         Reviewed by Geoffrey Garen.
2073
2074         * Configurations/FeatureDefines.xcconfig:
2075         Add feature define.
2076
2077 2017-03-09  Alex Christensen  <achristensen@webkit.org>
2078
2079         [Content Extensions] Introduce if-top-url and unless-top-url
2080         https://bugs.webkit.org/show_bug.cgi?id=169433
2081
2082         Reviewed by Brady Eidson.
2083
2084         Rename conditionedFilters to topURLFilters to reflect the fact that they are the filters
2085         that are run on the top URL, and possibly just the domain of the top url.
2086         I was a bit too aggressive when renaming domain* to condition* in r213533.
2087
2088         * Shared/WebCompiledContentExtension.cpp:
2089         (WebKit::WebCompiledContentExtension::conditionsApplyOnlyToDomain):
2090         (WebKit::WebCompiledContentExtension::topURLFiltersBytecode):
2091         (WebKit::WebCompiledContentExtension::topURLFiltersBytecodeLength):
2092         (WebKit::WebCompiledContentExtension::conditionedFiltersBytecode): Deleted.
2093         (WebKit::WebCompiledContentExtension::conditionedFiltersBytecodeLength): Deleted.
2094         * Shared/WebCompiledContentExtension.h:
2095         * Shared/WebCompiledContentExtensionData.cpp:
2096         (WebKit::WebCompiledContentExtensionData::encode):
2097         (WebKit::WebCompiledContentExtensionData::decode):
2098         * Shared/WebCompiledContentExtensionData.h:
2099         (WebKit::WebCompiledContentExtensionData::WebCompiledContentExtensionData):
2100         * UIProcess/API/APIUserContentExtensionStore.cpp:
2101         (API::encodeContentExtensionMetaData):
2102         (API::decodeContentExtensionMetaData):
2103         (API::compiledToFile):
2104         (API::createExtension):
2105         (API::UserContentExtensionStore::invalidateContentExtensionVersion):
2106         (API::userContentExtensionStoreErrorCategory):
2107         * UIProcess/API/APIUserContentExtensionStore.h:
2108         Increment CurrentContentExtensionFileVersion because we have changed the format of the binary on disk.
2109         We only added 4 bytes, but that's binary incompatible and requires re-compiling any existing content extensions.
2110
2111 2017-03-09  Brent Fulgham  <bfulgham@apple.com>
2112
2113         [WK2][iOS] Extend WebProcess sandbox to support audio and video compression/decompression
2114         https://bugs.webkit.org/show_bug.cgi?id=169431
2115         <rdar://problem/30844650>
2116
2117         Reviewed by Youenn Fablet.
2118
2119         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2120
2121 2017-03-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2122
2123         [WK2] Add a UI delegate hook for custom handling of data interaction operations
2124         https://bugs.webkit.org/show_bug.cgi?id=169430
2125         <rdar://problem/30954654>
2126
2127         Reviewed by Tim Horton.
2128
2129         Introduce a new SPI method on the UI delegate for clients who need to override data interaction operation behaviors.
2130         Note that implementing this delegate method and returning YES will not propagate a `drop` event to the page.
2131
2132         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2133
2134 2017-03-08  Matt Rajca  <mrajca@apple.com>
2135
2136         Let clients control autoplay quirks with website policies.
2137         https://bugs.webkit.org/show_bug.cgi?id=169390
2138
2139         Reviewed by Wenson Hsieh.
2140         
2141         Many sites incorrectly assume media will start off playing and display a pause button from the
2142         start. We can trick many of these sites into updating their controls by sending a "pause"
2143         event when we prevent a media element from playing.
2144
2145         We don't want this to become standard web behavior, however, since ultimately sites should adapt
2146         to the new behavior. This patch lets clients decide which limited set of sites gets to use auto-play
2147         quirks.
2148
2149         * Shared/WebsitePolicies.h:
2150         (WebKit::WebsitePolicies::encode):
2151         (WebKit::WebsitePolicies::decode):
2152         * UIProcess/API/APIWebsitePolicies.h:
2153         * UIProcess/API/C/WKWebsitePolicies.cpp:
2154         (WKWebsitePoliciesSetAllowsAutoplayQuirks):
2155         (WKWebsitePoliciesGetAllowsAutoplayQuirks):
2156         * UIProcess/API/C/WKWebsitePolicies.h:
2157         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2158         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
2159         (-[_WKWebsitePolicies setAllowsAutoplayQuirks:]):
2160         (-[_WKWebsitePolicies allowsAutoplayQuirks]):
2161         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2162         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2163         * WebProcess/WebPage/WebPage.cpp:
2164         (WebKit::WebPage::updateWebsitePolicies):
2165
2166 2017-03-09  Chris Dumez  <cdumez@apple.com>
2167
2168         [WK2] Prevent app nap for the active tab
2169         https://bugs.webkit.org/show_bug.cgi?id=169417
2170         <rdar://problem/30876965>
2171
2172         Reviewed by Gavin Barraclough.
2173
2174         Prevent app nap for the active tab to minimize the risks of breakage.
2175
2176         From the AppNap documentation [1], the app is only a candidate for app nap if it not the
2177         foreground app. However, in the Safari case, the foreground app is Safari (UIProcess) and
2178         the same policy does not apply to our foreground WebContent process unless we explicitly
2179         make it so. This patch addresses the issue by taking a UserActivity when the tab is
2180         active to prevent app nap.
2181
2182         [1] https://developer.apple.com/library/content/documentation/Performance/Conceptual/power_efficiency_guidelines_osx/AppNap.html
2183
2184         * WebProcess/WebPage/WebPage.cpp:
2185         (WebKit::WebPage::updateThrottleState):
2186
2187 2017-03-08  Anders Carlsson  <andersca@apple.com>
2188
2189         Add new delegate methods
2190         https://bugs.webkit.org/show_bug.cgi?id=169394
2191         Part of rdar://problem/28880714.
2192
2193         Reviewed by Tim Horton.
2194
2195         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
2196         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2197         (-[WKPaymentAuthorizationViewControllerDelegate invalidate]):
2198         (toShippingMethod):
2199         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]):
2200         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]):
2201         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]):
2202         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]):
2203         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:completion:]):
2204         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:completion:]):
2205         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:completion:]):
2206         (WebKit::toPKPaymentAuthorizationStatus):
2207         (WebKit::toPKPaymentErrorCode):
2208         (WebKit::toNSError):
2209         (WebKit::toNSErrors):
2210         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession):
2211         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection):
2212         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection):
2213         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection):
2214
2215 2017-03-09  Tim Horton  <timothy_horton@apple.com>
2216
2217         WKWebView should automatically respect insets from the view controller hierarchy
2218         https://bugs.webkit.org/show_bug.cgi?id=169398
2219         <rdar://problem/30617593>
2220
2221         Reviewed by Dean Jackson.
2222
2223         * Platform/spi/ios/UIKitSPI.h:
2224         * UIProcess/API/Cocoa/WKWebView.mm:
2225         (-[WKWebView _initializeWithConfiguration:]):
2226         (-[WKWebView _computedContentInset]):
2227         (activeMinimumLayoutSize):
2228         (-[WKWebView _frameOrBoundsChanged]):
2229         Factor insets from above us in the view controller hierarchy into our
2230         content insets (and layout size) automatically.
2231
2232 2017-03-09  Tomas Popela  <tpopela@redhat.com>
2233
2234         Correctly process the return value of gdk_drag_context_get_selected_action()
2235
2236         Reviewed by Carlos Garcia Campos.
2237
2238         It returns the action itself and not the bitmask.
2239
2240         * UIProcess/gtk/DragAndDropHandler.cpp:
2241         (WebKit::DragAndDropHandler::drop):
2242
2243 2017-03-09  Adrian Perez de Castro  <aperez@igalia.com>
2244
2245         [GTK] Use GtkFileChooserNative for open/save dialogs
2246         https://bugs.webkit.org/show_bug.cgi?id=169278
2247
2248         Reviewed by Carlos Garcia Campos.
2249
2250         When building with GTK+ 3.20.0 or newer, use GtkFileChooserNative instead of GtkFileChooserDialog to allow for
2251         better integration with the runtime environment and use native open/save dialogs. This also makes WebKitGTK+ use
2252         portal-based load/save dialogs when running inside the Flatpak sandbox.
2253
2254         The existing GtkFileChooserDialog implementation will still be used when building against older versions of
2255         GTK+, so this change does not require a new version of the toolkit.
2256
2257         * UIProcess/API/gtk/WebKitWebView.cpp:
2258         (fileChooserDialogResponseCallback):
2259         (webkitWebViewRunFileChooser):
2260
2261 2017-03-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2262
2263         Add plumbing for WebCore to notify WebKit2 when an edit drag has concluded
2264         https://bugs.webkit.org/show_bug.cgi?id=169392
2265         <rdar://problem/30882974>
2266
2267         Reviewed by Tim Horton.
2268
2269         Add boilerplate plumbing for didConcludeEditDataInteraction from the web process to the UI process. Also makes
2270         some minor tweaks to WKContentView along the way.
2271
2272         * UIProcess/PageClient.h:
2273         * UIProcess/WebPageProxy.h:
2274         * UIProcess/WebPageProxy.messages.in:
2275         * UIProcess/ios/PageClientImplIOS.h:
2276         * UIProcess/ios/PageClientImplIOS.mm:
2277         (WebKit::PageClientImpl::didConcludeEditDataInteraction):
2278         * UIProcess/ios/WKContentViewInteraction.h:
2279         * UIProcess/ios/WKContentViewInteraction.mm:
2280
2281         Bail out of zooming to the focus rect when performing a data interaction operation. This needs to eventually
2282         work, but is not high priority at the moment.
2283
2284         (-[WKContentView becomeFirstResponderForWebView]):
2285         (-[WKContentView _displayFormNodeInputView]):
2286         (-[WKContentView useSelectionAssistantWithMode:]):
2287         (-[WKContentView _updateChangedSelection:]):
2288         (-[WKContentView suppressAssistantSelectionView]):
2289         (-[WKContentView setSuppressAssistantSelectionView:]):
2290
2291         Add a mechanism for suppressing the text interaction assistant's selection view. If the text interaction
2292         assistant exists while beginning or ending suppression, the selection will be deactivated or activated. If there
2293         is not text interaction assistant, then we instead remember whether or not we should be suppressing the
2294         selection, and bail out of activating the selection if so.
2295
2296         * UIProcess/ios/WebPageProxyIOS.mm:
2297         (WebKit::WebPageProxy::didConcludeEditDataInteraction):
2298         * WebProcess/WebCoreSupport/WebDragClient.h:
2299         * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
2300         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
2301         (WebKit::WebDragClient::didConcludeEditDrag):
2302         * WebProcess/WebPage/WebPage.h:
2303         * WebProcess/WebPage/ios/WebPageIOS.mm:
2304         (WebKit::WebPage::didConcludeEditDataInteraction):
2305
2306 2017-03-08  John Wilander  <wilander@apple.com>
2307
2308         Resource Load Statistics: Communicate to the network process which domains to partition
2309         https://bugs.webkit.org/show_bug.cgi?id=169322
2310         <rdar://problem/30768921>
2311
2312         Reviewed by Alex Christensen.
2313
2314         * NetworkProcess/NetworkProcess.cpp:
2315         (WebKit::NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
2316         * NetworkProcess/NetworkProcess.h:
2317         * NetworkProcess/NetworkProcess.messages.in:
2318         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2319         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2320             Now consults WebCore::NetworkStorageSession::shouldPartitionCookiesForHost()
2321             to decide whether partitioning should be applied or not.
2322         * UIProcess/API/C/WKCookieManager.cpp:
2323         (WKCookieManagerSetCookieStoragePartitioningEnabled):
2324             To allow TestRunner to configure cookie partitioning.
2325         * UIProcess/API/C/WKCookieManager.h:
2326         * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
2327         (WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandler):
2328             To allow TestRunner to set a domain for which
2329             partitioning should be applied.
2330         * UIProcess/API/C/WKResourceLoadStatisticsManager.h:
2331         * UIProcess/Network/NetworkProcessProxy.cpp:
2332         (WebKit::NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
2333         * UIProcess/Network/NetworkProcessProxy.h:
2334         * UIProcess/Network/NetworkProcessProxy.messages.in:
2335         * UIProcess/WebCookieManagerProxy.cpp:
2336         (WebKit::WebCookieManagerProxy::setCookieStoragePartitioningEnabled):
2337             To allow TestRunner to configure cookie partitioning.
2338         * UIProcess/WebCookieManagerProxy.h:
2339         * UIProcess/WebResourceLoadStatisticsManager.cpp:
2340         (WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
2341             To allow TestRunner to set a domain for which
2342             partitioning should be applied.
2343         * UIProcess/WebResourceLoadStatisticsManager.h:
2344         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2345         (WebKit::WebResourceLoadStatisticsStore::classifyResource):
2346             Now tells the network process as soon as a domain
2347             has been classified as prevalent.
2348         (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
2349             Overloaded function to allow injection of handlers for communication with the
2350             network process.
2351         * UIProcess/WebResourceLoadStatisticsStore.h:
2352         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2353         (WebKit::WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
2354         (WebKit::WebsiteDataStore::registerSharedResourceLoadObserver):
2355             Now sets two callback handlers for communication with the network process.
2356         * UIProcess/WebsiteData/WebsiteDataStore.h:
2357
2358 2017-03-08  Michael Catanzaro  <mcatanzaro@igalia.com>
2359
2360         Fix -Wattributes warning spam
2361         https://bugs.webkit.org/show_bug.cgi?id=169243
2362
2363         Reviewed by Alexey Proskuryakov.
2364
2365         * Shared/API/c/WKDeclarationSpecifiers.h: Add WK_UNAVAILABLE macro.
2366         * UIProcess/API/C/WKPageGroup.h: Use it.
2367
2368 2017-03-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
2369
2370         Enable async image decoding for large images
2371         https://bugs.webkit.org/show_bug.cgi?id=165039
2372
2373         Reviewed by Simon Fraser.
2374
2375         Add WK2 preferences for setting/getting LargeImageAsyncDecoding and
2376         AnimatedImageAsyncDecoding.
2377         
2378         * UIProcess/API/C/WKPreferences.cpp:
2379         (WKPreferencesSetLargeImageAsyncDecodingEnabled):
2380         (WKPreferencesGetLargeImageAsyncDecodingEnabled):
2381         (WKPreferencesSetAnimatedImageAsyncDecodingEnabled):
2382         (WKPreferencesGetAnimatedImageAsyncDecodingEnabled):
2383         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2384
2385 2017-03-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2386
2387         Add TextIndicator support for providing a snapshot excluding selected content
2388         https://bugs.webkit.org/show_bug.cgi?id=169309
2389         <rdar://problem/30883525>
2390
2391         Reviewed by Tim Horton.
2392
2393         Serialize the snapshot excluding the selection and the snapshot's bounds when sending TextIndicatorData over
2394         IPC to the UI process.
2395
2396         * Shared/WebCoreArgumentCoders.cpp:
2397         (IPC::ArgumentCoder<TextIndicatorData>::encode):
2398         (IPC::ArgumentCoder<TextIndicatorData>::decode):
2399
2400 2017-03-08  Brent Fulgham  <bfulgham@apple.com>
2401
2402         REGRESSION(r213564): Netflix does not play content
2403         https://bugs.webkit.org/show_bug.cgi?id=169391
2404         <rdar://problem/30930190>
2405
2406         Reviewed by Alex Christensen.
2407
2408         Add the missing IOKit properties identified during testing on Netflix.
2409
2410         * WebProcess/com.apple.WebProcess.sb.in:
2411
2412 2017-03-08  Anders Carlsson  <andersca@apple.com>
2413
2414         Clean up WebPaymentCoordinatorProxy
2415         https://bugs.webkit.org/show_bug.cgi?id=169393
2416         Part of rdar://problem/28880714.
2417
2418         Reviewed by Beth Dakin.
2419
2420         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2421         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]):
2422         Move this to where it belongs.
2423
2424         (WebKit::toPKPaymentSummaryItems):
2425         Add a new helper function.
2426
2427         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection):
2428         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection):
2429         Use the new helper function.
2430
2431 2017-03-08  Brent Fulgham  <bfulgham@apple.com>
2432
2433         [Mac][WK2] Whitelist a local cache needed by CFNetwork
2434         https://bugs.webkit.org/show_bug.cgi?id=169388
2435         <rdar://problem/30224000>
2436
2437         Reviewed by Alex Christensen.
2438
2439         Whitelist access to a local cache needed by CFNetwork.
2440
2441         * WebProcess/com.apple.WebProcess.sb.in:
2442
2443 2017-03-08  Anders Carlsson  <andersca@apple.com>
2444
2445         Simplify the PaymentCoordinator interface
2446         https://bugs.webkit.org/show_bug.cgi?id=169382
2447         Part of rdar://problem/28880714.
2448
2449         Reviewed by Tim Horton.
2450
2451         Send the new structs over the wire to the UI process and update the various proxy object to take them instead of
2452         multiple parameters.
2453
2454         * Scripts/webkit/messages.py:
2455         (headers_for_type):
2456         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
2457         (IPC::ArgumentCoder<WebCore::PaymentAuthorizationResult>::encode):
2458         (IPC::ArgumentCoder<WebCore::PaymentAuthorizationResult>::decode):
2459         (IPC::ArgumentCoder<WebCore::PaymentError>::encode):
2460         (IPC::ArgumentCoder<WebCore::PaymentError>::decode):
2461         (IPC::ArgumentCoder<WebCore::PaymentMethodUpdate>::encode):
2462         (IPC::ArgumentCoder<WebCore::PaymentMethodUpdate>::decode):
2463         (IPC::ArgumentCoder<WebCore::ShippingContactUpdate>::encode):
2464         (IPC::ArgumentCoder<WebCore::ShippingContactUpdate>::decode):
2465         (IPC::ArgumentCoder<WebCore::ShippingMethodUpdate>::encode):
2466         (IPC::ArgumentCoder<WebCore::ShippingMethodUpdate>::decode):
2467         * Shared/WebCoreArgumentCoders.h:
2468         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
2469         (WebKit::WebPaymentCoordinatorProxy::completeShippingMethodSelection):
2470         (WebKit::WebPaymentCoordinatorProxy::completeShippingContactSelection):
2471         (WebKit::WebPaymentCoordinatorProxy::completePaymentMethodSelection):
2472         (WebKit::WebPaymentCoordinatorProxy::completePaymentSession):
2473         (WebKit::isValidEnum): Deleted.
2474         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
2475         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
2476         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2477         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession):
2478         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection):
2479         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection):
2480         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection):
2481         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
2482         (WebKit::WebPaymentCoordinator::completeShippingMethodSelection):
2483         (WebKit::WebPaymentCoordinator::completeShippingContactSelection):
2484         (WebKit::WebPaymentCoordinator::completePaymentMethodSelection):
2485         (WebKit::WebPaymentCoordinator::completePaymentSession):
2486         * WebProcess/ApplePay/WebPaymentCoordinator.h:
2487
2488 2017-03-08  Brent Fulgham  <bfulgham@apple.com>
2489
2490         Remove the trace command from the sandbox profile.
2491
2492         * WebProcess/com.apple.WebProcess.sb.in: Unreviewed.
2493
2494 2017-03-08  Brent Fulgham  <bfulgham@apple.com>
2495
2496         REGRESSION(r212904): [WK2][Mac] Revise sandbox to support AES3
2497         https://bugs.webkit.org/show_bug.cgi?id=169361
2498         <rdar://problem/30927476>
2499
2500         Unreviewed sandbox revert. Avoid web compatibility issue by
2501         restoring access to AES3 Plugin path.
2502
2503         Tests: Existing media tests, on older Mac hardware.
2504
2505         * WebProcess/com.apple.WebProcess.sb.in:
2506
2507 2017-03-08  Simon Fraser  <simon.fraser@apple.com>
2508
2509         Add support for history.scrollRestoration
2510         https://bugs.webkit.org/show_bug.cgi?id=147782
2511         rdar://problem/22614568
2512
2513         Reviewed by Sam Weinig.
2514         
2515         Need to send shouldRestoreScrollPosition to the UI process in SessionState,
2516         WKWebView now stores _unobscuredCenterToRestore and _scrollOffsetToRestore as
2517         std::optionals, and they will be nullopt if scroll restoration should not happen.
2518
2519         ViewGestureControllerIOS also needs knowledge of whether scroll restoration will
2520         happen, and compares UI-process scroll position vs. the position at snapshot time
2521         to know if the snapshot should be shown (this prevents showing a misleading snapshot
2522         when swiping back on a navigation where scroll restoration is disabled).
2523
2524         * Shared/SessionState.cpp:
2525         (WebKit::FrameState::encode):
2526         (WebKit::FrameState::decode):
2527         * Shared/SessionState.h:
2528         * Shared/WebBackForwardListItem.h:
2529         (WebKit::WebBackForwardListItem::pageState):
2530         * UIProcess/API/Cocoa/WKWebView.mm:
2531         (-[WKWebView _processDidExit]):
2532         (-[WKWebView _didCommitLayerTree:]):
2533         (-[WKWebView _restorePageScrollPosition:scrollOrigin:previousObscuredInset:scale:]):
2534         (-[WKWebView _restorePageStateToUnobscuredCenter:scale:]):
2535         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2536         * UIProcess/API/gtk/PageClientImpl.cpp:
2537         (WebKit::PageClientImpl::viewScrollPosition):
2538         * UIProcess/API/gtk/PageClientImpl.h:
2539         * UIProcess/PageClient.h:
2540         * UIProcess/WebPageProxy.cpp:
2541         (WebKit::WebPageProxy::viewScrollPosition):
2542         * UIProcess/WebPageProxy.h:
2543         * UIProcess/WebPageProxy.messages.in:
2544         * UIProcess/ios/PageClientImplIOS.h:
2545         * UIProcess/ios/PageClientImplIOS.mm:
2546         (WebKit::PageClientImpl::viewScrollPosition):
2547         (WebKit::PageClientImpl::restorePageState):
2548         (WebKit::PageClientImpl::restorePageCenterAndScale):
2549         * UIProcess/ios/ViewGestureControllerIOS.mm:
2550         (WebKit::ViewGestureController::beginSwipeGesture):
2551         * UIProcess/ios/WebPageProxyIOS.mm:
2552         (WebKit::WebPageProxy::restorePageState):
2553         (WebKit::WebPageProxy::restorePageCenterAndScale):
2554         * UIProcess/mac/PageClientImpl.h:
2555         * UIProcess/mac/PageClientImpl.mm:
2556         (WebKit::PageClientImpl::viewScrollPosition):
2557         * UIProcess/mac/ViewSnapshotStore.h:
2558         (WebKit::ViewSnapshot::setViewScrollPosition):
2559         (WebKit::ViewSnapshot::viewScrollPosition):
2560         * UIProcess/mac/ViewSnapshotStore.mm:
2561         (WebKit::ViewSnapshotStore::recordSnapshot):
2562         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
2563         (WebKit::toFrameState):
2564         (WebKit::applyFrameState):
2565         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2566         (WebKit::WebFrameLoaderClient::restoreViewState):
2567         * WebProcess/WebPage/ios/WebPageIOS.mm:
2568         (WebKit::WebPage::restorePageState):
2569
2570 2017-03-08  Matt Rajca  <mrajca@apple.com>
2571
2572         Add support for updating autoplay policies after a page has been loaded.
2573         https://bugs.webkit.org/show_bug.cgi?id=169360
2574
2575         Reviewed by Alex Christensen.
2576
2577         * WebProcess/WebPage/WebPage.cpp:
2578         (WebKit::WebPage::updateWebsitePolicies):
2579
2580 2017-03-08  Tim Horton  <timothy_horton@apple.com>
2581
2582         Switching focus from a UITextField to an editable WKWebView causes the keyboard to dance
2583         https://bugs.webkit.org/show_bug.cgi?id=168932
2584         <rdar://problem/30193996>
2585
2586         Reviewed by Beth Dakin.
2587
2588         When WKWebView first becomes first responder from a tap, we don't have
2589         enough information to immediately respond accurately to various questions
2590         from UIKit, because we haven't had time to ask the Web Content process
2591         what is under the touch. Defer updating input views until we get a
2592         response or lose first responder status, so that the keyboard doesn't
2593         start transitioning to its new state until we know what that is.
2594
2595         There is currently no test because TestWebKitAPI has no UIApplication,
2596         and thus cannot generate mock events.
2597
2598         * Platform/spi/ios/UIKitSPI.h:
2599         * WebKit2.xcodeproj/project.pbxproj:
2600         * UIProcess/ios/InputViewUpdateDeferrer.h: Added.
2601         * UIProcess/ios/InputViewUpdateDeferrer.mm: Added.
2602         Add an RAII object that defers input view updates while alive.
2603
2604         * UIProcess/ios/WKContentView.mm:
2605         * UIProcess/ios/WKContentViewInteraction.h:
2606         * UIProcess/ios/WKContentViewInteraction.mm:
2607         (-[WKContentView cleanupInteraction]):
2608         (-[WKContentView _commitPotentialTapFailed]):
2609         (-[WKContentView _didNotHandleTapAsClick:]):
2610         (-[WKContentView _didCompleteSyntheticClick]):
2611         (-[WKContentView _singleTapCommited:]):
2612         (-[WKContentView _attemptClickAtLocation:]):
2613         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]):
2614         Create a InputViewUpdateDeferrer just before we become first responder
2615         from a tap, and destroy it when we get a response (of any kind) or lose
2616         first-responder status (or interaction is torn down).
2617
2618         * UIProcess/PageClient.h:
2619         * UIProcess/WebPageProxy.h:
2620         * UIProcess/WebPageProxy.messages.in:
2621         * UIProcess/ios/PageClientImplIOS.h:
2622         * UIProcess/ios/PageClientImplIOS.mm:
2623         (WebKit::PageClientImpl::didCompleteSyntheticClick):
2624         * UIProcess/ios/WebPageProxyIOS.mm:
2625         (WebKit::WebPageProxy::didCompleteSyntheticClick):
2626         * WebProcess/WebPage/ios/WebPageIOS.mm:
2627         (WebKit::WebPage::completeSyntheticClick):
2628         Plumb an indication that the synthetic click completed, regardless of
2629         how it was handled.
2630
2631 2017-03-08  Zan Dobersek  <zdobersek@igalia.com>
2632
2633         [WK2] Guard GLib-specific code in Module, Connection files with USE(GLIB)
2634         https://bugs.webkit.org/show_bug.cgi?id=169349
2635
2636         Reviewed by Carlos Garcia Campos.
2637
2638         Use the USE(GLIB) build guards for GLib-specific code in Connection and
2639         Module header files and the ConnectionUnix implementation file, instead
2640         of the PLATFORM(GTK) guard.
2641
2642         * Platform/IPC/Connection.h:
2643         * Platform/IPC/unix/ConnectionUnix.cpp:
2644         (IPC::Connection::platformInitialize):
2645         (IPC::Connection::platformInvalidate):
2646         (IPC::Connection::open):
2647         (IPC::Connection::sendOutputMessage):
2648         * Platform/Module.h:
2649
2650 2017-03-08  Tim Horton  <timothy_horton@apple.com>
2651
2652         Remove unused WebPageIOS::zoomToRect and plumbing
2653         https://bugs.webkit.org/show_bug.cgi?id=169344
2654
2655         Reviewed by Alex Christensen.
2656
2657         * UIProcess/PageClient.h:
2658         * UIProcess/WebPageProxy.h:
2659         * UIProcess/WebPageProxy.messages.in:
2660         * UIProcess/ios/PageClientImplIOS.h:
2661         * UIProcess/ios/PageClientImplIOS.mm:
2662         (WebKit::PageClientImpl::zoomToRect): Deleted.
2663         * WebProcess/WebPage/WebPage.h:
2664         * WebProcess/WebPage/ios/WebPageIOS.mm:
2665         (WebKit::WebPage::zoomToRect): Deleted.
2666
2667 2017-03-08  Brad Wright  <bwright2@apple.com>
2668
2669         UIViewController with WKWebView presented modally causes the presented UIViewController to be dismissed.
2670         https://bugs.webkit.org/show_bug.cgi?id=165225
2671         
2672         Reviewed by Wenson Hsieh.
2673
2674         The problem happens on an iPhone with a WKWebView inside a view controller presented modally. If the user selects an HTML file input 
2675         tag button, a UIDocumentMenuViewController will appear. Anything the user does next causes the entire modal view controller to get dismissed.
2676
2677         To fix this problem, I prevent the UIDocumentMenuViewController from being dismissed by not saving a pointer to it. The UIDocumentMenuViewController 
2678         always goes away by itself on any user interaction. Trying to dismiss the UIDocumentMenuViewController when it is already dismissed causes the modal view controller
2679         to be dismissed.
2680
2681         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2682         (-[WKFileUploadPanel _cancel]):
2683         (-[WKFileUploadPanel dismiss]):
2684         (-[WKFileUploadPanel _showDocumentPickerMenu]):
2685         (-[WKFileUploadPanel _presentMenuOptionForCurrentInterfaceIdiom:]):
2686         (-[WKFileUploadPanel _presentForCurrentInterfaceIdiom:]): Deleted.
2687
2688 2017-03-08  Alexey Proskuryakov  <ap@apple.com>
2689
2690         WebKit should not export dyld install name hints on watchOS and tvOS
2691         https://bugs.webkit.org/show_bug.cgi?id=169342
2692
2693         Reviewed by Dan Bernstein.
2694
2695         * Shared/API/Cocoa/WebKit.m:
2696
2697 2017-03-07  Simon Fraser  <simon.fraser@apple.com>
2698
2699         Have fixedPositionCreatesStackingContext be on by default everywhere
2700         https://bugs.webkit.org/show_bug.cgi?id=169334
2701
2702         Reviewed by Zalan Bujtas.
2703
2704         It makes no sense to have web-exposed CSS functionality be different based on setting,
2705         and other browser are now aligned with having position:fixed create stacking context.
2706
2707         So remove the fixedPositionCreatesStackingContext setting and have StyleResolver::adjustRenderStyle()
2708         always force stacking context for position:fixed.
2709
2710         * WebProcess/WebPage/WebPage.cpp:
2711         (WebKit::WebPage::setUseFixedLayout):
2712         * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
2713         (WebKit::RemoteLayerTreeDrawingArea::updatePreferences):
2714         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2715         (WebKit::TiledCoreAnimationDrawingArea::updatePreferences):
2716
2717 2017-03-07  Brent Fulgham  <bfulgham@apple.com>
2718
2719         [Mac][WK2] Whitelist iokit-get-properties
2720         https://bugs.webkit.org/show_bug.cgi?id=169331
2721         <rdar://problem/16363632>
2722
2723         Reviewed by Alex Christensen.
2724
2725         Block access to all IOKit properties by default. Turn on only those properties
2726         that are actually needed by our engine.
2727
2728         * DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in:
2729         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2730         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
2731         * WebProcess/com.apple.WebProcess.sb.in:
2732
2733 2017-03-07  Simon Fraser  <simon.fraser@apple.com>
2734
2735         Enable SubpixelAntialiasedLayerTextEnabled by default on some versions of macOS
2736         https://bugs.webkit.org/show_bug.cgi?id=169329
2737
2738         Reviewed by Tim Horton.
2739
2740         If the macOS version is > 101300, enable subpixelAntialiasedLayerTextEnabled.
2741
2742         * Shared/WebPreferencesDefinitions.h:
2743
2744 2017-03-07  Dean Jackson  <dino@apple.com>
2745
2746         Some platforms won't be able to create a GPUDevice
2747         https://bugs.webkit.org/show_bug.cgi?id=169314
2748         <rdar://problems/30907521>
2749
2750         Reviewed by Jon Lee.
2751
2752         Disable WEB_GPU on the iOS Simulator.
2753
2754         * Configurations/FeatureDefines.xcconfig:
2755
2756 2017-03-07  Brent Fulgham  <bfulgham@apple.com>
2757
2758         [Mac][iOS][WK2] Whitelist sysctl-read
2759         https://bugs.webkit.org/show_bug.cgi?id=169306
2760         <rdar://problem/16371458>
2761
2762         Reviewed by Alex Christensen.
2763
2764         Limit access to the 'sysctl' call to read-only cases of the very small
2765         set of operations we actually use.
2766
2767         * DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in:
2768         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2769         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
2770         * Resources/SandboxProfiles/ios/com.apple.WebKit.Databases.sb:
2771         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2772         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2773         * WebProcess/com.apple.WebProcess.sb.in:
2774
2775 2017-03-07  Alex Christensen  <achristensen@webkit.org>
2776
2777         [Content Extensions] Rename "Domain" to "Condition" where appropriate
2778         https://bugs.webkit.org/show_bug.cgi?id=169297
2779
2780         Reviewed by Brady Eidson.
2781
2782         * Shared/WebCompiledContentExtension.cpp:
2783         (WebKit::WebCompiledContentExtension::filtersWithoutConditionsBytecode):
2784         (WebKit::WebCompiledContentExtension::filtersWithoutConditionsBytecodeLength):
2785         (WebKit::WebCompiledContentExtension::filtersWithConditionsBytecode):
2786         (WebKit::WebCompiledContentExtension::filtersWithConditionsBytecodeLength):
2787         (WebKit::WebCompiledContentExtension::conditionedFiltersBytecode):
2788         (WebKit::WebCompiledContentExtension::conditionedFiltersBytecodeLength):
2789         (WebKit::WebCompiledContentExtension::filtersWithoutDomainsBytecode): Deleted.
2790         (WebKit::WebCompiledContentExtension::filtersWithoutDomainsBytecodeLength): Deleted.
2791         (WebKit::WebCompiledContentExtension::filtersWithDomainsBytecode): Deleted.
2792         (WebKit::WebCompiledContentExtension::filtersWithDomainsBytecodeLength): Deleted.
2793         (WebKit::WebCompiledContentExtension::domainFiltersBytecode): Deleted.
2794         (WebKit::WebCompiledContentExtension::domainFiltersBytecodeLength): Deleted.
2795         * Shared/WebCompiledContentExtension.h:
2796         * Shared/WebCompiledContentExtensionData.cpp:
2797         (WebKit::WebCompiledContentExtensionData::encode):
2798         (WebKit::WebCompiledContentExtensionData::decode):
2799         * Shared/WebCompiledContentExtensionData.h:
2800         (WebKit::WebCompiledContentExtensionData::WebCompiledContentExtensionData):
2801         * UIProcess/API/APIUserContentExtensionStore.cpp:
2802         (API::ContentExtensionMetaData::fileSize):
2803         (API::encodeContentExtensionMetaData):
2804         (API::decodeContentExtensionMetaData):
2805         (API::compiledToFile):
2806         (API::createExtension):
2807         (API::UserContentExtensionStore::lookupContentExtension):
2808         (API::UserContentExtensionStore::compileContentExtension):
2809         (API::UserContentExtensionStore::removeContentExtension):
2810         * UIProcess/API/APIUserContentExtensionStore.h:
2811
2812 2017-03-07  Brent Fulgham  <bfulgham@apple.com>
2813
2814         [Mac][WK2] Expand sandbox to support access to audio component registrar
2815         https://bugs.webkit.org/show_bug.cgi?id=169283
2816         <rdar://problem/30793512>
2817
2818         Reviewed by Alexey Proskuryakov.
2819
2820         * WebProcess/com.apple.WebProcess.sb.in:
2821
2822 2017-03-07  Chris Dumez  <cdumez@apple.com>
2823
2824         Port DOMTimer from std::chrono::milliseconds to WTF::Seconds type
2825         https://bugs.webkit.org/show_bug.cgi?id=169236
2826
2827         Reviewed by Simon Fraser.
2828
2829         * UIProcess/WebProcessPool.cpp:
2830         (WebKit::WebProcessPool::updateHiddenPageThrottlingAutoIncreaseLimit):
2831         * WebProcess/WebPage/WebPage.h:
2832         (WebKit::WebPage::setHiddenPageDOMTimerThrottlingIncreaseLimit):
2833         * WebProcess/WebProcess.cpp:
2834         (WebKit::WebProcess::setHiddenPageDOMTimerThrottlingIncreaseLimit):
2835         * WebProcess/WebProcess.h:
2836         * WebProcess/WebProcess.messages.in:
2837
2838 2017-03-06  Aakash Jain  <aakash_jain@apple.com>
2839
2840         Enable SUPPORTS_TEXT_BASED_API in WebKit2 for iOS
2841         https://bugs.webkit.org/show_bug.cgi?id=169233
2842
2843         Reviewed by Alexey Proskuryakov.
2844
2845         * Configurations/Base.xcconfig: Enable SUPPORTS_TEXT_BASED_API.
2846         * Configurations/WebKit.xcconfig: Pass information to TAPI about reexporting WebKitLegacy and few extra headers.
2847         * WebKit2.xcodeproj/project.pbxproj: Run scripts which are run for installhdrs phase for installapi phase as well.
2848
2849 2017-03-06  Dan Bernstein  <mitz@apple.com>
2850
2851         [Cocoa] Expose API::InjectedBundle::EditorClient::didChange via the Objective-C bundle SPI
2852         https://bugs.webkit.org/show_bug.cgi?id=169223
2853
2854         Reviewed by Tim Horton.
2855
2856         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h: Declared new
2857           delegate method -_webProcessPlugInBrowserContextControllerDidChangeByEditing:.
2858         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2859         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): Added an override
2860           of API::InjectedBundle::EditorClient::didChange that calls the new delegate method.
2861
2862 2017-03-06  Michael Saboff  <msaboff@apple.com>
2863
2864         Unreviewed build fix after r213492.
2865
2866         * Configurations/Base.xcconfig:
2867
2868 2017-03-06  Aakash Jain  <aakash_jain@apple.com>
2869
2870         Add WK_CLASS_AVAILABLE to _WKLinkIconParameters and _WKWebViewPrintFormatter
2871         https://bugs.webkit.org/show_bug.cgi?id=169225
2872
2873         Reviewed by Tim Horton.
2874
2875         * UIProcess/API/Cocoa/_WKLinkIconParameters.h:
2876         * UIProcess/_WKWebViewPrintFormatter.h:
2877
2878 2017-03-06  Michael Saboff  <msaboff@apple.com>
2879
2880         Unreviewed build fix after r213483.
2881
2882         * Configurations/Base.xcconfig:
2883
2884 2017-03-06  Brent Fulgham  <bfulgham@apple.com>
2885
2886         [Mac][WK2] Support new CoreMedia routing features
2887         https://bugs.webkit.org/show_bug.cgi?id=169241
2888         <rdar://problem/30077969>
2889
2890         Reviewed by Alexey Proskuryakov.
2891
2892         * WebProcess/com.apple.WebProcess.sb.in:
2893
2894 2017-03-06  Michael Saboff  <msaboff@apple.com>
2895
2896         Take advantage of fast permissions switching of JIT memory for devices that support it
2897         https://bugs.webkit.org/show_bug.cgi?id=169155
2898
2899         Reviewed by Saam Barati.
2900
2901         Updated the Xcode config files to match what is in the JavaScriptCore ones.
2902
2903         * Configurations/FeatureDefines.xcconfig:
2904
2905 2017-03-06  Aakash Jain  <aakash_jain@apple.com>
2906
2907         Make WKMenuItemIdentifiersPrivate.h private header
2908         https://bugs.webkit.org/show_bug.cgi?id=168981
2909
2910         Reviewed by Tim Horton.
2911
2912         * WebKit2.xcodeproj/project.pbxproj: Made WKMenuItemIdentifiersPrivate.h private.
2913
2914 2017-03-06  Alexey Proskuryakov  <ap@apple.com>
2915
2916         Replace -sub_umbrella linker flag with a build setting
2917         https://bugs.webkit.org/show_bug.cgi?id=169146
2918
2919         Reviewed by Tim Horton.
2920
2921         * Configurations/WebKit.xcconfig:
2922
2923 2017-03-03  Matt Rajca  <mrajca@apple.com>
2924
2925         Media: notify clients when the user never plays a media element that was prevented from auto-playing
2926         https://bugs.webkit.org/show_bug.cgi?id=169150
2927
2928         Reviewed by Alex Christensen.
2929
2930         * UIProcess/API/C/WKPageUIClient.h:
2931
2932 2017-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
2933
2934         Expand font-weight and font-stretch to take any number
2935         https://bugs.webkit.org/show_bug.cgi?id=168889
2936
2937         Reviewed by Simon Fraser.
2938
2939         Migrate off old enum types.
2940
2941         * WebProcess/WebPage/WebPage.cpp:
2942         (WebKit::WebPage::editorState):
2943
2944 2017-03-06  Andreas Kling  <akling@apple.com>
2945
2946         [iOS] Report domains crashing under memory pressure via enhanced privacy logging.
2947         <https://webkit.org/b/169133>
2948         <rdar://problem/29964017>
2949
2950         Reviewed by Antti Koivisto.
2951
2952         Notify the UI process when the memory pressure status changes.
2953         If a web process crashes while under memory pressure, log the domain of the last open page
2954         using enhanced privacy logging.
2955
2956         * UIProcess/WebPageProxy.cpp:
2957         (WebKit::WebPageProxy::processDidCrash):
2958         * UIProcess/WebProcessProxy.h:
2959         (WebKit::WebProcessProxy::memoryPressureStatusChanged):
2960         (WebKit::WebProcessProxy::isUnderMemoryPressure):
2961         * UIProcess/WebProcessProxy.messages.in:
2962         * WebProcess/WebProcess.cpp:
2963         (WebKit::WebProcess::initializeWebProcess):
2964
2965 2017-03-05  Brady Eidson  <beidson@apple.com>
2966
2967         Remove new files accidentally added in r213441
2968
2969         Unreviewed.
2970
2971         * UIProcess/WebLoadingProviderProxy.cpp: Removed.
2972         * UIProcess/WebLoadingProviderProxy.h: Removed.
2973         * UIProcess/WebLoadingProviderProxy.messages.in: Removed.
2974
2975 2017-03-05  Brady Eidson  <beidson@apple.com>
2976
2977         Rename CustomProtocolFoo to LegacyCustomProtocolFoo.
2978         https://bugs.webkit.org/show_bug.cgi?id=169188
2979
2980         Reviewed by Andy Estes.
2981
2982         * CMakeLists.txt:
2983         * DerivedSources.make:
2984
2985         * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm: Renamed from Source/WebKit2/NetworkProcess/CustomProtocols/Cocoa/CustomProtocolManagerCocoa.mm.
2986         (+[WKCustomProtocol canInitWithRequest:]):
2987         (+[WKCustomProtocol canonicalRequestForRequest:]):
2988         (+[WKCustomProtocol requestIsCacheEquivalent:toRequest:]):
2989         (-[WKCustomProtocol initWithRequest:cachedResponse:client:]):
2990         (-[WKCustomProtocol initializationRunLoop]):
2991         (-[WKCustomProtocol startLoading]):
2992         (-[WKCustomProtocol stopLoading]):
2993         (WebKit::LegacyCustomProtocolManager::registerProtocolClass):
2994         (WebKit::LegacyCustomProtocolManager::registerScheme):
2995         (WebKit::LegacyCustomProtocolManager::unregisterScheme):
2996         (WebKit::LegacyCustomProtocolManager::supportsScheme):
2997         (WebKit::dispatchOnInitializationRunLoop):
2998         (WebKit::LegacyCustomProtocolManager::didFailWithError):
2999         (WebKit::LegacyCustomProtocolManager::didLoadData):
3000         (WebKit::LegacyCustomProtocolManager::didReceiveResponse):
3001         (WebKit::LegacyCustomProtocolManager::didFinishLoading):
3002         (WebKit::LegacyCustomProtocolManager::wasRedirectedToRequest):
3003         (WebKit::LegacyCustomProtocolManager::protocolForID):
3004
3005         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp: Renamed from Source/WebKit2/NetworkProcess/CustomProtocols/CustomProtocolManager.cpp.
3006         (WebKit::generateCustomProtocolID):
3007         (WebKit::LegacyCustomProtocolManager::supplementName):
3008         (WebKit::LegacyCustomProtocolManager::LegacyCustomProtocolManager):
3009         (WebKit::LegacyCustomProtocolManager::initialize):
3010         (WebKit::LegacyCustomProtocolManager::addCustomProtocol):
3011         (WebKit::LegacyCustomProtocolManager::removeCustomProtocol):
3012         (WebKit::LegacyCustomProtocolManager::startLoading):
3013         (WebKit::LegacyCustomProtocolManager::stopLoading):
3014         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h: Renamed from Source/WebKit2/NetworkProcess/CustomProtocols/CustomProtocolManager.h.
3015         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.messages.in: Renamed from Source/WebKit2/NetworkProcess/CustomProtocols/CustomProtocolManager.messages.in.
3016
3017         * NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp: Renamed from Source/WebKit2/NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp.
3018         (WebKit::CustomProtocolManager::WebSoupRequestAsyncData::WebSoupRequestAsyncData):
3019         (WebKit::CustomProtocolManager::WebSoupRequestAsyncData::~WebSoupRequestAsyncData):
3020         (WebKit::CustomProtocolManager::registerProtocolClass):
3021         (WebKit::CustomProtocolManager::registerScheme):
3022         (WebKit::CustomProtocolManager::unregisterScheme):
3023         (WebKit::CustomProtocolManager::supportsScheme):
3024         (WebKit::CustomProtocolManager::didFailWithError):
3025         (WebKit::CustomProtocolManager::didLoadData):
3026         (WebKit::CustomProtocolManager::didReceiveResponse):
3027         (WebKit::CustomProtocolManager::didFinishLoading):
3028         (WebKit::CustomProtocolManager::wasRedirectedToRequest):
3029
3030         * NetworkProcess/NetworkProcess.cpp:
3031         (WebKit::NetworkProcess::NetworkProcess):
3032
3033         * NetworkProcess/NetworkSession.cpp:
3034         (WebKit::NetworkSession::create):
3035         * NetworkProcess/NetworkSession.h:
3036
3037         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
3038         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3039         (WebKit::globalLegacyCustomProtocolManager):
3040         (WebKit::NetworkSessionCocoa::setLegacyCustomProtocolManager):
3041         (WebKit::NetworkSessionCocoa::create):
3042         (WebKit::NetworkSessionCocoa::defaultSession):
3043         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3044         (WebKit::globalCustomProtocolManager): Deleted.
3045         (WebKit::NetworkSessionCocoa::setCustomProtocolManager): Deleted.
3046
3047         * NetworkProcess/mac/RemoteNetworkingContext.mm:
3048         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
3049
3050         * UIProcess/API/APICustomProtocolManagerClient.h:
3051         (API::LegacyCustomProtocolManagerClient::~LegacyCustomProtocolManagerClient):
3052         (API::LegacyCustomProtocolManagerClient::startLoading):
3053         (API::LegacyCustomProtocolManagerClient::stopLoading):
3054         (API::LegacyCustomProtocolManagerClient::invalidate):
3055         (API::CustomProtocolManagerClient::~CustomProtocolManagerClient): Deleted.
3056         (API::CustomProtocolManagerClient::startLoading): Deleted.
3057         (API::CustomProtocolManagerClient::stopLoading): Deleted.
3058         (API::CustomProtocolManagerClient::invalidate): Deleted.
3059
3060         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.h: Renamed from Source/WebKit2/UIProcess/Cocoa/CustomProtocolManagerClient.h.
3061         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm: Renamed from Source/WebKit2/UIProcess/Cocoa/CustomProtocolManagerClient.mm.
3062         (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]):
3063         (-[WKCustomProtocolLoader dealloc]):
3064         (-[WKCustomProtocolLoader customProtocolManagerProxyDestroyed]):
3065         (-[WKCustomProtocolLoader connection:didFailWithError:]):
3066         (-[WKCustomProtocolLoader connection:willCacheResponse:]):
3067         (-[WKCustomProtocolLoader connection:didReceiveResponse:]):
3068         (-[WKCustomProtocolLoader connection:didReceiveData:]):
3069         (-[WKCustomProtocolLoader connection:willSendRequest:redirectResponse:]):
3070         (-[WKCustomProtocolLoader connectionDidFinishLoading:]):
3071         (WebKit::LegacyCustomProtocolManagerClient::startLoading):
3072         (WebKit::LegacyCustomProtocolManagerClient::stopLoading):
3073         (WebKit::LegacyCustomProtocolManagerClient::invalidate):
3074
3075         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3076         (WebKit::WebProcessPool::platformInitialize):
3077
3078         * UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.cpp: Removed.
3079         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.cpp: Added.
3080         (WebKit::LegacyCustomProtocolManagerProxy::LegacyCustomProtocolManagerProxy):
3081         (WebKit::LegacyCustomProtocolManagerProxy::~LegacyCustomProtocolManagerProxy):
3082         (WebKit::LegacyCustomProtocolManagerProxy::startLoading):
3083         (WebKit::LegacyCustomProtocolManagerProxy::stopLoading):
3084         (WebKit::LegacyCustomProtocolManagerProxy::processDidClose):
3085         (WebKit::LegacyCustomProtocolManagerProxy::wasRedirectedToRequest):
3086         (WebKit::LegacyCustomProtocolManagerProxy::didReceiveResponse):
3087         (WebKit::LegacyCustomProtocolManagerProxy::didLoadData):
3088         (WebKit::LegacyCustomProtocolManagerProxy::didFailWithError):
3089         (WebKit::LegacyCustomProtocolManagerProxy::didFinishLoading):
3090         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h: Renamed from Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h.
3091         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.messages.in: Renamed from Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.messages.in.
3092
3093         * UIProcess/Network/NetworkProcessProxy.cpp:
3094         * UIProcess/Network/NetworkProcessProxy.h:
3095
3096         * UIProcess/WebProcessPool.cpp:
3097         (WebKit::WebProcessPool::WebProcessPool):
3098         (WebKit::WebProcessPool::setLegacyCustomProtocolManagerClient):
3099         (WebKit::WebProcessPool::registerSchemeForCustomProtocol):
3100         (WebKit::WebProcessPool::unregisterSchemeForCustomProtocol):
3101         (WebKit::WebProcessPool::setCustomProtocolManagerClient): Deleted.
3102         * UIProcess/WebProcessPool.h:
3103
3104         * WebKit2.xcodeproj/project.pbxproj:
3105
3106         * WebProcess/cocoa/WebProcessCocoa.mm:
3107
3108 2017-03-04  Eric Carlson  <eric.carlson@apple.com>
3109
3110         [iOS] The web process should inherit application state from UI process
3111         https://bugs.webkit.org/show_bug.cgi?id=169156
3112         <rdar://problem/30845473>
3113
3114         Reviewed by Alexey Proskuryakov.
3115
3116         * Platform/spi/ios/CelestialSPI.h: Added.
3117
3118         * WebKit2.xcodeproj/project.pbxproj: Include CelestialSPI.h.
3119
3120         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist: Add entitlement.
3121
3122         * WebProcess/WebPage/ios/WebPageIOS.mm:
3123         (WebKit::WebPage::platformInitialize): Set up PID proxying.
3124
3125 2017-03-04  Aakash Jain  <aakash_jain@apple.com>
3126
3127         Add symbols required by TAPI from Shared/API/Cocoa/WebKit.m in a header file
3128         https://bugs.webkit.org/show_bug.cgi?id=169162
3129
3130         Reviewed by Alexey Proskuryakov.
3131
3132         The symbols from binary and headers should match precisely, otherwise TAPI would
3133         complain. There are few symbols which are not actually needed in header file, but
3134         we still need to add them in a header file to make TAPI happy.
3135
3136         * Platform/ExtraPublicSymbolsForTAPI.h: Added.
3137         * WebKit2.xcodeproj/project.pbxproj: Added ExtraPublicSymbolsForTAPI.h
3138
3139 2017-03-04  Aakash Jain  <aakash_jain@apple.com>
3140
3141         Add symbols required by TAPI in a header file
3142         https://bugs.webkit.org/show_bug.cgi?id=169113
3143         <rdar://problem/30772033>
3144
3145         Reviewed by Alexey Proskuryakov.
3146
3147         The symbols from binary and headers should match precisely, otherwise TAPI would
3148         complain. There are few symbols which are not actually needed in header file, but
3149         we still need to add them in a header file to make TAPI happy.
3150
3151         * Platform/ExtraPrivateSymbolsForTAPI.h: Added.
3152         * WebKit2.xcodeproj/project.pbxproj: Added Platform/ExtraPrivateSymbolsForTAPI.h
3153
3154 2017-03-04  Joseph Pecoraro  <pecoraro@apple.com>
3155
3156         Remove duplicate initialization guard in WebKit2 logging initialization
3157         https://bugs.webkit.org/show_bug.cgi?id=169164
3158
3159         Reviewed by Dan Bernstein.
3160
3161         * Platform/Logging.cpp:
3162         (WebKit::initializeLogChannelsIfNecessary):
3163
3164 2017-03-03  Youenn Fablet  <youenn@apple.com>
3165
3166         [WebRTC] Update libwebrtc source code
3167         https://bugs.webkit.org/show_bug.cgi?id=168599
3168
3169         Reviewed by Alex Christensen.
3170
3171         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
3172
3173 2017-03-03  Dean Jackson  <dino@apple.com>
3174
3175         Add WebGPU compile flag and experimental feature flag
3176         https://bugs.webkit.org/show_bug.cgi?id=169161
3177         <rdar://problem/30846689>
3178
3179         Reviewed by Tim Horton.
3180
3181         Add ENABLE_WEBGPU, an experimental feature flag, a RuntimeEnabledFeature,
3182         and an InternalSetting.
3183
3184         * Configurations/FeatureDefines.xcconfig:
3185         * Shared/WebPreferencesDefinitions.h:
3186         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3187         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3188         * WebProcess/WebPage/WebPage.cpp:
3189         (WebKit::WebPage::updatePreferences):
3190
3191 2017-03-03  Dean Jackson  <dino@apple.com>
3192
3193         Move Input Events and Gamepad from experimental features into main preferences
3194         https://bugs.webkit.org/show_bug.cgi?id=169157
3195         <rdar://problems/30845587>
3196
3197         Reviewed by Myles C. Maxfield.
3198
3199         These are no longer experimental on trunk.
3200
3201         * Shared/WebPreferencesDefinitions.h:
3202
3203 2017-03-03  Brent Fulgham  <bfulgham@apple.com>
3204
3205         [MediaStream iOS] REGRESSION(r212883): Missing function definition breaks sandbox
3206         https://bugs.webkit.org/show_bug.cgi?id=169148
3207         <rdar://problem/30825728>
3208
3209         Reviewed by Alex Christensen.
3210
3211         The changes in r212883 added a call to 'shared-preferences-read', which is not defined
3212         for iOS. In fact, it's not needed since 'user-preference-read' does everything we need on iOS.
3213         Switch to the correct preference rule.
3214
3215         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: Add missing function
3216
3217 2017-03-03  Aakash Jain  <aakash_jain@apple.com>
3218
3219         Move declaration of _WKSetCrashReportApplicationSpecificInformation to header file
3220         https://bugs.webkit.org/show_bug.cgi?id=169043
3221
3222         Reviewed by Alex Christensen.
3223
3224         * WebKit2.xcodeproj/project.pbxproj: Added WebProcessCocoa.h
3225         * WebProcess/cocoa/WebProcessCocoa.h: Added.
3226         * WebProcess/cocoa/WebProcessCocoa.mm: Imported WebProcessCocoa.h
3227         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm: Ditto.
3228
3229 2017-03-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3230
3231         [GTK] Ensure WebKitWebView always have a user content manager
3232         https://bugs.webkit.org/show_bug.cgi?id=169130
3233
3234         Reviewed by Michael Catanzaro.
3235
3236         User content manager is a construct only property, so if not set by the user the web view doesn't have any. We
3237         can create a default one, like we do for settings, when user didn't provide one.
3238
3239         * UIProcess/API/gtk/WebKitWebView.cpp:
3240         (webkitWebViewConstructed):
3241
3242 2017-03-02  Sam Weinig  <sam@webkit.org>
3243
3244         Rename htmlediting.h/cpp to Editing.h/cpp
3245         https://bugs.webkit.org/show_bug.cgi?id=169103
3246
3247         Reviewed by Alex Christensen.
3248
3249         * WebProcess/WebPage/WebPage.cpp:
3250         * WebProcess/WebPage/ios/WebPageIOS.mm:
3251         * WebProcess/WebPage/mac/WebPageMac.mm:
3252
3253 2017-03-02  Joseph Pecoraro  <pecoraro@apple.com>
3254
3255         [Mac] Set the NSURLSessionTask priority to match the request's priority
3256         https://bugs.webkit.org/show_bug.cgi?id=169115
3257         <rdar://problem/28881392>
3258
3259         Reviewed by Alex Christensen.
3260
3261         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3262         (WebKit::toNSURLSessionTaskPriority):
3263         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
3264         Set the priority on the task based on the ResourceRequest's priority.
3265         This is used for HTTP/2 request prioritization.
3266
3267 2017-03-02  Mark Lam  <mark.lam@apple.com>
3268
3269         Add WebKit2 hooks to notify the VM that the user has requested a debugger break.
3270         https://bugs.webkit.org/show_bug.cgi?id=169089
3271
3272         Reviewed by Tim Horton and Joseph Pecoraro.
3273
3274         * CMakeLists.txt:
3275         * DerivedSources.make:
3276         * UIProcess/WebInspectorProxy.cpp:
3277         (WebKit::WebInspectorProxy::connect):
3278         * WebKit2.xcodeproj/project.pbxproj:
3279         * WebProcess/WebPage/WebInspectorInterruptDispatcher.cpp: Added.
3280         (WebKit::WebInspectorInterruptDispatcher::create):
3281         (WebKit::WebInspectorInterruptDispatcher::WebInspectorInterruptDispatcher):
3282         (WebKit::WebInspectorInterruptDispatcher::~WebInspectorInterruptDispatcher):
3283         (WebKit::WebInspectorInterruptDispatcher::initializeConnection):
3284         (WebKit::WebInspectorInterruptDispatcher::notifyNeedDebuggerBreak):
3285         * WebProcess/WebPage/WebInspectorInterruptDispatcher.h: Added.
3286         * WebProcess/WebPage/WebInspectorInterruptDispatcher.messages.in: Added.
3287         * WebProcess/WebProcess.cpp:
3288         (WebKit::WebProcess::WebProcess):
3289         (WebKit::WebProcess::initializeConnection):
3290         * WebProcess/WebProcess.h:
3291
3292 2017-03-02  Brady Eidson  <beidson@apple.com>
3293
3294         Update WKWebsiteDatastoreConfiguration SPI.
3295         https://bugs.webkit.org/show_bug.cgi?id=169102
3296
3297         Reviewed by Tim Horton.
3298         
3299         Make these strings URLs, and throw exceptions if you try to use non-file URLs.
3300
3301         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3302         (-[WKWebsiteDataStore _initWithConfiguration:]):
3303
3304         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
3305         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
3306         (checkURLArgument):
3307         (-[_WKWebsiteDataStoreConfiguration _webStorageDirectory]):
3308         (-[_WKWebsiteDataStoreConfiguration _setWebStorageDirectory:]):
3309         (-[_WKWebsiteDataStoreConfiguration _indexedDBDatabaseDirectory]):
3310         (-[_WKWebsiteDataStoreConfiguration _setIndexedDBDatabaseDirectory:]):
3311         (-[_WKWebsiteDataStoreConfiguration _webSQLDatabaseDirectory]):
3312         (-[_WKWebsiteDataStoreConfiguration _setWebSQLDatabaseDirectory:]):
3313
3314 2017-03-02  Youenn Fablet  <youenn@apple.com>
3315
3316         Move part of NetworkRTCProvider::close implementation in NetworkRTCProvider destructor
3317         https://bugs.webkit.org/show_bug.cgi?id=169104
3318
3319         Reviewed by Alex Christensen.
3320
3321         Improving NetworkRTCProvider clean-up by moving some member field cleaning to the destructor.
3322         The remaining cleaning is still kept in NetworkRTCProvider::close as we need to go to the rtc network thread and
3323         for that, we take a ref of NetworkRTCProvider.
3324         Stopping any resolver before freeing them.
3325
3326         * NetworkProcess/webrtc/NetworkRTCMonitor.h:
3327         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
3328         (WebKit::NetworkRTCProvider::~NetworkRTCProvider):
3329         (WebKit::NetworkRTCProvider::close):
3330         * NetworkProcess/webrtc/NetworkRTCProvider.h:
3331
3332 2017-03-02  Youenn Fablet  <youenn@apple.com>
3333
3334         [iOS] Replicate NetworkProcess Mac sandboxing in iOS to allow TCP/UDP
3335         https://bugs.webkit.org/show_bug.cgi?id=169105
3336
3337         Reviewed by Alex Christensen.
3338
3339         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Adding sandbox extension support for TCP/UDP networking.
3340
3341 2017-03-02  Aakash Jain  <aakash_jain@apple.com>
3342
3343         Move stringMatchesWildcardString from WebKit2 to WebCore
3344         https://bugs.webkit.org/show_bug.cgi?id=169065
3345
3346         Reviewed by Alexey Proskuryakov.
3347
3348         * Platform/mac/StringUtilities.h: Moved stringMatchesWildcardString to WebCore.
3349         * WebKit2.xcodeproj/project.pbxproj: Make StringUtilities.h a project header.
3350         * Platform/mac/StringUtilities.mm:
3351         (WebKit::wildcardRegexPatternString): Moved to WebCore.
3352         (WebKit::stringMatchesWildcardString): Ditto.
3353         * WebProcess/Plugins/WebPluginInfoProvider.cpp: Using stringMatchesWildcardString from WebCore.
3354
3355 2017-03-02  Aakash Jain  <aakash_jain@apple.com>
3356
3357         IsSmartPtr<WKRetainPtr<T>>::value should not be exported
3358         https://bugs.webkit.org/show_bug.cgi?id=169047
3359
3360         Reviewed by Alexey Proskuryakov.
3361
3362         * UIProcess/API/cpp/WKRetainPtr.h:
3363
3364 2017-03-02  Youenn Fablet  <youenn@apple.com>
3365
3366         Activate some new webrtc tests
3367         https://bugs.webkit.org/show_bug.cgi?id=168850
3368
3369         Reviewed by Alex Christensen.
3370
3371         * Shared/WebPreferencesDefinitions.h: Activating peer connection by default when libwebrtc is on.
3372         This allows ensuring the network process will have its sandbox extension.
3373
3374 2017-03-02  Brian Burg  <bburg@apple.com>
3375
3376         Web Automation: _WKAutomationSessionDelegate should work with WKWebViews
3377         https://bugs.webkit.org/show_bug.cgi?id=169091
3378         <rdar://problem/30810538>
3379
3380         Reviewed by Tim Horton.
3381
3382         As a first step towards fixing the mistake of using WKPageRef in an Objective-C SPI,
3383         add the correct delegate methods that take WKWebView so that Objective-C clients can
3384         use this functionality.
3385
3386         In a future patch, we'll remove the WKPageRef delegate methods when they are no longer
3387         being used by clients. Clients should switch to using WKWebView, or wait for a C SPI
3388         with equivalent functionality (something like WKAutomationSessionClient) to be ported.
3389
3390         While I'm fixing this mess, make API::AutomationSessionClient use references instead
3391         of pointers. We null-check all WebPageProxy parameters before calling its methods.
3392
3393         * UIProcess/API/APIAutomationSessionClient.h:
3394         (API::AutomationSessionClient::didDisconnectFromRemote):
3395         (API::AutomationSessionClient::didRequestNewWindow):
3396         (API::AutomationSessionClient::isShowingJavaScriptDialogOnPage):
3397         (API::AutomationSessionClient::dismissCurrentJavaScriptDialogOnPage):
3398         (API::AutomationSessionClient::acceptCurrentJavaScriptDialogOnPage):
3399         (API::AutomationSessionClient::messageOfCurrentJavaScriptDialogOnPage):
3400         (API::AutomationSessionClient::setUserInputForCurrentJavaScriptPromptOnPage):
3401         Change pointer to reference.
3402
3403         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
3404         Add duplicate delegate methods that take/return WKWebView instead of WKPageRef.
3405         Adjust the delegate method names to reflect parameter type and avoid conflicts with the
3406         WKPageRef-using methods that we need to remove eventually.
3407
3408         * UIProcess/Automation/WebAutomationSession.cpp:
3409         (WebKit::WebAutomationSession::terminate):
3410         (WebKit::WebAutomationSession::createBrowsingContext):
3411         (WebKit::WebAutomationSession::isShowingJavaScriptDialog):
3412         (WebKit::WebAutomationSession::dismissCurrentJavaScriptDialog):
3413         (WebKit::WebAutomationSession::acceptCurrentJavaScriptDialog):
3414         (WebKit::WebAutomationSession::messageOfCurrentJavaScriptDialog):
3415         (WebKit::WebAutomationSession::setUserInputForCurrentJavaScriptPrompt):
3416         Dereference `this` and `webPageProxy` when calling API::AutomationSessionClient methods.
3417
3418         * UIProcess/Cocoa/AutomationSessionClient.h:
3419         * UIProcess/Cocoa/AutomationSessionClient.mm:
3420         (WebKit::AutomationSessionClient::AutomationSessionClient):
3421         (WebKit::AutomationSessionClient::didDisconnectFromRemote):
3422         (WebKit::AutomationSessionClient::didRequestNewWindow):
3423         (WebKit::AutomationSessionClient::isShowingJavaScriptDialogOnPage):
3424         (WebKit::AutomationSessionClient::dismissCurrentJavaScriptDialogOnPage):
3425         (WebKit::AutomationSessionClient::acceptCurrentJavaScriptDialogOnPage):
3426         (WebKit::AutomationSessionClient::messageOfCurrentJavaScriptDialogOnPage):
3427         (WebKit::AutomationSessionClient::setUserInputForCurrentJavaScriptPromptOnPage):
3428         Now there are two possible delegate methods for most of these, so try to use the
3429         WKWebView-based delegate method first and fall back to the WKPageRef delegate method.
3430
3431 2017-03-02  Alex Christensen  <achristensen@webkit.org>
3432
3433         Continue enabling WebRTC
3434         https://bugs.webkit.org/show_bug.cgi?id=169056
3435
3436         Reviewed by Jon Lee.
3437
3438         * Configurations/FeatureDefines.xcconfig:
3439
3440 2017-03-01  Megan Gardner  <megan_gardner@apple.com>
3441
3442         Data interaction support for WK1
3443         https://bugs.webkit.org/show_bug.cgi?id=169062
3444
3445         Reviewed by Wenson Hsieh.
3446
3447         Allow for separate additions files in WK1 and WK2
3448
3449         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
3450
3451 2017-03-02  Youenn Fablet  <youenn@apple.com>
3452
3453         [WebRTC] Activate ICE candidate privacy policy
3454         https://bugs.webkit.org/show_bug.cgi?id=168975
3455
3456         Reviewed by Alex Christensen.
3457