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