Massive "Server-process-to-context-process" connection overhaul.
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2017-11-13  Brady Eidson  <beidson@apple.com>
2
3         Massive "Server-process-to-context-process" connection overhaul.
4         https://bugs.webkit.org/show_bug.cgi?id=179554
5
6         Reviewed by Chris Dumez.
7
8         * DerivedSources.make:
9         * WebKit.xcodeproj/project.pbxproj:
10
11         * Shared/WebCoreArgumentCoders.h:
12
13         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
14         (WebKit::WebSWServerConnection::sendToContextProcess):
15         (WebKit::WebSWServerConnection::installServiceWorkerContext): Deleted.
16         (WebKit::WebSWServerConnection::fireInstallEvent): Deleted.
17         (WebKit::WebSWServerConnection::fireActivateEvent): Deleted.
18         (WebKit::WebSWServerConnection::setContextConnection): Deleted.
19         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
20
21         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp: Copied from Source/WebCore/workers/service/server/SWServerWorker.cpp.
22         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
23         (WebKit::WebSWServerToContextConnection::messageSenderConnection):
24         (WebKit::WebSWServerToContextConnection::messageSenderDestinationID):
25         (WebKit::WebSWServerToContextConnection::connectionClosed):
26         (WebKit::WebSWServerToContextConnection::installServiceWorkerContext):
27         (WebKit::WebSWServerToContextConnection::fireInstallEvent):
28         (WebKit::WebSWServerToContextConnection::fireActivateEvent):
29         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h: Copied from Source/WebCore/workers/service/ServiceWorkerTypes.h.
30         (WebKit::WebSWServerToContextConnection::create):
31         (WebKit::WebSWServerToContextConnection::ipcConnection const):
32         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: Copied from Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in.
33
34         * StorageProcess/StorageProcess.cpp:
35         (WebKit::StorageProcess::didClose):
36         (WebKit::StorageProcess::didReceiveMessage):
37         (WebKit::StorageProcess::globalServerToContextConnection):
38         (WebKit::StorageProcess::createServerToContextConnection):
39         (WebKit::StorageProcess::didGetWorkerContextProcessConnection):
40         (WebKit::StorageProcess::workerContextProcessConnection): Deleted.
41         (WebKit::StorageProcess::createWorkerContextProcessConnection): Deleted.
42         (WebKit::StorageProcess::serviceWorkerContextFailedToStart): Deleted.
43         (WebKit::StorageProcess::serviceWorkerContextStarted): Deleted.
44         (WebKit::StorageProcess::didFinishServiceWorkerInstall): Deleted.
45         (WebKit::StorageProcess::didFinishServiceWorkerActivation): Deleted.
46         (WebKit::StorageProcess::setServiceWorkerHasPendingEvents): Deleted.
47         * StorageProcess/StorageProcess.h:
48         * StorageProcess/StorageProcess.messages.in:
49
50         * StorageProcess/StorageToWebProcessConnection.cpp:
51         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
52         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
53         (WebKit::StorageToWebProcessConnection::workerContextProcessConnectionCreated):
54
55         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
56         (WebKit::WebSWContextManagerConnection::installServiceWorker):
57         (WebKit::WebSWContextManagerConnection::serviceWorkerStartedWithMessage):
58         (WebKit::WebSWContextManagerConnection::fireInstallEvent):
59         (WebKit::WebSWContextManagerConnection::fireActivateEvent):
60         (WebKit::WebSWContextManagerConnection::didFinishInstall):
61         (WebKit::WebSWContextManagerConnection::didFinishActivation):
62         (WebKit::WebSWContextManagerConnection::setServiceWorkerHasPendingEvents):
63         * WebProcess/Storage/WebSWContextManagerConnection.h:
64         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
65
66 2017-11-13  Brent Fulgham  <bfulgham@apple.com>
67
68         WebContent sandbox should not include 'system.sb'
69         https://bugs.webkit.org/show_bug.cgi?id=179548
70         <rdar://problem/35367154>
71
72         Reviewed by Darin Adler.
73
74         Stop including 'system.sb', and just include the portions of that sandbox that we
75         actually use in WebContent Process. This is the first step in some further sandbox
76         tightening.
77
78         * WebProcess/com.apple.WebProcess.sb.in:
79
80 2017-11-13  Simon Fraser  <simon.fraser@apple.com>
81
82         When navigating back to a page, compositing layers may not use accelerated drawing
83         https://bugs.webkit.org/show_bug.cgi?id=178749
84         rdar://problem/35158946
85
86         Reviewed by Dean Jackson.
87
88         Avoid assertions when a test enables accelerated drawing (which we can't support
89         in the iOS simulator).
90
91         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
92         (WebKit::RemoteLayerBackingStore::ensureBackingStore):
93
94 2017-11-13  Youenn Fablet  <youenn@apple.com>
95
96         matchRegistration does not need to go to StorageProcess if no service worker is registered
97         https://bugs.webkit.org/show_bug.cgi?id=179480
98
99         Reviewed by Chris Dumez.
100
101         Removed origin store handling from StorageProcess since it is now handled within SWServer.
102         Updated clearing of web site data accordingly.
103         Optimized matchRegistration by looking at the origin store before doing any IPC.
104         Do IPC to the StorageProcess if the origin store is not yet initialized on the WebProcess.
105
106         * StorageProcess/ServiceWorker/WebSWOriginStore.h:
107         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
108         (WebKit::WebSWServerConnection::resolveRegistrationJobInClient):
109         (WebKit::WebSWServerConnection::resolveUnregistrationJobInClient):
110         * StorageProcess/StorageProcess.cpp:
111         (WebKit::StorageProcess::deleteWebsiteData):
112         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
113         (WebKit::StorageProcess::swServerForSession):
114         (WebKit::StorageProcess::swOriginStoreForSession):
115         (WebKit::StorageProcess::registerSWServerConnection):
116         (WebKit::StorageProcess::unregisterSWServerConnection):
117         (WebKit::StorageProcess::ensureSWOriginStoreForSession): Deleted.
118         (WebKit::StorageProcess::swOriginStoreForSession const): Deleted.
119         * StorageProcess/StorageProcess.h:
120         * StorageProcess/ServiceWorker/WebSWOriginStore.cpp:
121         (WebKit::WebSWOriginStore::addToStore):
122         (WebKit::WebSWOriginStore::removeFromStore):
123         (WebKit::WebSWOriginStore::clearStore):
124         (WebKit::WebSWOriginStore::add): Deleted.
125         (WebKit::WebSWOriginStore::remove): Deleted.
126         (WebKit::WebSWOriginStore::clear): Deleted.
127         * StorageProcess/ServiceWorker/WebSWOriginStore.h:
128         * WebProcess/Storage/WebSWClientConnection.cpp:
129         (WebKit::WebSWClientConnection::matchRegistration):
130
131 2017-11-13  Alex Christensen  <achristensen@webkit.org>
132
133         Merge NetworkProcess::EnsurePrivateBrowsingSession and NetworkProcess::AddWebsiteDataStore into one message type
134         https://bugs.webkit.org/show_bug.cgi?id=178751
135
136         Reviewed by Brady Eidson.
137
138         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
139         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
140         * NetworkProcess/NetworkProcess.cpp:
141         (WebKit::NetworkProcess::initializeNetworkProcess):
142         (WebKit::NetworkProcess::ensurePrivateBrowsingSession): Deleted.
143         * NetworkProcess/NetworkProcess.h:
144         * NetworkProcess/NetworkProcess.messages.in:
145         * NetworkProcess/RemoteNetworkingContext.h:
146         * NetworkProcess/mac/RemoteNetworkingContext.mm:
147         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
148         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession): Deleted.
149         * Shared/WebsiteDataStoreParameters.cpp:
150         (WebKit::WebsiteDataStoreParameters::legacyPrivateSessionParameters):
151         * Shared/WebsiteDataStoreParameters.h:
152         * UIProcess/WebProcessPool.cpp:
153         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
154         (WebKit::WebProcessPool::createNewWebProcess):
155         (WebKit::WebProcessPool::pageAddedToProcess):
156         * WebProcess/InjectedBundle/InjectedBundle.cpp:
157         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
158         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
159         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
160         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
161         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession): Deleted.
162         * WebProcess/WebPage/WebPage.cpp:
163         (WebKit::WebPage::setSessionID):
164         * WebProcess/WebProcess.cpp:
165         (WebKit::WebProcess::ensurePrivateBrowsingSession): Deleted.
166         * WebProcess/WebProcess.h:
167         * WebProcess/WebProcess.messages.in:
168
169 2017-11-13  Alex Christensen  <achristensen@webkit.org>
170
171         Add logs to debug content extension test failures
172         https://bugs.webkit.org/show_bug.cgi?id=179624
173
174         Reviewed by Chris Dumez.
175
176         * UIProcess/API/APIContentRuleListStore.cpp:
177         (API::compiledToFile):
178         Right now I'm seeing this log:
179         "Rule list compilation failed: Unspecified error during compile."
180         I need more information to debug what is failing on the bots.
181
182 2017-11-07  Brian Burg  <bburg@apple.com>
183
184         Web Automation: inViewCenterPoint should not include topContentInset when computed in viewport coordinates
185         https://bugs.webkit.org/show_bug.cgi?id=179129
186         <rdar://problem/35297038>
187
188         Reviewed by Simon Fraser.
189
190         When computing the in view center point per W3C specification, the top content inset
191         is inadvertently added back in when converting to the root view coordinate system.
192
193         This patch reworks the protocol command so that it explicitly requests a coordinate
194         system, with options for "Page" (root / contents), "LayoutViewport", and "VisualViewport".
195         The latter is not implemented in this patch, since it is intended for use on iOS someday.
196
197         * UIProcess/Automation/Automation.json:
198         Change usesViewport to CoordinateSystem.
199         Add a new coordinate system enum type and use it.
200         Fix relevant comments for Automation.computElementLayout.
201
202         * UIProcess/Automation/WebAutomationSession.h:
203         * UIProcess/Automation/WebAutomationSession.cpp:
204         (WebKit::protocolStringToCoordinateSystem):
205         (WebKit::WebAutomationSession::computeElementLayout):
206         Parse the requested coordinate system and send it in the message to the web process.
207
208         * WebKit.xcodeproj/project.pbxproj:
209         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
210         * WebProcess/Automation/WebAutomationSessionProxy.h:
211         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
212         (WebKit::WebAutomationSessionProxy::computeElementLayout):
213         Rework the implementation. Get the element bounds and in-view center point in
214         client coordinates and convert back to root view coordinates for CoordinateSystem::Page.
215
216 2017-11-08  Keith Miller  <keith_miller@apple.com>
217
218         Async iteration should only fetch the next method once and add feature flag
219         https://bugs.webkit.org/show_bug.cgi?id=179451
220
221         Reviewed by Geoffrey Garen.
222
223         Add feature flag for Async iteration.
224
225         * Configurations/FeatureDefines.xcconfig:
226
227 2017-11-13  Mark Lam  <mark.lam@apple.com>
228
229         Add more overflow check book-keeping for MarkedArgumentBuffer.
230         https://bugs.webkit.org/show_bug.cgi?id=179634
231         <rdar://problem/35492517>
232
233         Reviewed by Saam Barati.
234
235         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
236         (WebKit::NPJSObject::construct):
237         (WebKit::NPJSObject::invoke):
238
239 2017-11-13  Timothy Horton  <timothy_horton@apple.com>
240
241         Address some post-landing review comments from r224728
242         https://bugs.webkit.org/show_bug.cgi?id=179576
243
244         * Platform/IPC/mac/MachMessage.h:
245         (IPC::MachMessage::setMessageReceiverName):
246         (IPC::MachMessage::setMessageName):
247         More moving!
248
249 2017-11-13  Tim Horton  <timothy_horton@apple.com>
250
251         Occasional MobileSafari crash under -[WKPDFView web_setMinimumSize:]
252         https://bugs.webkit.org/show_bug.cgi?id=179628
253         <rdar://problem/34773037>
254
255         Reviewed by Simon Fraser.
256
257         * UIProcess/ios/WKPDFView.mm:
258         (-[WKPDFView _computePageAndDocumentFrames]):
259         Similar to r223444, avoid propagating null CGRects into the view hierarchy.
260         In this case, the null rect comes from applying margins to a rect that is 
261         smaller than the margins. We could check for that specifically, but a
262         more-general check for a null rect seems reasonable.
263
264 2017-11-13  Tim Horton  <timothy_horton@apple.com>
265
266         Use the real mach type instead of reinterpret_casting in MachMessage
267         https://bugs.webkit.org/show_bug.cgi?id=179629
268
269         Reviewed by Dan Bernstein.
270
271         * Platform/IPC/mac/MachMessage.cpp:
272         (IPC::MachMessage::header):
273         * Platform/IPC/mac/MachMessage.h:
274         Just use mach_msg_header_t proper, and avoid the reinterpret_cast.
275         This also corrects the alignment of the struct on platforms where
276         alignof(mach_msg_header_t) != alignof(uint8_t).
277
278 2017-11-13  Gabriel Ivascu  <givascu@igalia.com>
279
280         [GTK] Automatically adjust font size when gtk-xft-dpi changes
281         https://bugs.webkit.org/show_bug.cgi?id=142673
282
283         Reviewed by Michael Catanzaro.
284
285         * UIProcess/API/glib/WebKitSettings.cpp:
286         (webKitSettingsDispose):
287         (webKitSettingsConstructed):
288         (webkit_settings_class_init):
289
290 2017-11-13  Chris Dumez  <cdumez@apple.com>
291
292         Implement "Service Worker Has No Pending Events" / "Update Service Worker Extended Events Set" algorithms
293         https://bugs.webkit.org/show_bug.cgi?id=179618
294
295         Reviewed by Brady Eidson.
296
297         * StorageProcess/StorageProcess.cpp:
298         (WebKit::StorageProcess::setServiceWorkerHasPendingEvents):
299         * StorageProcess/StorageProcess.h:
300         * StorageProcess/StorageProcess.messages.in:
301         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
302         (WebKit::WebSWContextManagerConnection::setServiceWorkerHasPendingEvents):
303         * WebProcess/Storage/WebSWContextManagerConnection.h:
304
305 2017-11-13  Wenson Hsieh  <wenson_hsieh@apple.com>
306
307         [Attachment Support] Implement SPI for clients to request data for a given attachment
308         https://bugs.webkit.org/show_bug.cgi?id=179586
309         <rdar://problem/35355720>
310
311         Reviewed by Darin Adler.
312
313         Adds support in WebKit for fetching data for a given attachment element. See WebCore/ChangeLog for more details.
314         Most of the changes here are boilerplate plumbing of -requestAttachmentData through the client layers.
315
316         Test coverage by augmenting existing API tests in WKAttachmentTests, and adding 3 new tests.
317
318         * UIProcess/API/APIAttachment.cpp:
319         (API::Attachment::requestData):
320         * UIProcess/API/APIAttachment.h:
321         * UIProcess/API/Cocoa/_WKAttachment.h:
322         * UIProcess/API/Cocoa/_WKAttachment.mm:
323         (-[_WKAttachment requestData:]):
324         * UIProcess/WebPageProxy.cpp:
325         (WebKit::WebPageProxy::sharedBufferCallback):
326
327         Add a new IPC callback helper type, SharedBufferCallback. This is similar to the existing DataCallback, but
328         instead of deserializing to an API::Data, we convert to a SharedBuffer instead. Additionally,
329         SharedBufferCallback is able to draw a distinction between null data and empty data. This allows -requestData:
330         to distinguish between cases where (for instance) the data for a given attachment is an empty blob, and when
331         the attachment doesn't exist at all.
332
333         (WebKit::WebPageProxy::dataCallback):
334         (WebKit::WebPageProxy::insertAttachment):
335         (WebKit::WebPage::invokeSharedBufferCallback):
336         (WebKit::WebPageProxy::requestAttachmentData):
337         * UIProcess/WebPageProxy.h:
338         * UIProcess/WebPageProxy.messages.in:
339         * WebProcess/WebPage/WebPage.cpp:
340         (WebKit::WebPage::requestAttachmentData):
341         * WebProcess/WebPage/WebPage.h:
342         * WebProcess/WebPage/WebPage.messages.in:
343
344 2017-11-12  Darin Adler  <darin@apple.com>
345
346         More is<> and downcast<>, less static_cast<>
347         https://bugs.webkit.org/show_bug.cgi?id=179600
348
349         Reviewed by Chris Dumez.
350
351         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivate.cpp:
352         (WebKit::wrap): Use is/downcast.
353         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
354         (WebKit::WebEditorClient::handleKeyboardEvent): Ditto.
355         * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp:
356         (WebKit::WebEditorClient::handleKeyboardEvent): Ditto.
357         * WebProcess/WebPage/WebPage.cpp:
358         (WebKit::WebPage::handleEditingKeyboardEvent): Ditto.
359         * WebProcess/WebPage/mac/WebPageMac.mm:
360         (WebKit::frameForEvent): Ditto.
361
362 2017-11-12  Gabriel Ivascu  <givascu@igalia.com>
363
364         [GTK] Add functionality to handle font sizes in points
365         https://bugs.webkit.org/show_bug.cgi?id=179285
366
367         Reviewed by Carlos Garcia Campos and Michael Catanzaro.
368
369         * UIProcess/API/glib/WebKitSettings.cpp:
370         (webkit_settings_class_init):
371         (webkit_settings_font_size_to_points):
372         (webkit_settings_font_size_to_pixels):
373         * UIProcess/API/gtk/WebKitSettings.h:
374         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
375
376 2017-11-11  Tim Horton  <timothy_horton@apple.com>
377
378         Increase the alignment requirement of WKObject's wrapped C++ object
379         https://bugs.webkit.org/show_bug.cgi?id=179518
380
381         Reviewed by Dan Bernstein.
382
383         * Shared/API/APIObject.h:
384         * Shared/Cocoa/APIObject.mm:
385         (API::allocateWKObject):
386         (API::Object::fromWKObjectExtraSpace):
387         (API::Object::newObject):
388         * Shared/Cocoa/WKObject.mm:
389         (-[WKObject dealloc]):
390         (-[WKObject _apiObject]):
391         * UIProcess/API/Cocoa/WKConnection.mm:
392         (-[WKConnection dealloc]):
393         (-[WKConnection _apiObject]):
394         (-[WKConnection _connection]):
395         Increase the alignment of the C++ object stored inside WKObject's extra space
396         to 8-bytes, for platforms where some types require greater-than-pointer alignment.
397         To achieve this, increase the size of the extra-space allocation by the difference
398         between 8 bytes and pointer-alignment, and then align within that.
399
400 2017-11-11  Tim Horton  <timothy_horton@apple.com>
401
402         Avoid composing the message + recipient name for crash logs until a failure actually occurs
403         https://bugs.webkit.org/show_bug.cgi?id=179576
404
405         Reviewed by Dan Bernstein.
406
407         * Platform/IPC/mac/ConnectionMac.mm:
408         (IPC::Connection::sendMessage):
409         (IPC::Connection::sendOutgoingMessage):
410         * Platform/IPC/mac/MachMessage.h:
411         (IPC::MachMessage::messageReceiverName const):
412         (IPC::MachMessage::setMessageReceiverName):
413         (IPC::MachMessage::messageName const):
414         (IPC::MachMessage::setMessageName):
415         Store the message name and receiver name separately on MachMessage,
416         only composing them into a string if the message is unhandled. This
417         makes the time spent composing the string in sendOutgoingMessage
418         completely disappear. In absolute terms, it wasn't huge, but if you
419         do enough IPC it starts to add up.
420
421 2017-11-10  Chris Dumez  <cdumez@apple.com>
422
423         [Service Workers] Implement "Try Activate" / "Activate" algorithms
424         https://bugs.webkit.org/show_bug.cgi?id=179436
425
426         Reviewed by Brady Eidson.
427
428         Implement proper "Try Activate" / "Activate" algorithms as per:
429         - https://w3c.github.io/ServiceWorker/#try-activate-algorithm
430         - https://w3c.github.io/ServiceWorker/#activation-algorithm
431
432         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
433         (WebKit::WebSWServerConnection::fireActivateEvent):
434         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
435         * StorageProcess/StorageProcess.cpp:
436         (WebKit::StorageProcess::didFinishServiceWorkerActivation):
437         * StorageProcess/StorageProcess.h:
438         * StorageProcess/StorageProcess.messages.in:
439         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
440         (WebKit::WebSWContextManagerConnection::fireActivateEvent):
441         (WebKit::WebSWContextManagerConnection::didFinishActivation):
442         * WebProcess/Storage/WebSWContextManagerConnection.h:
443         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
444
445 2017-11-10  John Wilander  <wilander@apple.com>
446
447         Ignore HSTS for partitioned, cross-origin subresource requests
448         https://bugs.webkit.org/show_bug.cgi?id=178993
449         <rdar://problem/34962462>
450
451         Reviewed by Brent Fulgham.
452
453         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
454         (downgradeRequest):
455             Convenience function to downgrade a request if
456             CFNetwork as already upgraded it during
457             canonicalization. This allows the rest of 
458             WebKit's processing to function, such as UIR
459             and mixed content blocking.
460         (updateIgnoreStrictTransportSecuritySettingIfNecessary):
461             Adds and removed the ignore request accordingly.
462         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
463             Now asks CFNetwork to ignore HSTS on resource loads we
464             partition cookies for.
465         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
466             Now asks CFNetwork to ignore HSTS on resource loads we
467             partition cookies for.
468
469 2017-11-10  Alex Christensen  <achristensen@webkit.org>
470
471         _WKThumbnailView initialization with WKWebView needs to call correct initWithFrame
472         https://bugs.webkit.org/show_bug.cgi?id=179537
473         <rdar://problem/35275219>
474
475         Reviewed by Darin Adler.
476
477         I introduced this in r223439 and made an ObjC mistake.  This is what I get for adding SPI with no tests.
478         I fixed this by making the existing WKView/_WKThumbnailView API tests work with WKWebView.
479
480         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
481         (-[_WKThumbnailView initWithFrame:fromWKWebView:]):
482
483 2017-11-10  Carlos Garcia Campos  <cgarcia@igalia.com>
484
485         [GTK][WPE] Switch to use API::NavigationClient
486         https://bugs.webkit.org/show_bug.cgi?id=178720
487
488         Reviewed by Alex Christensen.
489
490         Replace WebKitLoaderClient and WebKitPolicyClient with WebKitNavigationClient that implements
491         API::NavigationClient.
492
493         * PlatformGTK.cmake:
494         * PlatformWPE.cmake:
495         * UIProcess/API/APINavigationAction.h: Add new constructor that receives a target frame name instead of a target
496         frame info.
497         * UIProcess/API/APINavigationClient.h:
498         (API::NavigationClient::didDisplayInsecureContent): Added.
499         (API::NavigationClient::didRunInsecureContent): Added.
500         (API::NavigationClient::decidePolicyForNavigationResponse): Change NavigationResponse parameter to be a
501         Ref<NavigationResponse>&& instead of a NavigationResponse&.
502         * UIProcess/API/C/WKPage.cpp:
503         (WKPageSetPageNavigationClient): Update NavigationResponse parameter.
504         * UIProcess/API/glib/WebKitBackForwardList.cpp:
505         (webkitBackForwardListChanged):
506         * UIProcess/API/glib/WebKitBackForwardListPrivate.h:
507         * UIProcess/API/glib/WebKitNavigationAction.cpp:
508         (webkitNavigationActionCreate): Wrap the given API::NavigationAction.
509         (webkit_navigation_action_get_navigation_type): Use the wrapped API::NavigationAction.
510         (webkit_navigation_action_get_mouse_button): Ditto.
511         (webkit_navigation_action_get_modifiers): Ditto.
512         (webkit_navigation_action_get_request): Ditto.
513         (webkit_navigation_action_is_user_gesture): Ditto.
514         (webkit_navigation_action_is_redirect): Ditto.
515         * UIProcess/API/glib/WebKitNavigationActionPrivate.h:
516         (_WebKitNavigationAction::_WebKitNavigationAction):
517         * UIProcess/API/glib/WebKitNavigationClient.cpp: Renamed from Source/WebKit/UIProcess/API/glib/WebKitLoaderClient.cpp.
518         (NavigationClient::NavigationClient):
519         (attachNavigationClientToView):
520         * UIProcess/API/glib/WebKitNavigationClient.h: Renamed from Source/WebKit/UIProcess/API/glib/WebKitLoaderClient.h.
521         * UIProcess/API/glib/WebKitNavigationPolicyDecision.cpp:
522         (webkit_navigation_policy_decision_get_frame_name): Add FIXME.
523         (webkitNavigationPolicyDecisionCreate): Get the target frame name from the API::NavigationAction.
524         * UIProcess/API/glib/WebKitNavigationPolicyDecisionPrivate.h:
525         * UIProcess/API/glib/WebKitPolicyClient.cpp: Removed.
526         * UIProcess/API/glib/WebKitPolicyClient.h: Removed.
527         * UIProcess/API/glib/WebKitPolicyDecision.cpp:
528         (webkitPolicyDecisionSetListener): Remove the madePolicyDecision boolean member, we can null-check the listener instead.
529         (webkit_policy_decision_use): Ensure listener is nullptr after being invoked to prevent the decision from being made
530         more than once.
531         (webkit_policy_decision_ignore): Ditto.
532         (webkit_policy_decision_download): Ditto.
533         * UIProcess/API/glib/WebKitPolicyDecisionPrivate.h:
534         * UIProcess/API/glib/WebKitResponsePolicyDecision.cpp:
535         (webkit_response_policy_decision_get_request): Use the wrapped API::NavigationResponse.
536         (webkit_response_policy_decision_get_response): Ditto.
537         (webkit_response_policy_decision_is_mime_type_supported): Ditto.
538         (webkitResponsePolicyDecisionCreate): Wrap the given API::NavigationResponse.
539         * UIProcess/API/glib/WebKitResponsePolicyDecisionPrivate.h:
540         * UIProcess/API/glib/WebKitUIClient.cpp:
541         (UIClient::createNewPage): Create the WebKitNavigationAction from a new API::NavigationAction.
542         * UIProcess/API/glib/WebKitWebView.cpp:
543         (webkitWebViewConstructed): Attach navigation client.
544         * UIProcess/Cocoa/NavigationState.h: Update API::NavigationResponse parameter of decidePolicyForNavigationResponse.
545         * UIProcess/Cocoa/NavigationState.mm:
546         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
547         * UIProcess/WebPageProxy.cpp:
548         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame): Notify the navigation client if it's used.
549         (WebKit::WebPageProxy::didRunInsecureContentForFrame): Ditto.
550         (WebKit::WebPageProxy::decidePolicyForNewWindowAction): Use the new API::NavigationAction constructor to pass
551         the target frame name, instead of a null target frame info.
552         (WebKit::WebPageProxy::decidePolicyForResponse): Move the API::NavigationResponse.
553
554 2017-11-09  Chris Dumez  <cdumez@apple.com>
555
556         Unreviewed, rolling out r224661.
557
558         Broke build on several internal Mac/iOS bots
559
560         Reverted changeset:
561
562         "Ignore HSTS for partitioned, cross-origin subresource
563         requests"
564         https://bugs.webkit.org/show_bug.cgi?id=178993
565         https://trac.webkit.org/changeset/224661
566
567 2017-11-09  Chris Dumez  <cdumez@apple.com>
568
569         ServiceWorkerRegistration objects may get recycled for different SWServerRegistration objects
570         https://bugs.webkit.org/show_bug.cgi?id=179517
571
572         Reviewed by Brady Eidson.
573
574         * Scripts/webkit/messages.py:
575         (forward_declarations_and_headers):
576         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
577         (WebKit::WebSWServerConnection::updateRegistrationStateInClient):
578         (WebKit::WebSWServerConnection::fireUpdateFoundEvent):
579         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
580         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
581         * WebProcess/Storage/WebSWClientConnection.cpp:
582         (WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer):
583         (WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer):
584         * WebProcess/Storage/WebSWClientConnection.h:
585         * WebProcess/Storage/WebSWClientConnection.messages.in:
586
587 2017-11-09  John Wilander  <wilander@apple.com>
588
589         Ignore HSTS for partitioned, cross-origin subresource requests
590         https://bugs.webkit.org/show_bug.cgi?id=178993
591         <rdar://problem/34962462>
592
593         Reviewed by Brent Fulgham.
594
595         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
596         (downgradeRequest):
597             Convenience function to downgrade a request if
598             CFNetwork as already upgraded it during
599             canonicalization. This allows the rest of 
600             WebKit's processing to function, such as UIR
601             and mixed content blocking.
602         (updateIgnoreStrictTransportSecuritySettingIfNecessary):
603             Adds and removed the ignore request accordingly.
604         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
605             Now asks CFNetwork to ignore HSTS on resource loads we
606             partition cookies for.
607         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
608             Now asks CFNetwork to ignore HSTS on resource loads we
609             partition cookies for.
610
611 2017-11-09  Chris Dumez  <cdumez@apple.com>
612
613         Implement real post 'install' event steps of the Install algorithm (steps 14+)
614         https://bugs.webkit.org/show_bug.cgi?id=179401
615
616         Reviewed by Brady Eidson.
617
618         Implement step 14+ of Install algorithm, as per:
619         - https://w3c.github.io/ServiceWorker/#installation-algorithm
620
621         * Scripts/webkit/messages.py:
622         (headers_for_type):
623         * Shared/WebCoreArgumentCoders.h:
624         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
625         (WebKit::WebSWServerConnection::resolveRegistrationJobInClient):
626         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
627         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
628         * WebProcess/Storage/WebSWClientConnection.cpp:
629         (WebKit::WebSWClientConnection::didResolveRegistrationPromise):
630         * WebProcess/Storage/WebSWClientConnection.h:
631         * WebProcess/Storage/WebSWClientConnection.messages.in:
632
633 2017-11-09  Megan Gardner  <megan_gardner@apple.com>
634
635         Clean out unused selection items from UIKitSPI
636         https://bugs.webkit.org/show_bug.cgi?id=179459
637
638         Reviewed by Tim Horton.
639
640         Many of these should have been removed from previous commits, but they were missed.
641         None of these enums or methods are being used by WebKit anymore, and removing them will keep things
642         clean and allow UIKit to remove things that are not used at all by anyone anymore.
643
644         * Platform/spi/ios/UIKitSPI.h:
645
646 2017-11-09  Christopher Reid  <chris.reid@sony.com>
647
648         Use enum classes within FileSystem
649         https://bugs.webkit.org/show_bug.cgi?id=175172
650
651         Reviewed by Darin Adler.
652
653         * NetworkProcess/Downloads/BlobDownloadClient.cpp:
654         * NetworkProcess/NetworkDataTaskBlob.cpp:
655         * NetworkProcess/cache/NetworkCache.cpp:
656         * NetworkProcess/capture/NetworkCaptureManager.cpp:
657         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
658         * Shared/WebMemorySampler.cpp:
659         * UIProcess/API/APIContentRuleListStore.cpp:
660         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
661
662 2017-11-09  Youenn Fablet  <youenn@apple.com>
663
664         ServiceWorkerClientFetch should create not null ResourceError
665         https://bugs.webkit.org/show_bug.cgi?id=179485
666
667         Reviewed by Darin Adler.
668
669         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
670         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
671
672 2017-11-09  Andy Estes  <aestes@apple.com>
673
674         [iOS] Adopt UIPreviewDataAttachmentListIsContentManaged
675         https://bugs.webkit.org/show_bug.cgi?id=179458
676         <rdar://problem/35034691>
677
678         Reviewed by Dan Bernstein.
679
680         * Platform/spi/ios/UIKitSPI.h:
681         * UIProcess/ios/WKContentViewInteraction.mm:
682         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
683
684 2017-11-08  Joseph Pecoraro  <pecoraro@apple.com>
685
686         Include a more complete block signature in public headers to avoid potential -Wstrict-prototypes warnings
687         https://bugs.webkit.org/show_bug.cgi?id=179466
688
689         Reviewed by Dan Bernstein.
690
691         * UIProcess/API/Cocoa/WKHTTPCookieStore.h:
692         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
693         (-[WKHTTPCookieStore setCookie:completionHandler:]):
694         (-[WKHTTPCookieStore deleteCookie:completionHandler:]):
695
696 2017-11-08  Jeremy Jones  <jeremyj@apple.com>
697
698         Make WKFullScreenWidnowController more robust against modification by the embedding app.
699         https://bugs.webkit.org/show_bug.cgi?id=179413
700         rdar://problem/35408061
701
702         Reviewed by Darin Adler.
703
704         Present fullscreen UViewController in a separate UIWindow to prevent interaction with the embedding app's
705         UIViewController hierarchy.
706
707         Immediately tear down the fullscreen interface if the embedding app removes the WKWebView from the fullscreen window.
708         This prevents the fullscreen interface from getting into an invalid state.
709
710         Preserve scrollView.zoomScale because it is not effectively preserved by the more indirect _viewScale.
711
712         Use a custom root view controller to allow hiding of the status bar.
713
714         Remove the no-longer-necessary dispatch_after calls during enter and exit fullscreen.
715
716         * UIProcess/API/Cocoa/WKWebView.mm:
717         (-[WKWebView removeFromSuperview]):
718         * UIProcess/ios/WKFullScreenWindowControllerIOS.h:
719         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
720         (WebKit::WKWebViewState::applyTo):
721         (WebKit::WKWebViewState::store):
722         (-[_WKFullScreenViewController loadView]):
723         (-[_WKFullscreenRootViewController prefersStatusBarHidden]):
724         (-[WKFullScreenWindowController enterFullScreen]):
725         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
726         (-[WKFullScreenWindowController completedExitFullScreen]):
727         (-[WKFullScreenWindowController exitFullscreenImmediately]):
728         (-[WKFullScreenWindowController close]):
729         (-[WKFullScreenWindowController webViewDidRemoveFromSuperviewWhileInFullscreen]):
730         (-[_WKFullScreenViewController viewDidDisappear:]): Deleted.
731
732 2017-11-08  Jeremy Jones  <jeremyj@apple.com>
733
734         HTMLMediaElement should not use element fullscreen on iOS
735         https://bugs.webkit.org/show_bug.cgi?id=179418
736         rdar://problem/35409277
737
738         Reviewed by Eric Carlson.
739
740         Add ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN to determine if HTMLMediaElement should use element full screen or not.
741
742         * Configurations/FeatureDefines.xcconfig:
743
744 2017-11-08  Wenson Hsieh  <wenson_hsieh@apple.com>
745
746         [Attachment Support] Implement delegate hooks for attachment element insertion and removal
747         https://bugs.webkit.org/show_bug.cgi?id=179016
748         <rdar://problem/35250890>
749
750         Reviewed by Tim Horton.
751
752         See WebCore/ChangeLog for more details.
753
754         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
755         * UIProcess/API/Cocoa/WKWebView.mm:
756         (-[WKWebView _didInsertAttachment:]):
757         (-[WKWebView _didRemoveAttachment:]):
758         * UIProcess/API/Cocoa/WKWebViewInternal.h:
759         * UIProcess/Cocoa/PageClientImplCocoa.h:
760         * UIProcess/Cocoa/PageClientImplCocoa.mm:
761         (WebKit::PageClientImplCocoa::didInsertAttachment):
762         (WebKit::PageClientImplCocoa::didRemoveAttachment):
763         * UIProcess/PageClient.h:
764         (WebKit::PageClient::didInsertAttachment):
765         (WebKit::PageClient::didRemoveAttachment):
766         * UIProcess/WebPageProxy.cpp:
767         (WebKit::WebPageProxy::didInsertAttachment):
768         (WebKit::WebPageProxy::didRemoveAttachment):
769         * UIProcess/WebPageProxy.h:
770         * UIProcess/WebPageProxy.messages.in:
771         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
772         (WebKit::WebEditorClient::didInsertAttachment):
773         (WebKit::WebEditorClient::didRemoveAttachment):
774         * WebProcess/WebCoreSupport/WebEditorClient.h:
775
776 2017-11-08  Carlos Garcia Campos  <cgarcia@igalia.com>
777
778         REGRESSION(r223773): [GTK] WebKitWebInspector bring-to-front signal is emitted right after open-window
779         https://bugs.webkit.org/show_bug.cgi?id=179365
780
781         Reviewed by Michael Catanzaro.
782
783         In the GTK+ API, open-window already implies presenting the window to bring it to the front, so it's not
784         expected that bring-to-front is emitted on open. This is happening since r223773 that moved common code from
785         platform specific inspector files to the main file, but in the case of open the mac implementation was not
786         exactly the same as the GTK+ one. This broke /webkit2/WebKitWebInspector/default and
787         /webkit2/WebKitWebInspector/manual-attach-detach.
788
789         * UIProcess/WebInspectorProxy.cpp:
790         (WebKit::WebInspectorProxy::open): Set m_isOpening for the scope of the function.
791         * UIProcess/WebInspectorProxy.h: Add m_isOpening.
792         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
793         (WebKit::WebInspectorProxy::platformBringToFront): Return early if m_isOpening is true.
794
795 2017-11-07  Carlos Garcia Campos  <cgarcia@igalia.com>
796
797         REGRESSION(r224179): [GTK] Several WebViewEditor tests are failing since r224179
798         https://bugs.webkit.org/show_bug.cgi?id=179366
799
800         Reviewed by Michael Catanzaro.
801
802         In r224179, webkit_web_view_can_execute_editing_command() was optimized to use the sync path for commands
803         supported by the WebViewEditorState, but the state requires a redraw to be up to date. We can't know if
804         WebViewEditorState is in sync, when webkit_web_view_can_execute_editing_command() is called, so we always need
805         to ask the web process.
806
807         * UIProcess/API/glib/WebKitWebView.cpp:
808         (webkit_web_view_can_execute_editing_command):
809
810 2017-11-07  Carlos Garcia Campos  <cgarcia@igalia.com>
811
812         [GTK][WPE] Build inspector resources using copy-user-interface-resources.pl script
813         https://bugs.webkit.org/show_bug.cgi?id=179317
814
815         Reviewed by Michael Catanzaro.
816
817         This is the script used by Apple and it has several advantages:
818
819           - It allows to combine and minify most of the js and css files, which improves performance and binary size.
820           - It removes the debug resources and assertions in production builds.
821           - It allows to remove the test resources in production builds.
822
823         The patch also moves the common cmake code to generate the resources to a new file InspectorGResources.cmake included
824         by GTK+ and WPE platform cmake files.
825
826         * InspectorGResources.cmake: Added.
827         * PlatformGTK.cmake:
828         * PlatformWPE.cmake:
829
830 2017-11-07  Jeremy Jones  <jeremyj@apple.com>
831
832         Add downcast support for FullscreenClient.
833         https://bugs.webkit.org/show_bug.cgi?id=178824
834
835         Reviewed by Simon Fraser.
836
837         Add SPECIALIZE_TYPE_TRAITS macros for API::FullscreenClient and WebKit::Fullscreen client so 
838         downcasts can be done safely.
839
840         * UIProcess/API/APIFullscreenClient.h:
841         (API::FullscreenClient::isType const):
842         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
843         (WKPageSetFullscreenDelegate):
844         (WKPageGetFullscreenDelegate):
845         * UIProcess/API/Cocoa/WKWebView.mm:
846         (-[WKWebView _setFullscreenDelegate:]):
847         (-[WKWebView _fullscreenDelegate]):
848         * UIProcess/Cocoa/FullscreenClient.h:
849         (isType):
850         * UIProcess/Cocoa/FullscreenClient.mm:
851
852 2017-11-07  Brady Eidson  <beidson@apple.com>
853
854         Implement "UpdateWorkerState" and use it
855         https://bugs.webkit.org/show_bug.cgi?id=179318
856
857         Reviewed by Chris Dumez.
858
859         * Scripts/webkit/messages.py:
860         (headers_for_type):
861         * Shared/WebCoreArgumentCoders.h:
862  
863        * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
864         (WebKit::WebSWServerConnection::updateWorkerStateInClient):
865         (WebKit::WebSWServerConnection::installServiceWorkerContext):
866         (WebKit::WebSWServerConnection::setContextConnection):
867         (WebKit::WebSWServerConnection::updateServiceWorkerContext): Deleted.
868         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
869
870         * WebProcess/Storage/WebSWClientConnection.messages.in:
871
872         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
873         (WebKit::WebSWContextManagerConnection::installServiceWorker):
874         (WebKit::WebSWContextManagerConnection::updateServiceWorker): Deleted.
875         * WebProcess/Storage/WebSWContextManagerConnection.h:
876         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
877
878 2017-11-07  Commit Queue  <commit-queue@webkit.org>
879
880         Unreviewed, rolling out r224512 and r224521.
881         https://bugs.webkit.org/show_bug.cgi?id=179388
882
883         An API test added with this change is failing an assertion on
884         the bots. (Requested by ryanhaddad on #webkit).
885
886         Reverted changesets:
887
888         "[Attachment Support] Implement delegate hooks for attachment
889         element insertion and removal"
890         https://bugs.webkit.org/show_bug.cgi?id=179016
891         https://trac.webkit.org/changeset/224512
892
893         "Remove stray logging from a newly added API test"
894         https://trac.webkit.org/changeset/224521
895
896 2017-11-07  Chris Dumez  <cdumez@apple.com>
897
898         [Service Workers] Add support for "install" event
899         https://bugs.webkit.org/show_bug.cgi?id=179338
900
901         Reviewed by Youenn Fablet.
902
903         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
904         (WebKit::WebSWServerConnection::firePostInstallEvents):
905         (WebKit::WebSWServerConnection::fireInstallEvent):
906         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
907         * StorageProcess/StorageProcess.cpp:
908         (WebKit::StorageProcess::didFinishServiceWorkerInstall):
909         * StorageProcess/StorageProcess.h:
910         * StorageProcess/StorageProcess.messages.in:
911         * WebProcess/Storage/WebSWClientConnection.messages.in:
912         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
913         (WebKit::WebSWContextManagerConnection::fireInstallEvent):
914         (WebKit::WebSWContextManagerConnection::didFinishInstall):
915         * WebProcess/Storage/WebSWContextManagerConnection.h:
916         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
917
918 2017-11-07  Youenn Fablet  <youenn@apple.com>
919
920         Support the case of fetch events that are not responded
921         https://bugs.webkit.org/show_bug.cgi?id=179336
922
923         Reviewed by Chris Dumez.
924
925         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
926         (WebKit::WebServiceWorkerFetchTaskClient::didNotHandle):
927         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
928
929 2017-11-06  Alex Christensen  <achristensen@webkit.org>
930
931         Make ResourceLoader::willSendRequestInternal asynchronous
932         https://bugs.webkit.org/show_bug.cgi?id=179251
933
934         Reviewed by Andy Estes.
935
936         * WebProcess/Network/WebLoaderStrategy.cpp:
937         (WebKit::WebLoaderStrategy::loadResource):
938         (WebKit::WebLoaderStrategy::schedulePluginStreamLoad):
939         * WebProcess/Network/WebLoaderStrategy.h:
940         * WebProcess/Plugins/PluginView.cpp:
941         (WebKit::PluginView::Stream::start):
942
943 2017-11-06  Wenson Hsieh  <wenson_hsieh@apple.com>
944
945         [Attachment Support] Implement delegate hooks for attachment element insertion and removal
946         https://bugs.webkit.org/show_bug.cgi?id=179016
947         <rdar://problem/35250890>
948
949         Reviewed by Tim Horton.
950
951         Adds boilerplate plumbing to WebEditorClient, WebPage, and the usual machinery in the UI process to notify
952         WebKit2 clients when attachment elements have been inserted or removed from the document. See the WebCore
953         ChangeLog for more details about the implementation, or the Tools ChangeLog for more information about new API
954         tests.
955
956         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
957         * UIProcess/API/Cocoa/WKWebView.mm:
958         (-[WKWebView _didInsertAttachment:]):
959         (-[WKWebView _didRemoveAttachment:]):
960         * UIProcess/API/Cocoa/WKWebViewInternal.h:
961         * UIProcess/Cocoa/PageClientImplCocoa.h:
962         * UIProcess/Cocoa/PageClientImplCocoa.mm:
963         (WebKit::PageClientImplCocoa::didInsertAttachment):
964         (WebKit::PageClientImplCocoa::didRemoveAttachment):
965         * UIProcess/PageClient.h:
966         (WebKit::PageClient::didInsertAttachment):
967         (WebKit::PageClient::didRemoveAttachment):
968         * UIProcess/WebPageProxy.cpp:
969         (WebKit::WebPageProxy::didInsertAttachment):
970         (WebKit::WebPageProxy::didRemoveAttachment):
971         * UIProcess/WebPageProxy.h:
972         * UIProcess/WebPageProxy.messages.in:
973         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
974         (WebKit::WebEditorClient::didInsertAttachment):
975         (WebKit::WebEditorClient::didRemoveAttachment):
976         * WebProcess/WebCoreSupport/WebEditorClient.h:
977
978 2017-11-06  Jeremy Jones  <jeremyj@apple.com>
979
980         iOS element fullscreen should use a UIGestureRecognizer to detect user interaction.
981         https://bugs.webkit.org/show_bug.cgi?id=179029
982         rdar://problem/35307882
983
984         Reviewed by Simon Fraser.
985
986         Replace _WKTapDelegatingView with a UILongPressGestureRecognizer. When set with a duration of 0, it effectively
987         recognizes UITouchBegin events.
988
989         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
990         (-[_WKFullScreenViewController loadView]):
991         (-[_WKFullScreenViewController gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
992         (-[_WKTapDelegatingView setTarget:action:]): Deleted.
993         (-[_WKTapDelegatingView hitTest:withEvent:]): Deleted.
994
995 2017-11-06  Chris Dumez  <cdumez@apple.com>
996
997         [Service Workers] Add proper implementation for 'updatefound' event
998         https://bugs.webkit.org/show_bug.cgi?id=179302
999
1000         Reviewed by Brady Eidson.
1001
1002         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1003         (WebKit::WebSWServerConnection::fireUpdateFoundEvent):
1004         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1005         * WebProcess/Storage/WebSWClientConnection.messages.in:
1006
1007 2017-11-06  Christopher Reid  <chris.reid@sony.com>
1008
1009         Use enum classes within FileSystem
1010         https://bugs.webkit.org/show_bug.cgi?id=175172
1011
1012         Reviewed by Myles C. Maxfield.
1013
1014         * NetworkProcess/Downloads/BlobDownloadClient.cpp:
1015         * NetworkProcess/NetworkDataTaskBlob.cpp:
1016         * NetworkProcess/cache/NetworkCache.cpp:
1017         * NetworkProcess/capture/NetworkCaptureManager.cpp:
1018         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
1019         * Shared/WebMemorySampler.cpp:
1020         * UIProcess/API/APIContentRuleListStore.cpp:
1021         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
1022
1023 2017-11-06  Michael Catanzaro  <mcatanzaro@igalia.com>
1024
1025         [WPE] Properly use SYSTEM_INCLUDE_DIRECTORIES for WebKit build target
1026         https://bugs.webkit.org/show_bug.cgi?id=179097
1027
1028         Reviewed by Žan Doberšek.
1029
1030         * PlatformWPE.cmake:
1031
1032 2017-11-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1033
1034         JIT call inline caches should cache calls to objects with getCallData/getConstructData traps
1035         https://bugs.webkit.org/show_bug.cgi?id=144458
1036
1037         Reviewed by Saam Barati.
1038
1039         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
1040         (WebKit::JSNPMethod::JSNPMethod):
1041         (WebKit::JSNPMethod::getCallData): Deleted.
1042         * WebProcess/Plugins/Netscape/JSNPMethod.h:
1043         (WebKit::JSNPMethod::createStructure):
1044
1045 2017-11-04  Chris Dumez  <cdumez@apple.com>
1046
1047         REGRESSION(r223718): Leaking WebProcessPool after reconfiguration
1048         https://bugs.webkit.org/show_bug.cgi?id=179123
1049         <rdar://problem/35294685>
1050
1051         Reviewed by Geoff Garen.
1052
1053         Make sure we destroy the ServiceWorker WebProcess once all other WebProcesses
1054         go away at there is no use keeping it running at this point. Also, this prevents
1055         leaking the WebProcessPool since the WebProcessProxy holds a strong reference
1056         to the WebProcessPool.
1057
1058         * UIProcess/WebProcessPool.cpp:
1059         (WebKit::WebProcessPool::disconnectProcess):
1060
1061 2017-11-01  Darin Adler  <darin@apple.com>
1062
1063         Simplify event dispatch code and make it a bit more consistent
1064         https://bugs.webkit.org/show_bug.cgi?id=178991
1065
1066         Reviewed by Chris Dumez.
1067
1068         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEvent.cpp:
1069         (webkit_dom_event_get_src_element): Call target instead of srcElement.
1070
1071 2017-11-04  Aishwarya Nirmal  <anirmal@apple.com>
1072
1073         [Touch Bar Web API] Add support for menuitem tag
1074         https://bugs.webkit.org/show_bug.cgi?id=179020
1075
1076         Reviewed by Ryosuke Niwa.
1077
1078         Adds in the MenuItemElementEnabled flag so that the menu item element is a runtime-
1079         enabled feature. It has a default value of false.
1080
1081         * Shared/WebPreferences.yaml:
1082         * UIProcess/API/C/WKPreferences.cpp:
1083         (WKPreferencesSetMenuItemElementEnabled):
1084         (WKPreferencesGetMenuItemElementEnabled):
1085         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1086
1087 2017-11-03  Chris Dumez  <cdumez@apple.com>
1088
1089         Unreviewed, rolling out r224438.
1090
1091         Has caused assertions on the bots
1092
1093         Reverted changeset:
1094
1095         "REGRESSION(r223718): Leaking WebProcessPool after
1096         reconfiguration"
1097         https://bugs.webkit.org/show_bug.cgi?id=179123
1098         https://trac.webkit.org/changeset/224438
1099
1100 2017-11-03  Youenn Fablet  <youenn@apple.com>
1101
1102         Requests handled by Service Worker should not go through preflighting
1103         https://bugs.webkit.org/show_bug.cgi?id=179250
1104
1105         Reviewed by Alex Christensen.
1106
1107         * WebProcess/Network/WebLoaderStrategy.cpp:
1108         (WebKit::WebLoaderStrategy::scheduleLoad):
1109         * WebProcess/Storage/WebSWClientConnection.cpp:
1110         (WebKit::WebSWClientConnection::startFetch):
1111         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
1112         (WebKit::shouldHandleFetch):
1113
1114 2017-11-03  Chris Dumez  <cdumez@apple.com>
1115
1116         REGRESSION(r223718): Leaking WebProcessPool after reconfiguration
1117         https://bugs.webkit.org/show_bug.cgi?id=179123
1118         <rdar://problem/35294685>
1119
1120         Reviewed by Geoffrey Garen.
1121
1122         Make sure we destroy the ServiceWorker WebProcess once all other WebProcesses
1123         go away at there is no use keeping it running at this point. Also, this prevents
1124         leaking the WebProcessPool since the WebProcessProxy holds a strong reference
1125         to the WebProcessPool.
1126
1127         * UIProcess/WebProcessPool.cpp:
1128         (WebKit::WebProcessPool::disconnectProcess):
1129
1130 2017-11-03  Youenn Fablet  <youenn@apple.com>
1131
1132         Implement Service Worker Matching Registration algorithm
1133         https://bugs.webkit.org/show_bug.cgi?id=178882
1134
1135         Reviewed by Chris Dumez.
1136
1137         Added IPC plumbery for matchRegistration request and response.
1138         Added some limited clearing of workers and registrations.
1139
1140         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1141         (WebKit::WebSWServerConnection::matchRegistration):
1142         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1143         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1144         * StorageProcess/StorageProcess.cpp:
1145         (WebKit::StorageProcess::deleteWebsiteData):
1146         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
1147         * WebProcess/Storage/WebSWClientConnection.cpp:
1148         (WebKit::WebSWClientConnection::didMatchRegistration):
1149         (WebKit::WebSWClientConnection::matchRegistration):
1150         * WebProcess/Storage/WebSWClientConnection.h:
1151         * WebProcess/Storage/WebSWClientConnection.messages.in:
1152         * WebProcess/Storage/WebServiceWorkerProvider.h:
1153
1154 2017-11-03  Jeremy Jones  <jeremyj@apple.com>
1155
1156         Element fullscreen should use FloatRects instead of IntRects in beganEnterFullScreenWithInitialFrame
1157         https://bugs.webkit.org/show_bug.cgi?id=179033
1158         rdar://problem/35309279
1159         
1160         Reviewed by Darin Adler.
1161
1162         Screen coordinates are floats, so use NSRect instead of IntRect on Mac.
1163
1164         * UIProcess/mac/WKFullScreenWindowController.h:
1165         * UIProcess/mac/WKFullScreenWindowController.mm:
1166         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
1167         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
1168
1169 2017-11-03  Chris Dumez  <cdumez@apple.com>
1170
1171         Use a single identifier type to identify Service Workers
1172         https://bugs.webkit.org/show_bug.cgi?id=179192
1173
1174         Reviewed by Brady Eidson.
1175
1176         Use a single identifier type to identify Service Workers. We had both a String
1177         identifier and a uint64_t identifier for each service worker. We now consistently
1178         use a ServiceWorkerIdentifier which is a strongly typed identifier backed by a
1179         uint64_t.
1180
1181         * Scripts/webkit/messages.py:
1182         (forward_declarations_and_headers):
1183         (forward_declarations_and_headers.templates):
1184         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1185         (WebKit::WebSWServerConnection::startFetch):
1186         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
1187         (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient):
1188         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1189         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1190         * StorageProcess/StorageProcess.cpp:
1191         (WebKit::StorageProcess::serviceWorkerContextFailedToStart):
1192         (WebKit::StorageProcess::serviceWorkerContextStarted):
1193         (WebKit::StorageProcess::postMessageToServiceWorkerClient):
1194         * StorageProcess/StorageProcess.h:
1195         * StorageProcess/StorageProcess.messages.in:
1196         * WebProcess/Storage/WebSWClientConnection.cpp:
1197         (WebKit::WebSWClientConnection::postMessageToServiceWorkerGlobalScope):
1198         (WebKit::WebSWClientConnection::postMessageToServiceWorkerClient):
1199         * WebProcess/Storage/WebSWClientConnection.h:
1200         * WebProcess/Storage/WebSWClientConnection.messages.in:
1201         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1202         (WebKit::WebSWContextManagerConnection::updateServiceWorker):
1203         (WebKit::WebSWContextManagerConnection::serviceWorkerStartedWithMessage):
1204         (WebKit::WebSWContextManagerConnection::startFetch):
1205         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerGlobalScope):
1206         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerClient):
1207         * WebProcess/Storage/WebSWContextManagerConnection.h:
1208         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1209
1210 2017-11-03  Antti Koivisto  <antti@apple.com>
1211
1212         Enable display:contents by default as experimental feature
1213         https://bugs.webkit.org/show_bug.cgi?id=179239
1214         <rdar://problem/35334612>
1215
1216         Reviewed by Darin Adler.
1217
1218         We pass most of the WPT tests. What remains is mostly flexbox related edge cases.
1219
1220         * Shared/WebPreferences.yaml:
1221
1222 2017-11-03  Frederic Wang  <fwang@igalia.com>
1223
1224         Use WK_IOS_TBA instead of WK_MAC_TBA to indicate availability of private functions on iOS
1225         https://bugs.webkit.org/show_bug.cgi?id=179238
1226
1227         Reviewed by Darin Adler.
1228
1229         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1230         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1231
1232 2017-11-02  Maciej Stachowiak  <mjs@apple.com>
1233
1234         Don't try to guess plugin MIME type from a file extension in a URL (no observable effect)
1235         https://bugs.webkit.org/show_bug.cgi?id=178333
1236
1237         Reviewed by Darin Adler.
1238
1239         * WebProcess/Plugins/PluginView.cpp:
1240         (WebKit::PluginView::pluginDidReceiveUserInteraction): loadedMIMEType --> serviceType
1241         * WebProcess/WebPage/WebPage.cpp:
1242         (WebKit::WebPage::determinePrimarySnapshottedPlugIn): ditto
1243
1244 2017-11-02  Brady Eidson  <beidson@apple.com>
1245
1246         SW: Implement "Update Registration State" algorithm (unused for now)
1247         https://bugs.webkit.org/show_bug.cgi?id=179186
1248
1249         Reviewed by Chris Dumez.
1250
1251         * Scripts/webkit/messages.py:
1252         (headers_for_type):
1253
1254         * Shared/WebCoreArgumentCoders.h:
1255
1256         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1257         (WebKit::WebSWServerConnection::updateRegistrationStateInClient):
1258         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1259         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1260
1261         * WebProcess/Storage/WebSWClientConnection.cpp:
1262         (WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer):
1263         (WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer):
1264         * WebProcess/Storage/WebSWClientConnection.h:
1265         * WebProcess/Storage/WebSWClientConnection.messages.in:
1266
1267 2017-11-02  Alex Christensen  <achristensen@webkit.org>
1268
1269         Use CompletionHandlers for redirects
1270         https://bugs.webkit.org/show_bug.cgi?id=179163
1271
1272         Reviewed by Tim Horton.
1273
1274         * NetworkProcess/Downloads/BlobDownloadClient.cpp:
1275         (WebKit::BlobDownloadClient::willSendRequestAsync):
1276         * NetworkProcess/Downloads/BlobDownloadClient.h:
1277         * NetworkProcess/NetworkDataTask.h:
1278         * NetworkProcess/NetworkLoad.cpp:
1279         (WebKit::NetworkLoad::~NetworkLoad):
1280         (WebKit::NetworkLoad::continueWillSendRequest):
1281         (WebKit::NetworkLoad::willSendRequestAsync):
1282         * NetworkProcess/NetworkLoad.h:
1283         * NetworkProcess/NetworkLoadClient.h:
1284         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1285         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
1286         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
1287         * UIProcess/API/APIDownloadClient.h:
1288         (API::DownloadClient::willSendRequest):
1289         * UIProcess/API/C/WKContext.cpp:
1290         (WKContextSetDownloadClient):
1291         * UIProcess/Cocoa/DownloadClient.h:
1292         * UIProcess/Cocoa/DownloadClient.mm:
1293         (WebKit::DownloadClient::willSendRequest):
1294         * WebProcess/Network/WebResourceLoader.cpp:
1295         (WebKit::WebResourceLoader::willSendRequest):
1296         * WebProcess/Plugins/PluginView.cpp:
1297         (WebKit::PluginView::Stream::~Stream):
1298         (WebKit::PluginView::Stream::continueLoad):
1299         (WebKit::PluginView::Stream::willSendRequest):
1300         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
1301
1302 2017-11-02  Christopher Reid  <chris.reid@sony.com>
1303
1304         Add a FileSystem namespace to FileSystem.cpp
1305         https://bugs.webkit.org/show_bug.cgi?id=179063
1306
1307         Reviewed by Darin Adler.
1308
1309         * NetworkProcess/Downloads/BlobDownloadClient.cpp:
1310         * NetworkProcess/Downloads/BlobDownloadClient.h:
1311         * NetworkProcess/NetworkDataTaskBlob.cpp:
1312         * NetworkProcess/NetworkDataTaskBlob.h:
1313         * NetworkProcess/NetworkProcess.cpp:
1314         * NetworkProcess/cache/CacheStorageEngine.cpp:
1315         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1316         * NetworkProcess/cache/NetworkCache.cpp:
1317         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
1318         * NetworkProcess/cache/NetworkCacheData.cpp:
1319         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
1320         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
1321         * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
1322         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
1323         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1324         * NetworkProcess/capture/NetworkCaptureManager.cpp:
1325         * NetworkProcess/capture/NetworkCaptureManager.h:
1326         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
1327         * NetworkProcess/capture/NetworkCaptureResource.h:
1328         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1329         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1330         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1331         * Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp:
1332         * Shared/Plugins/unix/PluginSearchPath.cpp:
1333         * Shared/WebMemorySampler.cpp:
1334         * Shared/WebMemorySampler.h:
1335         * Shared/gtk/ProcessExecutablePathGtk.cpp:
1336         * Shared/ios/ChildProcessIOS.mm:
1337         * Shared/mac/ChildProcessMac.mm:
1338         * Shared/mac/SandboxExtensionMac.mm:
1339         * Shared/wpe/ProcessExecutablePathWPE.cpp:
1340         * StorageProcess/StorageProcess.cpp:
1341         * UIProcess/API/APIContentRuleListStore.cpp:
1342         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
1343         * UIProcess/API/glib/IconDatabase.cpp:
1344         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
1345         * UIProcess/API/glib/WebKitFileChooserRequest.cpp:
1346         * UIProcess/API/glib/WebKitWebContext.cpp:
1347         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
1348         * UIProcess/Automation/WebAutomationSession.cpp:
1349         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1350         * UIProcess/Cocoa/WebViewImpl.mm:
1351         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
1352         * UIProcess/Plugins/gtk/PluginInfoCache.cpp:
1353         * UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp:
1354         * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
1355         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
1356         * UIProcess/WebStorage/LocalStorageDatabase.cpp:
1357         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
1358         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1359         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1360         * UIProcess/gtk/WebProcessPoolGtk.cpp:
1361         * UIProcess/mac/WebPageProxyMac.mm:
1362         * UIProcess/wpe/WebProcessPoolWPE.cpp:
1363         * WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.cpp:
1364         * WebProcess/InjectedBundle/glib/InjectedBundleGlib.cpp:
1365         * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
1366         * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp:
1367         * WebProcess/Plugins/Netscape/NetscapePluginStream.h:
1368         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
1369
1370 2017-11-02  Joseph Pecoraro  <pecoraro@apple.com>
1371
1372         Make ServiceWorker a Remote Inspector debuggable target
1373         https://bugs.webkit.org/show_bug.cgi?id=179043
1374         <rdar://problem/34126008>
1375
1376         Reviewed by Brian Burg.
1377
1378         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h:
1379         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm:
1380         (debuggableTypeString):
1381         Provide a way to start a Remote Web Inspector frontend for a ServiceWorker target type.
1382
1383 2017-11-02  Ryan Haddad  <ryanhaddad@apple.com>
1384
1385         Unreviewed, rolling out r224353.
1386
1387         Breaks internal builds.
1388
1389         Reverted changeset:
1390
1391         "Ignore HSTS for partitioned, cross-origin subresource
1392         requests"
1393         https://bugs.webkit.org/show_bug.cgi?id=178993
1394         https://trac.webkit.org/changeset/224353
1395
1396 2017-11-02  John Wilander  <wilander@apple.com>
1397
1398         Ignore HSTS for partitioned, cross-origin subresource requests
1399         https://bugs.webkit.org/show_bug.cgi?id=178993
1400         <rdar://problem/34962462>
1401
1402         Reviewed by Brent Fulgham and Alex Christensen.
1403
1404         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1405         (downgradeRequest):
1406             Convenience function to downgrade a request if
1407             CFNetwork as already upgraded it during
1408             canonicalization. This allows the rest of 
1409             WebKit's processing to function, such as UIR
1410             and mixed content blocking.
1411         (updateIgnoreStrictTransportSecuritySettingIfNecessary):
1412             Adds and removed the ignore request accordingly.
1413         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
1414             Now asks CFNetwork to ignore HSTS on resource loads we
1415             partition cookies for.
1416         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
1417             Now asks CFNetwork to ignore HSTS on resource loads we
1418             partition cookies for.
1419
1420 2017-11-02  Yousuke Kimoto  <yousuke.kimoto@sony.com>
1421
1422         [WinCairo] Add IPC files for wincairo webkit
1423         https://bugs.webkit.org/show_bug.cgi?id=177919
1424
1425         Reviewed by Alex Christensen.
1426
1427         * Platform/IPC/Attachment.cpp:
1428         * Platform/IPC/Attachment.h:
1429         (IPC::Attachment::Attachment):
1430         (IPC::Attachment::handle):
1431         * Platform/IPC/Connection.h:
1432         (IPC::Connection::identifierIsNull):
1433         (IPC::Connection::sendWithReply):
1434         * Platform/IPC/win/AttachmentWin.cpp: Added.
1435         (IPC::Attachment::encode const):
1436         (IPC::getDuplicatedHandle):
1437         (IPC::Attachment::decode):
1438         * Platform/IPC/win/ConnectionWin.cpp: Added.
1439         (IPC::Connection::createServerAndClientIdentifiers):
1440         (IPC::Connection::platformInitialize):
1441         (IPC::Connection::platformInvalidate):
1442         (IPC::Connection::readEventHandler):
1443         (IPC::Connection::writeEventHandler):
1444         (IPC::Connection::open):
1445         (IPC::Connection::platformCanSendOutgoingMessages const):
1446         (IPC::Connection::sendOutgoingMessage):
1447         (IPC::Connection::willSendSyncMessage):
1448         (IPC::Connection::didReceiveSyncReply):
1449         * PlatformWin.cmake:
1450
1451 2017-11-02  Megan Gardner  <megan_gardner@apple.com>
1452
1453         Early out selection update when data is not present
1454         https://bugs.webkit.org/show_bug.cgi?id=179084
1455
1456         Reviewed by Ryosuke Niwa.
1457
1458         We should early out of a selection update when we do not have the data that is necessary to make that
1459         update. This mostly helps avoid debug asserts, but will be helpful with the selection changes that are
1460         ongoing.
1461
1462         * UIProcess/ios/WKContentViewInteraction.mm:
1463         (-[WKContentView _updateChangedSelection:]):
1464
1465 2017-11-02  Eric Carlson  <eric.carlson@apple.com>
1466
1467         [MediaStream] audioTrack.label is always empty on macOS
1468         https://bugs.webkit.org/show_bug.cgi?id=179175
1469         <rdar://problem/35315438>
1470
1471         Reviewed by Youenn Fablet.
1472
1473         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
1474         (WebKit::UserMediaCaptureManager::createCaptureSource): Pass settings.label to Source constructor.
1475
1476 2017-11-02  Frederic Wang  <fwang@igalia.com>
1477
1478         Add references to bug 179167 in FIXME comments
1479         https://bugs.webkit.org/show_bug.cgi?id=179168
1480
1481         Reviewed by Daniel Bates.
1482
1483         * Configurations/FeatureDefines.xcconfig:
1484
1485 2017-11-01  Jeremy Jones  <jeremyj@apple.com>
1486
1487         Implement WKFullscreenWindowController for iOS.
1488         https://bugs.webkit.org/show_bug.cgi?id=178924
1489         rdar://problem/34697120
1490
1491         Reviewed by Simon Fraser.
1492
1493         Plumb relevant calls through WKWebView and PageClientImplIOS.
1494
1495         This forms the base implementation for element fullscreen. This will animate an element into fullscreen and back to inline.
1496         It does this by replacing the WKWebView with a placeholder image and presenting the WKWebView with a fullscreen view controller.
1497         This also attempts to preserve UI state of the WKWebView when it is placed back inline.
1498
1499         To enable _WKFullscreenDelegate for iOS, this adds an iOS version of the delegate methods that passes WKWebView instead of NSView.
1500         The iOS version of these functions are renamed to be more specific and disambiguate them from the video fullscreen delegate methods.
1501
1502         This also adds an image asset for the done button.
1503
1504         * Configurations/FeatureDefines.xcconfig:
1505         * UIProcess/API/Cocoa/WKWebView.mm:
1506         (-[WKWebView hasFullScreenWindowController]):
1507         (-[WKWebView fullScreenWindowController]):
1508         (-[WKWebView closeFullScreenWindowController]):
1509         (-[WKWebView fullScreenPlaceholderView]):
1510         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1511         * UIProcess/API/Cocoa/_WKFullscreenDelegate.h:
1512         * UIProcess/Cocoa/FullscreenClient.h:
1513         * UIProcess/Cocoa/FullscreenClient.mm:
1514         (WebKit::FullscreenClient::FullscreenClient):
1515         (WebKit::FullscreenClient::setDelegate):
1516         (WebKit::FullscreenClient::willEnterFullscreen):
1517         (WebKit::FullscreenClient::didEnterFullscreen):
1518         (WebKit::FullscreenClient::willExitFullscreen):
1519         (WebKit::FullscreenClient::didExitFullscreen):
1520         * UIProcess/ios/PageClientImplIOS.mm:
1521         (WebKit::PageClientImpl::closeFullScreenManager):
1522         (WebKit::PageClientImpl::isFullScreen):
1523         (WebKit::PageClientImpl::enterFullScreen):
1524         (WebKit::PageClientImpl::exitFullScreen):
1525         (WebKit::PageClientImpl::beganEnterFullScreen):
1526         (WebKit::PageClientImpl::beganExitFullScreen):
1527         * UIProcess/ios/WKContentView.mm:
1528         * UIProcess/ios/WKFullScreenWindowControllerIOS.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKFullscreenDelegate.h.
1529         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm: Added.
1530         (WebKit::replaceViewWithView):
1531         (WebKit::WKWebViewState::applyTo):
1532         (WebKit::WKWebViewState::store):
1533         (-[_WKTapDelgatingView setTarget:action:]):
1534         (-[_WKTapDelgatingView hitTest:withEvent:]):
1535         (-[_WKFullScreenViewController dealloc]):
1536         (-[_WKFullScreenViewController viewWillTransitionToSize:withTransitionCoordinator:]):
1537         (+[_WKFullScreenViewController configureView:withBackgroundFillOfColor:opacity:filter:]):
1538         (-[_WKFullScreenViewController _updateTransparencyOfVisualEffectView:]):
1539         (-[_WKFullScreenViewController createVisualEffectViewWithFrame:]):
1540         (-[_WKFullScreenViewController loadView]):
1541         (-[_WKFullScreenViewController viewWillAppear:]):
1542         (-[_WKFullScreenViewController viewDidDisappear:]):
1543         (-[_WKFullScreenViewController cancelAction:]):
1544         (-[_WKFullScreenViewController hideCancelButton]):
1545         (-[_WKFullScreenViewController showCancelButton]):
1546         (-[_WKFullScreenViewController setTarget:action:]):
1547         (-[_WKFullScreenViewController prefersStatusBarHidden]):
1548         (-[WKFullscreenAnimationController transitionDuration:]):
1549         (-[WKFullscreenAnimationController animateTransition:]):
1550         (-[WKFullscreenAnimationController animationEnded:]):
1551         (-[WKFullScreenWindowController initWithWebView:page:]):
1552         (-[WKFullScreenWindowController dealloc]):
1553         (-[WKFullScreenWindowController isFullScreen]):
1554         (-[WKFullScreenWindowController webViewPlaceholder]):
1555         (-[WKFullScreenWindowController enterFullScreen]):
1556         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
1557         (-[WKFullScreenWindowController completedEnterFullScreen]):
1558         (-[WKFullScreenWindowController exitFullScreen]):
1559         (-[WKFullScreenWindowController requestExitFullScreen]):
1560         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
1561         (-[WKFullScreenWindowController completedExitFullScreen]):
1562         (-[WKFullScreenWindowController close]):
1563         (-[WKFullScreenWindowController _manager]):
1564         (-[WKFullScreenWindowController animationControllerForPresentedController:presentingController:sourceController:]):
1565         (-[WKFullScreenWindowController animationControllerForDismissedController:]):
1566         * WebKit.xcassets/Contents.json: Added.
1567         * WebKit.xcassets/Done.imageset/Contents.json: Added.
1568         * WebKit.xcassets/Done.imageset/Done.pdf: Added.
1569         * WebKit.xcodeproj/project.pbxproj:
1570         * WebProcess/FullScreen/WebFullScreenManager.cpp:
1571         (WebKit::WebFullScreenManager::willEnterFullScreen):
1572         (WebKit::WebFullScreenManager::willExitFullScreen):
1573
1574 2017-11-01  Daniel Bates  <dabates@apple.com>
1575
1576         XMLHttpRequest should not sniff content encoding
1577         https://bugs.webkit.org/show_bug.cgi?id=175597
1578         <rdar://problem/34912624>
1579
1580         Reviewed by Alex Christensen.
1581
1582         Fixes an issue where the body of an HTTP response with headers "Content-Type: application/octet-stream" and
1583         "Content-Encoding: gzip" associated with an XHR request to a .gz file would not be automatically gzipped
1584         decompressed. Specifically, such a response would be treated analogous to a response with headers
1585         "Content-Type: application/gzip" and "Content-Encoding: identity". This behavior does not conform to the
1586         behavior of the Content-Encoding header as defined in the HTTP 1.1 and later specs. Moreover this behavior
1587         breaks the Epic Zen Garden demo: <https://s3.amazonaws.com/mozilla-games/ZenGarden/EpicZenGarden.html>.
1588
1589         On macOS 10.13.2 opt out of content encoding sniffing when making an XHR request. We likely can
1590         selectively opt out of content encoding sniffing for other network requests. This will be done
1591         in subsequent commits to make it straightforward to identify site breakage (if any).
1592
1593         * NetworkProcess/Downloads/Download.cpp:
1594         (WebKit::Download::start): Enable content encoding sniff to match existing behavior.
1595         (WebKit::Download::startWithHandle): Ditto.
1596         * NetworkProcess/NetworkDataTask.cpp:
1597         (WebKit::NetworkDataTask::create): Pass through the content encoding sniffing policy.
1598         * NetworkProcess/NetworkLoad.cpp:
1599         (WebKit::NetworkLoad::NetworkLoad): Ditto.
1600         * NetworkProcess/NetworkLoadParameters.h:
1601         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1602         (WebKit::NetworkResourceLoadParameters::encode const): Encode content encoding sniffing policy.
1603         (WebKit::NetworkResourceLoadParameters::decode): Decode content encoding sniffing policy.
1604         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
1605         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad): Enable content encoding sniff to match existing
1606         behavior. We should look to disable content encoding sniffing in a subsequent change.
1607         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1608         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1609         (WebKit::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded): Added helper function
1610         to apply sniffing policies and bind request to interface, if applicable.
1611         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Modified to take the content encoding sniffing
1612         policy. Calls applySniffingPoliciesAndBindRequestToInferfaceIfNeeded() to apply this policy. Also use
1613         convenience function URL::isLocalFile() to determine if the URL is a file URL.
1614         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1615         (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup): Pass through the content encoding sniffing policy.
1616         * NetworkProcess/soup/NetworkDataTaskSoup.h:
1617         * WebProcess/Network/WebLoaderStrategy.cpp:
1618         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): Pass through the content encoding sniffing policy.
1619         (WebKit::WebLoaderStrategy::loadResourceSynchronously): Enable content encoding sniff to match existing
1620         behavior.
1621
1622 2017-11-01  Brady Eidson  <beidson@apple.com>
1623
1624         Plumbing for handling SW scripts failing to evaluate
1625         https://bugs.webkit.org/show_bug.cgi?id=178926
1626
1627         Reviewed by Chris Dumez.
1628
1629         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1630         (WebKit::WebSWServerConnection::updateServiceWorkerContext):
1631         (WebKit::WebSWServerConnection::setContextConnection):
1632         (WebKit::WebSWServerConnection::startServiceWorkerContext): Deleted.
1633         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1634
1635         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1636         (WebKit::WebSWContextManagerConnection::updateServiceWorker):
1637         (WebKit::WebSWContextManagerConnection::serviceWorkerStartedWithMessage):
1638         (WebKit::WebSWContextManagerConnection::startServiceWorker): Deleted.
1639         * WebProcess/Storage/WebSWContextManagerConnection.h:
1640         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1641
1642 2017-11-01  Frederic Wang  <fwang@igalia.com>
1643
1644         Make iOS Find UI reveal matches in scrollable elements
1645         https://bugs.webkit.org/show_bug.cgi?id=178789
1646
1647         Reviewed by Tim Horton.
1648
1649         * WebProcess/WebPage/ios/FindControllerIOS.mm:
1650         (WebKit::FindController::didFindString): Reveal selection up to the main frame. The main frame
1651         is handled by the SmartMagnificationController.
1652
1653 2017-11-01  Michael Catanzaro  <mcatanzaro@igalia.com>
1654
1655         REGRESSION(r224192): [WPE] Fix WebEventFactory::createWebWheelEvent
1656         https://bugs.webkit.org/show_bug.cgi?id=179098
1657
1658         Reviewed by Sam Weinig.
1659
1660         * Shared/wpe/WebEventFactory.cpp:
1661         (WebKit::WebEventFactory::createWebWheelEvent):
1662
1663 2017-10-31  Tim Horton  <timothy_horton@apple.com>
1664
1665         Clean up some drag and drop feature flags
1666         https://bugs.webkit.org/show_bug.cgi?id=179082
1667
1668         Reviewed by Simon Fraser.
1669
1670         * Configurations/FeatureDefines.xcconfig:
1671
1672 2017-10-31  Wenson Hsieh  <wenson_hsieh@apple.com>
1673
1674         Followup to r224238: API::Attachment should generate a _WKAttachment ObjC wrapper
1675         https://bugs.webkit.org/show_bug.cgi?id=179080
1676
1677         Reviewed by Tim Horton.
1678
1679         Fixes a failing API test. The new Attachment object type added in r224238 was not actually being handled in
1680         Object::newObject, so a plain WKObject Objective C wrapper was being created; fix this by allocating a new
1681         _WKAttachment object for Type::Attachment.
1682
1683         * Shared/Cocoa/APIObject.mm:
1684         (API::Object::newObject):
1685
1686 2017-10-31  Tim Horton  <timothy_horton@apple.com>
1687
1688         Fix up some content filtering feature flags
1689         https://bugs.webkit.org/show_bug.cgi?id=179079
1690
1691         Reviewed by Simon Fraser.
1692
1693         * Configurations/FeatureDefines.xcconfig:
1694
1695 2017-10-31  Youenn Fablet  <youenn@apple.com>
1696
1697         rwt should allow service worker to load localhost HTTPS resources with any certificate
1698         https://bugs.webkit.org/show_bug.cgi?id=179018
1699
1700         Reviewed by Chris Dumez.
1701
1702         Allowing ServiceWorkerProcessProxy to handle authentication challenge.
1703         Temporarily adding a boolean flag through WebProcessPool to lower the SSL certificate verifications for service workers.
1704         This allows reducing flakiness in our layout tests for rwt.
1705         Future work should be done to expose a correct API for the application level to handle authentication challenges properly.
1706
1707         * UIProcess/API/C/WKContext.cpp:
1708         (WKContextSetAllowsAnySSLCertificateForServiceWorkerTesting):
1709         * UIProcess/API/C/WKContextPrivate.h:
1710         * UIProcess/API/Cocoa/WKProcessPool.mm:
1711         (-[WKProcessPool _setAllowsAnySSLCertificateForServiceWorker:]):
1712         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1713         * UIProcess/Network/NetworkProcessProxy.cpp:
1714         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
1715         (WebKit::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace):
1716         * UIProcess/ServiceWorkerProcessProxy.cpp:
1717         (WebKit::ServiceWorkerProcessProxy::didReceiveAuthenticationChallenge):
1718         * UIProcess/ServiceWorkerProcessProxy.h:
1719         * UIProcess/WebProcessPool.h:
1720
1721 2017-10-31  Joseph Pecoraro  <pecoraro@apple.com>
1722
1723         Web Inspector: UIProcess ASSERT in ~RemoteWebInspectorProxy when InspectorProcess crashes
1724         https://bugs.webkit.org/show_bug.cgi?id=179044
1725
1726         Reviewed by Alex Christensen.
1727
1728         * UIProcess/RemoteWebInspectorProxy.cpp:
1729         (WebKit::RemoteWebInspectorProxy::frontendDidClose):
1730         Add a protector to keep the proxy alive for the duration of this method.
1731
1732 2017-10-31  Youenn Fablet  <youenn@apple.com>
1733
1734         Crash in:  com.apple.WebKit: WebKit::CacheStorage::Caches::initializeSize(WTF::Function<void (std::optional<WebCore::DOMCacheEngine::Error>&&)>&&) + 30 (CacheStorageEngineCaches.cpp:163)
1735         https://bugs.webkit.org/show_bug.cgi?id=179037
1736
1737         Reviewed by Chris Dumez.
1738
1739         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1740         (WebKit::CacheStorage::Caches::initializeSize): the storage backend may be cleared when clearing caches by the UI Process.
1741         Returning early in that case. A web application will typically fail to open a cache in this case.
1742         On retry, the cache should be opened.
1743
1744 2017-10-31  Wenson Hsieh  <wenson_hsieh@apple.com>
1745
1746         [Attachment Support] Implement WKWebView SPI for inserting attachment elements
1747         https://bugs.webkit.org/show_bug.cgi?id=179013
1748         <rdar://problem/35249668>
1749
1750         Reviewed by Tim Horton.
1751
1752         Adds native SPI to insert attachment elements given a filename, an optional MIME type, and a data blob. See
1753         change-by-change comments below for more detail. Covered by a new API test.
1754
1755         * PlatformMac.cmake:
1756         * Shared/API/APIObject.h:
1757         * Shared/API/Cocoa/WebKitPrivate.h:
1758         * UIProcess/API/APIAttachment.cpp: Copied from Source/WebKit/Shared/API/Cocoa/WebKitPrivate.h.
1759         (API::Attachment::create):
1760         (API::Attachment::Attachment):
1761         (API::Attachment::~Attachment):
1762
1763         Introduce API::Attachment, which represents a platform-agnostic Attachment.
1764
1765         * UIProcess/API/APIAttachment.h: Copied from Source/WebKit/Shared/API/Cocoa/WebKitPrivate.h.
1766         * UIProcess/API/Cocoa/WKWebView.mm:
1767         (-[WKWebView _insertAttachmentWithFilename:contentType:data:options:completion:]):
1768
1769         Adds support for inserting a new attachment element. Calls out to WebPageProxy to insert the attachment from the
1770         given data blob, and creates a new API-object-backed _WKAttachment.
1771
1772         (-[WKWebView _executeEditCommand:argument:completion:]):
1773
1774         Support passing in a nil completion block.
1775
1776         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1777         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1778         * UIProcess/API/Cocoa/_WKAttachment.h: Copied from Source/WebKit/Shared/API/Cocoa/WebKitPrivate.h.
1779         * UIProcess/API/Cocoa/_WKAttachment.mm: Copied from Source/WebCore/html/HTMLAttachmentElement.h.
1780
1781         Introduces _WKAttachment, an Objective C wrapper around the API::Attachment.
1782
1783         (-[_WKAttachment _apiObject]):
1784         (-[_WKAttachment isEqual:]):
1785         (-[_WKAttachment uniqueIdentifier]):
1786         (-[_WKAttachment hash]):
1787
1788         Add _WKAttachment, a WebKit SPI object that wraps an attachment element unique identifier. Also, allow
1789         _WKAttachment to be used as a hashable NSDictionary key.
1790
1791         (-[_WKAttachment description]):
1792         * UIProcess/API/Cocoa/_WKAttachmentInternal.h: Copied from Source/WebKit/Shared/API/Cocoa/WebKitPrivate.h.
1793         (API::wrapper):
1794         * UIProcess/WebPageProxy.cpp:
1795         (WebKit::WebPageProxy::insertAttachment):
1796
1797         Implement IPC support for inserting an attachment.
1798
1799         * UIProcess/WebPageProxy.h:
1800         * WebKit.xcodeproj/project.pbxproj:
1801         * WebProcess/WebPage/WebPage.cpp:
1802         (WebKit::WebPage::insertAttachment):
1803         * WebProcess/WebPage/WebPage.h:
1804         * WebProcess/WebPage/WebPage.messages.in:
1805
1806 2017-10-31  Alex Christensen  <achristensen@webkit.org>
1807
1808         Fix custom header field setting with reloads and asynchronous navigation action policy decisions
1809         https://bugs.webkit.org/show_bug.cgi?id=179064
1810
1811         Reviewed by Tim Horton.
1812
1813         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1814         (WebKit::WebFrameLoaderClient::applyToDocumentLoader):
1815         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1816         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1817         * WebProcess/WebPage/WebFrame.cpp:
1818         (WebKit::WebFrame::didReceivePolicyDecision):
1819         * WebProcess/WebPage/WebFrame.h:
1820         * WebProcess/WebPage/WebPage.cpp:
1821         (WebKit::WebPage::didReceivePolicyDecision):
1822
1823 2017-10-31  Carlos Garcia Campos  <cgarcia@igalia.com>
1824
1825         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.19.1 release.
1826
1827         * gtk/NEWS: Add release notes for 2.19.1.
1828
1829 2017-10-31  Carlos Garcia Campos  <cgarcia@igalia.com>
1830
1831         Unreviewed. Fix GTK+ make distcheck.
1832
1833         Include WebCore/TextEncodingRegistry.h to ensure the forwarding header is generated.
1834
1835         * UIProcess/API/glib/WebKitSettings.cpp:
1836
1837 2017-10-31  Commit Queue  <commit-queue@webkit.org>
1838
1839         Unreviewed, rolling out r223884.
1840         https://bugs.webkit.org/show_bug.cgi?id=179055
1841
1842         It broke GTK+ make distcheck (Requested by KaL on #webkit).
1843
1844         Reverted changeset:
1845
1846         "[GTK][WPE] generate-forwarding-headers.pl should also scan
1847         derived sources in WebKit framework"
1848         https://bugs.webkit.org/show_bug.cgi?id=178579
1849         https://trac.webkit.org/changeset/223884
1850
1851 2017-10-30  Fujii Hironori  <Hironori.Fujii@sony.com>
1852
1853         Use LazyNeverDestroyed instead of DEFINE_GLOBAL for XMLNames, HTMLNames, MathMLNames and SVGNames
1854         https://bugs.webkit.org/show_bug.cgi?id=175118
1855
1856         Reviewed by Alex Christensen.
1857
1858         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLPrivate.cpp:
1859         (WebKit::wrap):
1860
1861 2017-10-27  Megan Gardner  <megan_gardner@apple.com>
1862
1863         Correctly determine affinity when inserting text via Keyboard Suggestions
1864         https://bugs.webkit.org/show_bug.cgi?id=178969
1865
1866         Reviewed by Ryosuke Niwa.
1867
1868         Use the logic of VisiblePosition to correctly determine cursor affinity. We were
1869         defaulting to upstream, but that in incorrect and resulted in hitting asserts that
1870         we should not. This should give us the correct affinity in all cases.
1871
1872         * WebProcess/WebPage/ios/WebPageIOS.mm:
1873         (WebKit::WebPage::syncApplyAutocorrection):
1874
1875 2017-10-30  Commit Queue  <commit-queue@webkit.org>
1876
1877         Unreviewed, rolling out r224078.
1878         https://bugs.webkit.org/show_bug.cgi?id=179026
1879
1880         MotionMark regression (Requested by shallawa on #webkit).
1881
1882         Reverted changeset:
1883
1884         "When navigating back to a page, compositing layers may not
1885         use accelerated drawing"
1886         https://bugs.webkit.org/show_bug.cgi?id=178749
1887         https://trac.webkit.org/changeset/224078
1888
1889 2017-10-30  Sam Weinig  <sam@webkit.org>
1890
1891         [Setting] Only expose experimental features that are compiled in
1892         https://bugs.webkit.org/show_bug.cgi?id=179023
1893
1894         Reviewed by Tim Horton.
1895
1896         * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb:
1897         
1898             Update template to conditionally expose experimental features based on their
1899             'condition' option in WebPreferences.yaml
1900
1901 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
1902
1903         [WPE] Fix build warnings
1904         https://bugs.webkit.org/show_bug.cgi?id=178899
1905
1906         Reviewed by Carlos Alberto Lopez Perez.
1907
1908         * PlatformWPE.cmake:
1909
1910 2017-10-30  Sam Weinig  <sam@webkit.org>
1911
1912         [Settings] Replace macro driven experimental features code with generated code
1913         https://bugs.webkit.org/show_bug.cgi?id=178994
1914
1915         Reviewed by Simon Fraser.
1916
1917         As a first step toward allowing experimental features to vary based on compile
1918         time flags, replace the macro driven implementation of the WebPreferences part
1919         of experimental features, with one generated from a template file.
1920
1921         * CMakeLists.txt:
1922         * DerivedSources.make:
1923         * Scripts/GeneratePreferences.rb:
1924         * WebKit.xcodeproj/project.pbxproj:
1925
1926             Generate the new template.
1927         
1928         * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb: Added.
1929         * UIProcess/WebPreferences.cpp:
1930         (WebKit::createExperimentalFeaturesVector): Deleted.
1931         (WebKit::WebPreferences::experimentalFeatures): Deleted.
1932         (WebKit::WebPreferences::isEnabledForFeature const): Deleted.
1933         (WebKit::WebPreferences::setEnabledForFeature): Deleted.
1934         (WebKit::WebPreferences::enableAllExperimentalFeatures): Deleted.
1935         
1936             Replace macro implementation with template generated one.
1937
1938 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
1939
1940         [WPE] Build more files under WebCore as unified sources and get rid of WebCorePlatformWPE build target
1941         https://bugs.webkit.org/show_bug.cgi?id=178964
1942
1943         Reviewed by Carlos Alberto Lopez Perez.
1944
1945         * PlatformWPE.cmake:
1946
1947 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
1948
1949         [WPE][GTK] Expose availability of certain editing commands in WebKitEditorState
1950         https://bugs.webkit.org/show_bug.cgi?id=168219
1951
1952         Reviewed by Ryosuke Niwa.
1953
1954         Expose canCut, canCopy, canPaste, canUndo, and canRedo in EditorState::PostLayouData.
1955
1956         Add corresponding new WPE/GTK API.
1957
1958         Remove allowsCopy from WebKitTestResultData. It's unused, does not work correctly in all
1959         circumstances, and irritates Ryosuke.
1960
1961         Also, remove a bunch of #ifs guarding post layout data, since it's now used on all ports.
1962
1963         * Shared/EditorState.cpp:
1964         (WebKit::EditorState::encode const):
1965         (WebKit::EditorState::decode):
1966         (WebKit::EditorState::PostLayoutData::encode const):
1967         (WebKit::EditorState::PostLayoutData::decode):
1968         * Shared/EditorState.h:
1969         (WebKit::EditorState::postLayoutData const const):
1970         * Shared/WebHitTestResultData.cpp:
1971         (WebKit::WebHitTestResultData::WebHitTestResultData):
1972         (WebKit::WebHitTestResultData::encode const):
1973         (WebKit::WebHitTestResultData::decode):
1974         * Shared/WebHitTestResultData.h:
1975         * UIProcess/API/APIHitTestResult.h:
1976         (API::HitTestResult::allowsCopy const): Deleted.
1977         * UIProcess/API/glib/WebKitEditorState.cpp:
1978         (webkitEditorStateChanged):
1979         (webkit_editor_state_is_cut_available):
1980         (webkit_editor_state_is_copy_available):
1981         (webkit_editor_state_is_paste_available):
1982         (webkit_editor_state_is_undo_available):
1983         (webkit_editor_state_is_redo_available):
1984         * UIProcess/API/glib/WebKitWebView.cpp:
1985         (webkit_web_view_can_execute_editing_command):
1986         * UIProcess/API/gtk/WebKitEditorState.h:
1987         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1988         * UIProcess/API/wpe/WebKitEditorState.h:
1989         * WebProcess/WebPage/WebPage.cpp:
1990         (WebKit::WebPage::editorState const):
1991         * WebProcess/WebPage/mac/WebPageMac.mm:
1992         (WebKit::WebPage::performImmediateActionHitTestAtLocation):
1993
1994 2017-10-27  Sam Weinig  <sam@webkit.org>
1995
1996         [Settings] Generate more of the WebKit preferences code
1997         https://bugs.webkit.org/show_bug.cgi?id=178945
1998
1999         Reviewed by Chris Dumez.
2000
2001         Generate WebPreferencesKeys.{h,cpp} and WebPreferencesStoreDefaultsMap.cpp
2002
2003         * CMakeLists.txt:
2004         * DerivedSources.make:
2005         * WebKit.xcodeproj/project.pbxproj:
2006         * Scripts/GeneratePreferences.rb:
2007         
2008             Generate new files.
2009         
2010         * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
2011         
2012             Update include.
2013         
2014         * Scripts/PreferencesTemplates/WebPreferencesKeys.cpp.erb: Added.
2015         * Scripts/PreferencesTemplates/WebPreferencesKeys.h.erb: Added.
2016         * Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb: Added.
2017
2018             Add template files for new generated files.
2019
2020         * Shared/WebPreferencesDefaultValues.h: Copied from Source/WebKit/Shared/WebPreferencesDefinitionsBase.h.
2021         * Shared/WebPreferencesDefinitionsBase.h:
2022         
2023             Renamed WebPreferencesDefinitionsBase.h to WebPreferencesDefaultValues.h to better indicate what it is.
2024         
2025         * Shared/WebPreferencesKeys.cpp: Removed.
2026         * Shared/WebPreferencesKeys.h: Removed.
2027         
2028             Replaced with generated versions.
2029
2030         * Shared/WebPreferencesStore.cpp:
2031         (WebKit::defaults): Deleted.
2032         * Shared/WebPreferencesStore.h:
2033         
2034             Replace macro driven defaults map with generated WebPreferencesStoreDefaultsMap.cpp.
2035
2036 2017-10-28  Chris Dumez  <cdumez@apple.com>
2037
2038         self.ExtendableEvent / Client / Clients / WindowClient do not exist in a Service Worker
2039         https://bugs.webkit.org/show_bug.cgi?id=178976
2040
2041         Reviewed by Sam Weinig.
2042
2043         Actually enable the Service Worker RuntimeEnabledFeature in the Service Worker
2044         WebProcess.
2045
2046         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2047         (WebKit::WebSWContextManagerConnection::updatePreferences):
2048
2049 2017-10-28  Joseph Pecoraro  <pecoraro@apple.com>
2050
2051         Make postprocess-framework-headers.sh a little easier to read
2052         https://bugs.webkit.org/show_bug.cgi?id=178971
2053
2054         Reviewed by Sam Weinig.
2055
2056         * mac/postprocess-framework-headers.sh:
2057
2058 2017-10-27  Daniel Bates  <dabates@apple.com>
2059
2060         Attempt to fix the Apple El Capitan build following <https://trac.webkit.org/changeset/224134>
2061         (https://bugs.webkit.org/show_bug.cgi?id=178919)
2062
2063         Move definition of NetworkLoad::isAllowedToAskUserForCredentials() outside of USE(NETWORK_SESSION)-guarded section.
2064
2065         * NetworkProcess/NetworkLoad.cpp:
2066         (WebKit::NetworkLoad::isAllowedToAskUserForCredentials const):
2067
2068 2017-10-27  Daniel Bates  <dabates@apple.com>
2069
2070         Only allow non-mixed content protected subresources to ask for credentials
2071         https://bugs.webkit.org/show_bug.cgi?id=178919
2072         <rdar://problem/35015245>
2073
2074         Reviewed by Alex Christensen.
2075
2076         Only allow non-mixed content protected subresources to ask for credentials. It is not meaningful
2077         to allow protected mixed-content subresources to ask for credentials.
2078
2079         * NetworkProcess/Downloads/PendingDownload.cpp:
2080         (WebKit::PendingDownload::PendingDownload): Initialize m_isAllowedToAskUserForCredentials based on
2081         the specified resource load parameters or NetworkLoad object.
2082         * NetworkProcess/Downloads/PendingDownload.h: Add override for NetworkLoadClient::isAllowedToAskUserForCredentials().
2083         * NetworkProcess/NetworkLoad.cpp:
2084         (WebKit::NetworkLoad::isAllowedToAskUserForCredentials const): Added.
2085         (WebKit::NetworkLoad::completeAuthenticationChallenge): Ask NetworkLoadClient whether the load is
2086         allowed to prompt for credentials.
2087         (WebKit::NetworkLoad::didReceiveAuthenticationChallenge): Ditto.
2088         * NetworkProcess/NetworkLoad.h:
2089         * NetworkProcess/NetworkLoadClient.h:
2090         * NetworkProcess/NetworkResourceLoader.cpp:
2091         (WebKit::NetworkResourceLoader::NetworkResourceLoader): Initialize m_isAllowedToAskUserForCredentials
2092         based on the specified resource load parameters.
2093         (WebKit::NetworkResourceLoader::willSendRedirectedRequest): We do not support prompting for credentials
2094         for synchronous loads.
2095         (WebKit::NetworkResourceLoader::continueWillSendRequest): Modified to take an argument as to whether the
2096         load is allowed to ask the user for credentials and updates state.
2097         * NetworkProcess/NetworkResourceLoader.h:
2098         * NetworkProcess/NetworkResourceLoader.messages.in: Modified message ContinueWillSendRequest to take a
2099         boolean as to whether the load is allowed to ask the user for credentials.
2100         * NetworkProcess/PreconnectTask.h: Override NetworkLoadClient::isAllowedToAskUserForCredentials()
2101         such that we never ask for credentials. This matches our current behavior.
2102         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h: Ditto.
2103         * WebProcess/Network/WebResourceLoader.cpp:
2104         (WebKit::WebResourceLoader::willSendRequest): Query ResourceLoader as to whether the load is allowed to
2105         ask the user for credentials and pass this state to NetworkResourceLoader.
2106
2107 2017-10-27  Adrian Perez de Castro  <aperez@igalia.com>
2108
2109         [GTK][CMake] Incorrect conditional check when adding build dir to GIR runtime library path
2110         https://bugs.webkit.org/show_bug.cgi?id=178936
2111
2112         Reviewed by Michael Catanzaro.
2113
2114         * PlatformGTK.cmake: Fix spelling of variable used in conditional.
2115
2116 2017-10-27  Chris Dumez  <cdumez@apple.com>
2117
2118         Add initial support for serviceWorkerClient.postMessage()
2119         https://bugs.webkit.org/show_bug.cgi?id=178794
2120
2121         Reviewed by Youenn Fablet.
2122
2123         Add initial support for serviceWorkerClient.postMessage():
2124         - https://w3c.github.io/ServiceWorker/#client-postmessage
2125
2126         It is now possible to do bi-directional communication with a service worker
2127         via postMessage().
2128
2129         * Shared/WebCoreArgumentCoders.cpp:
2130         (IPC::ArgumentCoder<ServiceWorkerClientIdentifier>::encode):
2131         (IPC::ArgumentCoder<ServiceWorkerClientIdentifier>::decode):
2132         * Shared/WebCoreArgumentCoders.h:
2133         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2134         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
2135         (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient):
2136         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2137         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2138         * StorageProcess/StorageProcess.cpp:
2139         (WebKit::StorageProcess::postMessageToServiceWorkerClient):
2140         * StorageProcess/StorageProcess.h:
2141         * StorageProcess/StorageProcess.messages.in:
2142         * WebProcess/Storage/WebSWClientConnection.cpp:
2143         (WebKit::WebSWClientConnection::postMessageToServiceWorkerGlobalScope):
2144         (WebKit::WebSWClientConnection::postMessageToServiceWorkerClient):
2145         * WebProcess/Storage/WebSWClientConnection.h:
2146         * WebProcess/Storage/WebSWClientConnection.messages.in:
2147         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2148         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerGlobalScope):
2149         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerClient):
2150         * WebProcess/Storage/WebSWContextManagerConnection.h:
2151         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2152
2153 2017-10-27  David Kilzer  <ddkilzer@apple.com>
2154
2155         REGRESSION (r224077): DeprecatedGlobalSettings::setAVKitEnabled() not protected by HAVE(AVKIT)
2156
2157         Unreviewed build fix.
2158
2159         * WebProcess/WebPage/WebPage.cpp:
2160         (WebKit::WebPage::updatePreferences): Fix build.
2161
2162 2017-10-26  Jeremy Jones  <jeremyj@apple.com>
2163
2164         Implement seek tolerance methods in WebAVPlayerController.
2165         https://bugs.webkit.org/show_bug.cgi?id=178838
2166         rdar://problem/33781777
2167
2168         Reviewed by Eric Carlson.
2169
2170         This implementes additional methods on WebAVPlayerController that allows AVKit more control over seeking.
2171
2172         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
2173         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
2174         (WebKit::PlaybackSessionModelContext::seekToTime):
2175         (WebKit::PlaybackSessionManagerProxy::seekToTime):
2176         * WebProcess/cocoa/PlaybackSessionManager.h:
2177         * WebProcess/cocoa/PlaybackSessionManager.messages.in:
2178         * WebProcess/cocoa/PlaybackSessionManager.mm:
2179         (WebKit::PlaybackSessionManager::seekToTime):
2180
2181 2017-10-26  Brian Burg  <bburg@apple.com>
2182
2183         Web Automation: denying user permission for getUserMedia doesn't work
2184         https://bugs.webkit.org/show_bug.cgi?id=178895
2185
2186         Reviewed by Youenn Fablet.
2187
2188         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2189         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2190         The ordering of special cases is incorrect. Safari configures its automation views to
2191         allow mock devices and never prompt for them. These checks were before the check for
2192         the automation session's getUserMedia permission. Switch these checks.
2193
2194         Also change the deny reason so that subsequent requests are also denied. This matches
2195         behavior when a user denies a permission request on a real dialog. With this change,
2196         the DOM error changes from SecurityError to NotAllowedError, which makes more sense.
2197
2198 2017-10-26  Michael Catanzaro  <mcatanzaro@igalia.com>
2199
2200         Unreviewed, fix GCC warning spam after r224077
2201         https://bugs.webkit.org/show_bug.cgi?id=178823
2202
2203         Need to leave a blank line at the bottom of the file.
2204
2205         * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
2206
2207 2017-10-25  Simon Fraser  <simon.fraser@apple.com>
2208
2209         When navigating back to a page, compositing layers may not use accelerated drawing
2210         https://bugs.webkit.org/show_bug.cgi?id=178749
2211         rdar://problem/35158946
2212
2213         Reviewed by Dean Jackson.
2214
2215         Avoid assertions when a test enables accelerated drawing (which we can't support
2216         in the iOS simulator).
2217
2218         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
2219         (WebKit::RemoteLayerBackingStore::ensureBackingStore):
2220
2221 2017-10-26  Sam Weinig  <sam@webkit.org>
2222
2223         [Settings] Generate the bulk of WebPage::updatePreferences(...)
2224         https://bugs.webkit.org/show_bug.cgi?id=178823
2225
2226         Reviewed by Tim Horton.
2227
2228         * CMakeLists.txt:
2229         * DerivedSources.make:
2230         * WebKit.xcodeproj/project.pbxproj:
2231
2232             Add new file generation.
2233
2234         * Scripts/GeneratePreferences.rb:
2235         
2236             Replace 'webkitOnly' boolean option with a new 'webcoreBinding' option.
2237             'webcoreBinding' supports the following values:
2238                 - none (same as webkit only)
2239                 - custom (means that you do bind to a webcore concept, but currently it must
2240                   be done in a custom manner)
2241                 - DeprecatedGlobalSettings (binds to a DeprecatedGlobalSettings setting)
2242                 - RuntimeEnabledFeatures (binds to a RuntimeEnabledFeatures setting)
2243             If 'webcoreBinding' is not provided, the preference binds to WebCore Setting
2244             of either the same name or the override name provided by the new 'webcoreName'
2245             option (we should try to remove the need for 'webcoreName' by unifying with 
2246             WebCore on preference/setting naming).
2247             
2248             A 'condition' option was also added to indicate that the preference is only available
2249             when that macro condition is true.
2250             
2251             Since we are generating most of WebPage::updatePreferences, we can simplify the
2252             macros in WebPreferencesDefinitions.h to only have normal/debug/experimental variants
2253             and remove the need for per-type macros, which were only used in WebPage::updatePreferences.
2254         
2255         * Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb: Added.
2256         
2257             Generates bindings from WebPreferences to WebCore::Settings/DeprecatedGlobalSettings/RuntimeEnabledFeatures.
2258             Does not generate a binding if the 'webcoreBinding' option is set to either 'none' or 'custom'.
2259         
2260         * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
2261     
2262             Simplify down to just normal/debug/experimental macros.
2263         
2264         * Shared/WebPreferences.yaml:
2265         
2266             Annotate perferences with new optional 'webcoreBinding', 'webcoreName', and 'condition'
2267             options.
2268         
2269         * WebProcess/WebPage/WebPage.cpp:
2270         (WebKit::WebPage::updatePreferences):
2271         
2272             Replace a ton of hand written preference to settings bindings with a call to updatePreferencesGenerated().
2273         
2274         * WebProcess/WebPage/WebPage.h:
2275         
2276             Add declaration of updatePreferencesGenerated, remove platformPreferencesDidChange.
2277
2278         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
2279         (WebKit::WebPage::platformPreferencesDidChange): Deleted.
2280         * WebProcess/WebPage/ios/WebPageIOS.mm:
2281         (WebKit::WebPage::platformPreferencesDidChange): Deleted.
2282         * WebProcess/WebPage/mac/WebPageMac.mm:
2283         (WebKit::WebPage::platformPreferencesDidChange): Deleted.
2284         * WebProcess/WebPage/win/WebPageWin.cpp:
2285         (WebKit::WebPage::platformPreferencesDidChange): Deleted.
2286         * WebProcess/WebPage/wpe/WebPageWPE.cpp:
2287         (WebKit::WebPage::platformPreferencesDidChange): Deleted.
2288         
2289             Remove all the empty platformPreferencesDidChange functions.
2290
2291 2017-10-26  Alex Christensen  <achristensen@webkit.org>
2292
2293         Move WKWebViewConfiguration validation to WKWebView construction
2294         https://bugs.webkit.org/show_bug.cgi?id=178840
2295
2296         Reviewed by Tim Horton.
2297         
2298         I'm trying to remove WKWebViewConfigurationInternal methods so I can make WKWebViewConfiguration
2299         a wrapper around an APIObject like all the other API objects.  A small step towards making this easier
2300         is to remove the unnecessary method _validate and move its logic to its one callsite.  I added an API test
2301         that ensures no change in behavior.
2302
2303         * UIProcess/API/Cocoa/WKWebView.mm:
2304         (-[WKWebView _initializeWithConfiguration:]):
2305         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2306         (-[WKWebViewConfiguration _validate]): Deleted.
2307         * UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h:
2308
2309 2017-10-26  Megan Gardner  <megan_gardner@apple.com>
2310
2311         Remove unneeded block selection calculation code
2312         https://bugs.webkit.org/show_bug.cgi?id=178889
2313
2314         Reviewed by Tim Horton.
2315
2316         Removing more block selection code. Much of this should have been removed
2317         before, as the only things that were using these functions were removed in the
2318         last patch. Also remove the code decided if you should move to block mode or not,
2319         as the answer now is always NO.
2320
2321         * WebProcess/WebPage/WebPage.h:
2322         * WebProcess/WebPage/ios/WebPageIOS.mm:
2323         (WebKit::WebPage::updateSelectionWithTouches):
2324         (WebKit::WebPage::rangeForBlockAtPoint): Deleted.
2325         (WebKit::distanceBetweenRectsForPosition): Deleted.
2326         (WebKit::rectsEssentiallyTheSame): Deleted.
2327         (WebKit::unionDOMRanges): Deleted.
2328         (WebKit::computeEdgeCenter): Deleted.
2329         (WebKit::WebPage::expandedRangeFromHandle): Deleted.
2330         (WebKit::WebPage::contractedRangeFromHandle): Deleted.
2331         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle): Deleted.
2332         (WebKit::WebPage::switchToBlockSelectionAtPoint): Deleted.
2333         (WebKit::WebPage::shouldSwitchToBlockModeForHandle): Deleted.
2334
2335 2017-10-26  Jeremy Jones  <jeremyj@apple.com>
2336
2337         Call setFullscreenClient on iOS.
2338         https://bugs.webkit.org/show_bug.cgi?id=178089
2339
2340         Reviewed by Simon Fraser.
2341
2342         This was only being set for MacOS.
2343
2344         * UIProcess/ios/WKContentView.mm:
2345         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
2346
2347 2017-10-26  Eric Carlson  <eric.carlson@apple.com>
2348
2349         NowPlayingInfo should contain a unique identifier
2350         https://bugs.webkit.org/show_bug.cgi?id=178872
2351
2352         Reviewed by Jer Noble.
2353
2354         * UIProcess/API/Cocoa/WKWebView.mm:
2355         (-[WKWebView _requestActiveNowPlayingSessionInfo:]): Take a completion handler.
2356         (-[WKWebView _requestActiveNowPlayingSessionInfo]): Deleted.
2357         (-[WKWebView _handleActiveNowPlayingSessionInfoResponse:title:duration:elapsedTime:]): Deleted.
2358         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2359         * UIProcess/PageClient.h:
2360
2361         * UIProcess/WebPageProxy.cpp:
2362         (WebKit::WebPageProxy::requestActiveNowPlayingSessionInfo): Ditto.
2363         (WebKit::WebPageProxy::nowPlayingInfoCallback): Lookup and call completion handler.
2364         (WebKit::WebPageProxy::handleActiveNowPlayingSessionInfoResponse const): Deleted.
2365         * UIProcess/WebPageProxy.h:
2366         * UIProcess/WebPageProxy.messages.in:
2367
2368         * UIProcess/ios/PageClientImplIOS.h:
2369         * UIProcess/ios/PageClientImplIOS.mm:
2370         (WebKit::PageClientImpl::handleActiveNowPlayingSessionInfoResponse): Deleted.
2371
2372         * UIProcess/mac/PageClientImplMac.h:
2373         * UIProcess/mac/PageClientImplMac.mm:
2374         (WebKit::PageClientImpl::handleActiveNowPlayingSessionInfoResponse): Deleted.
2375
2376         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
2377         (WebKit::WebPage::requestActiveNowPlayingSessionInfo): Take callback ID. Pass unique ID.
2378         * WebProcess/WebPage/WebPage.h:
2379         * WebProcess/WebPage/WebPage.messages.in:
2380
2381 2017-10-26  Andy Estes  <aestes@apple.com>
2382
2383         [Payment Request] Enable Payment Request whenever Apple Pay is enabled
2384         https://bugs.webkit.org/show_bug.cgi?id=178880
2385
2386         Reviewed by Tim Horton.
2387
2388         * Shared/WebPreferences.yaml:
2389         * UIProcess/API/C/WKPreferences.cpp:
2390         (WKPreferencesSetPaymentRequestEnabled): Deleted.
2391         (WKPreferencesGetPaymentRequestEnabled): Deleted.
2392         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2393         * WebProcess/WebPage/WebPage.cpp:
2394         (WebKit::WebPage::updatePreferences):
2395
2396 2017-10-26  Chris Dumez  <cdumez@apple.com>
2397
2398         Bring back SWContextManager abstraction in WebCore
2399         https://bugs.webkit.org/show_bug.cgi?id=178876
2400
2401         Reviewed by Geoffrey Garen.
2402
2403         Bring back SWContextManager abstraction in WebCore. It was killed in <https://trac.webkit.org/changeset/223718> but
2404         is actually useful when the ServiceWorker wants to message the storage process.
2405
2406         * CMakeLists.txt:
2407         * DerivedSources.make:
2408         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2409         (WebKit::WebSWServerConnection::startServiceWorkerContext):
2410         (WebKit::WebSWServerConnection::startFetch):
2411         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
2412         * WebKit.xcodeproj/project.pbxproj:
2413         * WebProcess/Storage/WebSWContextManagerConnection.cpp: Renamed from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.cpp.
2414         (WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection):
2415         (WebKit::WebSWContextManagerConnection::updatePreferences):
2416         (WebKit::WebSWContextManagerConnection::startServiceWorker):
2417         (WebKit::WebSWContextManagerConnection::startFetch):
2418         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerGlobalScope):
2419         * WebProcess/Storage/WebSWContextManagerConnection.h: Renamed from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h.
2420         * WebProcess/Storage/WebSWContextManagerConnection.messages.in: Renamed from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.messages.in.
2421         * WebProcess/WebProcess.cpp:
2422         (WebKit::WebProcess::didReceiveMessage):
2423         (WebKit::WebProcess::getWorkerContextConnection):
2424         * WebProcess/WebProcess.h:
2425
2426 2017-10-26  Alexey Proskuryakov  <ap@apple.com>
2427
2428         Remove deprecated WebKit symbols
2429         https://bugs.webkit.org/show_bug.cgi?id=178875
2430         rdar://problem/31139070
2431
2432         Reviewed by Dan Bernstein.
2433
2434         * PlatformMac.cmake:
2435         * Shared/API/c/WKDeprecatedFunctions.cpp:
2436         (WKContextSetProcessModel):
2437         (WKPageGroupCopyIdentifier): Deleted.
2438         (WKPageGroupAddUserContentFilter): Deleted.
2439         (WKPageGroupRemoveUserContentFilter): Deleted.
2440         * UIProcess/API/C/WKPageGroup.h:
2441         * UIProcess/API/Cocoa/_WKVisitedLinkProvider.mm: Removed.
2442         * UIProcess/API/Cocoa/_WKVisitedLinkStore.h:
2443         * WebKit.xcodeproj/project.pbxproj:
2444
2445 2017-10-26  Ryan Haddad  <ryanhaddad@apple.com>
2446
2447         Unreviewed, rolling out r223984.
2448
2449         Caused LayoutTest assertion failures.
2450
2451         Reverted changeset:
2452
2453         "When navigating back to a page, compositing layers may not
2454         use accelerated drawing"
2455         https://bugs.webkit.org/show_bug.cgi?id=178749
2456         https://trac.webkit.org/changeset/223984
2457
2458 2017-10-26  Megan Gardner  <megan_gardner@apple.com>
2459
2460         Remove code to update block selection
2461         https://bugs.webkit.org/show_bug.cgi?id=178843
2462
2463         Reviewed by Tim Horton.
2464
2465         Removes code for updating block selection, which has been disabled.
2466         This code is being slowly pruned to avoid regressions and accidental removal of code that is being used.
2467
2468         * Platform/spi/ios/UIKitSPI.h:
2469         * UIProcess/PageClient.h:
2470         * UIProcess/WebPageProxy.h:
2471         * UIProcess/WebPageProxy.messages.in:
2472         * UIProcess/ios/PageClientImplIOS.h:
2473         * UIProcess/ios/PageClientImplIOS.mm:
2474         (WebKit::PageClientImpl::didUpdateBlockSelectionWithTouch): Deleted.
2475         * UIProcess/ios/WKContentViewInteraction.h:
2476         * UIProcess/ios/WKContentViewInteraction.mm:
2477         (toSelectionHandlePosition): Deleted.
2478         (-[WKContentView _didUpdateBlockSelectionWithTouch:withFlags:growThreshold:shrinkThreshold:]): Deleted.
2479         (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]): Deleted.
2480         * UIProcess/ios/WebPageProxyIOS.mm:
2481         (WebKit::WebPageProxy::updateBlockSelectionWithTouch): Deleted.
2482         (WebKit::WebPageProxy::didUpdateBlockSelectionWithTouch): Deleted.
2483         * WebProcess/WebPage/WebPage.h:
2484         * WebProcess/WebPage/WebPage.messages.in:
2485         * WebProcess/WebPage/ios/WebPageIOS.mm:
2486         (WebKit::shouldExpand): Deleted.
2487         (WebKit::WebPage::changeBlockSelection): Deleted.
2488         (WebKit::WebPage::updateBlockSelectionWithTouch): Deleted.
2489
2490 2017-10-26  Ryan Haddad  <ryanhaddad@apple.com>
2491
2492         Unreviewed, rolling out r223994.
2493
2494         The LayoutTest for this change is failing.
2495
2496         Reverted changeset:
2497
2498         "Add service worker handle fetch support for all subresource
2499         requests"
2500         https://bugs.webkit.org/show_bug.cgi?id=178769
2501         https://trac.webkit.org/changeset/223994
2502
2503 2017-10-26  Ryan Haddad  <ryanhaddad@apple.com>
2504
2505         Unreviewed, rolling out r223908.
2506
2507         Causes LayoutTest crashes with newer SDKs.
2508
2509         Reverted changeset:
2510
2511         "Adopt new secure coding APIs"
2512         https://bugs.webkit.org/show_bug.cgi?id=178484
2513         https://trac.webkit.org/changeset/223908
2514
2515 2017-10-26  Christopher Reid  <chris.reid@sony.com>
2516
2517         Remove scopeguard from platform
2518         https://bugs.webkit.org/show_bug.cgi?id=178681
2519
2520         Reviewed by Brady Eidson.
2521
2522         * Shared/mac/ChildProcessMac.mm:
2523
2524 2017-10-25  Per Arne Vollan  <pvollan@apple.com>
2525
2526         Network process crash under WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge.
2527         https://bugs.webkit.org/show_bug.cgi?id=160234
2528         rdar://problem/30675510
2529
2530         Reviewed by Geoffrey Garen.
2531
2532         An exception is raised because we call the method rejectProtectionSpaceAndContinueWithChallenge on the CFNetwork
2533         challenge sender, which does not implement this optional method. The methods on the authentication challenge
2534         sender are deprecated when network session is used, so we should not call them in that case.
2535
2536         * Shared/Authentication/AuthenticationManager.cpp:
2537         (WebKit::AuthenticationManager::useCredentialForSingleChallenge):
2538         (WebKit::AuthenticationManager::continueWithoutCredentialForSingleChallenge):
2539         (WebKit::AuthenticationManager::cancelSingleChallenge):
2540         (WebKit::AuthenticationManager::performDefaultHandlingForSingleChallenge):
2541         (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge):
2542         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
2543         (WebKit::AuthenticationManager::receivedCredential):
2544         (WebKit::AuthenticationManager::receivedRequestToContinueWithoutCredential):
2545         (WebKit::AuthenticationManager::receivedCancellation):
2546         (WebKit::AuthenticationManager::receivedRequestToPerformDefaultHandling):
2547         (WebKit::AuthenticationManager::receivedChallengeRejection):
2548         * Shared/Authentication/soup/AuthenticationManagerSoup.cpp:
2549
2550 2017-10-25  Youenn Fablet  <youenn@apple.com>
2551
2552         Move DNS resolution outside of NetworkRTCProvider
2553         https://bugs.webkit.org/show_bug.cgi?id=178796
2554
2555         Reviewed by Geoffrey Garen.
2556
2557        Tested through manual testing on external STUN servers.
2558        Moving NetworkRTCProvider::Resolver into NetworkRTCResolver.
2559        Updating the implementation to use a completion handler.
2560
2561         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
2562         (WebKit::NetworkRTCProvider::createResolver):
2563         * NetworkProcess/webrtc/NetworkRTCProvider.h:
2564         * NetworkProcess/webrtc/NetworkRTCResolver.cpp:
2565         (WebKit::NetworkRTCResolver::NetworkRTCResolver):
2566         (WebKit::NetworkRTCResolver::~NetworkRTCResolver):
2567         (WebKit::NetworkRTCResolver::start):
2568         (WebKit::NetworkRTCResolver::stop):
2569         (WebKit::NetworkRTCResolver::completed):
2570         (WebKit::NetworkRTCProvider::Resolver::~Resolver): Deleted.
2571         (WebKit::NetworkRTCProvider::stop): Deleted.
2572         (WebKit::NetworkRTCProvider::resolutionCompleted): Deleted.
2573         * NetworkProcess/webrtc/NetworkRTCResolver.h:
2574         * WebKit.xcodeproj/project.pbxproj:
2575
2576 2017-10-25  Eric Carlson  <eric.carlson@apple.com>
2577
2578         [MediaStream] Clear cached gUM prompt state
2579         https://bugs.webkit.org/show_bug.cgi?id=178754
2580         <rdar://problem/32742356>
2581
2582         Reviewed by Youenn Fablet.
2583
2584         * Shared/WebPreferences.yaml: Define new settings.
2585
2586         * Shared/WebPreferencesDefinitionsBase.h: New default values.
2587
2588         * UIProcess/API/C/WKPreferences.cpp:
2589         (WKPreferencesSetInactiveMediaCaptureSteamRepromptIntervalInMinutes): New.
2590         (WKPreferencesGetInactiveMediaCaptureSteamRepromptIntervalInMinutes): Ditto.
2591         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2592
2593         * UIProcess/API/Cocoa/WKPreferences.mm:
2594         (-[WKPreferences _inactiveMediaCaptureSteamRepromptIntervalInMinutes]): Ditto.
2595         (-[WKPreferences _setInactiveMediaCaptureSteamRepromptIntervalInMinutes:]): Ditto.
2596         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2597
2598         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2599         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy): Initialize
2600         the timer.
2601         (WebKit::UserMediaPermissionRequestManagerProxy::createRequest): Remove unneeded namespace.
2602         (WebKit::toWebCore): Remove unneeded breaks.
2603         (WebKit::UserMediaPermissionRequestManagerProxy::searchForGrantedRequest const): Remove unneeded namespace.
2604         (WebKit::UserMediaPermissionRequestManagerProxy::wasRequestDenied): Ditto.
2605         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): Ditto.
2606         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo): Ditto.
2607         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): Ditto.
2608         (WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs const): Ditto.
2609         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged): Set the watchdog timer
2610         to the correct interval based on capture state.
2611         (WebKit::UserMediaPermissionRequestManagerProxy::watchdogTimerFired): Clear cached state.
2612         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2613
2614 2017-10-25  Simon Fraser  <simon.fraser@apple.com>
2615
2616         When navigating back to a page, compositing layers may not use accelerated drawing
2617         https://bugs.webkit.org/show_bug.cgi?id=178749
2618         rdar://problem/35158946
2619
2620         Reviewed by Dean Jackson.
2621
2622         Avoid assertions when a test enables accelerated drawing (which we can't support
2623         in the iOS simulator).
2624
2625         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
2626         (WebKit::RemoteLayerBackingStore::ensureBackingStore):
2627
2628 2017-10-25  Youenn Fablet  <youenn@apple.com>
2629
2630         Enable ServiceWorker to fetch resources
2631         https://bugs.webkit.org/show_bug.cgi?id=178673
2632
2633         Reviewed by Brady Eidson.
2634
2635         ServiceWorkerContextManager makes use of the new ServiceWorkerThreadProxy.
2636         It creates the necessary environment for the thread to make use of network loads, web sockets and cache storage.
2637         Fetch is functional with these changes.
2638
2639         ServiceWorkerProcessProxy is introduced as a UIProcess proxy to the service worker process.
2640         This process proxy is responsible to give the pageID used by all service worker thread instances for network loads.
2641         ServiceWorkerContextManager is responsible to give a unique frameID for all service worker threads.
2642         This is necessary as these two ids are currently needed for any network load.
2643
2644         ServiceWorkerThreadProxy creates its own FrameLoaderClient which is now used to get pageID, frameID and sessionID.
2645
2646         * UIProcess/ServiceWorkerProcessProxy.cpp: Added.
2647         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
2648         (WebKit::m_serviceWorkerPageID):
2649         (WebKit::ServiceWorkerProcessProxy::~ServiceWorkerProcessProxy):
2650         (WebKit::ServiceWorkerProcessProxy::start):
2651         * UIProcess/ServiceWorkerProcessProxy.h: Added.
2652         * UIProcess/WebProcessPool.cpp:
2653         (WebKit::WebProcessPool::getWorkerContextProcessConnection):
2654         (WebKit::WebProcessPool::createNewWebProcess):
2655         (WebKit::WebProcessPool::initializeNewWebProcess):
2656         (WebKit::WebProcessPool::disconnectProcess):
2657         (WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
2658         (WebKit::WebProcessPool::createWebPage):
2659         * UIProcess/WebProcessPool.h:
2660         * UIProcess/WebProcessProxy.cpp:
2661         (WebKit::WebProcessProxy::generatePageID):
2662         * UIProcess/WebProcessProxy.h:
2663         * WebKit.xcodeproj/project.pbxproj:
2664         * WebProcess/Network/WebLoaderStrategy.cpp:
2665         (WebKit::WebLoaderStrategy::scheduleLoad):
2666         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2667         (WebKit::WebLoaderStrategy::startPingLoad):
2668         * WebProcess/Network/WebLoaderStrategy.h:
2669         * WebProcess/Storage/ServiceWorkerContextManager.cpp:
2670         (WebKit::ServiceWorkerContextManager::ServiceWorkerContextManager):
2671         (WebKit::ServiceWorkerContextManager::startServiceWorker):
2672         (WebKit::ServiceWorkerContextManager::startFetch):
2673         * WebProcess/Storage/ServiceWorkerContextManager.h:
2674         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2675         (WebKit::WebFrameLoaderClient::pageID const):
2676         (WebKit::WebFrameLoaderClient::frameID const):
2677         (WebKit::WebFrameLoaderClient::sessionID const):
2678         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2679         * WebProcess/WebProcess.cpp:
2680         (WebKit::WebProcess::getWorkerContextConnection):
2681         * WebProcess/WebProcess.h:
2682         * WebProcess/WebProcess.messages.in:
2683
2684 2017-10-25  Yousuke Kimoto  <yousuke.kimoto@sony.com>
2685
2686         [WinCairo] Add WebKit platform files for wincairo webkit
2687         https://bugs.webkit.org/show_bug.cgi?id=178000
2688
2689         Reviewed by Alex Christensen.
2690
2691         * Platform/Module.h:
2692         * Platform/SharedMemory.h:
2693         (WebKit::SharedMemory::handle const):
2694         * Platform/win/LoggingWin.cpp: Added. It is based on Source/WebCore/platform/win/LoggingWin.cpp
2695         (WebKit::logLevelString):
2696         * Platform/win/ModuleWin.cpp: Added.
2697         (WebKit::Module::load):
2698         (WebKit::Module::unload):
2699         (WebKit::Module::platformFunctionPointer const):
2700         * Platform/win/SharedMemoryWin.cpp: Added.
2701         (WebKit::SharedMemory::Handle::Handle):
2702         (WebKit::SharedMemory::Handle::~Handle):
2703         (WebKit::SharedMemory::Handle::isNull const):
2704         (WebKit::SharedMemory::Handle::encode const):
2705         (WebKit::SharedMemory::Handle::clear):
2706         (WebKit::getDuplicatedHandle):
2707         (WebKit::SharedMemory::Handle::decode):
2708         (WebKit::protectAttribute):
2709         (WebKit::SharedMemory::allocate):
2710         (WebKit::SharedMemory::create):
2711         (WebKit::accessRights):
2712         (WebKit::SharedMemory::map):
2713         (WebKit::SharedMemory::adopt):
2714         (WebKit::SharedMemory::~SharedMemory):
2715         (WebKit::SharedMemory::createHandle):
2716         (WebKit::SharedMemory::systemPageSize):
2717         * PlatformWin.cmake:
2718
2719 2017-10-25  Chris Dumez  <cdumez@apple.com>
2720
2721         Add support for unregistering a service worker
2722         https://bugs.webkit.org/show_bug.cgi?id=178735
2723
2724         Reviewed by Brady Eidson.
2725
2726         Add support for unregistering a service worker:
2727         - https://w3c.github.io/ServiceWorker/#navigator-service-worker-unregister
2728
2729         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2730         (WebKit::WebSWServerConnection::resolveRegistrationJobInClient):
2731         (WebKit::WebSWServerConnection::resolveUnregistrationJobInClient):
2732         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2733         * WebProcess/Storage/WebSWClientConnection.messages.in:
2734
2735 2017-10-25  Chris Dumez  <cdumez@apple.com>
2736
2737         Make SharedStringHashTable less error prone
2738         https://bugs.webkit.org/show_bug.cgi?id=178764
2739
2740         Reviewed by Youenn Fablet.
2741
2742         SharedStringHashTable is backed by SharedMemory and this SharedMemory
2743         may be readonly (and is when used in the WebContent process). As a result,
2744         some of the operations on SharedStringHashTable that write to this shared
2745         memory will crash if called and the SharedMemory is readonly.
2746
2747         To make this less error prone, introduce a new SharedStringHashTableReadOnly
2748         base class for SharedStringHashTable and only keep the operations that
2749         write to the shared memory on SharedStringHashTableReadOnly (namely, add() /
2750         remove() / clear(). Update VisitedLinkTableController and WebSWOriginTable
2751         to use SharedStringHashTableReadOnly since they are instantiated in the
2752         WebContent process and use readonly shared memory.
2753
2754         * Shared/SharedStringHashTable.cpp:
2755         (WebKit::SharedStringHashTableReadOnly::SharedStringHashTableReadOnly):
2756         (WebKit::SharedStringHashTableReadOnly::~SharedStringHashTableReadOnly):
2757         (WebKit::SharedStringHashTableReadOnly::setSharedMemory):
2758         (WebKit::doubleHash):
2759         (WebKit::SharedStringHashTableReadOnly::contains const):
2760         (WebKit::SharedStringHashTableReadOnly::findSlot const):
2761         (WebKit::SharedStringHashTable::SharedStringHashTable):
2762         (WebKit::SharedStringHashTable::~SharedStringHashTable):
2763         (WebKit::SharedStringHashTable::add):
2764         (WebKit::SharedStringHashTable::remove):
2765         (WebKit::SharedStringHashTable::clear):
2766         * Shared/SharedStringHashTable.h:
2767         * WebProcess/Storage/WebSWOriginTable.h:
2768         * WebProcess/WebPage/VisitedLinkTableController.cpp:
2769         (WebKit::VisitedLinkTableController::removeAllVisitedLinks):
2770         * WebProcess/WebPage/VisitedLinkTableController.h:
2771
2772 2017-10-25  Adrian Perez de Castro  <aperez@igalia.com>
2773
2774         [WPE] Remove GLib API functions which use Cairo
2775         https://bugs.webkit.org/show_bug.cgi?id=178205
2776
2777         Reviewed by Michael Catanzaro.
2778
2779         Add PLATFORM(GTK) guards for the parts of of the GLib API which use cairo_surface_t (web
2780         page snapshots and favicons), and remove the affected function prototypes from public API
2781         headers. This way, the WPE version of the API is not tied to Cairo.
2782
2783         * PlatformWPE.cmake:
2784         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
2785         * UIProcess/API/glib/WebKitFaviconDatabasePrivate.h:
2786         * UIProcess/API/glib/WebKitInjectedBundleClient.cpp:
2787         * UIProcess/API/glib/WebKitWebView.cpp:
2788         (webkitWebViewConstructed):
2789         (webkitWebViewGetProperty):
2790         (webkitWebViewDispose):
2791         (webkit_web_view_class_init):
2792         (webkitWebViewLoadChanged):
2793         * UIProcess/API/glib/WebKitWebViewPrivate.h:
2794         * UIProcess/API/wpe/WebKitFaviconDatabase.h:
2795         * UIProcess/API/wpe/WebKitWebView.h:
2796         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
2797         (webkitWebPageDidReceiveMessage):
2798
2799 2017-10-25  Zan Dobersek  <zdobersek@igalia.com>
2800
2801         Make SERVICE_WORKER feature buildable on GTK, WPE
2802         https://bugs.webkit.org/show_bug.cgi?id=178574
2803
2804         Reviewed by Carlos Garcia Campos.
2805
2806         * CMakeLists.txt: Add missing files to the build.
2807         * StorageProcess/StorageProcess.cpp:
2808         (WebKit::StorageProcess::didGetWorkerContextProcessConnection):
2809         IPC::Attachment object should be accessed through an rvalue reference,
2810         making it mutable and enabling releasing the file descriptor.
2811         * StorageProcess/StorageProcess.h: Adjust the method signature.
2812         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2813         Explicitly include the ResourceError header from WebCore (using a forwarding header).
2814         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2815         Include the CachedResource header from WebCore (again using a forwarding header).
2816         * WebProcess/Storage/WebServiceWorkerProvider.h: Forward-declare the WebCore::CachedResource type.
2817
2818 2017-10-24  Youenn Fablet  <youenn@apple.com>
2819
2820         ServiceWorkerClientFetch should return an error that is not null in case of failure
2821         https://bugs.webkit.org/show_bug.cgi?id=178761
2822
2823         Reviewed by Geoffrey Garen.
2824
2825         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2826         (WebKit::ServiceWorkerClientFetch::didFail): Generating a General error.
2827
2828 2017-10-24  Youenn Fablet  <youenn@apple.com>
2829
2830         Enable service worker to use cache storage api
2831         https://bugs.webkit.org/show_bug.cgi?id=178684
2832
2833         Reviewed by Brady Eidson.
2834
2835         Passing the WebPreferences store of the default page group of the WebProcessPool to its ServiceWorker process.
2836         ServiceWorkerContextManager then uses it to initialize the preferences accordingly.
2837         Patch is covered by new test which is using cache api previously disabled and now enabled through the store.
2838
2839         Made use of the new ServiceWorkerThreadProxy in ServiceWorkerContextManager to enable a cache storage connection.
2840         Fixed the default size of quota in WebsiteDataStore.
2841
2842         * UIProcess/WebProcessPool.cpp:
2843         (WebKit::WebProcessPool::getWorkerContextProcessConnection):
2844         * UIProcess/WebsiteData/WebsiteDataStore.h:
2845         * WebProcess/Storage/ServiceWorkerContextManager.cpp:
2846         (WebKit::ServiceWorkerContextManager::ServiceWorkerContextManager):
2847         (WebKit::ServiceWorkerContextManager::updatePreferences):
2848         (WebKit::ServiceWorkerContextManager::startServiceWorker):
2849         (WebKit::ServiceWorkerContextManager::startFetch):
2850         * WebProcess/Storage/ServiceWorkerContextManager.h:
2851         (WebKit::ServiceWorkerContextManager::ServiceWorkerContextManager): Deleted.
2852         * WebProcess/WebProcess.cpp:
2853         (WebKit::WebProcess::getWorkerContextConnection):
2854         * WebProcess/WebProcess.h:
2855         * WebProcess/WebProcess.messages.in:
2856
2857 2017-10-24  Alex Christensen  <achristensen@webkit.org>
2858
2859         Selecting and right-clicking URL-like strings with IDNA-disallowed characters in host or authority causes rendering engine crash
2860         https://bugs.webkit.org/show_bug.cgi?id=174267
2861
2862         Reviewed by Tim Horton.
2863
2864         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2865         (WKBundlePageCanHandleRequest):
2866
2867 2017-10-24  Chris Dumez  <cdumez@apple.com>
2868
2869         Add initial implementation for serviceWorker.postMessage()
2870         https://bugs.webkit.org/show_bug.cgi?id=178534
2871
2872         Reviewed by Youenn Fablet.
2873
2874         Add initial implementation for serviceWorker.postMessage():
2875         - https://w3c.github.io/ServiceWorker/#service-worker-postmessage
2876
2877         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2878         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
2879         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2880         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2881         * WebProcess/Storage/ServiceWorkerContextManager.cpp:
2882         (WebKit::ServiceWorkerContextManager::postMessageToServiceWorkerGlobalScope):
2883         * WebProcess/Storage/ServiceWorkerContextManager.h:
2884         * WebProcess/Storage/ServiceWorkerContextManager.messages.in:
2885         * WebProcess/Storage/WebSWClientConnection.cpp:
2886         (WebKit::WebSWClientConnection::postMessageToServiceWorkerGlobalScope):
2887         * WebProcess/Storage/WebSWClientConnection.h:
2888
2889 2017-10-24  Brent Fulgham  <bfulgham@apple.com>
2890
2891         Adopt new secure coding APIs
2892         https://bugs.webkit.org/show_bug.cgi?id=178484
2893         <rdar://problem/34837193>
2894
2895         Reviewed by Tim Horton.
2896
2897         Switch to new NSKeyed[Un]Archiver methods that active and use
2898         NSSecureCoding by default.
2899
2900         * Platform/ios/AccessibilityIOS.mm:
2901         (WebKit::newAccessibilityRemoteToken): Use secure-by-default API.
2902         * Shared/Cocoa/DataDetectionResult.mm:
2903         (WebKit::DataDetectionResult::encode const): Ditto.
2904         (WebKit::DataDetectionResult::decode): Ditto.
2905         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
2906         (IPC::ArgumentCoder<WebCore::Payment>::encode): Ditto.
2907         (IPC::ArgumentCoder<WebCore::Payment>::decode): Ditto.
2908         (IPC::ArgumentCoder<WebCore::PaymentContact>::encode): Ditto.
2909         (IPC::ArgumentCoder<WebCore::PaymentContact>::decode): Ditto.
2910         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode): Ditto.
2911         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::decode): Ditto.
2912         (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode): Ditto.
2913         (IPC::ArgumentCoder<WebCore::PaymentMethod>::decode): Ditto.
2914         * Shared/ios/InteractionInformationAtPosition.mm:
2915         (WebKit::InteractionInformationAtPosition::encode const): Ditto.
2916         (WebKit::InteractionInformationAtPosition::decode): Ditto.
2917         * Shared/mac/WebCoreArgumentCodersMac.mm:
2918         (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData): Ditto.
2919         (IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData): Ditto.
2920         (IPC::ArgumentCoder<Credential>::encodePlatformData): Ditto.
2921         (IPC::ArgumentCoder<Credential>::decodePlatformData): Ditto.
2922         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode): Ditto.
2923         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::decode): Ditto.
2924         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData): Ditto.
2925         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::decodePlatformData): Ditto.
2926         * Shared/mac/WebHitTestResultData.mm:
2927         (WebKit::WebHitTestResultData::platformEncode const): Ditto.
2928         (WebKit::WebHitTestResultData::platformDecode): Ditto.
2929         * UIProcess/API/Cocoa/WKProcessPool.mm:
2930         (-[WKProcessPool _setObject:forBundleParameter:]): Ditto.
2931         (-[WKProcessPool _setObjectsForBundleParametersWithDictionary:]): Ditto.
2932         * UIProcess/API/Cocoa/WKWebView.mm:
2933         (-[WKWebView _setInputDelegate:]): Ditto.
2934         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2935         (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto.
2936         * UIProcess/ios/PageClientImplIOS.mm:
2937         (WebKit::PageClientImpl::startAssistingNode): Ditto.
2938         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2939         (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Ditto.
2940         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
2941         (WebKit::InjectedBundle::initialize): Ditto.
2942         (WebKit::InjectedBundle::setBundleParameter): Ditto.
2943         (WebKit::InjectedBundle::setBundleParameters): Ditto.
2944
2945 2017-10-24  Sam Weinig  <sam@webkit.org>
2946
2947         [Settings] Add initial support for generating preferences related code
2948         https://bugs.webkit.org/show_bug.cgi?id=178656
2949
2950         Reviewed by Dean Jackson.
2951
2952         As a first step towards getting off the macros in WebPreferencesDefinitions.h
2953         and reducing the overhead of adding a preference, this change generates adds
2954         WebPreferences.yaml where preference changes will go, and generates much of
2955         WebPreferencesDefinitions.h from it (all the custom defaults moved to 
2956         WebPreferencesDefinitionsBase.h). Subsequent changes will remove the need for 
2957         the macros in WebPreferencesDefinitions.h entirely.
2958
2959         * CMakeLists.txt:
2960         * DerivedSources.make:
2961         * WebKit.xcodeproj/project.pbxproj:
2962         
2963             Add new files / rules to generate WebPreferencesDefinitions.h.
2964         
2965         * Scripts/GeneratePreferences.rb: Added.
2966         * Scripts/PreferencesTemplates: Added.
2967         * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
2968         
2969             Add scripts and template to generate WebPreferencesDefinitions.h from
2970             WebPreferences.yaml.
2971
2972         * Shared/WebPreferences.yaml: Added.
2973         
2974             Configuration file for preferences.
2975         
2976         * Shared/WebPreferencesDefinitions.h: Removed.
2977         * Shared/WebPreferencesDefinitionsBase.h: Copied from Source/WebKit/Shared/WebPreferencesDefinitions.h.
2978         
2979             Moved custom defaults to new WebPreferencesDefinitionsBase.h. Removed the need for 
2980             FOR_EACH_WEBKIT_STRING_PREFERENCE by using custom defaults for the font family values.
2981
2982 2017-10-24  Matt Lewis  <jlewis3@apple.com>
2983
2984         Unreviewed, rolling out r223889.
2985
2986         This caused multiple crashes on all platforms
2987
2988         Reverted changeset:
2989
2990         "Adopt new secure coding APIs"
2991         https://bugs.webkit.org/show_bug.cgi?id=178484
2992         https://trac.webkit.org/changeset/223889
2993
2994 2017-10-24  Youenn Fablet  <youenn@apple.com>
2995
2996         ASSERTION FAILED: !m_serviceWorkerManager in WebProcess::getWorkerContextConnection() on API tests
2997         https://bugs.webkit.org/show_bug.cgi?id=178586
2998         <rdar://problem/35115902>
2999
3000         Reviewed by Brady Eidson.
3001
3002        Covered by API tests no longer crashing.
3003
3004         * UIProcess/WebProcessPool.cpp:
3005         (WebKit::WebProcessPool::getWorkerContextProcessConnection): Sending a worker context process connection message only at creation of the service worker process.
3006
3007 2017-10-24  Brent Fulgham  <bfulgham@apple.com>
3008
3009         Adopt new secure coding APIs
3010         https://bugs.webkit.org/show_bug.cgi?id=178484
3011         <rdar://problem/34837193>
3012
3013         Reviewed by Tim Horton.
3014
3015         Switch to new NSKeyed[Un]Archiver methods that active and use
3016         NSSecureCoding by default.
3017
3018         * Platform/ios/AccessibilityIOS.mm:
3019         (WebKit::newAccessibilityRemoteToken): Use secure-by-default API.
3020         * Shared/Cocoa/DataDetectionResult.mm:
3021         (WebKit::DataDetectionResult::encode const): Ditto.
3022         (WebKit::DataDetectionResult::decode): Ditto.
3023         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
3024         (IPC::ArgumentCoder<WebCore::Payment>::encode): Ditto.
3025         (IPC::ArgumentCoder<WebCore::Payment>::decode): Ditto.
3026         (IPC::ArgumentCoder<WebCore::PaymentContact>::encode): Ditto.
3027         (IPC::ArgumentCoder<WebCore::PaymentContact>::decode): Ditto.
3028         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode): Ditto.
3029         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::decode): Ditto.
3030         (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode): Ditto.
3031         (IPC::ArgumentCoder<WebCore::PaymentMethod>::decode): Ditto.
3032         * Shared/ios/InteractionInformationAtPosition.mm:
3033         (WebKit::InteractionInformationAtPosition::encode const): Ditto.
3034         (WebKit::InteractionInformationAtPosition::decode): Ditto.
3035         * Shared/mac/WebCoreArgumentCodersMac.mm:
3036         (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData): Ditto.
3037         (IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData): Ditto.
3038         (IPC::ArgumentCoder<Credential>::encodePlatformData): Ditto.
3039         (IPC::ArgumentCoder<Credential>::decodePlatformData): Ditto.
3040         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode): Ditto.
3041         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::decode): Ditto.
3042         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData): Ditto.
3043         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::decodePlatformData): Ditto.
3044         * Shared/mac/WebHitTestResultData.mm:
3045         (WebKit::WebHitTestResultData::platformEncode const): Ditto.
3046         (WebKit::WebHitTestResultData::platformDecode): Ditto.
3047         * UIProcess/API/Cocoa/WKProcessPool.mm:
3048         (-[WKProcessPool _setObject:forBundleParameter:]): Ditto.
3049         (-[WKProcessPool _setObjectsForBundleParametersWithDictionary:]): Ditto.
3050         * UIProcess/API/Cocoa/WKWebView.mm:
3051         (-[WKWebView _setInputDelegate:]): Ditto.
3052         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3053         (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto.
3054         * UIProcess/ios/PageClientImplIOS.mm:
3055         (WebKit::PageClientImpl::startAssistingNode): Ditto.
3056         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3057         (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Ditto.
3058         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
3059         (WebKit::InjectedBundle::initialize): Ditto.
3060         (WebKit::InjectedBundle::setBundleParameter): Ditto.
3061         (WebKit::InjectedBundle::setBundleParameters): Ditto.
3062
3063 2017-10-24  Zan Dobersek  <zdobersek@igalia.com>
3064
3065         [GTK][WPE] generate-forwarding-headers.pl should also scan derived sources in WebKit framework
3066         https://bugs.webkit.org/show_bug.cgi?id=178579
3067
3068         Reviewed by Carlos Garcia Campos.
3069
3070         * PlatformGTK.cmake: When generating forwarding headers, derived sources
3071         should be scanned as well. The DERIVED_SOURCES_WEBKIT_DIR value has to
3072         be passed as an include path to the generate-forward-headers.pl script
3073         to achieve that. This target then also has to depend on all the derived
3074         source files to be generated before this can be performed.
3075         * PlatformWPE.cmake: Ditto.
3076
3077 2017-10-23  Brian Burg  <bburg@apple.com>
3078
3079         [Cocoa] Web Automation: add SPI to tell whether the automation session is currently simulating user interactions
3080         https://bugs.webkit.org/show_bug.cgi?id=178616
3081
3082         Reviewed by Joseph Pecoraro.
3083
3084         This is needed to disambiguate whether an action (such as selectAll:) came from
3085         a user clicking on "Edit > Select All" in a menu or whether it was produced by
3086         simulating the keystrokes to produce the chord for "Command + a". Some clients,
3087         such as Safari, would allow the latter but not the former during automation.
3088
3089         * UIProcess/API/Cocoa/_WKAutomationSession.h:
3090         * UIProcess/API/Cocoa/_WKAutomationSession.mm:
3091         (-[_WKAutomationSession isSimulatingUserInteraction]):
3092         Add new SPI property that's backed by the same WebAutomationSession method.
3093
3094         * UIProcess/Automation/WebAutomationSession.h:
3095         * UIProcess/Automation/WebAutomationSession.cpp:
3096         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
3097         (WebKit::WebAutomationSession::performMouseInteraction):
3098         (WebKit::WebAutomationSession::performKeyboardInteractions):
3099         Set m_simulatingUserInteraction prior to sending the synthesized events. It will
3100         be cleared when keyboardEventsFlushedForPage() is called by WebPageProxy.
3101
3102         * UIProcess/WebPageProxy.cpp:
3103         (WebKit::WebPageProxy::didReceiveEvent):
3104         Notify the automation session that the key event queue was flushed *after* giving
3105         delegates a chance to do something with the key event. This is necessary so that
3106         any actions that are created from the NSEvent by the delegates are handled prior
3107         to the automation session finishing its keyboard interaction command.
3108
3109 2017-10-23  Brian Burg  <bburg@apple.com>
3110
3111         [Mac] Web Automation: key modifiers for synthesized NSEvents are incorrect
3112         https://bugs.webkit.org/show_bug.cgi?id=178615
3113
3114         Reviewed by Joseph Pecoraro.
3115
3116         In both PLATFORM(MAC) platform methods for simulating keyboard interactions,
3117         we errantly relied on +[NSEvent modifierFlags] to get the current state of
3118         sticky modifiers when creating synthesized events. This is incorrect for two reasons:
3119         modifierFlags is never updated when simulating a sequence of events (because
3120         all the events are synthesized before any are delivered); and the NSEvent class
3121         method only reflects the modifier state of the primary physical keyboard, which
3122         is not affected by synthesized NSEvents that happen to have modifier flags.
3123
3124         Instead, just keep our own m_currentModifiers state in the session and compute
3125         the necessary NSEventModifierFlags to put on each synthesized event. This aligns
3126         the implementation with the treatment of sticky keys in the iOS and GTK platform methods.
3127
3128         * UIProcess/Automation/WebAutomationSession.h: Every port gets this variable now.
3129         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
3130         (WebKit::WebAutomationSession::platformSimulateKeyStroke):
3131         (WebKit::WebAutomationSession::platformSimulateKeySequence):
3132         Use and update m_currentModifiers.
3133
3134 2017-10-23  Alex Christensen  <achristensen@webkit.org>
3135
3136         Fix ASAN test after r222824
3137         https://bugs.webkit.org/show_bug.cgi?id=178688
3138         <rdar://problem/35104706>
3139
3140         Reviewed by Tim Horton.
3141
3142         * UIProcess/WebBackForwardList.cpp:
3143         (WebKit::WebBackForwardList::clear):
3144         Resizing a list of Ref<T> after we've WTFMoved all the elements doesn't make ASAN happy.
3145
3146 2017-10-23  Tim Horton  <timothy_horton@apple.com>
3147
3148         Stop using _UIApplicationUsesLegacyUI()
3149         https://bugs.webkit.org/show_bug.cgi?id=178680
3150         <rdar://problem/35131949>
3151
3152         Reviewed by Dan Bernstein.
3153
3154         * Platform/spi/ios/UIKitSPI.h:
3155         * UIProcess/ios/forms/WKFormSelectPopover.mm:
3156         (-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):
3157         (-[WKSelectPopover initWithView:hasGroups:]):
3158         Resolve _UIApplicationUsesLegacyUI to false and simplify.
3159
3160 2017-10-23  Ryan Haddad  <ryanhaddad@apple.com>
3161
3162         Unreviewed, suppress deprecation warnings to fix the build.
3163         <rdar://problem/35131949>
3164
3165         * UIProcess/ios/forms/WKFormSelectPopover.mm:
3166         (-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):
3167         (-[WKSelectPopover initWithView:hasGroups:]):
3168
3169 2017-10-23  Youenn Fablet  <youenn@apple.com>
3170
3171         TestController should clear all fetch caches when resetting its state
3172         https://bugs.webkit.org/show_bug.cgi?id=178486
3173         <rdar://problem/35066305>
3174
3175         Reviewed by Chris Dumez.
3176
3177         Adding a new DidNotHandle message to disambiguate with the DidFail fetch case.
3178         With DidNotHandle, the loading should go the network process.
3179         With DidFail, the loading should return a network error.
3180
3181         On receiving an order to start a fetch, ServiceWorkerThread will dispatch a fetch event.
3182         The client of this event will retrieve the response and return it to the WebProcess through IPC.
3183
3184         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3185         (WebKit::WebSWServerConnection::didNotHandleFetch):
3186         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3187         * StorageProcess/StorageProcess.cpp:
3188         (WebKit::StorageProcess::didNotHandleFetch):
3189         * StorageProcess/StorageProcess.h:
3190         * StorageProcess/StorageProcess.messages.in:
3191         * WebKit.xcodeproj/project.pbxproj:
3192         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
3193         (WebKit::ServiceWorkerClientFetch::didFail):
3194         (WebKit::ServiceWorkerClientFetch::didNotHandle):
3195         * WebProcess/Storage/ServiceWorkerClientFetch.h:
3196         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in:
3197         * WebProcess/Storage/ServiceWorkerContextManager.cpp:
3198         (WebKit::ServiceWorkerContextManager::startFetch):
3199         * WebProcess/Storage/ServiceWorkerContextManager.h:
3200         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp: Added.
3201         (WebKit::WebServiceWorkerFetchTaskClient::~WebServiceWorkerFetchTaskClient):
3202         (WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
3203         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveResponse):
3204         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
3205         (WebKit::WebServiceWorkerFetchTaskClient::didFail):
3206         (WebKit::WebServiceWorkerFetchTaskClient::didFinish):
3207         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h: Added.
3208         * WebProcess/WebProcess.cpp:
3209         (WebKit::WebProcess::startFetchInServiceWorker):
3210         * WebProcess/WebProcess.h:
3211
3212 2017-10-22  Wenson Hsieh  <wenson_hsieh@apple.com>
3213
3214         [iOS] WebProcess::initializeWebProcess spends ~150ms spinning up AVSystemController on some devices
3215         https://bugs.webkit.org/show_bug.cgi?id=178640
3216         <rdar://problem/35113105>
3217
3218         Reviewed by Youenn Fablet.
3219
3220         In r213933, we added a mechanism to allow the web process to drive media capture, by setting an attribute on the
3221         shared AVSystemController. This requires us to fault in the Celestial framework, which is a slight performance
3222         hit on some hardware. Instead of doing this at the start of every web process launch, we can just do this work
3223         lazily, the first time the web process requests permissions for user media access.
3224
3225         * WebProcess/WebCoreSupport/WebUserMediaClient.cpp:
3226         (WebKit::WebUserMediaClient::requestUserMediaAccess):
3227         * WebProcess/WebPage/WebPage.cpp:
3228         (WebKit::WebPage::prepareToSendUserMediaPermissionRequest):
3229         * WebProcess/WebPage/WebPage.h:
3230         * WebProcess/WebPage/ios/WebPageIOS.mm:
3231         (WebKit::WebPage::prepareToSendUserMediaPermissionRequest):
3232         * WebProcess/cocoa/WebProcessCocoa.mm:
3233         (WebKit::WebProcess::platformInitializeWebProcess):
3234
3235 2017-10-21  Michael Catanzaro  <mcatanzaro@igalia.com>
3236
3237         Unreviewed, silence a -Wunused-but-set-variable warning
3238
3239         * WebProcess/WebPage/EventDispatcher.cpp:
3240         (WebKit::EventDispatcher::wheelEvent):
3241
3242 2017-10-20  Alex Christensen  <achristensen@webkit.org>
3243
3244         Add FIXME comment after r223803
3245         https://bugs.webkit.org/show_bug.cgi?id=178418
3246
3247         * UIProcess/WebProcessPool.cpp:
3248         (WebKit::WebProcessPool::ensureNetworkProcess):
3249         We need some work to better support customized persistent data stores.  Add a comment indicating such.
3250
3251 2017-10-20  Alex Christensen  <achristensen@webkit.org>
3252
3253         Fix API tests after r223791.
3254         https://bugs.webkit.org/show_bug.cgi?id=178418
3255
3256         * UIProcess/WebProcessPool.cpp:
3257         (WebKit::WebProcessPool::ensureNetworkProcess):
3258         Whatever NetworkSessionInitializationParameters we send with the NetworkProcess initialization message,
3259         that's the default session.  This is needed for WebKit.WebsiteDataStoreCustomPaths.
3260         (WebKit::WebProcessPool::createNewWebProcess):
3261         Don't change behavior or NetworkProcess initialization like I did in r223791.
3262
3263 2017-10-20  Alex Christensen  <achristensen@webkit.org>
3264
3265         Fix download tests on El Capitan after r223730
3266         https://bugs.webkit.org/show_bug.cgi?id=178547
3267
3268         * UIProcess/Downloads/DownloadProxy.cpp:
3269         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
3270         Revert to original behavior.  This uses suggestedFilename, which may have come from places like
3271         the download attribute, instead of always using the filename from CFNetwork.
3272
3273 2017-10-20  Alex Christensen  <achristensen@webkit.org>
3274
3275         Expose _boundInterfaceIdentifier and _allowsCellularAccess to WKWebsiteDataStorePrivate
3276         https://bugs.webkit.org/show_bug.cgi?id=178418
3277         <rdar://problem/29599569>
3278
3279         Reviewed by Tim Horton.
3280         
3281         In r213747 I introduced allowsCellularAccess to _WKProcessPoolConfiguration because there
3282         was no way to add parameters to the default (and other) NetworkSession constructors.  Since
3283         clients have not adopted this SPI, we can introduce such a way in NetworkSessionCreationParameters
3284         and move the SPI to WKWebsiteDataStore, which is where it and other NetworkSession properties
3285         ought to be instead of making them WKProcessPool global.
3286
3287         We also need to expose access to NSURLRequest.boundInterfaceIdentifier.  Instead of serializing and
3288         deserializing that property for each NSURLRequest and then having subresources mysteriously jump back
3289         to having no bound interface identifiers, I'm adding this to WKWebsiteDataStore, too, to make it a
3290         session networking property.
3291         
3292         I manually verified that these properties are being set properly with a custom test app and added logs.
3293         Unfortunately, these properties don't do anything under circumstances anywhere close to what we test.
3294         The architecture change of having NetworkSessionCreationParameters is verified to not have a change in
3295         behavior by existing tests, such as any test that uses TestProtocol (which we should eventually remove).
3296
3297         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3298         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
3299         * NetworkProcess/NetworkProcess.cpp:
3300         (WebKit::NetworkProcess::NetworkProcess):
3301         (WebKit::NetworkProcess::initializeNetworkProcess):
3302         (WebKit::NetworkProcess::clearCachedCredentials):
3303         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3304         (WebKit::NetworkProcessCreationParameters::encode const):
3305         (WebKit::NetworkProcessCreationParameters::decode):
3306         * NetworkProcess/NetworkProcessCreationParameters.h:
3307         * NetworkProcess/NetworkSession.cpp:
3308         (WebKit::NetworkSession::create):
3309         (WebKit::NetworkSession::defaultSession): Deleted.
3310         * NetworkProcess/NetworkSession.h:
3311         * NetworkProcess/NetworkSessionCreationParameters.h: Added.
3312         (WebKit::NetworkSessionCreationParameters::encode const):
3313         (WebKit::NetworkSessionCreationParameters::decode):
3314         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
3315         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
3316         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3317         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
3318         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3319         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
3320         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
3321         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3322         (WebKit::NetworkSessionCocoa::setSourceApplicationSecondaryIdentifier):
3323         (WebKit::NetworkSessionCocoa::create):
3324         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3325         (WebKit::NetworkSessionCocoa::setLegacyCustomProtocolManager): Deleted.
3326         (WebKit::NetworkSessionCocoa::setAllowsCellularAccess): Deleted.
3327         (WebKit::NetworkSessionCocoa::defaultSession): Deleted.
3328         * NetworkProcess/mac/RemoteNetworkingContext.mm:
3329         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
3330         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
3331         * Shared/SessionTracker.cpp:
3332         (WebKit::SessionTracker::networkSession):
3333         (WebKit::SessionTracker::setSession):
3334         * Shared/WebsiteDataStoreParameters.cpp:
3335         (WebKit::WebsiteDataStoreParameters::encode const):
3336         (WebKit::WebsiteDataStoreParameters::decode):
3337         * Shared/WebsiteDataStoreParameters.h:
3338         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3339         (API::ProcessPoolConfiguration::copy):
3340         * UIProcess/API/APIProcessPoolConfiguration.h:
3341         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3342         (-[WKWebsiteDataStore _setBoundInterfaceIdentifier:]):
3343         (-[WKWebsiteDataStore _boundInterfaceIdentifier]):
3344         (-[WKWebsiteDataStore _setAllowsCellularAccess:]):
3345         (-[WKWebsiteDataStore _allowsCellularAccess]):
3346         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3347         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3348         (-[_WKProcessPoolConfiguration allowsCellularAccess]):
3349         (-[_WKProcessPoolConfiguration setAllowsCellularAccess:]):
3350         * UIProcess/WebProcessPool.cpp:
3351         (WebKit::WebProcessPool::ensureNetworkProcess):
3352         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
3353         * UIProcess/WebsiteData/WebsiteDataStore.h:
3354         (WebKit::WebsiteDataStore::setBoundInterfaceIdentifier):
3355         (WebKit::WebsiteDataStore::boundInterfaceIdentifier):
3356         (WebKit::WebsiteDataStore::setAllowsCellularAccess):
3357         (WebKit::WebsiteDataStore::allowsCellularAccess):
3358         * WebKit.xcodeproj/project.pbxproj:
3359         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3360         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
3361         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
3362         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
3363         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
3364         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
3365         * WebProcess/WebProcess.cpp:
3366         (WebKit::WebProcess::ensurePrivateBrowsingSession):
3367         (WebKit::WebProcess::clearCachedCredentials):
3368
3369 2017-10-20  Alex Christensen  <achristensen@webkit.org>
3370
3371         Add ObjC SPI to _WKDownloadDelegate missing from WKContextDownloadClient
3372         https://bugs.webkit.org/show_bug.cgi?id=178566
3373         <rdar://problem/23041906>
3374
3375         Reviewed by Brady Eidson.
3376
3377         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
3378         * UIProcess/Cocoa/DownloadClient.h:
3379         * UIProcess/Cocoa/DownloadClient.mm:
3380         (WebKit::DownloadClient::DownloadClient):
3381         (WebKit::DownloadClient::didReceiveAuthenticationChallenge):
3382         (WebKit::DownloadClient::shouldDecodeSourceDataOfMIMEType):
3383         (WebKit::DownloadClient::didCreateDestination):
3384         (WebKit::DownloadClient::processDidCrash):
3385
3386 2017-10-20  Youenn Fablet  <youenn@apple.com>
3387
3388         ResourceResponse should have a ServiceWorker source
3389         https://bugs.webkit.org/show_bug.cgi?id=178593
3390
3391         Reviewed by Alex Christensen.
3392
3393         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
3394         (WebKit::ServiceWorkerClientFetch::didReceiveResponse): setting response source to ServiceWorker.
3395         * WebProcess/Storage/ServiceWorkerClientFetch.h:
3396
3397 2017-10-20  Antoine Quint  <graouts@apple.com>
3398
3399         [Web Animations] Provide basic timeline and animation interfaces
3400         https://bugs.webkit.org/show_bug.cgi?id=178526
3401
3402         Reviewed by Dean Jackson.
3403
3404         Remove the WEB_ANIMATIONS compile-time flag.
3405
3406         * Configurations/FeatureDefines.xcconfig:
3407         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3408         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3409         (WebKit::InjectedBundle::setWebAnimationsEnabled):
3410         * WebProcess/WebPage/WebPage.cpp:
3411         (WebKit::WebPage::updatePreferences):
3412
3413 2017-10-02  Brian Burg  <bburg@apple.com>
3414
3415         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
3416         https://bugs.webkit.org/show_bug.cgi?id=177661
3417         <rdar://problem/34740286>
3418
3419         Reviewed by Joseph Pecoraro.
3420
3421         Move setup and delegates of the inspector frontend page into implementations of
3422         WebInspectorProxy::platformCreateFrontendPage. The Mac implementation
3423         will be subsumed by WKInspectorViewController, while the GTK implementation
3424         is inherited from the cross-platform version that uses C API. Eventually the
3425         GTK version should use GTK API rather than the soon to be deprecated C API.
3426
3427         * UIProcess/WebInspectorProxy.cpp:
3428         (WebKit::WebInspectorProxy::createFrontendPage):
3429         (WebKit::webProcessDidCrash): Deleted.
3430         (WebKit::decidePolicyForNavigationAction): Deleted.
3431         (WebKit::getContextMenuFromProposedMenu): Deleted.
3432         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
3433         (WebKit::exceededDatabaseQuota):
3434         (WebKit::webProcessDidCrash):
3435         (WebKit::decidePolicyForNavigationAction):
3436         (WebKit::getContextMenuFromProposedMenu):
3437         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
3438         * UIProcess/mac/WebInspectorProxyMac.mm:
3439         (WebKit::exceededDatabaseQuota):
3440         (WebKit::webProcessDidCrash):
3441         (WebKit::decidePolicyForNavigationAction):
3442         (WebKit::getContextMenuFromProposedMenu):
3443         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
3444
3445 2017-10-02  Brian Burg  <bburg@apple.com>
3446
3447         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
3448         https://bugs.webkit.org/show_bug.cgi?id=177661
3449         <rdar://problem/34740286>
3450
3451         Reviewed by Joseph Pecoraro.
3452
3453         Adopt WKInspectorViewController in WebInspectorProxyMac to set up the
3454         frontend's web view.
3455
3456         * UIProcess/WebInspectorProxy.cpp:
3457         (WebKit::WebInspectorProxy::invalidate):
3458         (WebKit::WebInspectorProxy::close):
3459         (WebKit::WebInspectorProxy::didClose):
3460         (WebKit::WebInspectorProxy::closeFrontendPageAndWindow):
3461         Make closeFrontendPageAndWindow into the method that does work.
3462         Only use didClose() as the IPC message entry point.
3463
3464         * UIProcess/WebInspectorProxy.h:
3465         (WebKit::WebInspectorProxy::isUnderTest const): Make public.
3466
3467         * UIProcess/mac/WKInspectorViewController.h:
3468         * UIProcess/mac/WKInspectorViewController.mm:
3469         (+[WKInspectorViewController viewIsInspectorWebView:]):
3470         Abstract away the -isInstanceOfClass: check for WKInspectorWKWebView.
3471         Clients shouldn't need to know whether we use a subclass or what its name is.
3472
3473         * UIProcess/mac/WebInspectorProxyMac.mm:
3474         (-[WKWebInspectorProxyObjCAdapter inspectorViewControllerInspectorDidCrash:]):
3475         (-[WKWebInspectorProxyObjCAdapter inspectorViewControllerInspectorIsUnderTest:]):
3476         Hook up view controller delegates.
3477
3478         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
3479         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
3480         (WebKit::WebInspectorProxy::closeFrontendPage):
3481         New implementation based on the view controller.
3482
3483         (WebKit::WebInspectorProxy::platformBringToFront):
3484         (WebKit::WebInspectorProxy::platformIsFront):
3485         (WebKit::WebInspectorProxy::platformCanAttach):
3486         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
3487         (WebKit::WebInspectorProxy::platformAttach):
3488         (WebKit::WebInspectorProxy::platformDetach):
3489         (WebKit::WebInspectorProxy::platformStartWindowDrag):
3490         Adjust to get the WKWebView out of the view controller for code that needs
3491         to do something with the NSView, such as get/set the frame.
3492
3493         (WebKit::WebInspectorProxy::createFrontendConfiguration): Deleted.
3494         (WebKit::exceededDatabaseQuota): Deleted.
3495         (WebKit::webProcessDidCrash): Deleted.
3496         (WebKit::decidePolicyForNavigationAction): Deleted.
3497         (WebKit::getContextMenuFromProposedMenu): Deleted.
3498
3499 2017-10-02  Brian Burg  <bburg@apple.com>
3500
3501         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
3502         https://bugs.webkit.org/show_bug.cgi?id=177661
3503         <rdar://problem/34740286>
3504
3505         Reviewed by Joseph Pecoraro.
3506
3507         Introduce new platform methods to open and close the frontend page and window.
3508         This matches how RemoteWebInspectorProxy divides work up into platform methods.
3509         Move existing code from platformDidClose, platformOpen, and other methods into
3510         the new platform methods. Move some identical platform code into WebInspectorProxy.cpp.
3511
3512         * UIProcess/WebInspectorProxy.h:
3513         * UIProcess/WebInspectorProxy.cpp:
3514         (WebKit::WebInspectorProxy::connect):
3515         (WebKit::WebInspectorProxy::showConsole):
3516         (WebKit::WebInspectorProxy::showResources):
3517         (WebKit::WebInspectorProxy::showTimelines):
3518         (WebKit::WebInspectorProxy::showMainResourceForFrame):
3519         (WebKit::WebInspectorProxy::createFrontendPage):
3520         (WebKit::WebInspectorProxy::createInspectorPage):
3521         (WebKit::WebInspectorProxy::open):
3522         (WebKit::WebInspectorProxy::didClose):
3523         (WebKit::WebInspectorProxy::eagerlyCreateInspectorPage): Renamed.
3524
3525         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
3526         (WebKit::WebInspectorProxy::updateInspectorWindowTitle const):
3527         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
3528         Do everything necessary to set up the frontend page WebView.
3529
3530         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
3531         Do everything necessary to set up the detached NSWindow for the frontend.
3532
3533         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
3534         (WebKit::WebInspectorProxy::platformDetach):
3535         (WebKit::WebInspectorProxy::platformCreateInspectorPage): Deleted.
3536         (WebKit::WebInspectorProxy::createInspectorWindow): Deleted.
3537         (WebKit::WebInspectorProxy::platformOpen): Deleted.
3538         (WebKit::WebInspectorProxy::platformDidClose): Deleted.
3539
3540         * UIProcess/mac/WebInspectorProxyMac.mm:
3541         (WebKit::WebInspectorProxy::updateInspectorWindowTitle const):
3542         (WebKit::WebInspectorProxy::platformCreateFrontendPage): Added.
3543         Do everything necessary to set up the frontend page WebView.
3544
3545         (WebKit::WebInspectorProxy::platformCreateFrontendWindow): Added.
3546         Do everything necessary to set up the detached NSWindow for the frontend.
3547
3548         (WebKit::WebInspectorProxy::closeFrontendPage):
3549         (WebKit::WebInspectorProxy::closeFrontendAfterInactivityTimerFired):
3550         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
3551         (WebKit::WebInspectorProxy::platformDidCloseForCrash):
3552         (WebKit::WebInspectorProxy::platformInvalidate):
3553         (WebKit::WebInspectorProxy::platformBringToFront): Carry through renamings.
3554
3555         (WebKit::WebInspectorProxy::platformDetach):
3556         Defer to the general open() method to create a window if needed and bring it to front.
3557
3558         (WebKit::WebInspectorProxy::platformCanAttach): Move this below open/close code.
3559
3560         (WebKit::WebInspectorProxy::closeFrontend): Deleted.
3561         (WebKit::WebInspectorProxy::createInspectorWindow): Deleted.
3562         (WebKit::WebInspectorProxy::platformCreateInspectorPage): Deleted.
3563         (WebKit::WebInspectorProxy::platformOpen): Deleted.
3564         (WebKit::WebInspectorProxy::platformDidClose): Deleted.
3565         Defer to the general open() method to create a window if needed and bring it to front.
3566
3567         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
3568         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
3569         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
3570         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
3571         (WebKit::WebInspectorProxy::platformCreateInspectorPage): Deleted.
3572         (WebKit::WebInspectorProxy::createInspectorWindow): Deleted.
3573         (WebKit::WebInspectorProxy::platformOpen): Deleted.
3574         (WebKit::WebInspectorProxy::platformDidClose): Deleted.
3575         Update stubs.
3576
3577 2017-10-02  Brian Burg  <bburg@apple.com>
3578
3579         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
3580         https://bugs.webkit.org/show_bug.cgi?id=177661
3581         <rdar://problem/34740286>
3582
3583         Reviewed by Joseph Pecoraro.
3584
3585         This patch refactors some Cocoa code pathas.
3586         Rename the timer that closes the WebView so it's more obvious what it is for.
3587         Extract the common code to close the frontend window so its not implemented by
3588         the timer callback.
3589
3590         In later patches, this will be extracted further into platform methods to open/close
3591         the frontend and window, like how it is for RemoteWebInspectorProxy.
3592
3593         * UIProcess/WebInspectorProxy.cpp:
3594         (WebKit::WebInspectorProxy::WebInspectorProxy):
3595         * UIProcess/WebInspectorProxy.h:
3596         * UIProcess/mac/WebInspectorProxyMac.mm:
3597         (WebKit::WebInspectorProxy::closeFrontendAfterInactivityTimerFired):
3598         (WebKit::WebInspectorProxy::closeFrontend):
3599         (WebKit::WebInspectorProxy::platformCreateInspectorPage):
3600         (WebKit::WebInspectorProxy::platformDidClose):
3601         (WebKit::WebInspectorProxy::platformDidCloseForCrash):
3602         (WebKit::WebInspectorProxy::platformInvalidate):
3603         (WebKit::WebInspectorProxy::closeTimerFired): Deleted.
3604
3605 2017-09-30  Brian Burg  <bburg@apple.com>
3606
3607         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
3608         https://bugs.webkit.org/show_bug.cgi?id=177661
3609         <rdar://problem/34740286>
3610
3611         Reviewed by Joseph Pecoraro.
3612
3613         Modernize the ObjC adapter and related code a bit before it is hooked
3614         into WKInspectorViewController.
3615
3616         * UIProcess/API/C/mac/WKInspectorPrivateMac.h: No need for the
3617         ivar to be declared here, move to @implementation.
3618
3619         * UIProcess/WebInspectorProxy.h: Simplify the name to match modern convention.
3620
3621         * UIProcess/mac/WebInspectorProxyMac.mm:
3622         (-[WKWebInspectorProxyObjCAdapter inspectorRef]):
3623         (-[WKWebInspectorProxyObjCAdapter initWithWebInspectorProxy:]):
3624         (-[WKWebInspectorProxyObjCAdapter invalidate]):
3625         (-[WKWebInspectorProxyObjCAdapter windowDidMove:]):
3626         (-[WKWebInspectorProxyObjCAdapter windowDidResize:]):
3627         (-[WKWebInspectorProxyObjCAdapter windowWillClose:]):
3628         (-[WKWebInspectorProxyObjCAdapter windowDidEnterFullScreen:]):
3629         (-[WKWebInspectorProxyObjCAdapter windowDidExitFullScreen:]):
3630         (-[WKWebInspectorProxyObjCAdapter inspectedViewFrameDidChange:]):
3631         Remove unnecessary casts to and from void*.
3632
3633         (WebKit::WebInspectorProxy::attachmentViewDidChange):
3634         (WebKit::WebInspectorProxy::setInspectorWindowFrame):
3635         (WebKit::WebInspectorProxy::closeTimerFired):
3636         (WebKit::WebInspectorProxy::createInspectorWindow):
3637         (WebKit::WebInspectorProxy::platformCreateInspectorPage):
3638         Fix uses of member variable m_objCAdapter.
3639
3640         (-[WKWebInspectorProxyObjCAdapter close]): Deleted.
3641         Rename this to invalidate to match modern convention. In this context,
3642         'close' might trick someone into thinking that this closes a window/page.
3643
3644 2017-09-30  Brian Burg  <bburg@apple.com>
3645
3646         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
3647         https://bugs.webkit.org/show_bug.cgi?id=177661
3648         <rdar://problem/34740286>
3649
3650         Reviewed by Joseph Pecoraro.
3651
3652         Move code that sets up and controls the inspector WebView into WKInspectorViewController.
3653         This will be shared between RemoteWebInspectorProxy and WebInspectorProxy eventually,
3654         but for now just pull out code from RemoteWebInspectorProxy. The next patch will move
3655         over WebInspectorProxy.
3656
3657         WKInspectorViewController uses the ObjC API for setting up the WKWebView's delegates.
3658         Previously, a WKWebView was used but the delegates were set up using the C API. In
3659         a few cases it uses delegate methods to ask the owning [Remote]WebInspectorProxy some
3660         things. In general, WKInspectorViewController doesn't dig into any internals of
3661         WebPageProxy or WebInspectorProxy; that is delegated to the client.
3662
3663         * UIProcess/RemoteWebInspectorProxy.h:
3664         (WebKit::RemoteWebInspectorProxy::isUnderTest const): Add a method stub for now.
3665         We might want to enable tests for a _WKRemoteWebInspectorViewController-based UI
3666         in the future, and WebInspectorProxy has the same method. Add this and connect it
3667         to the view controller delegate method.
3668
3669         (WebKit::RemoteWebInspectorProxy::webView const):
3670         This returns a plain WKWebView type now.
3671
3672         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
3673         (-[WKRemoteWebInspectorProxyObjCAdapter inspectorViewControllerInspectorDidCrash:]):
3674         (-[WKRemoteWebInspectorProxyObjCAdapter inspectorViewControllerInspectorIsUnderTest:]):
3675         (-[WKRemoteWebInspectorProxyObjCAdapter webViewWebContentProcessDidTerminate:]): Deleted.
3676         (-[WKRemoteWebInspectorProxyObjCAdapter webView:decidePolicyForNavigationAction:decisionHandler:]): Deleted.
3677         Make the ObjCAdapter forward view controller delegate calls to the C++ class.
3678         It no longer needs to be the delegate of the WebView, as the view controller handles that.
3679
3680         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
3681         Clean up and move WKWebView setup code into the view controller.
3682
3683         (WebKit::RemoteWebInspectorProxy::platformCloseFrontendPageAndWindow):
3684         The m_inspectorPage is closed by the caller before calling this method, so we don't need to do it here.
3685
3686         (WebKit::RemoteWebInspectorProxy::platformBringToFront):
3687         (WebKit::RemoteWebInspectorProxy::platformSave):
3688         (WebKit::RemoteWebInspectorProxy::platformAppend):
3689         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag):
3690         Use webView() instead of m_webView.
3691
3692         * UIProcess/mac/WKInspectorViewController.h: Added.
3693         * UIProcess/mac/WKInspectorViewController.mm: Added.
3694         (-[WKInspectorWKWebView tag]):
3695         (-[WKInspectorViewController initWithInspectedPage:]):
3696         (-[WKInspectorViewController dealloc]):
3697         (-[WKInspectorViewController delegate]):
3698         (-[WKInspectorViewController webView]):
3699         (-[WKInspectorViewController setDelegate:]):
3700         (-[WKInspectorViewController configuration]):
3701         (-[WKInspectorViewController _webView:getWindowFrameWithCompletionHandler:]):
3702         (-[WKInspectorViewController _webView:setWindowFrame:]):
3703         (-[WKInspectorViewController webView:runOpenPanelWithParameters:initiatedByFrame:completionHandler:]):
3704         (-[WKInspectorViewController _webView:decideDatabaseQuotaForSecurityOrigin:currentQuota:currentOriginUsage:currentDatabaseUsage:expectedUsage:decisionHandler:]):
3705         (-[WKInspectorViewController webViewWebContentProcessDidTerminate:]):
3706         (-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]):
3707         Move code from RemoteWebInspectorProxyMac into here.
3708
3709         * UIProcess/mac/WebInspectorProxyMac.mm:
3710         (WebKit::WebInspectorProxy::createFrontendWindow):
3711         Remove commented out code left over from the last time that this method got moved around.
3712
3713         * WebKit.xcodeproj/project.pbxproj:
3714         Add new class.
3715
3716 2017-10-20  Zan Dobersek  <zdobersek@igalia.com>
3717
3718         [WK2] Drop 'CoordinatedGraphics' as a platform prefix from generate-forwarding-headers.pl
3719         https://bugs.webkit.org/show_bug.cgi?id=178575
3720
3721         Reviewed by Carlos Garcia Campos.
3722
3723         * Scripts/generate-forwarding-headers.pl: Remove CoordinatedGraphics as
3724         a supported platform prefix. No one invokes the script with this
3725         argument anymore.
3726
3727 2017-10-19  Alex Christensen  <achristensen@webkit.org>
3728
3729         Introduce completionHandler-based SPI for _WKDownloadDelegate.decideDestinationWithSuggestedFilename
3730         https://bugs.webkit.org/show_bug.cgi?id=178560
3731
3732         Reviewed by Tim Horton.
3733
3734         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
3735         * UIProcess/Cocoa/DownloadClient.h:
3736         * UIProcess/Cocoa/DownloadClient.mm:
3737         (WebKit::DownloadClient::DownloadClient):
3738         (WebKit::DownloadClient::didStart):
3739         (WebKit::DownloadClient::didReceiveResponse):
3740         (WebKit::DownloadClient::didReceiveData):
3741         (WebKit::DownloadClient::decideDestinationWithSuggestedFilename):
3742         (WebKit::DownloadClient::didFinish):
3743         (WebKit::DownloadClient::didFail):
3744         (WebKit::DownloadClient::didCancel):
3745         (WebKit::DownloadClient::willSendRequest):
3746
3747 2017-10-19  Chris Dumez  <cdumez@apple.com>
3748
3749         ServiceWorkerContextManager should be an IPC::MessageReceiver
3750         https://bugs.webkit.org/show_bug.cgi?id=178552
3751
3752         Reviewed by Youenn Fablet.
3753
3754         ServiceWorkerContextManager should be an IPC::MessageReceiver, to avoid putting too many
3755         ServiceWorker related methods on WebProcess class.
3756
3757         * DerivedSources.make:
3758         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3759         (WebKit::WebSWServerConnection::startServiceWorkerContext):
3760         (WebKit::WebSWServerConnection::startFetch):
3761         * WebKit.xcodeproj/project.pbxproj:
3762         * WebProcess/Storage/ServiceWorkerContextManager.cpp:
3763         (WebKit::ServiceWorkerContextManager::startFetchInServiceWorker):
3764         (WebKit::ServiceWorkerContextManager::startFetch): Deleted.
3765         * WebProcess/Storage/ServiceWorkerContextManager.h:
3766         * WebProcess/Storage/ServiceWorkerContextManager.messages.in: Added.
3767         * WebProcess/WebProcess.cpp:
3768         (WebKit::WebProcess::didReceiveMessage):
3769         (WebKit::WebProcess::getWorkerContextConnection):
3770         (WebKit::WebProcess::startServiceWorkerContext): Deleted.
3771         (WebKit::WebProcess::startFetchInServiceWorker): Deleted.
3772         * WebProcess/WebProcess.h:
3773         * WebProcess/WebProcess.messages.in:
3774
3775 2017-10-19  Alex Christensen  <achristensen@webkit.org>
3776
3777         Modernize authentication challenge handling in WebKit
3778         https://bugs.webkit.org/show_bug.cgi?id=178555
3779
3780         Reviewed by Tim Horton.
3781
3782         * UIProcess/API/APILoaderClient.h:
3783         (API::LoaderClient::didReceiveAuthenticationChallengeInFrame):
3784         * UIProcess/API/APINavigationClient.h:
3785         (API::NavigationClient::didReceiveAuthenticationChallenge):
3786         * UIProcess/API/C/WKPage.cpp:
3787         (WKPageSetPageLoaderClient):
3788         (WKPageSetPageNavigationClient):
3789         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
3790         * UIProcess/Cocoa/NavigationState.h:
3791         * UIProcess/Cocoa/NavigationState.mm:
3792         (WebKit::NavigationState::NavigationClient::canAuthenticateAgainstProtectionSpace):
3793         (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):
3794         * UIProcess/WebPageProxy.cpp:
3795         (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
3796
3797 2017-10-19  Alex Christensen  <achristensen@webkit.org>
3798
3799         Modernize API::DownloadClient
3800         https://bugs.webkit.org/show_bug.cgi?id=178547
3801
3802         Reviewed by Andy Estes.
3803
3804         Use more C++ references instead of pointers because they're never null.
3805
3806         Remove canAuthenticateAgainstProtectionSpace because there are no implementations
3807         except the default implementation which always returns true and we don't intend to
3808         add this to the SPI because that's just a legacy call anyways from when NSURLConnection
3809         hadn't fully evolved, and we're moving away from NSURLConnection, especially in our API design.
3810
3811         Separate the NetworkSession-only and pre-NetworkSession-only callbacks.  All the synchronous
3812         IPC messages are only used in the pre-NetworkSession code, so once we remove it we can remove them!
3813
3814         Make API::DownloadClient calls that NetworkSession uses use a completion handler so we will be able to
3815         design an asynchronous API.
3816
3817         * NetworkProcess/Downloads/DownloadManager.cpp:
3818         (WebKit::DownloadManager::continueCanAuthenticateAgainstProtectionSpace): Deleted.
3819         * NetworkProcess/Downloads/DownloadManager.h:
3820         * NetworkProcess/Downloads/PendingDownload.cpp:
3821         (WebKit::PendingDownload::canAuthenticateAgainstProtectionSpaceAsync):
3822         (WebKit::PendingDownload::continueCanAuthenticateAgainstProtectionSpace): Deleted.
3823         * NetworkProcess/Downloads/PendingDownload.h:
3824         * NetworkProcess/NetworkProcess.cpp:
3825         (WebKit::NetworkProcess::continueCanAuthenticateAgainstProtectionSpaceDownload): Deleted.
3826         * NetworkProcess/NetworkProcess.h:
3827         * NetworkProcess/NetworkProcess.messages.in:
3828         * UIProcess/API/APIDownloadClient.h:
3829         (API::DownloadClient::didStart):
3830         (API::DownloadClient::didReceiveAuthenticationChallenge):
3831         (API::DownloadClient::didReceiveResponse):
3832         (API::DownloadClient::didReceiveData):
3833         (API::DownloadClient::shouldDecodeSourceDataOfMIMEType):
3834         (API::DownloadClient::decideDestinationWithSuggestedFilename):
3835         (API::DownloadClient::didCreateDestination):
3836         (API::DownloadClient::didFinish):
3837         (API::DownloadClient::didFail):
3838         (API::DownloadClient::didCancel):
3839         (API::DownloadClient::processDidCrash):
3840         (API::DownloadClient::willSendRequest):
3841         (API::DownloadClient::canAuthenticateAgainstProtectionSpace): Deleted.
3842         * UIProcess/API/C/WKContext.cpp:
3843         (WKContextSetDownloadClient):
3844         * UIProcess/API/glib/WebKitDownloadClient.cpp:
3845         * UIProcess/Cocoa/DownloadClient.h:
3846         * UIProcess/Cocoa/DownloadClient.mm:
3847         (WebKit::DownloadClient::didStart):
3848         (WebKit::DownloadClient::didReceiveResponse):
3849         (WebKit::DownloadClient::didReceiveData):
3850         (WebKit::DownloadClient::decideDestinationWithSuggestedFilename):
3851         (WebKit::DownloadClient::didFinish):
3852         (WebKit::DownloadClient::didFail):
3853         (WebKit::DownloadClient::didCancel):
3854         (WebKit::DownloadClient::willSendRequest):
3855         * UIProcess/Downloads/DownloadProxy.cpp:
3856         (WebKit::DownloadProxy::processDidClose):
3857         (WebKit::DownloadProxy::didStart):
3858         (WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
3859         (WebKit::DownloadProxy::willSendRequest):
3860         (WebKit::DownloadProxy::didReceiveResponse):
3861         (WebKit::DownloadProxy::didReceiveData):
3862         (WebKit::DownloadProxy::shouldDecodeSourceDataOfMIMEType):
3863         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):
3864         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
3865         (WebKit::DownloadProxy::didCreateDestination):
3866         (WebKit::DownloadProxy::didFinish):
3867         (WebKit::DownloadProxy::didFail):
3868         (WebKit::DownloadProxy::didCancel):
3869         (WebKit::DownloadProxy::canAuthenticateAgainstProtectionSpace): Deleted.
3870         * UIProcess/Downloads/DownloadProxy.h:
3871         * UIProcess/Downloads/DownloadProxy.messages.in:
3872
3873 2017-10-19  Nan Wang  <n_wang@apple.com>
3874
3875         AX: Provide a way for Accessibility to cache the selection while retrieving rects for speak selection
3876         https://bugs.webkit.org/show_bug.cgi?id=176247
3877         <rdar://problem/34217143>
3878
3879         Reviewed by Ryosuke Niwa.
3880
3881         When getting the rects for highlighting the spoken text within a selection range on iOS, we can get a
3882         list of totally wrong rects if the user changed the selection to some other text. This is because the
3883         calculation is based on the current selection range. Therefore, we need to provide a way for accessibility
3884         codepath to store the selection during a speaking session.
3885
3886         * UIProcess/API/Cocoa/WKWebView.mm:
3887         (-[WKWebView _accessibilityStoreSelection]):
3888         (-[WKWebView _accessibilityClearSelection]):
3889         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3890         * UIProcess/WebPageProxy.h:
3891         * UIProcess/ios/WKContentViewInteraction.h:
3892         * UIProcess/ios/WKContentViewInteraction.mm:
3893         (-[WKContentView _accessibilityStoreSelection]):
3894         (-[WKContentView _accessibilityClearSelection]):
3895         * UIProcess/ios/WebPageProxyIOS.mm:
3896         (WebKit::WebPageProxy::storeSelectionForAccessibility):
3897         * WebProcess/WebPage/WebPage.h:
3898         * WebProcess/WebPage/WebPage.messages.in:
3899         * WebProcess/WebPage/ios/WebPageIOS.mm:
3900         (WebKit::WebPage::getRectsForGranularityWithSelectionOffset):
3901         (WebKit::WebPage::storeSelectionForAccessibility):
3902         (WebKit::WebPage::getRectsAtSelectionOffsetWithText):
3903
3904 2017-10-19  Sam Weinig  <sam@webkit.org>
3905
3906         [Settings] Move global settings into their own file
3907         https://bugs.webkit.org/show_bug.cgi?id=178512
3908
3909         Reviewed by Darin Adler.
3910
3911         Moves all global settigns out of SettingsBase and into the new DeprecatedGlobalSettings.
3912
3913         * NetworkProcess/NetworkProcess.cpp:
3914         (WebKit::NetworkProcess::setAllowsAnySSLCertificateForWebSocket):
3915         * Shared/WebPreferencesDefinitions.h:
3916         * Shared/WebPreferencesStore.cpp:
3917         * WebProcess/WebPage/WebPage.cpp:
3918         (WebKit::m_cpuLimit):
3919         (WebKit::WebPage::updatePreferences):
3920         * WebProcess/WebProcess.cpp:
3921         (WebKit::WebProcess::setResourceLoadStatisticsEnabled):
3922         * WebProcess/cocoa/VideoFullscreenManager.mm:
3923         (WebKit::VideoFullscreenManager::supportsVideoFullscreen const):
3924
3925 2017-10-19  Andy Estes  <aestes@apple.com>
3926
3927         [iOS] Conditionally rename DatabaseProcess to StorageProcess when building for iOS devices
3928         https://bugs.webkit.org/show_bug.cgi?id=178181
3929         <rdar://problem/33660282>
3930
3931         Reviewed by Dan Bernstein.
3932
3933         * Configurations/BaseTarget.xcconfig:
3934         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
3935         (WebKit::serviceName):
3936         * WebKit.xcodeproj/project.pbxproj:
3937
3938 2017-10-19  Youenn Fablet  <youenn@apple.com>
3939
3940         Add preliminary support for ServiceWorker Handle Fetch
3941         https://bugs.webkit.org/show_bug.cgi?id=178475
3942         <rdar://problem/35066424>
3943
3944         Reviewed by Chris Dumez.
3945
3946         Relanding now that underlying issue is fixed in https://bugs.webkit.org/show_bug.cgi?id=178527.
3947
3948         Preliminary support of Handle Fetch algorithm and integration with fetch spec.
3949         Adding ServiceWorkerClientFetch as the class responsible to do the load through ServiceWorker.
3950         It is similar to WebResourceLoader that do the load through NetworkProcess.
3951         In case ServiceWorkerClientFetch is not able to load through ServiceWorker,
3952         it will fallback to WebResourceLoader through a fallback callback.
3953
3954         Loading through Service Worker is done currently if:
3955         - There is a service worker registered for that origin
3956         - Request is a subresource
3957         - service workers mode is all
3958         There will be cases where the service worker will not do the loading, for instance when fetch event handler is not set.
3959         Future work should try to reduce the cases where the IPC dance is done unnecessarily.
3960
3961         ServiceWorkerClientFetch is responsible to adapt the ServiceWorker response to ResourceLoader.
3962         In particular, it is calling ResourceLoader error callback if response is of type error.
3963         It should call ResourceLoader redirection callback if response is a redirection response.
3964         This will be done as a follow-up.
3965
3966         Implementing the IPC communication dedicated to fetch between WebProcess and ServiceWorker through StorageProcess.
3967         In the future, WebProcess should create a direct IPC communication to the ServiceWorker process.
3968
3969         Moved SWContextManager from WebCore to WebKit and renamed it to ServiceWorkerContextManager.
3970         This class is moved to WebKit as it will have to handle IPC and having a separation will add some unnecessary boilerplate.
3971
3972         * CMakeLists.txt:
3973         * DerivedSources.make:
3974         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3975         (WebKit::WebSWServerConnection::startFetch):
3976         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
3977         (WebKit::WebSWServerConnection::didReceiveFetchData):
3978         (WebKit::WebSWServerConnection::didFinishFetch):
3979         (WebKit::WebSWServerConnection::didFailFetch):
3980         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3981         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
3982         * StorageProcess/StorageProcess.cpp:
3983         (WebKit::StorageProcess::didFailFetch):
3984         (WebKit::StorageProcess::didReceiveFetchResponse):
3985         (WebKit::StorageProcess::didReceiveFetchData):
3986         (WebKit::StorageProcess::didFinishFetch):
3987         * StorageProcess/StorageProcess.h:
3988         * StorageProcess/StorageProcess.messages.in:
3989         * WebKit.xcodeproj/project.pbxproj:
3990         * WebProcess/Network/WebLoaderStrategy.cpp:
3991         (WebKit::WebLoaderStrategy::scheduleLoad):
3992         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3993         (WebKit::WebLoaderStrategy::remove):
3994         * WebProcess/Network/WebLoaderStrategy.h:
3995         * WebProcess/Storage/ServiceWorkerClientFetch.cpp: Added.
3996         (WebKit::ServiceWorkerClientFetch::ServiceWorkerClientFetch):
3997         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
3998         (WebKit::ServiceWorkerClientFetch::didReceiveData):
3999         (WebKit::ServiceWorkerClientFetch::didFinish):
4000         (WebKit::ServiceWorkerClientFetch::didFail):
4001         (WebKit::ServiceWorkerClientFetch::cancel):
4002         * WebProcess/Storage/ServiceWorkerClientFetch.h: Copied from Source/WebKit/WebProcess/Storage/WebSWClientConnection.h.
4003         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in: Copied from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in.
4004         * WebProcess/Storage/ServiceWorkerContextManager.cpp: Added.
4005         (WebKit::ServiceWorkerContextManager::startServiceWorkerContext):
4006         (WebKit::ServiceWorkerContextManager::startFetch):
4007         * WebProcess/Storage/ServiceWorkerContextManager.h: Renamed from Source/WebCore/workers/service/context/SWContextManager.h.
4008         (WebKit::ServiceWorkerContextManager::ServiceWorkerContextManager):