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