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