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