Followup to r224238: API::Attachment should generate a _WKAttachment ObjC wrapper
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2017-10-31  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         Followup to r224238: API::Attachment should generate a _WKAttachment ObjC wrapper
4         https://bugs.webkit.org/show_bug.cgi?id=179080
5
6         Reviewed by Tim Horton.
7
8         Fixes a failing API test. The new Attachment object type added in r224238 was not actually being handled in
9         Object::newObject, so a plain WKObject Objective C wrapper was being created; fix this by allocating a new
10         _WKAttachment object for Type::Attachment.
11
12         * Shared/Cocoa/APIObject.mm:
13         (API::Object::newObject):
14
15 2017-10-31  Tim Horton  <timothy_horton@apple.com>
16
17         Fix up some content filtering feature flags
18         https://bugs.webkit.org/show_bug.cgi?id=179079
19
20         Reviewed by Simon Fraser.
21
22         * Configurations/FeatureDefines.xcconfig:
23
24 2017-10-31  Youenn Fablet  <youenn@apple.com>
25
26         rwt should allow service worker to load localhost HTTPS resources with any certificate
27         https://bugs.webkit.org/show_bug.cgi?id=179018
28
29         Reviewed by Chris Dumez.
30
31         Allowing ServiceWorkerProcessProxy to handle authentication challenge.
32         Temporarily adding a boolean flag through WebProcessPool to lower the SSL certificate verifications for service workers.
33         This allows reducing flakiness in our layout tests for rwt.
34         Future work should be done to expose a correct API for the application level to handle authentication challenges properly.
35
36         * UIProcess/API/C/WKContext.cpp:
37         (WKContextSetAllowsAnySSLCertificateForServiceWorkerTesting):
38         * UIProcess/API/C/WKContextPrivate.h:
39         * UIProcess/API/Cocoa/WKProcessPool.mm:
40         (-[WKProcessPool _setAllowsAnySSLCertificateForServiceWorker:]):
41         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
42         * UIProcess/Network/NetworkProcessProxy.cpp:
43         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
44         (WebKit::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace):
45         * UIProcess/ServiceWorkerProcessProxy.cpp:
46         (WebKit::ServiceWorkerProcessProxy::didReceiveAuthenticationChallenge):
47         * UIProcess/ServiceWorkerProcessProxy.h:
48         * UIProcess/WebProcessPool.h:
49
50 2017-10-31  Joseph Pecoraro  <pecoraro@apple.com>
51
52         Web Inspector: UIProcess ASSERT in ~RemoteWebInspectorProxy when InspectorProcess crashes
53         https://bugs.webkit.org/show_bug.cgi?id=179044
54
55         Reviewed by Alex Christensen.
56
57         * UIProcess/RemoteWebInspectorProxy.cpp:
58         (WebKit::RemoteWebInspectorProxy::frontendDidClose):
59         Add a protector to keep the proxy alive for the duration of this method.
60
61 2017-10-31  Youenn Fablet  <youenn@apple.com>
62
63         Crash in:  com.apple.WebKit: WebKit::CacheStorage::Caches::initializeSize(WTF::Function<void (std::optional<WebCore::DOMCacheEngine::Error>&&)>&&) + 30 (CacheStorageEngineCaches.cpp:163)
64         https://bugs.webkit.org/show_bug.cgi?id=179037
65
66         Reviewed by Chris Dumez.
67
68         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
69         (WebKit::CacheStorage::Caches::initializeSize): the storage backend may be cleared when clearing caches by the UI Process.
70         Returning early in that case. A web application will typically fail to open a cache in this case.
71         On retry, the cache should be opened.
72
73 2017-10-31  Wenson Hsieh  <wenson_hsieh@apple.com>
74
75         [Attachment Support] Implement WKWebView SPI for inserting attachment elements
76         https://bugs.webkit.org/show_bug.cgi?id=179013
77         <rdar://problem/35249668>
78
79         Reviewed by Tim Horton.
80
81         Adds native SPI to insert attachment elements given a filename, an optional MIME type, and a data blob. See
82         change-by-change comments below for more detail. Covered by a new API test.
83
84         * PlatformMac.cmake:
85         * Shared/API/APIObject.h:
86         * Shared/API/Cocoa/WebKitPrivate.h:
87         * UIProcess/API/APIAttachment.cpp: Copied from Source/WebKit/Shared/API/Cocoa/WebKitPrivate.h.
88         (API::Attachment::create):
89         (API::Attachment::Attachment):
90         (API::Attachment::~Attachment):
91
92         Introduce API::Attachment, which represents a platform-agnostic Attachment.
93
94         * UIProcess/API/APIAttachment.h: Copied from Source/WebKit/Shared/API/Cocoa/WebKitPrivate.h.
95         * UIProcess/API/Cocoa/WKWebView.mm:
96         (-[WKWebView _insertAttachmentWithFilename:contentType:data:options:completion:]):
97
98         Adds support for inserting a new attachment element. Calls out to WebPageProxy to insert the attachment from the
99         given data blob, and creates a new API-object-backed _WKAttachment.
100
101         (-[WKWebView _executeEditCommand:argument:completion:]):
102
103         Support passing in a nil completion block.
104
105         * UIProcess/API/Cocoa/WKWebViewInternal.h:
106         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
107         * UIProcess/API/Cocoa/_WKAttachment.h: Copied from Source/WebKit/Shared/API/Cocoa/WebKitPrivate.h.
108         * UIProcess/API/Cocoa/_WKAttachment.mm: Copied from Source/WebCore/html/HTMLAttachmentElement.h.
109
110         Introduces _WKAttachment, an Objective C wrapper around the API::Attachment.
111
112         (-[_WKAttachment _apiObject]):
113         (-[_WKAttachment isEqual:]):
114         (-[_WKAttachment uniqueIdentifier]):
115         (-[_WKAttachment hash]):
116
117         Add _WKAttachment, a WebKit SPI object that wraps an attachment element unique identifier. Also, allow
118         _WKAttachment to be used as a hashable NSDictionary key.
119
120         (-[_WKAttachment description]):
121         * UIProcess/API/Cocoa/_WKAttachmentInternal.h: Copied from Source/WebKit/Shared/API/Cocoa/WebKitPrivate.h.
122         (API::wrapper):
123         * UIProcess/WebPageProxy.cpp:
124         (WebKit::WebPageProxy::insertAttachment):
125
126         Implement IPC support for inserting an attachment.
127
128         * UIProcess/WebPageProxy.h:
129         * WebKit.xcodeproj/project.pbxproj:
130         * WebProcess/WebPage/WebPage.cpp:
131         (WebKit::WebPage::insertAttachment):
132         * WebProcess/WebPage/WebPage.h:
133         * WebProcess/WebPage/WebPage.messages.in:
134
135 2017-10-31  Alex Christensen  <achristensen@webkit.org>
136
137         Fix custom header field setting with reloads and asynchronous navigation action policy decisions
138         https://bugs.webkit.org/show_bug.cgi?id=179064
139
140         Reviewed by Tim Horton.
141
142         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
143         (WebKit::WebFrameLoaderClient::applyToDocumentLoader):
144         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
145         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
146         * WebProcess/WebPage/WebFrame.cpp:
147         (WebKit::WebFrame::didReceivePolicyDecision):
148         * WebProcess/WebPage/WebFrame.h:
149         * WebProcess/WebPage/WebPage.cpp:
150         (WebKit::WebPage::didReceivePolicyDecision):
151
152 2017-10-31  Carlos Garcia Campos  <cgarcia@igalia.com>
153
154         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.19.1 release.
155
156         * gtk/NEWS: Add release notes for 2.19.1.
157
158 2017-10-31  Carlos Garcia Campos  <cgarcia@igalia.com>
159
160         Unreviewed. Fix GTK+ make distcheck.
161
162         Include WebCore/TextEncodingRegistry.h to ensure the forwarding header is generated.
163
164         * UIProcess/API/glib/WebKitSettings.cpp:
165
166 2017-10-31  Commit Queue  <commit-queue@webkit.org>
167
168         Unreviewed, rolling out r223884.
169         https://bugs.webkit.org/show_bug.cgi?id=179055
170
171         It broke GTK+ make distcheck (Requested by KaL on #webkit).
172
173         Reverted changeset:
174
175         "[GTK][WPE] generate-forwarding-headers.pl should also scan
176         derived sources in WebKit framework"
177         https://bugs.webkit.org/show_bug.cgi?id=178579
178         https://trac.webkit.org/changeset/223884
179
180 2017-10-30  Fujii Hironori  <Hironori.Fujii@sony.com>
181
182         Use LazyNeverDestroyed instead of DEFINE_GLOBAL for XMLNames, HTMLNames, MathMLNames and SVGNames
183         https://bugs.webkit.org/show_bug.cgi?id=175118
184
185         Reviewed by Alex Christensen.
186
187         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLPrivate.cpp:
188         (WebKit::wrap):
189
190 2017-10-27  Megan Gardner  <megan_gardner@apple.com>
191
192         Correctly determine affinity when inserting text via Keyboard Suggestions
193         https://bugs.webkit.org/show_bug.cgi?id=178969
194
195         Reviewed by Ryosuke Niwa.
196
197         Use the logic of VisiblePosition to correctly determine cursor affinity. We were
198         defaulting to upstream, but that in incorrect and resulted in hitting asserts that
199         we should not. This should give us the correct affinity in all cases.
200
201         * WebProcess/WebPage/ios/WebPageIOS.mm:
202         (WebKit::WebPage::syncApplyAutocorrection):
203
204 2017-10-30  Commit Queue  <commit-queue@webkit.org>
205
206         Unreviewed, rolling out r224078.
207         https://bugs.webkit.org/show_bug.cgi?id=179026
208
209         MotionMark regression (Requested by shallawa on #webkit).
210
211         Reverted changeset:
212
213         "When navigating back to a page, compositing layers may not
214         use accelerated drawing"
215         https://bugs.webkit.org/show_bug.cgi?id=178749
216         https://trac.webkit.org/changeset/224078
217
218 2017-10-30  Sam Weinig  <sam@webkit.org>
219
220         [Setting] Only expose experimental features that are compiled in
221         https://bugs.webkit.org/show_bug.cgi?id=179023
222
223         Reviewed by Tim Horton.
224
225         * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb:
226         
227             Update template to conditionally expose experimental features based on their
228             'condition' option in WebPreferences.yaml
229
230 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
231
232         [WPE] Fix build warnings
233         https://bugs.webkit.org/show_bug.cgi?id=178899
234
235         Reviewed by Carlos Alberto Lopez Perez.
236
237         * PlatformWPE.cmake:
238
239 2017-10-30  Sam Weinig  <sam@webkit.org>
240
241         [Settings] Replace macro driven experimental features code with generated code
242         https://bugs.webkit.org/show_bug.cgi?id=178994
243
244         Reviewed by Simon Fraser.
245
246         As a first step toward allowing experimental features to vary based on compile
247         time flags, replace the macro driven implementation of the WebPreferences part
248         of experimental features, with one generated from a template file.
249
250         * CMakeLists.txt:
251         * DerivedSources.make:
252         * Scripts/GeneratePreferences.rb:
253         * WebKit.xcodeproj/project.pbxproj:
254
255             Generate the new template.
256         
257         * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb: Added.
258         * UIProcess/WebPreferences.cpp:
259         (WebKit::createExperimentalFeaturesVector): Deleted.
260         (WebKit::WebPreferences::experimentalFeatures): Deleted.
261         (WebKit::WebPreferences::isEnabledForFeature const): Deleted.
262         (WebKit::WebPreferences::setEnabledForFeature): Deleted.
263         (WebKit::WebPreferences::enableAllExperimentalFeatures): Deleted.
264         
265             Replace macro implementation with template generated one.
266
267 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
268
269         [WPE] Build more files under WebCore as unified sources and get rid of WebCorePlatformWPE build target
270         https://bugs.webkit.org/show_bug.cgi?id=178964
271
272         Reviewed by Carlos Alberto Lopez Perez.
273
274         * PlatformWPE.cmake:
275
276 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
277
278         [WPE][GTK] Expose availability of certain editing commands in WebKitEditorState
279         https://bugs.webkit.org/show_bug.cgi?id=168219
280
281         Reviewed by Ryosuke Niwa.
282
283         Expose canCut, canCopy, canPaste, canUndo, and canRedo in EditorState::PostLayouData.
284
285         Add corresponding new WPE/GTK API.
286
287         Remove allowsCopy from WebKitTestResultData. It's unused, does not work correctly in all
288         circumstances, and irritates Ryosuke.
289
290         Also, remove a bunch of #ifs guarding post layout data, since it's now used on all ports.
291
292         * Shared/EditorState.cpp:
293         (WebKit::EditorState::encode const):
294         (WebKit::EditorState::decode):
295         (WebKit::EditorState::PostLayoutData::encode const):
296         (WebKit::EditorState::PostLayoutData::decode):
297         * Shared/EditorState.h:
298         (WebKit::EditorState::postLayoutData const const):
299         * Shared/WebHitTestResultData.cpp:
300         (WebKit::WebHitTestResultData::WebHitTestResultData):
301         (WebKit::WebHitTestResultData::encode const):
302         (WebKit::WebHitTestResultData::decode):
303         * Shared/WebHitTestResultData.h:
304         * UIProcess/API/APIHitTestResult.h:
305         (API::HitTestResult::allowsCopy const): Deleted.
306         * UIProcess/API/glib/WebKitEditorState.cpp:
307         (webkitEditorStateChanged):
308         (webkit_editor_state_is_cut_available):
309         (webkit_editor_state_is_copy_available):
310         (webkit_editor_state_is_paste_available):
311         (webkit_editor_state_is_undo_available):
312         (webkit_editor_state_is_redo_available):
313         * UIProcess/API/glib/WebKitWebView.cpp:
314         (webkit_web_view_can_execute_editing_command):
315         * UIProcess/API/gtk/WebKitEditorState.h:
316         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
317         * UIProcess/API/wpe/WebKitEditorState.h:
318         * WebProcess/WebPage/WebPage.cpp:
319         (WebKit::WebPage::editorState const):
320         * WebProcess/WebPage/mac/WebPageMac.mm:
321         (WebKit::WebPage::performImmediateActionHitTestAtLocation):
322
323 2017-10-27  Sam Weinig  <sam@webkit.org>
324
325         [Settings] Generate more of the WebKit preferences code
326         https://bugs.webkit.org/show_bug.cgi?id=178945
327
328         Reviewed by Chris Dumez.
329
330         Generate WebPreferencesKeys.{h,cpp} and WebPreferencesStoreDefaultsMap.cpp
331
332         * CMakeLists.txt:
333         * DerivedSources.make:
334         * WebKit.xcodeproj/project.pbxproj:
335         * Scripts/GeneratePreferences.rb:
336         
337             Generate new files.
338         
339         * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
340         
341             Update include.
342         
343         * Scripts/PreferencesTemplates/WebPreferencesKeys.cpp.erb: Added.
344         * Scripts/PreferencesTemplates/WebPreferencesKeys.h.erb: Added.
345         * Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb: Added.
346
347             Add template files for new generated files.
348
349         * Shared/WebPreferencesDefaultValues.h: Copied from Source/WebKit/Shared/WebPreferencesDefinitionsBase.h.
350         * Shared/WebPreferencesDefinitionsBase.h:
351         
352             Renamed WebPreferencesDefinitionsBase.h to WebPreferencesDefaultValues.h to better indicate what it is.
353         
354         * Shared/WebPreferencesKeys.cpp: Removed.
355         * Shared/WebPreferencesKeys.h: Removed.
356         
357             Replaced with generated versions.
358
359         * Shared/WebPreferencesStore.cpp:
360         (WebKit::defaults): Deleted.
361         * Shared/WebPreferencesStore.h:
362         
363             Replace macro driven defaults map with generated WebPreferencesStoreDefaultsMap.cpp.
364
365 2017-10-28  Chris Dumez  <cdumez@apple.com>
366
367         self.ExtendableEvent / Client / Clients / WindowClient do not exist in a Service Worker
368         https://bugs.webkit.org/show_bug.cgi?id=178976
369
370         Reviewed by Sam Weinig.
371
372         Actually enable the Service Worker RuntimeEnabledFeature in the Service Worker
373         WebProcess.
374
375         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
376         (WebKit::WebSWContextManagerConnection::updatePreferences):
377
378 2017-10-28  Joseph Pecoraro  <pecoraro@apple.com>
379
380         Make postprocess-framework-headers.sh a little easier to read
381         https://bugs.webkit.org/show_bug.cgi?id=178971
382
383         Reviewed by Sam Weinig.
384
385         * mac/postprocess-framework-headers.sh:
386
387 2017-10-27  Daniel Bates  <dabates@apple.com>
388
389         Attempt to fix the Apple El Capitan build following <https://trac.webkit.org/changeset/224134>
390         (https://bugs.webkit.org/show_bug.cgi?id=178919)
391
392         Move definition of NetworkLoad::isAllowedToAskUserForCredentials() outside of USE(NETWORK_SESSION)-guarded section.
393
394         * NetworkProcess/NetworkLoad.cpp:
395         (WebKit::NetworkLoad::isAllowedToAskUserForCredentials const):
396
397 2017-10-27  Daniel Bates  <dabates@apple.com>
398
399         Only allow non-mixed content protected subresources to ask for credentials
400         https://bugs.webkit.org/show_bug.cgi?id=178919
401         <rdar://problem/35015245>
402
403         Reviewed by Alex Christensen.
404
405         Only allow non-mixed content protected subresources to ask for credentials. It is not meaningful
406         to allow protected mixed-content subresources to ask for credentials.
407
408         * NetworkProcess/Downloads/PendingDownload.cpp:
409         (WebKit::PendingDownload::PendingDownload): Initialize m_isAllowedToAskUserForCredentials based on
410         the specified resource load parameters or NetworkLoad object.
411         * NetworkProcess/Downloads/PendingDownload.h: Add override for NetworkLoadClient::isAllowedToAskUserForCredentials().
412         * NetworkProcess/NetworkLoad.cpp:
413         (WebKit::NetworkLoad::isAllowedToAskUserForCredentials const): Added.
414         (WebKit::NetworkLoad::completeAuthenticationChallenge): Ask NetworkLoadClient whether the load is
415         allowed to prompt for credentials.
416         (WebKit::NetworkLoad::didReceiveAuthenticationChallenge): Ditto.
417         * NetworkProcess/NetworkLoad.h:
418         * NetworkProcess/NetworkLoadClient.h:
419         * NetworkProcess/NetworkResourceLoader.cpp:
420         (WebKit::NetworkResourceLoader::NetworkResourceLoader): Initialize m_isAllowedToAskUserForCredentials
421         based on the specified resource load parameters.
422         (WebKit::NetworkResourceLoader::willSendRedirectedRequest): We do not support prompting for credentials
423         for synchronous loads.
424         (WebKit::NetworkResourceLoader::continueWillSendRequest): Modified to take an argument as to whether the
425         load is allowed to ask the user for credentials and updates state.
426         * NetworkProcess/NetworkResourceLoader.h:
427         * NetworkProcess/NetworkResourceLoader.messages.in: Modified message ContinueWillSendRequest to take a
428         boolean as to whether the load is allowed to ask the user for credentials.
429         * NetworkProcess/PreconnectTask.h: Override NetworkLoadClient::isAllowedToAskUserForCredentials()
430         such that we never ask for credentials. This matches our current behavior.
431         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h: Ditto.
432         * WebProcess/Network/WebResourceLoader.cpp:
433         (WebKit::WebResourceLoader::willSendRequest): Query ResourceLoader as to whether the load is allowed to
434         ask the user for credentials and pass this state to NetworkResourceLoader.
435
436 2017-10-27  Adrian Perez de Castro  <aperez@igalia.com>
437
438         [GTK][CMake] Incorrect conditional check when adding build dir to GIR runtime library path
439         https://bugs.webkit.org/show_bug.cgi?id=178936
440
441         Reviewed by Michael Catanzaro.
442
443         * PlatformGTK.cmake: Fix spelling of variable used in conditional.
444
445 2017-10-27  Chris Dumez  <cdumez@apple.com>
446
447         Add initial support for serviceWorkerClient.postMessage()
448         https://bugs.webkit.org/show_bug.cgi?id=178794
449
450         Reviewed by Youenn Fablet.
451
452         Add initial support for serviceWorkerClient.postMessage():
453         - https://w3c.github.io/ServiceWorker/#client-postmessage
454
455         It is now possible to do bi-directional communication with a service worker
456         via postMessage().
457
458         * Shared/WebCoreArgumentCoders.cpp:
459         (IPC::ArgumentCoder<ServiceWorkerClientIdentifier>::encode):
460         (IPC::ArgumentCoder<ServiceWorkerClientIdentifier>::decode):
461         * Shared/WebCoreArgumentCoders.h:
462         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
463         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
464         (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient):
465         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
466         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
467         * StorageProcess/StorageProcess.cpp:
468         (WebKit::StorageProcess::postMessageToServiceWorkerClient):
469         * StorageProcess/StorageProcess.h:
470         * StorageProcess/StorageProcess.messages.in:
471         * WebProcess/Storage/WebSWClientConnection.cpp:
472         (WebKit::WebSWClientConnection::postMessageToServiceWorkerGlobalScope):
473         (WebKit::WebSWClientConnection::postMessageToServiceWorkerClient):
474         * WebProcess/Storage/WebSWClientConnection.h:
475         * WebProcess/Storage/WebSWClientConnection.messages.in:
476         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
477         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerGlobalScope):
478         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerClient):
479         * WebProcess/Storage/WebSWContextManagerConnection.h:
480         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
481
482 2017-10-27  David Kilzer  <ddkilzer@apple.com>
483
484         REGRESSION (r224077): DeprecatedGlobalSettings::setAVKitEnabled() not protected by HAVE(AVKIT)
485
486         Unreviewed build fix.
487
488         * WebProcess/WebPage/WebPage.cpp:
489         (WebKit::WebPage::updatePreferences): Fix build.
490
491 2017-10-26  Jeremy Jones  <jeremyj@apple.com>
492
493         Implement seek tolerance methods in WebAVPlayerController.
494         https://bugs.webkit.org/show_bug.cgi?id=178838
495         rdar://problem/33781777
496
497         Reviewed by Eric Carlson.
498
499         This implementes additional methods on WebAVPlayerController that allows AVKit more control over seeking.
500
501         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
502         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
503         (WebKit::PlaybackSessionModelContext::seekToTime):
504         (WebKit::PlaybackSessionManagerProxy::seekToTime):
505         * WebProcess/cocoa/PlaybackSessionManager.h:
506         * WebProcess/cocoa/PlaybackSessionManager.messages.in:
507         * WebProcess/cocoa/PlaybackSessionManager.mm:
508         (WebKit::PlaybackSessionManager::seekToTime):
509
510 2017-10-26  Brian Burg  <bburg@apple.com>
511
512         Web Automation: denying user permission for getUserMedia doesn't work
513         https://bugs.webkit.org/show_bug.cgi?id=178895
514
515         Reviewed by Youenn Fablet.
516
517         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
518         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
519         The ordering of special cases is incorrect. Safari configures its automation views to
520         allow mock devices and never prompt for them. These checks were before the check for
521         the automation session's getUserMedia permission. Switch these checks.
522
523         Also change the deny reason so that subsequent requests are also denied. This matches
524         behavior when a user denies a permission request on a real dialog. With this change,
525         the DOM error changes from SecurityError to NotAllowedError, which makes more sense.
526
527 2017-10-26  Michael Catanzaro  <mcatanzaro@igalia.com>
528
529         Unreviewed, fix GCC warning spam after r224077
530         https://bugs.webkit.org/show_bug.cgi?id=178823
531
532         Need to leave a blank line at the bottom of the file.
533
534         * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
535
536 2017-10-25  Simon Fraser  <simon.fraser@apple.com>
537
538         When navigating back to a page, compositing layers may not use accelerated drawing
539         https://bugs.webkit.org/show_bug.cgi?id=178749
540         rdar://problem/35158946
541
542         Reviewed by Dean Jackson.
543
544         Avoid assertions when a test enables accelerated drawing (which we can't support
545         in the iOS simulator).
546
547         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
548         (WebKit::RemoteLayerBackingStore::ensureBackingStore):
549
550 2017-10-26  Sam Weinig  <sam@webkit.org>
551
552         [Settings] Generate the bulk of WebPage::updatePreferences(...)
553         https://bugs.webkit.org/show_bug.cgi?id=178823
554
555         Reviewed by Tim Horton.
556
557         * CMakeLists.txt:
558         * DerivedSources.make:
559         * WebKit.xcodeproj/project.pbxproj:
560
561             Add new file generation.
562
563         * Scripts/GeneratePreferences.rb:
564         
565             Replace 'webkitOnly' boolean option with a new 'webcoreBinding' option.
566             'webcoreBinding' supports the following values:
567                 - none (same as webkit only)
568                 - custom (means that you do bind to a webcore concept, but currently it must
569                   be done in a custom manner)
570                 - DeprecatedGlobalSettings (binds to a DeprecatedGlobalSettings setting)
571                 - RuntimeEnabledFeatures (binds to a RuntimeEnabledFeatures setting)
572             If 'webcoreBinding' is not provided, the preference binds to WebCore Setting
573             of either the same name or the override name provided by the new 'webcoreName'
574             option (we should try to remove the need for 'webcoreName' by unifying with 
575             WebCore on preference/setting naming).
576             
577             A 'condition' option was also added to indicate that the preference is only available
578             when that macro condition is true.
579             
580             Since we are generating most of WebPage::updatePreferences, we can simplify the
581             macros in WebPreferencesDefinitions.h to only have normal/debug/experimental variants
582             and remove the need for per-type macros, which were only used in WebPage::updatePreferences.
583         
584         * Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb: Added.
585         
586             Generates bindings from WebPreferences to WebCore::Settings/DeprecatedGlobalSettings/RuntimeEnabledFeatures.
587             Does not generate a binding if the 'webcoreBinding' option is set to either 'none' or 'custom'.
588         
589         * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
590     
591             Simplify down to just normal/debug/experimental macros.
592         
593         * Shared/WebPreferences.yaml:
594         
595             Annotate perferences with new optional 'webcoreBinding', 'webcoreName', and 'condition'
596             options.
597         
598         * WebProcess/WebPage/WebPage.cpp:
599         (WebKit::WebPage::updatePreferences):
600         
601             Replace a ton of hand written preference to settings bindings with a call to updatePreferencesGenerated().
602         
603         * WebProcess/WebPage/WebPage.h:
604         
605             Add declaration of updatePreferencesGenerated, remove platformPreferencesDidChange.
606
607         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
608         (WebKit::WebPage::platformPreferencesDidChange): Deleted.
609         * WebProcess/WebPage/ios/WebPageIOS.mm:
610         (WebKit::WebPage::platformPreferencesDidChange): Deleted.
611         * WebProcess/WebPage/mac/WebPageMac.mm:
612         (WebKit::WebPage::platformPreferencesDidChange): Deleted.
613         * WebProcess/WebPage/win/WebPageWin.cpp:
614         (WebKit::WebPage::platformPreferencesDidChange): Deleted.
615         * WebProcess/WebPage/wpe/WebPageWPE.cpp:
616         (WebKit::WebPage::platformPreferencesDidChange): Deleted.
617         
618             Remove all the empty platformPreferencesDidChange functions.
619
620 2017-10-26  Alex Christensen  <achristensen@webkit.org>
621
622         Move WKWebViewConfiguration validation to WKWebView construction
623         https://bugs.webkit.org/show_bug.cgi?id=178840
624
625         Reviewed by Tim Horton.
626         
627         I'm trying to remove WKWebViewConfigurationInternal methods so I can make WKWebViewConfiguration
628         a wrapper around an APIObject like all the other API objects.  A small step towards making this easier
629         is to remove the unnecessary method _validate and move its logic to its one callsite.  I added an API test
630         that ensures no change in behavior.
631
632         * UIProcess/API/Cocoa/WKWebView.mm:
633         (-[WKWebView _initializeWithConfiguration:]):
634         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
635         (-[WKWebViewConfiguration _validate]): Deleted.
636         * UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h:
637
638 2017-10-26  Megan Gardner  <megan_gardner@apple.com>
639
640         Remove unneeded block selection calculation code
641         https://bugs.webkit.org/show_bug.cgi?id=178889
642
643         Reviewed by Tim Horton.
644
645         Removing more block selection code. Much of this should have been removed
646         before, as the only things that were using these functions were removed in the
647         last patch. Also remove the code decided if you should move to block mode or not,
648         as the answer now is always NO.
649
650         * WebProcess/WebPage/WebPage.h:
651         * WebProcess/WebPage/ios/WebPageIOS.mm:
652         (WebKit::WebPage::updateSelectionWithTouches):
653         (WebKit::WebPage::rangeForBlockAtPoint): Deleted.
654         (WebKit::distanceBetweenRectsForPosition): Deleted.
655         (WebKit::rectsEssentiallyTheSame): Deleted.
656         (WebKit::unionDOMRanges): Deleted.
657         (WebKit::computeEdgeCenter): Deleted.
658         (WebKit::WebPage::expandedRangeFromHandle): Deleted.
659         (WebKit::WebPage::contractedRangeFromHandle): Deleted.
660         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle): Deleted.
661         (WebKit::WebPage::switchToBlockSelectionAtPoint): Deleted.
662         (WebKit::WebPage::shouldSwitchToBlockModeForHandle): Deleted.
663
664 2017-10-26  Jeremy Jones  <jeremyj@apple.com>
665
666         Call setFullscreenClient on iOS.
667         https://bugs.webkit.org/show_bug.cgi?id=178089
668
669         Reviewed by Simon Fraser.
670
671         This was only being set for MacOS.
672
673         * UIProcess/ios/WKContentView.mm:
674         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
675
676 2017-10-26  Eric Carlson  <eric.carlson@apple.com>
677
678         NowPlayingInfo should contain a unique identifier
679         https://bugs.webkit.org/show_bug.cgi?id=178872
680
681         Reviewed by Jer Noble.
682
683         * UIProcess/API/Cocoa/WKWebView.mm:
684         (-[WKWebView _requestActiveNowPlayingSessionInfo:]): Take a completion handler.
685         (-[WKWebView _requestActiveNowPlayingSessionInfo]): Deleted.
686         (-[WKWebView _handleActiveNowPlayingSessionInfoResponse:title:duration:elapsedTime:]): Deleted.
687         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
688         * UIProcess/PageClient.h:
689
690         * UIProcess/WebPageProxy.cpp:
691         (WebKit::WebPageProxy::requestActiveNowPlayingSessionInfo): Ditto.
692         (WebKit::WebPageProxy::nowPlayingInfoCallback): Lookup and call completion handler.
693         (WebKit::WebPageProxy::handleActiveNowPlayingSessionInfoResponse const): Deleted.
694         * UIProcess/WebPageProxy.h:
695         * UIProcess/WebPageProxy.messages.in:
696
697         * UIProcess/ios/PageClientImplIOS.h:
698         * UIProcess/ios/PageClientImplIOS.mm:
699         (WebKit::PageClientImpl::handleActiveNowPlayingSessionInfoResponse): Deleted.
700
701         * UIProcess/mac/PageClientImplMac.h:
702         * UIProcess/mac/PageClientImplMac.mm:
703         (WebKit::PageClientImpl::handleActiveNowPlayingSessionInfoResponse): Deleted.
704
705         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
706         (WebKit::WebPage::requestActiveNowPlayingSessionInfo): Take callback ID. Pass unique ID.
707         * WebProcess/WebPage/WebPage.h:
708         * WebProcess/WebPage/WebPage.messages.in:
709
710 2017-10-26  Andy Estes  <aestes@apple.com>
711
712         [Payment Request] Enable Payment Request whenever Apple Pay is enabled
713         https://bugs.webkit.org/show_bug.cgi?id=178880
714
715         Reviewed by Tim Horton.
716
717         * Shared/WebPreferences.yaml:
718         * UIProcess/API/C/WKPreferences.cpp:
719         (WKPreferencesSetPaymentRequestEnabled): Deleted.
720         (WKPreferencesGetPaymentRequestEnabled): Deleted.
721         * UIProcess/API/C/WKPreferencesRefPrivate.h:
722         * WebProcess/WebPage/WebPage.cpp:
723         (WebKit::WebPage::updatePreferences):
724
725 2017-10-26  Chris Dumez  <cdumez@apple.com>
726
727         Bring back SWContextManager abstraction in WebCore
728         https://bugs.webkit.org/show_bug.cgi?id=178876
729
730         Reviewed by Geoffrey Garen.
731
732         Bring back SWContextManager abstraction in WebCore. It was killed in <https://trac.webkit.org/changeset/223718> but
733         is actually useful when the ServiceWorker wants to message the storage process.
734
735         * CMakeLists.txt:
736         * DerivedSources.make:
737         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
738         (WebKit::WebSWServerConnection::startServiceWorkerContext):
739         (WebKit::WebSWServerConnection::startFetch):
740         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
741         * WebKit.xcodeproj/project.pbxproj:
742         * WebProcess/Storage/WebSWContextManagerConnection.cpp: Renamed from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.cpp.
743         (WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection):
744         (WebKit::WebSWContextManagerConnection::updatePreferences):
745         (WebKit::WebSWContextManagerConnection::startServiceWorker):
746         (WebKit::WebSWContextManagerConnection::startFetch):
747         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerGlobalScope):
748         * WebProcess/Storage/WebSWContextManagerConnection.h: Renamed from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h.
749         * WebProcess/Storage/WebSWContextManagerConnection.messages.in: Renamed from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.messages.in.
750         * WebProcess/WebProcess.cpp:
751         (WebKit::WebProcess::didReceiveMessage):
752         (WebKit::WebProcess::getWorkerContextConnection):
753         * WebProcess/WebProcess.h:
754
755 2017-10-26  Alexey Proskuryakov  <ap@apple.com>
756
757         Remove deprecated WebKit symbols
758         https://bugs.webkit.org/show_bug.cgi?id=178875
759         rdar://problem/31139070
760
761         Reviewed by Dan Bernstein.
762
763         * PlatformMac.cmake:
764         * Shared/API/c/WKDeprecatedFunctions.cpp:
765         (WKContextSetProcessModel):
766         (WKPageGroupCopyIdentifier): Deleted.
767         (WKPageGroupAddUserContentFilter): Deleted.
768         (WKPageGroupRemoveUserContentFilter): Deleted.
769         * UIProcess/API/C/WKPageGroup.h:
770         * UIProcess/API/Cocoa/_WKVisitedLinkProvider.mm: Removed.
771         * UIProcess/API/Cocoa/_WKVisitedLinkStore.h:
772         * WebKit.xcodeproj/project.pbxproj:
773
774 2017-10-26  Ryan Haddad  <ryanhaddad@apple.com>
775
776         Unreviewed, rolling out r223984.
777
778         Caused LayoutTest assertion failures.
779
780         Reverted changeset:
781
782         "When navigating back to a page, compositing layers may not
783         use accelerated drawing"
784         https://bugs.webkit.org/show_bug.cgi?id=178749
785         https://trac.webkit.org/changeset/223984
786
787 2017-10-26  Megan Gardner  <megan_gardner@apple.com>
788
789         Remove code to update block selection
790         https://bugs.webkit.org/show_bug.cgi?id=178843
791
792         Reviewed by Tim Horton.
793
794         Removes code for updating block selection, which has been disabled.
795         This code is being slowly pruned to avoid regressions and accidental removal of code that is being used.
796
797         * Platform/spi/ios/UIKitSPI.h:
798         * UIProcess/PageClient.h:
799         * UIProcess/WebPageProxy.h:
800         * UIProcess/WebPageProxy.messages.in:
801         * UIProcess/ios/PageClientImplIOS.h:
802         * UIProcess/ios/PageClientImplIOS.mm:
803         (WebKit::PageClientImpl::didUpdateBlockSelectionWithTouch): Deleted.
804         * UIProcess/ios/WKContentViewInteraction.h:
805         * UIProcess/ios/WKContentViewInteraction.mm:
806         (toSelectionHandlePosition): Deleted.
807         (-[WKContentView _didUpdateBlockSelectionWithTouch:withFlags:growThreshold:shrinkThreshold:]): Deleted.
808         (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]): Deleted.
809         * UIProcess/ios/WebPageProxyIOS.mm:
810         (WebKit::WebPageProxy::updateBlockSelectionWithTouch): Deleted.
811         (WebKit::WebPageProxy::didUpdateBlockSelectionWithTouch): Deleted.
812         * WebProcess/WebPage/WebPage.h:
813         * WebProcess/WebPage/WebPage.messages.in:
814         * WebProcess/WebPage/ios/WebPageIOS.mm:
815         (WebKit::shouldExpand): Deleted.
816         (WebKit::WebPage::changeBlockSelection): Deleted.
817         (WebKit::WebPage::updateBlockSelectionWithTouch): Deleted.
818
819 2017-10-26  Ryan Haddad  <ryanhaddad@apple.com>
820
821         Unreviewed, rolling out r223994.
822
823         The LayoutTest for this change is failing.
824
825         Reverted changeset:
826
827         "Add service worker handle fetch support for all subresource
828         requests"
829         https://bugs.webkit.org/show_bug.cgi?id=178769
830         https://trac.webkit.org/changeset/223994
831
832 2017-10-26  Ryan Haddad  <ryanhaddad@apple.com>
833
834         Unreviewed, rolling out r223908.
835
836         Causes LayoutTest crashes with newer SDKs.
837
838         Reverted changeset:
839
840         "Adopt new secure coding APIs"
841         https://bugs.webkit.org/show_bug.cgi?id=178484
842         https://trac.webkit.org/changeset/223908
843
844 2017-10-26  Christopher Reid  <chris.reid@sony.com>
845
846         Remove scopeguard from platform
847         https://bugs.webkit.org/show_bug.cgi?id=178681
848
849         Reviewed by Brady Eidson.
850
851         * Shared/mac/ChildProcessMac.mm:
852
853 2017-10-25  Per Arne Vollan  <pvollan@apple.com>
854
855         Network process crash under WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge.
856         https://bugs.webkit.org/show_bug.cgi?id=160234
857         rdar://problem/30675510
858
859         Reviewed by Geoffrey Garen.
860
861         An exception is raised because we call the method rejectProtectionSpaceAndContinueWithChallenge on the CFNetwork
862         challenge sender, which does not implement this optional method. The methods on the authentication challenge
863         sender are deprecated when network session is used, so we should not call them in that case.
864
865         * Shared/Authentication/AuthenticationManager.cpp:
866         (WebKit::AuthenticationManager::useCredentialForSingleChallenge):
867         (WebKit::AuthenticationManager::continueWithoutCredentialForSingleChallenge):
868         (WebKit::AuthenticationManager::cancelSingleChallenge):
869         (WebKit::AuthenticationManager::performDefaultHandlingForSingleChallenge):
870         (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge):
871         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
872         (WebKit::AuthenticationManager::receivedCredential):
873         (WebKit::AuthenticationManager::receivedRequestToContinueWithoutCredential):
874         (WebKit::AuthenticationManager::receivedCancellation):
875         (WebKit::AuthenticationManager::receivedRequestToPerformDefaultHandling):
876         (WebKit::AuthenticationManager::receivedChallengeRejection):
877         * Shared/Authentication/soup/AuthenticationManagerSoup.cpp:
878
879 2017-10-25  Youenn Fablet  <youenn@apple.com>
880
881         Move DNS resolution outside of NetworkRTCProvider
882         https://bugs.webkit.org/show_bug.cgi?id=178796
883
884         Reviewed by Geoffrey Garen.
885
886        Tested through manual testing on external STUN servers.
887        Moving NetworkRTCProvider::Resolver into NetworkRTCResolver.
888        Updating the implementation to use a completion handler.
889
890         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
891         (WebKit::NetworkRTCProvider::createResolver):
892         * NetworkProcess/webrtc/NetworkRTCProvider.h:
893         * NetworkProcess/webrtc/NetworkRTCResolver.cpp:
894         (WebKit::NetworkRTCResolver::NetworkRTCResolver):
895         (WebKit::NetworkRTCResolver::~NetworkRTCResolver):
896         (WebKit::NetworkRTCResolver::start):
897         (WebKit::NetworkRTCResolver::stop):
898         (WebKit::NetworkRTCResolver::completed):
899         (WebKit::NetworkRTCProvider::Resolver::~Resolver): Deleted.
900         (WebKit::NetworkRTCProvider::stop): Deleted.
901         (WebKit::NetworkRTCProvider::resolutionCompleted): Deleted.
902         * NetworkProcess/webrtc/NetworkRTCResolver.h:
903         * WebKit.xcodeproj/project.pbxproj:
904
905 2017-10-25  Eric Carlson  <eric.carlson@apple.com>
906
907         [MediaStream] Clear cached gUM prompt state
908         https://bugs.webkit.org/show_bug.cgi?id=178754
909         <rdar://problem/32742356>
910
911         Reviewed by Youenn Fablet.
912
913         * Shared/WebPreferences.yaml: Define new settings.
914
915         * Shared/WebPreferencesDefinitionsBase.h: New default values.
916
917         * UIProcess/API/C/WKPreferences.cpp:
918         (WKPreferencesSetInactiveMediaCaptureSteamRepromptIntervalInMinutes): New.
919         (WKPreferencesGetInactiveMediaCaptureSteamRepromptIntervalInMinutes): Ditto.
920         * UIProcess/API/C/WKPreferencesRefPrivate.h:
921
922         * UIProcess/API/Cocoa/WKPreferences.mm:
923         (-[WKPreferences _inactiveMediaCaptureSteamRepromptIntervalInMinutes]): Ditto.
924         (-[WKPreferences _setInactiveMediaCaptureSteamRepromptIntervalInMinutes:]): Ditto.
925         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
926
927         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
928         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy): Initialize
929         the timer.
930         (WebKit::UserMediaPermissionRequestManagerProxy::createRequest): Remove unneeded namespace.
931         (WebKit::toWebCore): Remove unneeded breaks.
932         (WebKit::UserMediaPermissionRequestManagerProxy::searchForGrantedRequest const): Remove unneeded namespace.
933         (WebKit::UserMediaPermissionRequestManagerProxy::wasRequestDenied): Ditto.
934         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): Ditto.
935         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo): Ditto.
936         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): Ditto.
937         (WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs const): Ditto.
938         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged): Set the watchdog timer
939         to the correct interval based on capture state.
940         (WebKit::UserMediaPermissionRequestManagerProxy::watchdogTimerFired): Clear cached state.
941         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
942
943 2017-10-25  Simon Fraser  <simon.fraser@apple.com>
944
945         When navigating back to a page, compositing layers may not use accelerated drawing
946         https://bugs.webkit.org/show_bug.cgi?id=178749
947         rdar://problem/35158946
948
949         Reviewed by Dean Jackson.
950
951         Avoid assertions when a test enables accelerated drawing (which we can't support
952         in the iOS simulator).
953
954         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
955         (WebKit::RemoteLayerBackingStore::ensureBackingStore):
956
957 2017-10-25  Youenn Fablet  <youenn@apple.com>
958
959         Enable ServiceWorker to fetch resources
960         https://bugs.webkit.org/show_bug.cgi?id=178673
961
962         Reviewed by Brady Eidson.
963
964         ServiceWorkerContextManager makes use of the new ServiceWorkerThreadProxy.
965         It creates the necessary environment for the thread to make use of network loads, web sockets and cache storage.
966         Fetch is functional with these changes.
967
968         ServiceWorkerProcessProxy is introduced as a UIProcess proxy to the service worker process.
969         This process proxy is responsible to give the pageID used by all service worker thread instances for network loads.
970         ServiceWorkerContextManager is responsible to give a unique frameID for all service worker threads.
971         This is necessary as these two ids are currently needed for any network load.
972
973         ServiceWorkerThreadProxy creates its own FrameLoaderClient which is now used to get pageID, frameID and sessionID.
974
975         * UIProcess/ServiceWorkerProcessProxy.cpp: Added.
976         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
977         (WebKit::m_serviceWorkerPageID):
978         (WebKit::ServiceWorkerProcessProxy::~ServiceWorkerProcessProxy):
979         (WebKit::ServiceWorkerProcessProxy::start):
980         * UIProcess/ServiceWorkerProcessProxy.h: Added.
981         * UIProcess/WebProcessPool.cpp:
982         (WebKit::WebProcessPool::getWorkerContextProcessConnection):
983         (WebKit::WebProcessPool::createNewWebProcess):
984         (WebKit::WebProcessPool::initializeNewWebProcess):
985         (WebKit::WebProcessPool::disconnectProcess):
986         (WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
987         (WebKit::WebProcessPool::createWebPage):
988         * UIProcess/WebProcessPool.h:
989         * UIProcess/WebProcessProxy.cpp:
990         (WebKit::WebProcessProxy::generatePageID):
991         * UIProcess/WebProcessProxy.h:
992         * WebKit.xcodeproj/project.pbxproj:
993         * WebProcess/Network/WebLoaderStrategy.cpp:
994         (WebKit::WebLoaderStrategy::scheduleLoad):
995         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
996         (WebKit::WebLoaderStrategy::startPingLoad):
997         * WebProcess/Network/WebLoaderStrategy.h:
998         * WebProcess/Storage/ServiceWorkerContextManager.cpp:
999         (WebKit::ServiceWorkerContextManager::ServiceWorkerContextManager):
1000         (WebKit::ServiceWorkerContextManager::startServiceWorker):
1001         (WebKit::ServiceWorkerContextManager::startFetch):
1002         * WebProcess/Storage/ServiceWorkerContextManager.h:
1003         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1004         (WebKit::WebFrameLoaderClient::pageID const):
1005         (WebKit::WebFrameLoaderClient::frameID const):
1006         (WebKit::WebFrameLoaderClient::sessionID const):
1007         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1008         * WebProcess/WebProcess.cpp:
1009         (WebKit::WebProcess::getWorkerContextConnection):
1010         * WebProcess/WebProcess.h:
1011         * WebProcess/WebProcess.messages.in:
1012
1013 2017-10-25  Yousuke Kimoto  <yousuke.kimoto@sony.com>
1014
1015         [WinCairo] Add WebKit platform files for wincairo webkit
1016         https://bugs.webkit.org/show_bug.cgi?id=178000
1017
1018         Reviewed by Alex Christensen.
1019
1020         * Platform/Module.h:
1021         * Platform/SharedMemory.h:
1022         (WebKit::SharedMemory::handle const):
1023         * Platform/win/LoggingWin.cpp: Added. It is based on Source/WebCore/platform/win/LoggingWin.cpp
1024         (WebKit::logLevelString):
1025         * Platform/win/ModuleWin.cpp: Added.
1026         (WebKit::Module::load):
1027         (WebKit::Module::unload):
1028         (WebKit::Module::platformFunctionPointer const):
1029         * Platform/win/SharedMemoryWin.cpp: Added.
1030         (WebKit::SharedMemory::Handle::Handle):
1031         (WebKit::SharedMemory::Handle::~Handle):
1032         (WebKit::SharedMemory::Handle::isNull const):
1033         (WebKit::SharedMemory::Handle::encode const):
1034         (WebKit::SharedMemory::Handle::clear):
1035         (WebKit::getDuplicatedHandle):
1036         (WebKit::SharedMemory::Handle::decode):
1037         (WebKit::protectAttribute):
1038         (WebKit::SharedMemory::allocate):
1039         (WebKit::SharedMemory::create):
1040         (WebKit::accessRights):
1041         (WebKit::SharedMemory::map):
1042         (WebKit::SharedMemory::adopt):
1043         (WebKit::SharedMemory::~SharedMemory):
1044         (WebKit::SharedMemory::createHandle):
1045         (WebKit::SharedMemory::systemPageSize):
1046         * PlatformWin.cmake:
1047
1048 2017-10-25  Chris Dumez  <cdumez@apple.com>
1049
1050         Add support for unregistering a service worker
1051         https://bugs.webkit.org/show_bug.cgi?id=178735
1052
1053         Reviewed by Brady Eidson.
1054
1055         Add support for unregistering a service worker:
1056         - https://w3c.github.io/ServiceWorker/#navigator-service-worker-unregister
1057
1058         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1059         (WebKit::WebSWServerConnection::resolveRegistrationJobInClient):
1060         (WebKit::WebSWServerConnection::resolveUnregistrationJobInClient):
1061         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1062         * WebProcess/Storage/WebSWClientConnection.messages.in:
1063
1064 2017-10-25  Chris Dumez  <cdumez@apple.com>
1065
1066         Make SharedStringHashTable less error prone
1067         https://bugs.webkit.org/show_bug.cgi?id=178764
1068
1069         Reviewed by Youenn Fablet.
1070
1071         SharedStringHashTable is backed by SharedMemory and this SharedMemory
1072         may be readonly (and is when used in the WebContent process). As a result,
1073         some of the operations on SharedStringHashTable that write to this shared
1074         memory will crash if called and the SharedMemory is readonly.
1075
1076         To make this less error prone, introduce a new SharedStringHashTableReadOnly
1077         base class for SharedStringHashTable and only keep the operations that
1078         write to the shared memory on SharedStringHashTableReadOnly (namely, add() /
1079         remove() / clear(). Update VisitedLinkTableController and WebSWOriginTable
1080         to use SharedStringHashTableReadOnly since they are instantiated in the
1081         WebContent process and use readonly shared memory.
1082
1083         * Shared/SharedStringHashTable.cpp:
1084         (WebKit::SharedStringHashTableReadOnly::SharedStringHashTableReadOnly):
1085         (WebKit::SharedStringHashTableReadOnly::~SharedStringHashTableReadOnly):
1086         (WebKit::SharedStringHashTableReadOnly::setSharedMemory):
1087         (WebKit::doubleHash):
1088         (WebKit::SharedStringHashTableReadOnly::contains const):
1089         (WebKit::SharedStringHashTableReadOnly::findSlot const):
1090         (WebKit::SharedStringHashTable::SharedStringHashTable):
1091         (WebKit::SharedStringHashTable::~SharedStringHashTable):
1092         (WebKit::SharedStringHashTable::add):
1093         (WebKit::SharedStringHashTable::remove):
1094         (WebKit::SharedStringHashTable::clear):
1095         * Shared/SharedStringHashTable.h:
1096         * WebProcess/Storage/WebSWOriginTable.h:
1097         * WebProcess/WebPage/VisitedLinkTableController.cpp:
1098         (WebKit::VisitedLinkTableController::removeAllVisitedLinks):
1099         * WebProcess/WebPage/VisitedLinkTableController.h:
1100
1101 2017-10-25  Adrian Perez de Castro  <aperez@igalia.com>
1102
1103         [WPE] Remove GLib API functions which use Cairo
1104         https://bugs.webkit.org/show_bug.cgi?id=178205
1105
1106         Reviewed by Michael Catanzaro.
1107
1108         Add PLATFORM(GTK) guards for the parts of of the GLib API which use cairo_surface_t (web
1109         page snapshots and favicons), and remove the affected function prototypes from public API
1110         headers. This way, the WPE version of the API is not tied to Cairo.
1111
1112         * PlatformWPE.cmake:
1113         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
1114         * UIProcess/API/glib/WebKitFaviconDatabasePrivate.h:
1115         * UIProcess/API/glib/WebKitInjectedBundleClient.cpp:
1116         * UIProcess/API/glib/WebKitWebView.cpp:
1117         (webkitWebViewConstructed):
1118         (webkitWebViewGetProperty):
1119         (webkitWebViewDispose):
1120         (webkit_web_view_class_init):
1121         (webkitWebViewLoadChanged):
1122         * UIProcess/API/glib/WebKitWebViewPrivate.h:
1123         * UIProcess/API/wpe/WebKitFaviconDatabase.h:
1124         * UIProcess/API/wpe/WebKitWebView.h:
1125         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
1126         (webkitWebPageDidReceiveMessage):
1127
1128 2017-10-25  Zan Dobersek  <zdobersek@igalia.com>
1129
1130         Make SERVICE_WORKER feature buildable on GTK, WPE
1131         https://bugs.webkit.org/show_bug.cgi?id=178574
1132
1133         Reviewed by Carlos Garcia Campos.
1134
1135         * CMakeLists.txt: Add missing files to the build.
1136         * StorageProcess/StorageProcess.cpp:
1137         (WebKit::StorageProcess::didGetWorkerContextProcessConnection):
1138         IPC::Attachment object should be accessed through an rvalue reference,
1139         making it mutable and enabling releasing the file descriptor.
1140         * StorageProcess/StorageProcess.h: Adjust the method signature.
1141         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
1142         Explicitly include the ResourceError header from WebCore (using a forwarding header).
1143         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
1144         Include the CachedResource header from WebCore (again using a forwarding header).
1145         * WebProcess/Storage/WebServiceWorkerProvider.h: Forward-declare the WebCore::CachedResource type.
1146
1147 2017-10-24  Youenn Fablet  <youenn@apple.com>
1148
1149         ServiceWorkerClientFetch should return an error that is not null in case of failure
1150         https://bugs.webkit.org/show_bug.cgi?id=178761
1151
1152         Reviewed by Geoffrey Garen.
1153
1154         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
1155         (WebKit::ServiceWorkerClientFetch::didFail): Generating a General error.
1156
1157 2017-10-24  Youenn Fablet  <youenn@apple.com>
1158
1159         Enable service worker to use cache storage api
1160         https://bugs.webkit.org/show_bug.cgi?id=178684
1161
1162         Reviewed by Brady Eidson.
1163
1164         Passing the WebPreferences store of the default page group of the WebProcessPool to its ServiceWorker process.
1165         ServiceWorkerContextManager then uses it to initialize the preferences accordingly.
1166         Patch is covered by new test which is using cache api previously disabled and now enabled through the store.
1167
1168         Made use of the new ServiceWorkerThreadProxy in ServiceWorkerContextManager to enable a cache storage connection.
1169         Fixed the default size of quota in WebsiteDataStore.
1170
1171         * UIProcess/WebProcessPool.cpp:
1172         (WebKit::WebProcessPool::getWorkerContextProcessConnection):
1173         * UIProcess/WebsiteData/WebsiteDataStore.h:
1174         * WebProcess/Storage/ServiceWorkerContextManager.cpp:
1175         (WebKit::ServiceWorkerContextManager::ServiceWorkerContextManager):
1176         (WebKit::ServiceWorkerContextManager::updatePreferences):
1177         (WebKit::ServiceWorkerContextManager::startServiceWorker):
1178         (WebKit::ServiceWorkerContextManager::startFetch):
1179         * WebProcess/Storage/ServiceWorkerContextManager.h:
1180         (WebKit::ServiceWorkerContextManager::ServiceWorkerContextManager): Deleted.
1181         * WebProcess/WebProcess.cpp:
1182         (WebKit::WebProcess::getWorkerContextConnection):
1183         * WebProcess/WebProcess.h:
1184         * WebProcess/WebProcess.messages.in:
1185
1186 2017-10-24  Alex Christensen  <achristensen@webkit.org>
1187
1188         Selecting and right-clicking URL-like strings with IDNA-disallowed characters in host or authority causes rendering engine crash
1189         https://bugs.webkit.org/show_bug.cgi?id=174267
1190
1191         Reviewed by Tim Horton.
1192
1193         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1194         (WKBundlePageCanHandleRequest):
1195
1196 2017-10-24  Chris Dumez  <cdumez@apple.com>
1197
1198         Add initial implementation for serviceWorker.postMessage()
1199         https://bugs.webkit.org/show_bug.cgi?id=178534
1200
1201         Reviewed by Youenn Fablet.
1202
1203         Add initial implementation for serviceWorker.postMessage():
1204         - https://w3c.github.io/ServiceWorker/#service-worker-postmessage
1205
1206         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1207         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
1208         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1209         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1210         * WebProcess/Storage/ServiceWorkerContextManager.cpp:
1211         (WebKit::ServiceWorkerContextManager::postMessageToServiceWorkerGlobalScope):
1212         * WebProcess/Storage/ServiceWorkerContextManager.h:
1213         * WebProcess/Storage/ServiceWorkerContextManager.messages.in:
1214         * WebProcess/Storage/WebSWClientConnection.cpp:
1215         (WebKit::WebSWClientConnection::postMessageToServiceWorkerGlobalScope):
1216         * WebProcess/Storage/WebSWClientConnection.h:
1217
1218 2017-10-24  Brent Fulgham  <bfulgham@apple.com>
1219
1220         Adopt new secure coding APIs
1221         https://bugs.webkit.org/show_bug.cgi?id=178484
1222         <rdar://problem/34837193>
1223
1224         Reviewed by Tim Horton.
1225
1226         Switch to new NSKeyed[Un]Archiver methods that active and use
1227         NSSecureCoding by default.
1228
1229         * Platform/ios/AccessibilityIOS.mm:
1230         (WebKit::newAccessibilityRemoteToken): Use secure-by-default API.
1231         * Shared/Cocoa/DataDetectionResult.mm:
1232         (WebKit::DataDetectionResult::encode const): Ditto.
1233         (WebKit::DataDetectionResult::decode): Ditto.
1234         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
1235         (IPC::ArgumentCoder<WebCore::Payment>::encode): Ditto.
1236         (IPC::ArgumentCoder<WebCore::Payment>::decode): Ditto.
1237         (IPC::ArgumentCoder<WebCore::PaymentContact>::encode): Ditto.
1238         (IPC::ArgumentCoder<WebCore::PaymentContact>::decode): Ditto.
1239         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode): Ditto.
1240         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::decode): Ditto.
1241         (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode): Ditto.
1242         (IPC::ArgumentCoder<WebCore::PaymentMethod>::decode): Ditto.
1243         * Shared/ios/InteractionInformationAtPosition.mm:
1244         (WebKit::InteractionInformationAtPosition::encode const): Ditto.
1245         (WebKit::InteractionInformationAtPosition::decode): Ditto.
1246         * Shared/mac/WebCoreArgumentCodersMac.mm:
1247         (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData): Ditto.
1248         (IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData): Ditto.
1249         (IPC::ArgumentCoder<Credential>::encodePlatformData): Ditto.
1250         (IPC::ArgumentCoder<Credential>::decodePlatformData): Ditto.
1251         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode): Ditto.
1252         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::decode): Ditto.
1253         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData): Ditto.
1254         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::decodePlatformData): Ditto.
1255         * Shared/mac/WebHitTestResultData.mm:
1256         (WebKit::WebHitTestResultData::platformEncode const): Ditto.
1257         (WebKit::WebHitTestResultData::platformDecode): Ditto.
1258         * UIProcess/API/Cocoa/WKProcessPool.mm:
1259         (-[WKProcessPool _setObject:forBundleParameter:]): Ditto.
1260         (-[WKProcessPool _setObjectsForBundleParametersWithDictionary:]): Ditto.
1261         * UIProcess/API/Cocoa/WKWebView.mm:
1262         (-[WKWebView _setInputDelegate:]): Ditto.
1263         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1264         (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto.
1265         * UIProcess/ios/PageClientImplIOS.mm:
1266         (WebKit::PageClientImpl::startAssistingNode): Ditto.
1267         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1268         (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Ditto.
1269         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
1270         (WebKit::InjectedBundle::initialize): Ditto.
1271         (WebKit::InjectedBundle::setBundleParameter): Ditto.
1272         (WebKit::InjectedBundle::setBundleParameters): Ditto.
1273
1274 2017-10-24  Sam Weinig  <sam@webkit.org>
1275
1276         [Settings] Add initial support for generating preferences related code
1277         https://bugs.webkit.org/show_bug.cgi?id=178656
1278
1279         Reviewed by Dean Jackson.
1280
1281         As a first step towards getting off the macros in WebPreferencesDefinitions.h
1282         and reducing the overhead of adding a preference, this change generates adds
1283         WebPreferences.yaml where preference changes will go, and generates much of
1284         WebPreferencesDefinitions.h from it (all the custom defaults moved to 
1285         WebPreferencesDefinitionsBase.h). Subsequent changes will remove the need for 
1286         the macros in WebPreferencesDefinitions.h entirely.
1287
1288         * CMakeLists.txt:
1289         * DerivedSources.make:
1290         * WebKit.xcodeproj/project.pbxproj:
1291         
1292             Add new files / rules to generate WebPreferencesDefinitions.h.
1293         
1294         * Scripts/GeneratePreferences.rb: Added.
1295         * Scripts/PreferencesTemplates: Added.
1296         * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
1297         
1298             Add scripts and template to generate WebPreferencesDefinitions.h from
1299             WebPreferences.yaml.
1300
1301         * Shared/WebPreferences.yaml: Added.
1302         
1303             Configuration file for preferences.
1304         
1305         * Shared/WebPreferencesDefinitions.h: Removed.
1306         * Shared/WebPreferencesDefinitionsBase.h: Copied from Source/WebKit/Shared/WebPreferencesDefinitions.h.
1307         
1308             Moved custom defaults to new WebPreferencesDefinitionsBase.h. Removed the need for 
1309             FOR_EACH_WEBKIT_STRING_PREFERENCE by using custom defaults for the font family values.
1310
1311 2017-10-24  Matt Lewis  <jlewis3@apple.com>
1312
1313         Unreviewed, rolling out r223889.
1314
1315         This caused multiple crashes on all platforms
1316
1317         Reverted changeset:
1318
1319         "Adopt new secure coding APIs"
1320         https://bugs.webkit.org/show_bug.cgi?id=178484
1321         https://trac.webkit.org/changeset/223889
1322
1323 2017-10-24  Youenn Fablet  <youenn@apple.com>
1324
1325         ASSERTION FAILED: !m_serviceWorkerManager in WebProcess::getWorkerContextConnection() on API tests
1326         https://bugs.webkit.org/show_bug.cgi?id=178586
1327         <rdar://problem/35115902>
1328
1329         Reviewed by Brady Eidson.
1330
1331        Covered by API tests no longer crashing.
1332
1333         * UIProcess/WebProcessPool.cpp:
1334         (WebKit::WebProcessPool::getWorkerContextProcessConnection): Sending a worker context process connection message only at creation of the service worker process.
1335
1336 2017-10-24  Brent Fulgham  <bfulgham@apple.com>
1337
1338         Adopt new secure coding APIs
1339         https://bugs.webkit.org/show_bug.cgi?id=178484
1340         <rdar://problem/34837193>
1341
1342         Reviewed by Tim Horton.
1343
1344         Switch to new NSKeyed[Un]Archiver methods that active and use
1345         NSSecureCoding by default.
1346
1347         * Platform/ios/AccessibilityIOS.mm:
1348         (WebKit::newAccessibilityRemoteToken): Use secure-by-default API.
1349         * Shared/Cocoa/DataDetectionResult.mm:
1350         (WebKit::DataDetectionResult::encode const): Ditto.
1351         (WebKit::DataDetectionResult::decode): Ditto.
1352         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
1353         (IPC::ArgumentCoder<WebCore::Payment>::encode): Ditto.
1354         (IPC::ArgumentCoder<WebCore::Payment>::decode): Ditto.
1355         (IPC::ArgumentCoder<WebCore::PaymentContact>::encode): Ditto.
1356         (IPC::ArgumentCoder<WebCore::PaymentContact>::decode): Ditto.
1357         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode): Ditto.
1358         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::decode): Ditto.
1359         (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode): Ditto.
1360         (IPC::ArgumentCoder<WebCore::PaymentMethod>::decode): Ditto.
1361         * Shared/ios/InteractionInformationAtPosition.mm:
1362         (WebKit::InteractionInformationAtPosition::encode const): Ditto.
1363         (WebKit::InteractionInformationAtPosition::decode): Ditto.
1364         * Shared/mac/WebCoreArgumentCodersMac.mm:
1365         (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData): Ditto.
1366         (IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData): Ditto.
1367         (IPC::ArgumentCoder<Credential>::encodePlatformData): Ditto.
1368         (IPC::ArgumentCoder<Credential>::decodePlatformData): Ditto.
1369         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode): Ditto.
1370         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::decode): Ditto.
1371         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData): Ditto.
1372         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::decodePlatformData): Ditto.
1373         * Shared/mac/WebHitTestResultData.mm:
1374         (WebKit::WebHitTestResultData::platformEncode const): Ditto.
1375         (WebKit::WebHitTestResultData::platformDecode): Ditto.
1376         * UIProcess/API/Cocoa/WKProcessPool.mm:
1377         (-[WKProcessPool _setObject:forBundleParameter:]): Ditto.
1378         (-[WKProcessPool _setObjectsForBundleParametersWithDictionary:]): Ditto.
1379         * UIProcess/API/Cocoa/WKWebView.mm:
1380         (-[WKWebView _setInputDelegate:]): Ditto.
1381         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1382         (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto.
1383         * UIProcess/ios/PageClientImplIOS.mm:
1384         (WebKit::PageClientImpl::startAssistingNode): Ditto.
1385         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1386         (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Ditto.
1387         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
1388         (WebKit::InjectedBundle::initialize): Ditto.
1389         (WebKit::InjectedBundle::setBundleParameter): Ditto.
1390         (WebKit::InjectedBundle::setBundleParameters): Ditto.
1391
1392 2017-10-24  Zan Dobersek  <zdobersek@igalia.com>
1393
1394         [GTK][WPE] generate-forwarding-headers.pl should also scan derived sources in WebKit framework
1395         https://bugs.webkit.org/show_bug.cgi?id=178579
1396
1397         Reviewed by Carlos Garcia Campos.
1398
1399         * PlatformGTK.cmake: When generating forwarding headers, derived sources
1400         should be scanned as well. The DERIVED_SOURCES_WEBKIT_DIR value has to
1401         be passed as an include path to the generate-forward-headers.pl script
1402         to achieve that. This target then also has to depend on all the derived
1403         source files to be generated before this can be performed.
1404         * PlatformWPE.cmake: Ditto.
1405
1406 2017-10-23  Brian Burg  <bburg@apple.com>
1407
1408         [Cocoa] Web Automation: add SPI to tell whether the automation session is currently simulating user interactions
1409         https://bugs.webkit.org/show_bug.cgi?id=178616
1410
1411         Reviewed by Joseph Pecoraro.
1412
1413         This is needed to disambiguate whether an action (such as selectAll:) came from
1414         a user clicking on "Edit > Select All" in a menu or whether it was produced by
1415         simulating the keystrokes to produce the chord for "Command + a". Some clients,
1416         such as Safari, would allow the latter but not the former during automation.
1417
1418         * UIProcess/API/Cocoa/_WKAutomationSession.h:
1419         * UIProcess/API/Cocoa/_WKAutomationSession.mm:
1420         (-[_WKAutomationSession isSimulatingUserInteraction]):
1421         Add new SPI property that's backed by the same WebAutomationSession method.
1422
1423         * UIProcess/Automation/WebAutomationSession.h:
1424         * UIProcess/Automation/WebAutomationSession.cpp:
1425         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
1426         (WebKit::WebAutomationSession::performMouseInteraction):
1427         (WebKit::WebAutomationSession::performKeyboardInteractions):
1428         Set m_simulatingUserInteraction prior to sending the synthesized events. It will
1429         be cleared when keyboardEventsFlushedForPage() is called by WebPageProxy.
1430
1431         * UIProcess/WebPageProxy.cpp:
1432         (WebKit::WebPageProxy::didReceiveEvent):
1433         Notify the automation session that the key event queue was flushed *after* giving
1434         delegates a chance to do something with the key event. This is necessary so that
1435         any actions that are created from the NSEvent by the delegates are handled prior
1436         to the automation session finishing its keyboard interaction command.
1437
1438 2017-10-23  Brian Burg  <bburg@apple.com>
1439
1440         [Mac] Web Automation: key modifiers for synthesized NSEvents are incorrect
1441         https://bugs.webkit.org/show_bug.cgi?id=178615
1442
1443         Reviewed by Joseph Pecoraro.
1444
1445         In both PLATFORM(MAC) platform methods for simulating keyboard interactions,
1446         we errantly relied on +[NSEvent modifierFlags] to get the current state of
1447         sticky modifiers when creating synthesized events. This is incorrect for two reasons:
1448         modifierFlags is never updated when simulating a sequence of events (because
1449         all the events are synthesized before any are delivered); and the NSEvent class
1450         method only reflects the modifier state of the primary physical keyboard, which
1451         is not affected by synthesized NSEvents that happen to have modifier flags.
1452
1453         Instead, just keep our own m_currentModifiers state in the session and compute
1454         the necessary NSEventModifierFlags to put on each synthesized event. This aligns
1455         the implementation with the treatment of sticky keys in the iOS and GTK platform methods.
1456
1457         * UIProcess/Automation/WebAutomationSession.h: Every port gets this variable now.
1458         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
1459         (WebKit::WebAutomationSession::platformSimulateKeyStroke):
1460         (WebKit::WebAutomationSession::platformSimulateKeySequence):
1461         Use and update m_currentModifiers.
1462
1463 2017-10-23  Alex Christensen  <achristensen@webkit.org>
1464
1465         Fix ASAN test after r222824
1466         https://bugs.webkit.org/show_bug.cgi?id=178688
1467         <rdar://problem/35104706>
1468
1469         Reviewed by Tim Horton.
1470
1471         * UIProcess/WebBackForwardList.cpp:
1472         (WebKit::WebBackForwardList::clear):
1473         Resizing a list of Ref<T> after we've WTFMoved all the elements doesn't make ASAN happy.
1474
1475 2017-10-23  Tim Horton  <timothy_horton@apple.com>
1476
1477         Stop using _UIApplicationUsesLegacyUI()
1478         https://bugs.webkit.org/show_bug.cgi?id=178680
1479         <rdar://problem/35131949>
1480
1481         Reviewed by Dan Bernstein.
1482
1483         * Platform/spi/ios/UIKitSPI.h:
1484         * UIProcess/ios/forms/WKFormSelectPopover.mm:
1485         (-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):
1486         (-[WKSelectPopover initWithView:hasGroups:]):
1487         Resolve _UIApplicationUsesLegacyUI to false and simplify.
1488
1489 2017-10-23  Ryan Haddad  <ryanhaddad@apple.com>
1490
1491         Unreviewed, suppress deprecation warnings to fix the build.
1492         <rdar://problem/35131949>
1493
1494         * UIProcess/ios/forms/WKFormSelectPopover.mm:
1495         (-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):
1496         (-[WKSelectPopover initWithView:hasGroups:]):
1497
1498 2017-10-23  Youenn Fablet  <youenn@apple.com>
1499
1500         TestController should clear all fetch caches when resetting its state
1501         https://bugs.webkit.org/show_bug.cgi?id=178486
1502         <rdar://problem/35066305>
1503
1504         Reviewed by Chris Dumez.
1505
1506         Adding a new DidNotHandle message to disambiguate with the DidFail fetch case.
1507         With DidNotHandle, the loading should go the network process.
1508         With DidFail, the loading should return a network error.
1509
1510         On receiving an order to start a fetch, ServiceWorkerThread will dispatch a fetch event.
1511         The client of this event will retrieve the response and return it to the WebProcess through IPC.
1512
1513         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1514         (WebKit::WebSWServerConnection::didNotHandleFetch):
1515         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1516         * StorageProcess/StorageProcess.cpp:
1517         (WebKit::StorageProcess::didNotHandleFetch):
1518         * StorageProcess/StorageProcess.h:
1519         * StorageProcess/StorageProcess.messages.in:
1520         * WebKit.xcodeproj/project.pbxproj:
1521         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
1522         (WebKit::ServiceWorkerClientFetch::didFail):
1523         (WebKit::ServiceWorkerClientFetch::didNotHandle):
1524         * WebProcess/Storage/ServiceWorkerClientFetch.h:
1525         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in:
1526         * WebProcess/Storage/ServiceWorkerContextManager.cpp:
1527         (WebKit::ServiceWorkerContextManager::startFetch):
1528         * WebProcess/Storage/ServiceWorkerContextManager.h:
1529         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp: Added.
1530         (WebKit::WebServiceWorkerFetchTaskClient::~WebServiceWorkerFetchTaskClient):
1531         (WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
1532         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveResponse):
1533         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
1534         (WebKit::WebServiceWorkerFetchTaskClient::didFail):
1535         (WebKit::WebServiceWorkerFetchTaskClient::didFinish):
1536         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h: Added.
1537         * WebProcess/WebProcess.cpp:
1538         (WebKit::WebProcess::startFetchInServiceWorker):
1539         * WebProcess/WebProcess.h:
1540
1541 2017-10-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1542
1543         [iOS] WebProcess::initializeWebProcess spends ~150ms spinning up AVSystemController on some devices
1544         https://bugs.webkit.org/show_bug.cgi?id=178640
1545         <rdar://problem/35113105>
1546
1547         Reviewed by Youenn Fablet.
1548
1549         In r213933, we added a mechanism to allow the web process to drive media capture, by setting an attribute on the
1550         shared AVSystemController. This requires us to fault in the Celestial framework, which is a slight performance
1551         hit on some hardware. Instead of doing this at the start of every web process launch, we can just do this work
1552         lazily, the first time the web process requests permissions for user media access.
1553
1554         * WebProcess/WebCoreSupport/WebUserMediaClient.cpp:
1555         (WebKit::WebUserMediaClient::requestUserMediaAccess):
1556         * WebProcess/WebPage/WebPage.cpp:
1557         (WebKit::WebPage::prepareToSendUserMediaPermissionRequest):
1558         * WebProcess/WebPage/WebPage.h:
1559         * WebProcess/WebPage/ios/WebPageIOS.mm:
1560         (WebKit::WebPage::prepareToSendUserMediaPermissionRequest):
1561         * WebProcess/cocoa/WebProcessCocoa.mm:
1562         (WebKit::WebProcess::platformInitializeWebProcess):
1563
1564 2017-10-21  Michael Catanzaro  <mcatanzaro@igalia.com>
1565
1566         Unreviewed, silence a -Wunused-but-set-variable warning
1567
1568         * WebProcess/WebPage/EventDispatcher.cpp:
1569         (WebKit::EventDispatcher::wheelEvent):
1570
1571 2017-10-20  Alex Christensen  <achristensen@webkit.org>
1572
1573         Add FIXME comment after r223803
1574         https://bugs.webkit.org/show_bug.cgi?id=178418
1575
1576         * UIProcess/WebProcessPool.cpp:
1577         (WebKit::WebProcessPool::ensureNetworkProcess):
1578         We need some work to better support customized persistent data stores.  Add a comment indicating such.
1579
1580 2017-10-20  Alex Christensen  <achristensen@webkit.org>
1581
1582         Fix API tests after r223791.
1583         https://bugs.webkit.org/show_bug.cgi?id=178418
1584
1585         * UIProcess/WebProcessPool.cpp:
1586         (WebKit::WebProcessPool::ensureNetworkProcess):
1587         Whatever NetworkSessionInitializationParameters we send with the NetworkProcess initialization message,
1588         that's the default session.  This is needed for WebKit.WebsiteDataStoreCustomPaths.
1589         (WebKit::WebProcessPool::createNewWebProcess):
1590         Don't change behavior or NetworkProcess initialization like I did in r223791.
1591
1592 2017-10-20  Alex Christensen  <achristensen@webkit.org>
1593
1594         Fix download tests on El Capitan after r223730
1595         https://bugs.webkit.org/show_bug.cgi?id=178547
1596
1597         * UIProcess/Downloads/DownloadProxy.cpp:
1598         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
1599         Revert to original behavior.  This uses suggestedFilename, which may have come from places like
1600         the download attribute, instead of always using the filename from CFNetwork.
1601
1602 2017-10-20  Alex Christensen  <achristensen@webkit.org>
1603
1604         Expose _boundInterfaceIdentifier and _allowsCellularAccess to WKWebsiteDataStorePrivate
1605         https://bugs.webkit.org/show_bug.cgi?id=178418
1606         <rdar://problem/29599569>
1607
1608         Reviewed by Tim Horton.
1609         
1610         In r213747 I introduced allowsCellularAccess to _WKProcessPoolConfiguration because there
1611         was no way to add parameters to the default (and other) NetworkSession constructors.  Since
1612         clients have not adopted this SPI, we can introduce such a way in NetworkSessionCreationParameters
1613         and move the SPI to WKWebsiteDataStore, which is where it and other NetworkSession properties
1614         ought to be instead of making them WKProcessPool global.
1615
1616         We also need to expose access to NSURLRequest.boundInterfaceIdentifier.  Instead of serializing and
1617         deserializing that property for each NSURLRequest and then having subresources mysteriously jump back
1618         to having no bound interface identifiers, I'm adding this to WKWebsiteDataStore, too, to make it a
1619         session networking property.
1620         
1621         I manually verified that these properties are being set properly with a custom test app and added logs.
1622         Unfortunately, these properties don't do anything under circumstances anywhere close to what we test.
1623         The architecture change of having NetworkSessionCreationParameters is verified to not have a change in
1624         behavior by existing tests, such as any test that uses TestProtocol (which we should eventually remove).
1625
1626         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1627         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
1628         * NetworkProcess/NetworkProcess.cpp:
1629         (WebKit::NetworkProcess::NetworkProcess):
1630         (WebKit::NetworkProcess::initializeNetworkProcess):
1631         (WebKit::NetworkProcess::clearCachedCredentials):
1632         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1633         (WebKit::NetworkProcessCreationParameters::encode const):
1634         (WebKit::NetworkProcessCreationParameters::decode):
1635         * NetworkProcess/NetworkProcessCreationParameters.h:
1636         * NetworkProcess/NetworkSession.cpp:
1637         (WebKit::NetworkSession::create):
1638         (WebKit::NetworkSession::defaultSession): Deleted.
1639         * NetworkProcess/NetworkSession.h:
1640         * NetworkProcess/NetworkSessionCreationParameters.h: Added.
1641         (WebKit::NetworkSessionCreationParameters::encode const):
1642         (WebKit::NetworkSessionCreationParameters::decode):
1643         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
1644         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
1645         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1646         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1647         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1648         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1649         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1650         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1651         (WebKit::NetworkSessionCocoa::setSourceApplicationSecondaryIdentifier):
1652         (WebKit::NetworkSessionCocoa::create):
1653         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1654         (WebKit::NetworkSessionCocoa::setLegacyCustomProtocolManager): Deleted.
1655         (WebKit::NetworkSessionCocoa::setAllowsCellularAccess): Deleted.
1656         (WebKit::NetworkSessionCocoa::defaultSession): Deleted.
1657         * NetworkProcess/mac/RemoteNetworkingContext.mm:
1658         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
1659         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
1660         * Shared/SessionTracker.cpp:
1661         (WebKit::SessionTracker::networkSession):
1662         (WebKit::SessionTracker::setSession):
1663         * Shared/WebsiteDataStoreParameters.cpp:
1664         (WebKit::WebsiteDataStoreParameters::encode const):
1665         (WebKit::WebsiteDataStoreParameters::decode):
1666         * Shared/WebsiteDataStoreParameters.h:
1667         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1668         (API::ProcessPoolConfiguration::copy):
1669         * UIProcess/API/APIProcessPoolConfiguration.h:
1670         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1671         (-[WKWebsiteDataStore _setBoundInterfaceIdentifier:]):
1672         (-[WKWebsiteDataStore _boundInterfaceIdentifier]):
1673         (-[WKWebsiteDataStore _setAllowsCellularAccess:]):
1674         (-[WKWebsiteDataStore _allowsCellularAccess]):
1675         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1676         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1677         (-[_WKProcessPoolConfiguration allowsCellularAccess]):
1678         (-[_WKProcessPoolConfiguration setAllowsCellularAccess:]):
1679         * UIProcess/WebProcessPool.cpp:
1680         (WebKit::WebProcessPool::ensureNetworkProcess):
1681         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
1682         * UIProcess/WebsiteData/WebsiteDataStore.h:
1683         (WebKit::WebsiteDataStore::setBoundInterfaceIdentifier):
1684         (WebKit::WebsiteDataStore::boundInterfaceIdentifier):
1685         (WebKit::WebsiteDataStore::setAllowsCellularAccess):
1686         (WebKit::WebsiteDataStore::allowsCellularAccess):
1687         * WebKit.xcodeproj/project.pbxproj:
1688         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1689         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
1690         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
1691         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
1692         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
1693         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
1694         * WebProcess/WebProcess.cpp:
1695         (WebKit::WebProcess::ensurePrivateBrowsingSession):
1696         (WebKit::WebProcess::clearCachedCredentials):
1697
1698 2017-10-20  Alex Christensen  <achristensen@webkit.org>
1699
1700         Add ObjC SPI to _WKDownloadDelegate missing from WKContextDownloadClient
1701         https://bugs.webkit.org/show_bug.cgi?id=178566
1702         <rdar://problem/23041906>
1703
1704         Reviewed by Brady Eidson.
1705
1706         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
1707         * UIProcess/Cocoa/DownloadClient.h:
1708         * UIProcess/Cocoa/DownloadClient.mm:
1709         (WebKit::DownloadClient::DownloadClient):
1710         (WebKit::DownloadClient::didReceiveAuthenticationChallenge):
1711         (WebKit::DownloadClient::shouldDecodeSourceDataOfMIMEType):
1712         (WebKit::DownloadClient::didCreateDestination):
1713         (WebKit::DownloadClient::processDidCrash):
1714
1715 2017-10-20  Youenn Fablet  <youenn@apple.com>
1716
1717         ResourceResponse should have a ServiceWorker source
1718         https://bugs.webkit.org/show_bug.cgi?id=178593
1719
1720         Reviewed by Alex Christensen.
1721
1722         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
1723         (WebKit::ServiceWorkerClientFetch::didReceiveResponse): setting response source to ServiceWorker.
1724         * WebProcess/Storage/ServiceWorkerClientFetch.h:
1725
1726 2017-10-20  Antoine Quint  <graouts@apple.com>
1727
1728         [Web Animations] Provide basic timeline and animation interfaces
1729         https://bugs.webkit.org/show_bug.cgi?id=178526
1730
1731         Reviewed by Dean Jackson.
1732
1733         Remove the WEB_ANIMATIONS compile-time flag.
1734
1735         * Configurations/FeatureDefines.xcconfig:
1736         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1737         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1738         (WebKit::InjectedBundle::setWebAnimationsEnabled):
1739         * WebProcess/WebPage/WebPage.cpp:
1740         (WebKit::WebPage::updatePreferences):
1741
1742 2017-10-02  Brian Burg  <bburg@apple.com>
1743
1744         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
1745         https://bugs.webkit.org/show_bug.cgi?id=177661
1746         <rdar://problem/34740286>
1747
1748         Reviewed by Joseph Pecoraro.
1749
1750         Move setup and delegates of the inspector frontend page into implementations of
1751         WebInspectorProxy::platformCreateFrontendPage. The Mac implementation
1752         will be subsumed by WKInspectorViewController, while the GTK implementation
1753         is inherited from the cross-platform version that uses C API. Eventually the
1754         GTK version should use GTK API rather than the soon to be deprecated C API.
1755
1756         * UIProcess/WebInspectorProxy.cpp:
1757         (WebKit::WebInspectorProxy::createFrontendPage):
1758         (WebKit::webProcessDidCrash): Deleted.
1759         (WebKit::decidePolicyForNavigationAction): Deleted.
1760         (WebKit::getContextMenuFromProposedMenu): Deleted.
1761         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
1762         (WebKit::exceededDatabaseQuota):
1763         (WebKit::webProcessDidCrash):
1764         (WebKit::decidePolicyForNavigationAction):
1765         (WebKit::getContextMenuFromProposedMenu):
1766         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
1767         * UIProcess/mac/WebInspectorProxyMac.mm:
1768         (WebKit::exceededDatabaseQuota):
1769         (WebKit::webProcessDidCrash):
1770         (WebKit::decidePolicyForNavigationAction):
1771         (WebKit::getContextMenuFromProposedMenu):
1772         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
1773
1774 2017-10-02  Brian Burg  <bburg@apple.com>
1775
1776         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
1777         https://bugs.webkit.org/show_bug.cgi?id=177661
1778         <rdar://problem/34740286>
1779
1780         Reviewed by Joseph Pecoraro.
1781
1782         Adopt WKInspectorViewController in WebInspectorProxyMac to set up the
1783         frontend's web view.
1784
1785         * UIProcess/WebInspectorProxy.cpp:
1786         (WebKit::WebInspectorProxy::invalidate):
1787         (WebKit::WebInspectorProxy::close):
1788         (WebKit::WebInspectorProxy::didClose):
1789         (WebKit::WebInspectorProxy::closeFrontendPageAndWindow):
1790         Make closeFrontendPageAndWindow into the method that does work.
1791         Only use didClose() as the IPC message entry point.
1792
1793         * UIProcess/WebInspectorProxy.h:
1794         (WebKit::WebInspectorProxy::isUnderTest const): Make public.
1795
1796         * UIProcess/mac/WKInspectorViewController.h:
1797         * UIProcess/mac/WKInspectorViewController.mm:
1798         (+[WKInspectorViewController viewIsInspectorWebView:]):
1799         Abstract away the -isInstanceOfClass: check for WKInspectorWKWebView.
1800         Clients shouldn't need to know whether we use a subclass or what its name is.
1801
1802         * UIProcess/mac/WebInspectorProxyMac.mm:
1803         (-[WKWebInspectorProxyObjCAdapter inspectorViewControllerInspectorDidCrash:]):
1804         (-[WKWebInspectorProxyObjCAdapter inspectorViewControllerInspectorIsUnderTest:]):
1805         Hook up view controller delegates.
1806
1807         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
1808         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
1809         (WebKit::WebInspectorProxy::closeFrontendPage):
1810         New implementation based on the view controller.
1811
1812         (WebKit::WebInspectorProxy::platformBringToFront):
1813         (WebKit::WebInspectorProxy::platformIsFront):
1814         (WebKit::WebInspectorProxy::platformCanAttach):
1815         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
1816         (WebKit::WebInspectorProxy::platformAttach):
1817         (WebKit::WebInspectorProxy::platformDetach):
1818         (WebKit::WebInspectorProxy::platformStartWindowDrag):
1819         Adjust to get the WKWebView out of the view controller for code that needs
1820         to do something with the NSView, such as get/set the frame.
1821
1822         (WebKit::WebInspectorProxy::createFrontendConfiguration): Deleted.
1823         (WebKit::exceededDatabaseQuota): Deleted.
1824         (WebKit::webProcessDidCrash): Deleted.
1825         (WebKit::decidePolicyForNavigationAction): Deleted.
1826         (WebKit::getContextMenuFromProposedMenu): Deleted.
1827
1828 2017-10-02  Brian Burg  <bburg@apple.com>
1829
1830         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
1831         https://bugs.webkit.org/show_bug.cgi?id=177661
1832         <rdar://problem/34740286>
1833
1834         Reviewed by Joseph Pecoraro.
1835
1836         Introduce new platform methods to open and close the frontend page and window.
1837         This matches how RemoteWebInspectorProxy divides work up into platform methods.
1838         Move existing code from platformDidClose, platformOpen, and other methods into
1839         the new platform methods. Move some identical platform code into WebInspectorProxy.cpp.
1840
1841         * UIProcess/WebInspectorProxy.h:
1842         * UIProcess/WebInspectorProxy.cpp:
1843         (WebKit::WebInspectorProxy::connect):
1844         (WebKit::WebInspectorProxy::showConsole):
1845         (WebKit::WebInspectorProxy::showResources):
1846         (WebKit::WebInspectorProxy::showTimelines):
1847         (WebKit::WebInspectorProxy::showMainResourceForFrame):
1848         (WebKit::WebInspectorProxy::createFrontendPage):
1849         (WebKit::WebInspectorProxy::createInspectorPage):
1850         (WebKit::WebInspectorProxy::open):
1851         (WebKit::WebInspectorProxy::didClose):
1852         (WebKit::WebInspectorProxy::eagerlyCreateInspectorPage): Renamed.
1853
1854         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
1855         (WebKit::WebInspectorProxy::updateInspectorWindowTitle const):
1856         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
1857         Do everything necessary to set up the frontend page WebView.
1858
1859         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
1860         Do everything necessary to set up the detached NSWindow for the frontend.
1861
1862         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
1863         (WebKit::WebInspectorProxy::platformDetach):
1864         (WebKit::WebInspectorProxy::platformCreateInspectorPage): Deleted.
1865         (WebKit::WebInspectorProxy::createInspectorWindow): Deleted.
1866         (WebKit::WebInspectorProxy::platformOpen): Deleted.
1867         (WebKit::WebInspectorProxy::platformDidClose): Deleted.
1868
1869         * UIProcess/mac/WebInspectorProxyMac.mm:
1870         (WebKit::WebInspectorProxy::updateInspectorWindowTitle const):
1871         (WebKit::WebInspectorProxy::platformCreateFrontendPage): Added.
1872         Do everything necessary to set up the frontend page WebView.
1873
1874         (WebKit::WebInspectorProxy::platformCreateFrontendWindow): Added.
1875         Do everything necessary to set up the detached NSWindow for the frontend.
1876
1877         (WebKit::WebInspectorProxy::closeFrontendPage):
1878         (WebKit::WebInspectorProxy::closeFrontendAfterInactivityTimerFired):
1879         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
1880         (WebKit::WebInspectorProxy::platformDidCloseForCrash):
1881         (WebKit::WebInspectorProxy::platformInvalidate):
1882         (WebKit::WebInspectorProxy::platformBringToFront): Carry through renamings.
1883
1884         (WebKit::WebInspectorProxy::platformDetach):
1885         Defer to the general open() method to create a window if needed and bring it to front.
1886
1887         (WebKit::WebInspectorProxy::platformCanAttach): Move this below open/close code.
1888
1889         (WebKit::WebInspectorProxy::closeFrontend): Deleted.
1890         (WebKit::WebInspectorProxy::createInspectorWindow): Deleted.
1891         (WebKit::WebInspectorProxy::platformCreateInspectorPage): Deleted.
1892         (WebKit::WebInspectorProxy::platformOpen): Deleted.
1893         (WebKit::WebInspectorProxy::platformDidClose): Deleted.
1894         Defer to the general open() method to create a window if needed and bring it to front.
1895
1896         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
1897         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
1898         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
1899         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
1900         (WebKit::WebInspectorProxy::platformCreateInspectorPage): Deleted.
1901         (WebKit::WebInspectorProxy::createInspectorWindow): Deleted.
1902         (WebKit::WebInspectorProxy::platformOpen): Deleted.
1903         (WebKit::WebInspectorProxy::platformDidClose): Deleted.
1904         Update stubs.
1905
1906 2017-10-02  Brian Burg  <bburg@apple.com>
1907
1908         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
1909         https://bugs.webkit.org/show_bug.cgi?id=177661
1910         <rdar://problem/34740286>
1911
1912         Reviewed by Joseph Pecoraro.
1913
1914         This patch refactors some Cocoa code pathas.
1915         Rename the timer that closes the WebView so it's more obvious what it is for.
1916         Extract the common code to close the frontend window so its not implemented by
1917         the timer callback.
1918
1919         In later patches, this will be extracted further into platform methods to open/close
1920         the frontend and window, like how it is for RemoteWebInspectorProxy.
1921
1922         * UIProcess/WebInspectorProxy.cpp:
1923         (WebKit::WebInspectorProxy::WebInspectorProxy):
1924         * UIProcess/WebInspectorProxy.h:
1925         * UIProcess/mac/WebInspectorProxyMac.mm:
1926         (WebKit::WebInspectorProxy::closeFrontendAfterInactivityTimerFired):
1927         (WebKit::WebInspectorProxy::closeFrontend):
1928         (WebKit::WebInspectorProxy::platformCreateInspectorPage):
1929         (WebKit::WebInspectorProxy::platformDidClose):
1930         (WebKit::WebInspectorProxy::platformDidCloseForCrash):
1931         (WebKit::WebInspectorProxy::platformInvalidate):
1932         (WebKit::WebInspectorProxy::closeTimerFired): Deleted.
1933
1934 2017-09-30  Brian Burg  <bburg@apple.com>
1935
1936         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
1937         https://bugs.webkit.org/show_bug.cgi?id=177661
1938         <rdar://problem/34740286>
1939
1940         Reviewed by Joseph Pecoraro.
1941
1942         Modernize the ObjC adapter and related code a bit before it is hooked
1943         into WKInspectorViewController.
1944
1945         * UIProcess/API/C/mac/WKInspectorPrivateMac.h: No need for the
1946         ivar to be declared here, move to @implementation.
1947
1948         * UIProcess/WebInspectorProxy.h: Simplify the name to match modern convention.
1949
1950         * UIProcess/mac/WebInspectorProxyMac.mm:
1951         (-[WKWebInspectorProxyObjCAdapter inspectorRef]):
1952         (-[WKWebInspectorProxyObjCAdapter initWithWebInspectorProxy:]):
1953         (-[WKWebInspectorProxyObjCAdapter invalidate]):
1954         (-[WKWebInspectorProxyObjCAdapter windowDidMove:]):
1955         (-[WKWebInspectorProxyObjCAdapter windowDidResize:]):
1956         (-[WKWebInspectorProxyObjCAdapter windowWillClose:]):
1957         (-[WKWebInspectorProxyObjCAdapter windowDidEnterFullScreen:]):
1958         (-[WKWebInspectorProxyObjCAdapter windowDidExitFullScreen:]):
1959         (-[WKWebInspectorProxyObjCAdapter inspectedViewFrameDidChange:]):
1960         Remove unnecessary casts to and from void*.
1961
1962         (WebKit::WebInspectorProxy::attachmentViewDidChange):
1963         (WebKit::WebInspectorProxy::setInspectorWindowFrame):
1964         (WebKit::WebInspectorProxy::closeTimerFired):
1965         (WebKit::WebInspectorProxy::createInspectorWindow):
1966         (WebKit::WebInspectorProxy::platformCreateInspectorPage):
1967         Fix uses of member variable m_objCAdapter.
1968
1969         (-[WKWebInspectorProxyObjCAdapter close]): Deleted.
1970         Rename this to invalidate to match modern convention. In this context,
1971         'close' might trick someone into thinking that this closes a window/page.
1972
1973 2017-09-30  Brian Burg  <bburg@apple.com>
1974
1975         Web Inspector: consolidate code that hosts the Inspector page inside a WKWebView
1976         https://bugs.webkit.org/show_bug.cgi?id=177661
1977         <rdar://problem/34740286>
1978
1979         Reviewed by Joseph Pecoraro.
1980
1981         Move code that sets up and controls the inspector WebView into WKInspectorViewController.
1982         This will be shared between RemoteWebInspectorProxy and WebInspectorProxy eventually,
1983         but for now just pull out code from RemoteWebInspectorProxy. The next patch will move
1984         over WebInspectorProxy.
1985
1986         WKInspectorViewController uses the ObjC API for setting up the WKWebView's delegates.
1987         Previously, a WKWebView was used but the delegates were set up using the C API. In
1988         a few cases it uses delegate methods to ask the owning [Remote]WebInspectorProxy some
1989         things. In general, WKInspectorViewController doesn't dig into any internals of
1990         WebPageProxy or WebInspectorProxy; that is delegated to the client.
1991
1992         * UIProcess/RemoteWebInspectorProxy.h:
1993         (WebKit::RemoteWebInspectorProxy::isUnderTest const): Add a method stub for now.
1994         We might want to enable tests for a _WKRemoteWebInspectorViewController-based UI
1995         in the future, and WebInspectorProxy has the same method. Add this and connect it
1996         to the view controller delegate method.
1997
1998         (WebKit::RemoteWebInspectorProxy::webView const):
1999         This returns a plain WKWebView type now.
2000
2001         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
2002         (-[WKRemoteWebInspectorProxyObjCAdapter inspectorViewControllerInspectorDidCrash:]):
2003         (-[WKRemoteWebInspectorProxyObjCAdapter inspectorViewControllerInspectorIsUnderTest:]):
2004         (-[WKRemoteWebInspectorProxyObjCAdapter webViewWebContentProcessDidTerminate:]): Deleted.
2005         (-[WKRemoteWebInspectorProxyObjCAdapter webView:decidePolicyForNavigationAction:decisionHandler:]): Deleted.
2006         Make the ObjCAdapter forward view controller delegate calls to the C++ class.
2007         It no longer needs to be the delegate of the WebView, as the view controller handles that.
2008
2009         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
2010         Clean up and move WKWebView setup code into the view controller.
2011
2012         (WebKit::RemoteWebInspectorProxy::platformCloseFrontendPageAndWindow):
2013         The m_inspectorPage is closed by the caller before calling this method, so we don't need to do it here.
2014
2015         (WebKit::RemoteWebInspectorProxy::platformBringToFront):
2016         (WebKit::RemoteWebInspectorProxy::platformSave):
2017         (WebKit::RemoteWebInspectorProxy::platformAppend):
2018         (WebKit::RemoteWebInspectorProxy::platformStartWindowDrag):
2019         Use webView() instead of m_webView.
2020
2021         * UIProcess/mac/WKInspectorViewController.h: Added.
2022         * UIProcess/mac/WKInspectorViewController.mm: Added.
2023         (-[WKInspectorWKWebView tag]):
2024         (-[WKInspectorViewController initWithInspectedPage:]):
2025         (-[WKInspectorViewController dealloc]):
2026         (-[WKInspectorViewController delegate]):
2027         (-[WKInspectorViewController webView]):
2028         (-[WKInspectorViewController setDelegate:]):
2029         (-[WKInspectorViewController configuration]):
2030         (-[WKInspectorViewController _webView:getWindowFrameWithCompletionHandler:]):
2031         (-[WKInspectorViewController _webView:setWindowFrame:]):
2032         (-[WKInspectorViewController webView:runOpenPanelWithParameters:initiatedByFrame:completionHandler:]):
2033         (-[WKInspectorViewController _webView:decideDatabaseQuotaForSecurityOrigin:currentQuota:currentOriginUsage:currentDatabaseUsage:expectedUsage:decisionHandler:]):
2034         (-[WKInspectorViewController webViewWebContentProcessDidTerminate:]):
2035         (-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]):
2036         Move code from RemoteWebInspectorProxyMac into here.
2037
2038         * UIProcess/mac/WebInspectorProxyMac.mm:
2039         (WebKit::WebInspectorProxy::createFrontendWindow):
2040         Remove commented out code left over from the last time that this method got moved around.
2041
2042         * WebKit.xcodeproj/project.pbxproj:
2043         Add new class.
2044
2045 2017-10-20  Zan Dobersek  <zdobersek@igalia.com>
2046
2047         [WK2] Drop 'CoordinatedGraphics' as a platform prefix from generate-forwarding-headers.pl
2048         https://bugs.webkit.org/show_bug.cgi?id=178575
2049
2050         Reviewed by Carlos Garcia Campos.
2051
2052         * Scripts/generate-forwarding-headers.pl: Remove CoordinatedGraphics as
2053         a supported platform prefix. No one invokes the script with this
2054         argument anymore.
2055
2056 2017-10-19  Alex Christensen  <achristensen@webkit.org>
2057
2058         Introduce completionHandler-based SPI for _WKDownloadDelegate.decideDestinationWithSuggestedFilename
2059         https://bugs.webkit.org/show_bug.cgi?id=178560
2060
2061         Reviewed by Tim Horton.
2062
2063         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
2064         * UIProcess/Cocoa/DownloadClient.h:
2065         * UIProcess/Cocoa/DownloadClient.mm:
2066         (WebKit::DownloadClient::DownloadClient):
2067         (WebKit::DownloadClient::didStart):
2068         (WebKit::DownloadClient::didReceiveResponse):
2069         (WebKit::DownloadClient::didReceiveData):
2070         (WebKit::DownloadClient::decideDestinationWithSuggestedFilename):
2071         (WebKit::DownloadClient::didFinish):
2072         (WebKit::DownloadClient::didFail):
2073         (WebKit::DownloadClient::didCancel):
2074         (WebKit::DownloadClient::willSendRequest):
2075
2076 2017-10-19  Chris Dumez  <cdumez@apple.com>
2077
2078         ServiceWorkerContextManager should be an IPC::MessageReceiver
2079         https://bugs.webkit.org/show_bug.cgi?id=178552
2080
2081         Reviewed by Youenn Fablet.
2082
2083         ServiceWorkerContextManager should be an IPC::MessageReceiver, to avoid putting too many
2084         ServiceWorker related methods on WebProcess class.
2085
2086         * DerivedSources.make:
2087         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2088         (WebKit::WebSWServerConnection::startServiceWorkerContext):
2089         (WebKit::WebSWServerConnection::startFetch):
2090         * WebKit.xcodeproj/project.pbxproj:
2091         * WebProcess/Storage/ServiceWorkerContextManager.cpp:
2092         (WebKit::ServiceWorkerContextManager::startFetchInServiceWorker):
2093         (WebKit::ServiceWorkerContextManager::startFetch): Deleted.
2094         * WebProcess/Storage/ServiceWorkerContextManager.h:
2095         * WebProcess/Storage/ServiceWorkerContextManager.messages.in: Added.
2096         * WebProcess/WebProcess.cpp:
2097         (WebKit::WebProcess::didReceiveMessage):
2098         (WebKit::WebProcess::getWorkerContextConnection):
2099         (WebKit::WebProcess::startServiceWorkerContext): Deleted.
2100         (WebKit::WebProcess::startFetchInServiceWorker): Deleted.
2101         * WebProcess/WebProcess.h:
2102         * WebProcess/WebProcess.messages.in:
2103
2104 2017-10-19  Alex Christensen  <achristensen@webkit.org>
2105
2106         Modernize authentication challenge handling in WebKit
2107         https://bugs.webkit.org/show_bug.cgi?id=178555
2108
2109         Reviewed by Tim Horton.
2110
2111         * UIProcess/API/APILoaderClient.h:
2112         (API::LoaderClient::didReceiveAuthenticationChallengeInFrame):
2113         * UIProcess/API/APINavigationClient.h:
2114         (API::NavigationClient::didReceiveAuthenticationChallenge):
2115         * UIProcess/API/C/WKPage.cpp:
2116         (WKPageSetPageLoaderClient):
2117         (WKPageSetPageNavigationClient):
2118         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2119         * UIProcess/Cocoa/NavigationState.h:
2120         * UIProcess/Cocoa/NavigationState.mm:
2121         (WebKit::NavigationState::NavigationClient::canAuthenticateAgainstProtectionSpace):
2122         (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):
2123         * UIProcess/WebPageProxy.cpp:
2124         (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
2125
2126 2017-10-19  Alex Christensen  <achristensen@webkit.org>
2127
2128         Modernize API::DownloadClient
2129         https://bugs.webkit.org/show_bug.cgi?id=178547
2130
2131         Reviewed by Andy Estes.
2132
2133         Use more C++ references instead of pointers because they're never null.
2134
2135         Remove canAuthenticateAgainstProtectionSpace because there are no implementations
2136         except the default implementation which always returns true and we don't intend to
2137         add this to the SPI because that's just a legacy call anyways from when NSURLConnection
2138         hadn't fully evolved, and we're moving away from NSURLConnection, especially in our API design.
2139
2140         Separate the NetworkSession-only and pre-NetworkSession-only callbacks.  All the synchronous
2141         IPC messages are only used in the pre-NetworkSession code, so once we remove it we can remove them!
2142
2143         Make API::DownloadClient calls that NetworkSession uses use a completion handler so we will be able to
2144         design an asynchronous API.
2145
2146         * NetworkProcess/Downloads/DownloadManager.cpp:
2147         (WebKit::DownloadManager::continueCanAuthenticateAgainstProtectionSpace): Deleted.
2148         * NetworkProcess/Downloads/DownloadManager.h:
2149         * NetworkProcess/Downloads/PendingDownload.cpp:
2150         (WebKit::PendingDownload::canAuthenticateAgainstProtectionSpaceAsync):
2151         (WebKit::PendingDownload::continueCanAuthenticateAgainstProtectionSpace): Deleted.
2152         * NetworkProcess/Downloads/PendingDownload.h:
2153         * NetworkProcess/NetworkProcess.cpp:
2154         (WebKit::NetworkProcess::continueCanAuthenticateAgainstProtectionSpaceDownload): Deleted.
2155         * NetworkProcess/NetworkProcess.h:
2156         * NetworkProcess/NetworkProcess.messages.in:
2157         * UIProcess/API/APIDownloadClient.h:
2158         (API::DownloadClient::didStart):
2159         (API::DownloadClient::didReceiveAuthenticationChallenge):
2160         (API::DownloadClient::didReceiveResponse):
2161         (API::DownloadClient::didReceiveData):
2162         (API::DownloadClient::shouldDecodeSourceDataOfMIMEType):
2163         (API::DownloadClient::decideDestinationWithSuggestedFilename):
2164         (API::DownloadClient::didCreateDestination):
2165         (API::DownloadClient::didFinish):
2166         (API::DownloadClient::didFail):
2167         (API::DownloadClient::didCancel):
2168         (API::DownloadClient::processDidCrash):
2169         (API::DownloadClient::willSendRequest):
2170         (API::DownloadClient::canAuthenticateAgainstProtectionSpace): Deleted.
2171         * UIProcess/API/C/WKContext.cpp:
2172         (WKContextSetDownloadClient):
2173         * UIProcess/API/glib/WebKitDownloadClient.cpp:
2174         * UIProcess/Cocoa/DownloadClient.h:
2175         * UIProcess/Cocoa/DownloadClient.mm:
2176         (WebKit::DownloadClient::didStart):
2177         (WebKit::DownloadClient::didReceiveResponse):
2178         (WebKit::DownloadClient::didReceiveData):
2179         (WebKit::DownloadClient::decideDestinationWithSuggestedFilename):
2180         (WebKit::DownloadClient::didFinish):
2181         (WebKit::DownloadClient::didFail):
2182         (WebKit::DownloadClient::didCancel):
2183         (WebKit::DownloadClient::willSendRequest):
2184         * UIProcess/Downloads/DownloadProxy.cpp:
2185         (WebKit::DownloadProxy::processDidClose):
2186         (WebKit::DownloadProxy::didStart):
2187         (WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
2188         (WebKit::DownloadProxy::willSendRequest):
2189         (WebKit::DownloadProxy::didReceiveResponse):
2190         (WebKit::DownloadProxy::didReceiveData):
2191         (WebKit::DownloadProxy::shouldDecodeSourceDataOfMIMEType):
2192         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):
2193         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
2194         (WebKit::DownloadProxy::didCreateDestination):
2195         (WebKit::DownloadProxy::didFinish):
2196         (WebKit::DownloadProxy::didFail):
2197         (WebKit::DownloadProxy::didCancel):
2198         (WebKit::DownloadProxy::canAuthenticateAgainstProtectionSpace): Deleted.
2199         * UIProcess/Downloads/DownloadProxy.h:
2200         * UIProcess/Downloads/DownloadProxy.messages.in:
2201
2202 2017-10-19  Nan Wang  <n_wang@apple.com>
2203
2204         AX: Provide a way for Accessibility to cache the selection while retrieving rects for speak selection
2205         https://bugs.webkit.org/show_bug.cgi?id=176247
2206         <rdar://problem/34217143>
2207
2208         Reviewed by Ryosuke Niwa.
2209
2210         When getting the rects for highlighting the spoken text within a selection range on iOS, we can get a
2211         list of totally wrong rects if the user changed the selection to some other text. This is because the
2212         calculation is based on the current selection range. Therefore, we need to provide a way for accessibility
2213         codepath to store the selection during a speaking session.
2214
2215         * UIProcess/API/Cocoa/WKWebView.mm:
2216         (-[WKWebView _accessibilityStoreSelection]):
2217         (-[WKWebView _accessibilityClearSelection]):
2218         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2219         * UIProcess/WebPageProxy.h:
2220         * UIProcess/ios/WKContentViewInteraction.h:
2221         * UIProcess/ios/WKContentViewInteraction.mm:
2222         (-[WKContentView _accessibilityStoreSelection]):
2223         (-[WKContentView _accessibilityClearSelection]):
2224         * UIProcess/ios/WebPageProxyIOS.mm:
2225         (WebKit::WebPageProxy::storeSelectionForAccessibility):
2226         * WebProcess/WebPage/WebPage.h:
2227         * WebProcess/WebPage/WebPage.messages.in:
2228         * WebProcess/WebPage/ios/WebPageIOS.mm:
2229         (WebKit::WebPage::getRectsForGranularityWithSelectionOffset):
2230         (WebKit::WebPage::storeSelectionForAccessibility):
2231         (WebKit::WebPage::getRectsAtSelectionOffsetWithText):
2232
2233 2017-10-19  Sam Weinig  <sam@webkit.org>
2234
2235         [Settings] Move global settings into their own file
2236         https://bugs.webkit.org/show_bug.cgi?id=178512
2237
2238         Reviewed by Darin Adler.
2239
2240         Moves all global settigns out of SettingsBase and into the new DeprecatedGlobalSettings.
2241
2242         * NetworkProcess/NetworkProcess.cpp:
2243         (WebKit::NetworkProcess::setAllowsAnySSLCertificateForWebSocket):
2244         * Shared/WebPreferencesDefinitions.h:
2245         * Shared/WebPreferencesStore.cpp:
2246         * WebProcess/WebPage/WebPage.cpp:
2247         (WebKit::m_cpuLimit):
2248         (WebKit::WebPage::updatePreferences):
2249         * WebProcess/WebProcess.cpp:
2250         (WebKit::WebProcess::setResourceLoadStatisticsEnabled):
2251         * WebProcess/cocoa/VideoFullscreenManager.mm:
2252         (WebKit::VideoFullscreenManager::supportsVideoFullscreen const):
2253
2254 2017-10-19  Andy Estes  <aestes@apple.com>
2255
2256         [iOS] Conditionally rename DatabaseProcess to StorageProcess when building for iOS devices
2257         https://bugs.webkit.org/show_bug.cgi?id=178181
2258         <rdar://problem/33660282>
2259
2260         Reviewed by Dan Bernstein.
2261
2262         * Configurations/BaseTarget.xcconfig:
2263         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2264         (WebKit::serviceName):
2265         * WebKit.xcodeproj/project.pbxproj:
2266
2267 2017-10-19  Youenn Fablet  <youenn@apple.com>
2268
2269         Add preliminary support for ServiceWorker Handle Fetch
2270         https://bugs.webkit.org/show_bug.cgi?id=178475
2271         <rdar://problem/35066424>
2272
2273         Reviewed by Chris Dumez.
2274
2275         Relanding now that underlying issue is fixed in https://bugs.webkit.org/show_bug.cgi?id=178527.
2276
2277         Preliminary support of Handle Fetch algorithm and integration with fetch spec.
2278         Adding ServiceWorkerClientFetch as the class responsible to do the load through ServiceWorker.
2279         It is similar to WebResourceLoader that do the load through NetworkProcess.
2280         In case ServiceWorkerClientFetch is not able to load through ServiceWorker,
2281         it will fallback to WebResourceLoader through a fallback callback.
2282
2283         Loading through Service Worker is done currently if:
2284         - There is a service worker registered for that origin
2285         - Request is a subresource
2286         - service workers mode is all
2287         There will be cases where the service worker will not do the loading, for instance when fetch event handler is not set.
2288         Future work should try to reduce the cases where the IPC dance is done unnecessarily.
2289
2290         ServiceWorkerClientFetch is responsible to adapt the ServiceWorker response to ResourceLoader.
2291         In particular, it is calling ResourceLoader error callback if response is of type error.
2292         It should call ResourceLoader redirection callback if response is a redirection response.
2293         This will be done as a follow-up.
2294
2295         Implementing the IPC communication dedicated to fetch between WebProcess and ServiceWorker through StorageProcess.
2296         In the future, WebProcess should create a direct IPC communication to the ServiceWorker process.
2297
2298         Moved SWContextManager from WebCore to WebKit and renamed it to ServiceWorkerContextManager.
2299         This class is moved to WebKit as it will have to handle IPC and having a separation will add some unnecessary boilerplate.
2300
2301         * CMakeLists.txt:
2302         * DerivedSources.make:
2303         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2304         (WebKit::WebSWServerConnection::startFetch):
2305         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
2306         (WebKit::WebSWServerConnection::didReceiveFetchData):
2307         (WebKit::WebSWServerConnection::didFinishFetch):
2308         (WebKit::WebSWServerConnection::didFailFetch):
2309         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2310         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2311         * StorageProcess/StorageProcess.cpp:
2312         (WebKit::StorageProcess::didFailFetch):
2313         (WebKit::StorageProcess::didReceiveFetchResponse):
2314         (WebKit::StorageProcess::didReceiveFetchData):
2315         (WebKit::StorageProcess::didFinishFetch):
2316         * StorageProcess/StorageProcess.h:
2317         * StorageProcess/StorageProcess.messages.in:
2318         * WebKit.xcodeproj/project.pbxproj:
2319         * WebProcess/Network/WebLoaderStrategy.cpp:
2320         (WebKit::WebLoaderStrategy::scheduleLoad):
2321         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2322         (WebKit::WebLoaderStrategy::remove):
2323         * WebProcess/Network/WebLoaderStrategy.h:
2324         * WebProcess/Storage/ServiceWorkerClientFetch.cpp: Added.
2325         (WebKit::ServiceWorkerClientFetch::ServiceWorkerClientFetch):
2326         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
2327         (WebKit::ServiceWorkerClientFetch::didReceiveData):
2328         (WebKit::ServiceWorkerClientFetch::didFinish):
2329         (WebKit::ServiceWorkerClientFetch::didFail):
2330         (WebKit::ServiceWorkerClientFetch::cancel):
2331         * WebProcess/Storage/ServiceWorkerClientFetch.h: Copied from Source/WebKit/WebProcess/Storage/WebSWClientConnection.h.
2332         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in: Copied from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in.
2333         * WebProcess/Storage/ServiceWorkerContextManager.cpp: Added.
2334         (WebKit::ServiceWorkerContextManager::startServiceWorkerContext):
2335         (WebKit::ServiceWorkerContextManager::startFetch):
2336         * WebProcess/Storage/ServiceWorkerContextManager.h: Renamed from Source/WebCore/workers/service/context/SWContextManager.h.
2337         (WebKit::ServiceWorkerContextManager::ServiceWorkerContextManager):
2338         * WebProcess/Storage/WebSWClientConnection.cpp:
2339         (WebKit::WebSWClientConnection::startFetch):
2340         * WebProcess/Storage/WebSWClientConnection.h:
2341         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2342         (WebKit::shouldHandleFetch):
2343         (WebKit::WebServiceWorkerProvider::handleFetch):
2344         (WebKit::WebServiceWorkerProvider::cancelFetch):
2345         (WebKit::WebServiceWorkerProvider::fetchFinished):
2346         (WebKit::WebServiceWorkerProvider::didReceiveServiceWorkerClientFetchMessage):
2347         * WebProcess/Storage/WebServiceWorkerProvider.h:
2348         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
2349         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
2350         * WebProcess/WebProcess.cpp:
2351         (WebKit::WebProcess::getWorkerContextConnection):
2352         (WebKit::WebProcess::startServiceWorkerContext):
2353         (WebKit::WebProcess::startFetchInServiceWorker):
2354         * WebProcess/WebProcess.h:
2355         * WebProcess/WebProcess.messages.in:
2356
2357 2017-10-19  Youenn Fablet  <youenn@apple.com>
2358
2359         Service Worker process should not be selected to open WebView on it
2360         https://bugs.webkit.org/show_bug.cgi?id=178527
2361
2362         Reviewed by Chris Dumez.
2363
2364         Selection of process to open a page will no longer use an existing web process if it is the service worker process.
2365
2366         * UIProcess/WebProcessPool.cpp:
2367         (WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
2368
2369 2017-10-19  Tim Horton  <timothy_horton@apple.com>
2370
2371         Display link bringup can block the main thread for ~150ms during WKWebView init
2372         https://bugs.webkit.org/show_bug.cgi?id=178524
2373
2374         Reviewed by Dean Jackson.
2375
2376         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
2377         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2378         (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
2379         (WebKit::RemoteLayerTreeDrawingAreaProxy::displayLinkHandler):
2380         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
2381         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
2382         Lazily initialize the display link at first use.
2383
2384 2017-10-19  Tim Horton  <timothy_horton@apple.com>
2385
2386         Expand r209943 to suppress paste during provisional navigation as well
2387         https://bugs.webkit.org/show_bug.cgi?id=178429
2388         <rdar://problem/33952830>
2389
2390         Reviewed by Dean Jackson.
2391
2392         * Shared/WebPreferencesDefinitions.h:
2393         * UIProcess/API/C/WKPreferences.cpp:
2394         (WKPreferencesSetShouldSuppressKeyboardInputDuringProvisionalNavigation):
2395         (WKPreferencesGetShouldSuppressKeyboardInputDuringProvisionalNavigation):
2396         * UIProcess/API/Cocoa/WKPreferences.mm:
2397         (-[WKPreferences _shouldSuppressKeyboardInputDuringProvisionalNavigation]):
2398         (-[WKPreferences _setShouldSuppressKeyboardInputDuringProvisionalNavigation:]):
2399         * WebProcess/WebPage/WebPage.cpp:
2400         (WebKit::WebPage::updatePreferences):
2401         Adjust to the changed preference name, except at the SPI level.
2402
2403 2017-10-19  Youenn Fablet  <youenn@apple.com>
2404
2405         Add API to clean CacheStorage data
2406         https://bugs.webkit.org/show_bug.cgi?id=178034
2407
2408         Unreviewed.
2409
2410         * UIProcess/API/Cocoa/WKWebsiteDataRecord.h: Using WK_IOS_TBA instead of WK_MAC_TBA for iOS.
2411
2412 2017-10-19  Chris Dumez  <cdumez@apple.com>
2413
2414         Unreviewed build fix after r223692.
2415
2416         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2417
2418 2017-10-19  Chris Dumez  <cdumez@apple.com>
2419
2420         Unreviewed, revert r223650 as it caused crashes on the bots.
2421
2422         * CMakeLists.txt:
2423         * DerivedSources.make:
2424         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2425         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2426         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2427         * StorageProcess/StorageProcess.cpp:
2428         * StorageProcess/StorageProcess.h:
2429         * StorageProcess/StorageProcess.messages.in:
2430         * WebKit.xcodeproj/project.pbxproj:
2431         * WebProcess/Network/WebLoaderStrategy.cpp:
2432         (WebKit::WebLoaderStrategy::scheduleLoad):
2433         (WebKit::WebLoaderStrategy::remove):
2434         * WebProcess/Network/WebLoaderStrategy.h:
2435         * WebProcess/Storage/ServiceWorkerClientFetch.cpp: Removed.
2436         * WebProcess/Storage/ServiceWorkerClientFetch.h: Removed.
2437         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in: Removed.
2438         * WebProcess/Storage/ServiceWorkerContextManager.cpp: Removed.
2439         * WebProcess/Storage/WebSWClientConnection.cpp:
2440         * WebProcess/Storage/WebSWClientConnection.h:
2441         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2442         * WebProcess/Storage/WebServiceWorkerProvider.h:
2443         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
2444         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
2445         * WebProcess/WebProcess.cpp:
2446         (WebKit::WebProcess::getWorkerContextConnection):
2447         (WebKit::WebProcess::startServiceWorkerContext):
2448         * WebProcess/WebProcess.h:
2449         * WebProcess/WebProcess.messages.in:
2450
2451 2017-10-19  Chris Dumez  <cdumez@apple.com>
2452
2453         http/tests/workers/service/basic-register.html is a flaky failure.
2454         https://bugs.webkit.org/show_bug.cgi?id=178494
2455         <rdar://problem/35065315>
2456
2457         Reviewed by Youenn Fablet.
2458
2459         In WebSWServerConnection::resolveJobInClient(), when a service worker is
2460         registered, we:
2461         1. Add the origin to the WebSWOriginStore
2462         2. Send the IPC to the WebProcess to notify it that the registration succeeded.
2463
2464         The assumption was that step 1 would be synchronous and would therefore send
2465         the shared memory handle to the WebProcess (if the SharedMemory was invalidated)
2466         *before* step 2.
2467
2468         The issue is that step 1 was scheduling a zero-timer to schedule the addition.
2469         As a result, there was a race and the WebContent process could check the
2470         the WebSWOriginTable *after* being notified that a service worker was registered
2471         but *before* it received the SharedMemory handle for the WebSWOriginTable. This
2472         could lead to false negatives and was causing the layout test to be flaky.
2473
2474         To address the issue, step 1 is now synchronous.
2475
2476         * Shared/SharedStringHashStore.cpp:
2477         (WebKit::SharedStringHashStore::SharedStringHashStore):
2478         (WebKit::SharedStringHashStore::scheduleAddition):
2479         (WebKit::SharedStringHashStore::scheduleRemoval):
2480         (WebKit::SharedStringHashStore::contains):
2481         (WebKit::SharedStringHashStore::flushPendingChanges):
2482         (WebKit::SharedStringHashStore::processPendingOperations):
2483         * Shared/SharedStringHashStore.h:
2484         * StorageProcess/ServiceWorker/WebSWOriginStore.cpp:
2485         (WebKit::WebSWOriginStore::add):
2486         (WebKit::WebSWOriginStore::addAll):
2487         (WebKit::WebSWOriginStore::remove):
2488         * StorageProcess/ServiceWorker/WebSWOriginStore.h:
2489         * UIProcess/VisitedLinkStore.cpp:
2490         (WebKit::VisitedLinkStore::addVisitedLinkHash):
2491         (WebKit::VisitedLinkStore::removeVisitedLinkHash):
2492
2493 2017-10-18  Ryosuke Niwa  <rniwa@webkit.org>
2494
2495         Don't expose raw HTML in pasteboard to the web content
2496         https://bugs.webkit.org/show_bug.cgi?id=178422
2497
2498         Reviewed by Wenson Hsieh.
2499
2500         Encode & decode the origin string of the copied content written into the system pasteboard.
2501
2502         * Shared/WebCoreArgumentCoders.cpp:
2503         (IPC::ArgumentCoder<PasteboardWebContent>::encode):
2504         (IPC::ArgumentCoder<PasteboardWebContent>::decode):
2505
2506 2017-10-18  Chris Dumez  <cdumez@apple.com>
2507
2508         Implement ServiceWorkerRegistration.scope / updateViaCache
2509         https://bugs.webkit.org/show_bug.cgi?id=178497
2510
2511         Reviewed by Youenn Fablet.
2512
2513         * Shared/WebCoreArgumentCoders.h:
2514         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2515
2516 2017-10-18  Youenn Fablet  <youenn@apple.com>
2517
2518         Add preliminary support for ServiceWorker Handle Fetch
2519         https://bugs.webkit.org/show_bug.cgi?id=178475
2520
2521         Reviewed by Chris Dumez.
2522
2523         Preliminary support of Handle Fetch algorithm and integration with fetch spec.
2524         Adding ServiceWorkerClientFetch as the class responsible to do the load through ServiceWorker.
2525         It is similar to WebResourceLoader that do the load through NetworkProcess.
2526         In case ServiceWorkerClientFetch is not able to load through ServiceWorker,
2527         it will fallback to WebResourceLoader through a fallback callback.
2528
2529         Loading through Service Worker is done currently if:
2530         - There is a service worker registered for that origin
2531         - Request is a subresource
2532         - service workers mode is all
2533         There will be cases where the service worker will not do the loading, for instance when fetch event handler is not set.
2534         Future work should try to reduce the cases where the IPC dance is done unnecessarily.
2535
2536         ServiceWorkerClientFetch is responsible to adapt the ServiceWorker response to ResourceLoader.
2537         In particular, it is calling ResourceLoader error callback if response is of type error.
2538         It should call ResourceLoader redirection callback if response is a redirection response.
2539         This will be done as a follow-up.
2540
2541         Implementing the IPC communication dedicated to fetch between WebProcess and ServiceWorker through StorageProcess.
2542         In the future, WebProcess should create a direct IPC communication to the ServiceWorker process.
2543
2544         Moved SWContextManager from WebCore to WebKit and renamed it to ServiceWorkerContextManager.
2545         This class is moved to WebKit as it will have to handle IPC and having a separation will add some unnecessary boilerplate.
2546
2547         * DerivedSources.make:
2548         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2549         (WebKit::WebSWServerConnection::startFetch):
2550         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
2551         (WebKit::WebSWServerConnection::didReceiveFetchData):
2552         (WebKit::WebSWServerConnection::didFinishFetch):
2553         (WebKit::WebSWServerConnection::failedFetch):
2554         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2555         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2556         * StorageProcess/StorageProcess.cpp:
2557         (WebKit::StorageProcess::failedFetch):
2558         (WebKit::StorageProcess::didReceiveFetchResponse):
2559         (WebKit::StorageProcess::didReceiveFetchData):
2560         (WebKit::StorageProcess::didFinishFetch):
2561         * StorageProcess/StorageProcess.h:
2562         * StorageProcess/StorageProcess.messages.in:
2563         * WebKit.xcodeproj/project.pbxproj:
2564         * WebProcess/Network/WebLoaderStrategy.cpp:
2565         (WebKit::WebLoaderStrategy::scheduleLoad):
2566         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2567         * WebProcess/Network/WebLoaderStrategy.h:
2568         * WebProcess/Storage/ServiceWorkerClientFetch.cpp: Added.
2569         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
2570         (WebKit::ServiceWorkerClientFetch::didReceiveData):
2571         (WebKit::ServiceWorkerClientFetch::didFinishFetch):
2572         (WebKit::ServiceWorkerClientFetch::didFail):
2573         * WebProcess/Storage/ServiceWorkerClientFetch.h: Added.
2574         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in: Added.
2575         * WebProcess/Storage/ServiceWorkerContextManager.cpp: Renamed from Source/WebCore/workers/service/context/SWContextManager.cpp.
2576         (WebKit::ServiceWorkerContextManager::startServiceWorkerContext):
2577         (WebKit::ServiceWorkerContextManager::startFetch):
2578         * WebProcess/Storage/ServiceWorkerContextManager.h: Renamed from Source/WebCore/workers/service/context/SWContextManager.h.
2579         (WebKit::ServiceWorkerContextManager::ServiceWorkerContextManager):
2580         * WebProcess/Storage/WebSWClientConnection.cpp:
2581         (WebKit::WebSWClientConnection::startFetch):
2582         * WebProcess/Storage/WebSWClientConnection.h:
2583         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2584         (WebKit::shouldHandleFetch):
2585         (WebKit::WebServiceWorkerProvider::handleFetch):
2586         (WebKit::WebServiceWorkerProvider::didReceiveServiceWorkerClientFetchMessage):
2587         * WebProcess/Storage/WebServiceWorkerProvider.h:
2588         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
2589         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
2590         * WebProcess/WebProcess.cpp:
2591         (WebKit::WebProcess::getWorkerContextConnection):
2592         (WebKit::WebProcess::startServiceWorkerContext):
2593         (WebKit::WebProcess::startFetchInServiceWorker):
2594         * WebProcess/WebProcess.h:
2595         * WebProcess/WebProcess.messages.in:
2596
2597 2017-10-18  Chelsea Pugh  <cpugh@apple.com>
2598
2599         [iOS] Use new class name from UIKit when checking UITextSuggestion type
2600         https://bugs.webkit.org/show_bug.cgi?id=178416
2601         <rdar://problem/35010840>
2602
2603         Reviewed by Tim Horton.
2604
2605         Here we start using UITextAutofillSuggestion instead of the old name that was being used for
2606         AutoFill text suggestions.
2607
2608         * Platform/spi/ios/UIKitSPI.h:
2609         * UIProcess/ios/WKContentViewInteraction.mm:
2610         (-[WKContentView insertTextSuggestion:]): Use UITextAutofillSuggestion when checking the class
2611         and when casting instead of UIKeyboardLoginCredentialsSuggestion.
2612
2613 2017-10-17  Jiewen Tan  <jiewen_tan@apple.com>
2614
2615         Replace some stack raw pointers with RefPtrs within WebCore/html
2616         https://bugs.webkit.org/show_bug.cgi?id=178201
2617         <rdar://problem/34841692>
2618
2619         Reviewed by Ryosuke Niwa.
2620
2621         Change the type of node as toNode() is changed to return RefPtr.
2622
2623         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivate.cpp:
2624         (WebKit::wrap):
2625         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
2626         (WebKit::WebEditorClient::handleKeyboardEvent):
2627         * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp:
2628         (WebKit::WebEditorClient::handleKeyboardEvent):
2629         * WebProcess/WebPage/WebPage.cpp:
2630         (WebKit::WebPage::handleEditingKeyboardEvent):
2631         * WebProcess/WebPage/mac/WebPageMac.mm:
2632         (WebKit::frameForEvent):
2633
2634 2017-10-18  Chris Dumez  <cdumez@apple.com>
2635
2636         [Service Worker] Add stubs for Client / WindowClient / Clients
2637         https://bugs.webkit.org/show_bug.cgi?id=178469
2638
2639         Reviewed by Youenn Fablet.
2640
2641         Rename PageVisibilityState to VisibilityState.
2642
2643         * Shared/API/c/WKSharedAPICast.h:
2644         (WebKit::toVisibilityState):
2645         * WebProcess/WebPage/WebPage.h:
2646
2647 2017-10-18  John Wilander  <wilander@apple.com>
2648
2649         Check notifyPagesWhenTelemetryWasCaptured before notifying pages if there is no WebPageProxy
2650         https://bugs.webkit.org/show_bug.cgi?id=178470
2651         <rdar://problem/34417518>
2652
2653         Reviewed by Brian Burg.
2654
2655         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
2656         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
2657             Add a missing check of notifyPagesWhenTelemetryWasCaptured.
2658             The page notification is only for testing purposes.
2659
2660 2017-10-18  Chris Dumez  <cdumez@apple.com>
2661
2662         Unreviewed, fix build error after r223608 with some SDKs.
2663
2664         * StorageProcess/StorageProcess.cpp:
2665         (WebKit::StorageProcess::ensureSWOriginStoreForSession):
2666
2667 2017-10-18  Chris Dumez  <cdumez@apple.com>
2668
2669         Add an efficient data structure for WebCore to query if there is a Service Worker registered for a given origin
2670         https://bugs.webkit.org/show_bug.cgi?id=177876
2671         <rdar://problem/34813129>
2672
2673         Reviewed by Ryosuke Niwa.
2674
2675         Introduce a Service Worker origin store which gets populated / updated on the StorageProcess side
2676         and queried on the WebContent process side via the WebSWOriginTable so that the WebProcess can
2677         efficiently check if there is a ServiceWorker registered for a given origin without actually doing
2678         an IPC to the StorageProcess.
2679
2680         For efficiency, the hash table is backed by SharedMemory so we only pass shared memory handles
2681         between the StorageProcess and the WebProcesses.
2682
2683         We currently add entries to the WebSWOriginStore whenever a service worker registration succeeds
2684         on the StorageProcess side. We also clear this store whenever the API to clear service worker
2685         registrations is called. Code to query the WebSWOriginTable from the WebContent process side is
2686         there but currently only used by Internals for testing. We will later leverage this code when
2687         integrating with Fetch API.
2688
2689         * CMakeLists.txt:
2690         * Shared/SharedStringHashStore.h:
2691         (WebKit::SharedStringHashStore::Client::didUpdateSharedStringHashes):
2692         * Shared/SharedStringHashTable.cpp:
2693         (WebKit::SharedStringHashTable::clear):
2694         * StorageProcess/ServiceWorker/WebSWOriginStore.cpp: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp.
2695         (WebKit::WebSWOriginStore::WebSWOriginStore):
2696         (WebKit::WebSWOriginStore::add):
2697         (WebKit::WebSWOriginStore::remove):
2698         (WebKit::WebSWOriginStore::clear):
2699         (WebKit::WebSWOriginStore::registerSWServerConnection):
2700         (WebKit::WebSWOriginStore::unregisterSWServerConnection):
2701         (WebKit::WebSWOriginStore::sendStoreHandle):
2702         (WebKit::WebSWOriginStore::didInvalidateSharedMemory):
2703         * StorageProcess/ServiceWorker/WebSWOriginStore.h: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h.
2704         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2705         (WebKit::WebSWServerConnection::WebSWServerConnection):
2706         (WebKit::WebSWServerConnection::resolveJobInClient):
2707         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2708         (WebKit::WebSWServerConnection::sessionID const):
2709         * StorageProcess/StorageProcess.cpp:
2710         (WebKit::StorageProcess::deleteWebsiteData):
2711         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
2712         (WebKit::StorageProcess::ensureSWOriginStoreForSession):
2713         (WebKit::StorageProcess::swOriginStoreForSession const):
2714         (WebKit::StorageProcess::serviceWorkerContextStarted):
2715         (WebKit::StorageProcess::registerSWServerConnection):
2716         (WebKit::StorageProcess::unregisterSWServerConnection):
2717         * StorageProcess/StorageProcess.h:
2718         * StorageProcess/StorageProcess.messages.in:
2719         * WebKit.xcodeproj/project.pbxproj:
2720         * WebProcess/Storage/WebSWClientConnection.cpp:
2721         (WebKit::WebSWClientConnection::WebSWClientConnection):
2722         (WebKit::WebSWClientConnection::hasServiceWorkerRegisteredForOrigin const):
2723         (WebKit::WebSWClientConnection::setSWOriginTableSharedMemory):
2724         * WebProcess/Storage/WebSWClientConnection.h:
2725         * WebProcess/Storage/WebSWClientConnection.messages.in:
2726         * WebProcess/Storage/WebSWOriginTable.cpp: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h.
2727         (WebKit::WebSWOriginTable::contains const):
2728         (WebKit::WebSWOriginTable::setSharedMemory):
2729         * WebProcess/Storage/WebSWOriginTable.h: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h.
2730         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2731         (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession):
2732         * WebProcess/Storage/WebServiceWorkerProvider.h:
2733         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
2734         (WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession):
2735         * WebProcess/Storage/WebToStorageProcessConnection.h:
2736         * WebProcess/WebProcess.cpp:
2737         (WebKit::WebProcess::startServiceWorkerContext):
2738
2739 2017-10-16  Andy Estes  <aestes@apple.com>
2740
2741         [Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact and ApplePayError
2742         https://bugs.webkit.org/show_bug.cgi?id=178191
2743         <rdar://problem/34906367>
2744
2745         Reviewed by Tim Horton.
2746
2747         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2748         (WebKit::toNSError):
2749
2750 2017-10-17  Sam Weinig  <sam@webkit.org>
2751
2752         [Settings] Generate Settings.h/cpp
2753         https://bugs.webkit.org/show_bug.cgi?id=178361
2754
2755         Reviewed by Dean Jackson.
2756
2757         * PlatformGTK.cmake:
2758         * PlatformWPE.cmake:
2759
2760             Delete the old Settings.h from the forwarding 
2761             headers directory to allow the build to work.
2762
2763 2017-10-17  John Wilander  <wilander@apple.com>
2764
2765         Add and remove cookie partition accordingly in intermediary redirect requests
2766         https://bugs.webkit.org/show_bug.cgi?id=178369
2767         <rdar://problem/34467603>
2768
2769         Reviewed by Brent Fulgham.
2770
2771         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2772         (WebKit::shouldChangePartition):
2773             Convenience function. Comment documents the logic.
2774         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
2775             Now adds and removes cookie partition based on the
2776             redirect-to URL's domain.
2777         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
2778         (WKBundleResourceLoadStatisticsNotifyObserver):
2779             Test infrastructure.
2780         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
2781
2782 2017-10-17  Youenn Fablet  <youenn@apple.com>
2783
2784         Cache API implementation should be able to compute storage size for WebKit client applications.
2785         https://bugs.webkit.org/show_bug.cgi?id=178350
2786
2787         Reviewed by Chris Dumez.
2788
2789         When gathering data from DOM Cache, we compute the size as follows:
2790         - If Caches object is not persistent, size is zero
2791         - If Caches object is persistent, we use the size computed by NetworkCache::Storage. 
2792         Covered by updated tests.
2793
2794         * NetworkProcess/cache/CacheStorageEngine.cpp:
2795         (WebKit::CacheStorage::ReadOriginsTaskCounter::create):
2796         (WebKit::CacheStorage::ReadOriginsTaskCounter::addOrigin):
2797         (WebKit::CacheStorage::Engine::fetchEntries):
2798         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2799         (WebKit::CacheStorage::Caches::storageSize const):
2800         * NetworkProcess/cache/CacheStorageEngineCaches.h:
2801         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2802         (WKWebsiteDataStoreGetFetchCacheSizeForOrigin):
2803         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2804
2805 2017-10-17  Keith Miller  <keith_miller@apple.com>
2806
2807         Change WebCore sources to work with unified source builds
2808         https://bugs.webkit.org/show_bug.cgi?id=178229
2809
2810         Rubber stamped by Tim Horton.
2811
2812         * Configurations/FeatureDefines.xcconfig:
2813
2814 2017-10-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2815
2816         Unreviewed, fix the iOS build after r223431
2817
2818         Remove an unused variable captured in a lambda.
2819
2820         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2821         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
2822
2823 2017-10-12  Matt Rajca  <mrajca@apple.com>
2824
2825         Add API support for quirk that lets an arbitrary click allow auto-play.
2826         https://bugs.webkit.org/show_bug.cgi?id=178227
2827
2828         Reviewed by Alex Christensen.
2829
2830         Instead of hardcoding sites in WebCore, let API clients control which websites opt into the quirk that lets
2831         an arbitrary click allow auto-play via website policies.
2832
2833         * Shared/WebsitePolicies.h:
2834         * UIProcess/API/C/WKWebsitePolicies.cpp:
2835         (WKWebsitePoliciesSetAllowedAutoplayQuirks):
2836         (WKWebsitePoliciesGetAllowedAutoplayQuirks):
2837         * UIProcess/API/C/WKWebsitePolicies.h:
2838         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2839         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
2840         (-[_WKWebsitePolicies setAllowedAutoplayQuirks:]):
2841         (-[_WKWebsitePolicies allowedAutoplayQuirks]):
2842         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2843         (WebKit::WebFrameLoaderClient::applyToDocumentLoader):
2844         * WebProcess/WebPage/WebPage.cpp:
2845         (WebKit::WebPage::updateWebsitePolicies):
2846
2847 2017-10-16  Andy Estes  <aestes@apple.com>
2848
2849         [Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact and ApplePayError
2850         https://bugs.webkit.org/show_bug.cgi?id=178191
2851         <rdar://problem/34906367>
2852
2853         Reviewed by Tim Horton.
2854
2855         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2856         (WebKit::toNSError):
2857
2858 2017-10-16  Tim Horton  <timothy_horton@apple.com>
2859
2860         Safari crashes after searching PDF (under [WKPDFView zoom:to:atPoint:kind:])
2861         https://bugs.webkit.org/show_bug.cgi?id=178358
2862         <rdar://problem/34676899>
2863
2864         Reviewed by Wenson Hsieh.
2865
2866         * UIProcess/ios/WKPDFView.mm:
2867         (-[WKPDFView _didFindMatch:]):
2868         UIPDFSelection can return a null rect as the selection's bounds.
2869         We can't zoom to a null rect (and doing so results in CA throwing an
2870         exception later).
2871
2872 2017-10-16  Alex Christensen  <achristensen@webkit.org>
2873
2874         Add a _WKThumbnailView initializer with a WKWebView
2875         https://bugs.webkit.org/show_bug.cgi?id=178351
2876         <rdar://problem/34979453>
2877
2878         Reviewed by Tim Horton.
2879
2880         * UIProcess/API/Cocoa/WKWebView.mm:
2881         (-[WKWebView _page]):
2882         (-[WKWebView _setThumbnailView:]):
2883         (-[WKWebView _thumbnailView]):
2884         (-[WKWebView _setIgnoresAllEvents:]):
2885         (-[WKWebView _ignoresAllEvents]):
2886         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2887         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2888         * UIProcess/API/Cocoa/_WKThumbnailView.h:
2889         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
2890         (-[_WKThumbnailView initWithFrame:fromWKWebView:]):
2891         (-[_WKThumbnailView _viewWasUnparented]):
2892         (-[_WKThumbnailView _viewWasParented]):
2893
2894 2017-10-16  Alex Christensen  <achristensen@webkit.org>
2895
2896         Expose more WKView properties as WKWebViewPrivate SPI
2897         https://bugs.webkit.org/show_bug.cgi?id=178349
2898         <rdar://problem/34980919>
2899
2900         Reviewed by Tim Horton.
2901
2902         _backgroundExtendsBeyondPage was already exposed on iOS, but we need it on Mac, too.
2903         A few other properties also need exposing.
2904
2905         * UIProcess/API/Cocoa/WKWebView.mm:
2906         (toAPIScrollbarStyle):
2907         (toCoreScrollbarStyle):
2908         (-[WKWebView _setBackgroundExtendsBeyondPage:]):
2909         (-[WKWebView _backgroundExtendsBeyondPage]):
2910         (-[WKWebView _setOverlayScrollbarStyle:]):
2911         (-[WKWebView _overlayScrollbarStyle]):
2912         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2913
2914 2017-10-16  Chris Dumez  <cdumez@apple.com>
2915
2916         Log using differential privacy domains where the WebContent process crashes
2917         https://bugs.webkit.org/show_bug.cgi?id=178346
2918         <rdar://problem/33293830>
2919
2920         Reviewed by Alex Christensen.
2921
2922         * UIProcess/WebPageProxy.cpp:
2923         (WebKit::WebPageProxy::reload):
2924         (WebKit::WebPageProxy::currentURL const):
2925         (WebKit::WebPageProxy::processDidTerminate):
2926         * UIProcess/WebPageProxy.h:
2927         * UIProcess/WebProcessProxy.cpp:
2928         (WebKit::WebProcessProxy::didClose):
2929
2930 2017-10-16  Youenn Fablet  <youenn@apple.com>
2931
2932         Activate Cache API by default
2933         https://bugs.webkit.org/show_bug.cgi?id=178186
2934
2935         Reviewed by Chris Dumez.
2936
2937         * Shared/WebPreferencesDefinitions.h:
2938
2939 2017-10-16  Sam Weinig  <sam@webkit.org>
2940
2941         [Settings] Remove all custom code from Settings.h/cpp
2942         https://bugs.webkit.org/show_bug.cgi?id=178330
2943
2944         Reviewed by Simon Fraser.
2945
2946         * Shared/WebPreferencesDefinitions.h:
2947         * UIProcess/API/C/WKPreferences.cpp:
2948         (WKPreferencesSetFrameFlatteningEnabled):
2949         (WKPreferencesGetFrameFlatteningEnabled):
2950         * UIProcess/API/glib/WebKitSettings.cpp:
2951         (webkit_settings_get_enable_frame_flattening):
2952         (webkit_settings_set_enable_frame_flattening):
2953         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2954         (WebKit::InjectedBundle::setFrameFlatteningEnabled):
2955         
2956             Update for naming changes of FrameFlattening now that it is an enum class.
2957
2958         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2959         (WebKit::WebChromeClient::contentsSizeChanged const):
2960
2961             Ge the effectiveFrameFlattening from the FrameView, rather than the Settings.
2962
2963 2017-10-16  Chris Dumez  <cdumez@apple.com>
2964
2965         [WK2][NetworkSession] Add support for resuming downloads
2966         https://bugs.webkit.org/show_bug.cgi?id=177625
2967         <rdar://problem/34345975>
2968
2969         Reviewed by Alex Christensen.
2970
2971         Add support for resuming downloads for the WK2 NETWORK_SESSION code path.
2972
2973         This was tested manually. I was unable to write an API test because our tests
2974         do not run an HTTP server and CFNetwork does not seem to generate resume data
2975         when cancelling a download over non-HTTP.
2976
2977         * NetworkProcess/Downloads/Download.cpp:
2978         (WebKit::Download::didReceiveChallenge):
2979         (WebKit::Download::continueCanAuthenticateAgainstProtectionSpace):
2980         * NetworkProcess/Downloads/Download.h:
2981         * NetworkProcess/Downloads/DownloadManager.cpp:
2982         (WebKit::DownloadManager::continueCanAuthenticateAgainstProtectionSpace):
2983         (WebKit::DownloadManager::resumeDownload):
2984         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
2985         (WebKit::Download::resume):
2986         This currently includes a workaround for <rdar://problem/34745171>. We update the
2987         resume data to include the NSURLSessionResumeInfoLocalPath key with the final
2988         destination path so that CFNetwork looks for the temporary data at the right
2989         location.
2990
2991         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
2992         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2993         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
2994         (WebKit::NetworkSessionCocoa::downloadTaskWithResumeData):
2995         * Shared/Authentication/AuthenticationManager.cpp:
2996         (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
2997         * Shared/Authentication/AuthenticationManager.h:
2998
2999 2017-10-16  Adrian Perez de Castro  <aperez@igalia.com>
3000
3001         [WPE] Build failure due to invalid cast of EGLNativeWindowType when targetting 64-bit ARM
3002         https://bugs.webkit.org/show_bug.cgi?id=178090
3003
3004         Reviewed by Michael Catanzaro.
3005
3006         EGLNativeWindowType can be aliased to a different type depending (at least) on the EGL
3007         implementation, its build options, and the libepoxy build options.  Using "static_cast"
3008         works when it is a numeric value and the width of the value needs to be optionally
3009         extended to 64 bits (e.g. the EGL type is "int" in a 32-bit CPU) but not for pointers,
3010         and using "reinterpret_cast" works when the size of a pointer is 64 bits but not in other
3011         cases. Therefore it seems reasonable to use a plain C cast expression to solve this
3012         particular situation.
3013
3014         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
3015         (WebKit::AcceleratedSurfaceWPE::window const): Use a good old plain C cast expression.
3016
3017 2017-10-16  Chris Dumez  <cdumez@apple.com>
3018
3019         Clicks on Link with download attribute causes all (other) links to trigger download when clicked
3020         https://bugs.webkit.org/show_bug.cgi?id=178267
3021         <rdar://problem/34985016>
3022
3023         Reviewed by Darin Adler.
3024
3025         When clicking on an anchor with the download attribute, the m_syncNavigationActionHasDownloadAttribute
3026         flag on WebPageProxy would get set. This flag would not get reset right away and instead, it would get
3027         updated during the next call to WebPageProxy::decidePolicyForNavigationAction(). The issue is that if
3028         you later click on a link with target="_blank", WebPageProxy::decidePolicyForNewWindowAction() gets
3029         called instead of WebPageProxy::decidePolicyForNavigationAction() and we do not reset the
3030         m_syncNavigationActionHasDownloadAttribute flag and we force a download.
3031
3032         To address the problem, I got rid of this flag on WebPageProxy and it is error-prone and should really
3033         not be at page-level. Instead, I added a shouldForceDownload flag on the navigation object. It makes
3034         more sense to associate the flag with the navigation and makes it less error-prone.
3035
3036         * UIProcess/API/APINavigation.h:
3037         (API::Navigation::setShouldForceDownload):
3038         (API::Navigation::shouldForceDownload const):
3039         * UIProcess/WebPageProxy.cpp:
3040         (WebKit::WebPageProxy::receivedPolicyDecision):
3041         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3042         * UIProcess/WebPageProxy.h:
3043
3044 2017-10-16  Ryan Haddad  <ryanhaddad@apple.com>
3045
3046         Unreviewed, rolling out r223271.
3047
3048         This change introduced LayoutTest failures on WK1.
3049
3050         Reverted changeset:
3051
3052         "Use asynchronous ResourceHandleClient calls for WebKit1"
3053         https://bugs.webkit.org/show_bug.cgi?id=160677
3054         https://trac.webkit.org/changeset/223271
3055
3056 2017-10-13  Youenn Fablet  <youenn@apple.com>
3057
3058         Implement listing origins for which CacheStorage is storing data
3059         https://bugs.webkit.org/show_bug.cgi?id=178236
3060
3061         Reviewed by Chris Dumez.
3062
3063         Cache storage is split on per-origin folders which name is obfuscated through salting.
3064         To retrieve the origin for each folder, an origin file is now stored within each folder.
3065         This file contains the actual origin.
3066
3067         Adding support to get the list of origin by iterating through each folder and
3068         getting the actual origin by reading the content of the 'origin' file.
3069
3070         Adding C API for WebKitTestRunner.
3071
3072         * NetworkProcess/cache/CacheStorageEngine.cpp:
3073         (WebKit::CacheStorage::Engine::fetchEntries):
3074         (WebKit::CacheStorage::ReadOriginsTaskCounter::create):
3075         (WebKit::CacheStorage::ReadOriginsTaskCounter::~ReadOriginsTaskCounter):
3076         (WebKit::CacheStorage::ReadOriginsTaskCounter::addOrigin):
3077         (WebKit::CacheStorage::ReadOriginsTaskCounter::ReadOriginsTaskCounter):
3078         * NetworkProcess/cache/CacheStorageEngine.h:
3079         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
3080         (WebKit::CacheStorage::cachesOriginFilename):
3081         (WebKit::CacheStorage::Caches::retrieveOriginFromDirectory):
3082         (WebKit::CacheStorage::Caches::Caches):
3083         (WebKit::CacheStorage::Caches::storeOrigin):
3084         (WebKit::CacheStorage::Caches::readOrigin):
3085         (WebKit::CacheStorage::Caches::initialize):
3086         * NetworkProcess/cache/CacheStorageEngineCaches.h:
3087         (WebKit::CacheStorage::Caches::origin const):
3088         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3089         (WKWebsiteDataStoreGetFetchCacheOrigins):
3090         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3091
3092 2017-10-13  Alex Christensen  <achristensen@webkit.org>
3093
3094         Fix API tests after r223269.
3095         https://bugs.webkit.org/show_bug.cgi?id=178246
3096
3097         * UIProcess/API/APIContentRuleListStore.cpp:
3098         (API::ContentRuleListStore::getContentRuleListSource):
3099         Version 10 also has the ability to recover content rule list source.
3100
3101 2017-10-11  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
3102
3103         [GLib] WebKitNavigationAction should tell whether it is a redirect
3104         https://bugs.webkit.org/show_bug.cgi?id=178178
3105
3106         There is no good way to know whether a given navigation action has been caused
3107         by a redirect through the glib API. This is necessary to implement some app mode
3108         heuristics for Epiphany.
3109
3110         Reviewed by Carlos Garcia Campos.
3111
3112         * UIProcess/API/glib/WebKitNavigationAction.cpp:
3113         (webkit_navigation_action_is_redirect): returns whether the navigation action is a redirect.
3114         * UIProcess/API/glib/WebKitNavigationActionPrivate.h: add isRedirect to the wrapper object.
3115         (_WebKitNavigationAction::_WebKitNavigationAction):
3116         * UIProcess/API/gtk/WebKitNavigationAction.h: add the new API.
3117         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: ditto.
3118         * UIProcess/API/wpe/WebKitNavigationAction.h: ditto.
3119
3120 2017-10-12  Brady Eidson  <beidson@apple.com>
3121
3122         SW "Hello world".
3123         https://bugs.webkit.org/show_bug.cgi?id=178187
3124
3125         Reviewed by Andy Estes.
3126
3127         * WebProcess/WebProcess.cpp:
3128         (WebKit::WebProcess::startServiceWorkerContext):
3129
3130 2017-10-12  Alex Christensen  <achristensen@webkit.org>
3131
3132         Remove unnecessary includes in WebKit
3133         https://bugs.webkit.org/show_bug.cgi?id=178235
3134
3135         Reviewed by Tim Horton.
3136
3137         * Platform/IPC/ArgumentCoders.h:
3138         * WebProcess/WebProcess.cpp:
3139         * WebProcess/WebStorage/StorageAreaImpl.h:
3140
3141 2017-10-12  Alex Christensen  <achristensen@webkit.org>
3142
3143         Increment ContentRuleListStore::CurrentContentRuleListFileVersion
3144         https://bugs.webkit.org/show_bug.cgi?id=178246
3145         <rdar://problem/34890057>
3146
3147         Reviewed by Tim Horton.
3148
3149         * UIProcess/API/APIContentRuleListStore.h:
3150         Things are crashing.  Something isn't binary reverse compatible.
3151         Probably something related to r222602.
3152         This is why we have a version number to update.
3153
3154 2017-10-12  Alex Christensen  <achristensen@webkit.org>
3155
3156         Expose some of WKView's WebViewImpl accessors through WKWebViewPrivate
3157         https://bugs.webkit.org/show_bug.cgi?id=178240
3158         <rdar://problem/34962720>
3159
3160         Reviewed by Tim Horton.
3161         
3162         Also renamed createFullScreenWindow to fullScreenWindow to reflect the fact that it returns
3163         an autoreleased NSWindow so we don't make the same naming mistake in the WKWebView SPI.
3164
3165         * UIProcess/API/Cocoa/WKWebView.mm:
3166         (-[WKWebView _dismissContentRelativeChildWindows]):
3167         (-[WKWebView _setFrame:andScrollBy:]):
3168         (-[WKWebView _setTotalHeightOfBanners:]):
3169         (-[WKWebView _totalHeightOfBanners]):
3170         (-[WKWebView _beginDeferringViewInWindowChanges]):
3171         (-[WKWebView _endDeferringViewInWindowChanges]):
3172         (-[WKWebView _endDeferringViewInWindowChangesSync]):
3173         (-[WKWebView _gestureEventWasNotHandledByWebCore:]):
3174         (-[WKWebView _setIgnoresNonWheelEvents:]):
3175         (-[WKWebView _ignoresNonWheelEvents]):
3176         (-[WKWebView _setCustomSwipeViews:]):
3177         (-[WKWebView _setCustomSwipeViewsTopContentInset:]):
3178         (-[WKWebView _tryToSwipeWithEvent:ignoringPinnedState:]):
3179         (-[WKWebView _setDidMoveSwipeSnapshotCallback:]):
3180         (-[WKWebView _fullScreenPlaceholderView]):
3181         (-[WKWebView _fullScreenWindow]):
3182         (-[WKWebView _disableFrameSizeUpdates]):
3183         (-[WKWebView _enableFrameSizeUpdates]):
3184         (-[WKWebView _canChangeFrameLayout:]):
3185         (-[WKWebView _underlayColor]):
3186         (-[WKWebView _setUnderlayColor:]):
3187         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3188         * UIProcess/API/mac/WKView.mm:
3189         (-[WKView createFullScreenWindow]):
3190         * UIProcess/Cocoa/WebViewImpl.h:
3191         * UIProcess/Cocoa/WebViewImpl.mm:
3192         (WebKit::WebViewImpl::fullScreenWindowController):
3193         (WebKit::WebViewImpl::fullScreenWindow):
3194         (WebKit::WebViewImpl::createFullScreenWindow): Deleted.
3195
3196 2017-10-12  Youenn Fablet  <youenn@apple.com>
3197
3198         Layout Test http/tests/cache-storage/cache-clearing.https.html is failing
3199         https://bugs.webkit.org/show_bug.cgi?id=178200
3200
3201         Reviewed by Chris Dumez.
3202
3203         Deleting only the per-origin folders inside the CacheStorage engine root folder.
3204
3205         * NetworkProcess/cache/CacheStorageEngine.cpp:
3206         (WebKit::CacheStorage::Engine::clearAllCaches):
3207         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3208         (WKWebsiteDataStoreRemoveAllFetchCaches):
3209         (WKWebsiteDataStoreRemoveFetchCacheForOrigin):
3210         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3211
3212 2017-10-12  Chris Dumez  <cdumez@apple.com>
3213
3214         [Mac] Add support for MouseEvent.buttons
3215         https://bugs.webkit.org/show_bug.cgi?id=178214
3216
3217         Reviewed by Ryosuke Niwa.
3218
3219         * Shared/WebEvent.h:
3220         (WebKit::WebMouseEvent::buttons const):
3221         * Shared/WebEventConversion.cpp:
3222         (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
3223         * Shared/WebMouseEvent.cpp:
3224         (WebKit::WebMouseEvent::WebMouseEvent):
3225         (WebKit::WebMouseEvent::encode const):
3226         (WebKit::WebMouseEvent::decode):
3227         * Shared/mac/WebEventFactory.mm:
3228         (WebKit::currentlyPressedMouseButtons):
3229         (WebKit::WebEventFactory::createWebMouseEvent):
3230         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3231         (WebKit::PDFPlugin::showContextMenuAtPoint):
3232         * WebProcess/Plugins/PluginView.cpp:
3233         (WebKit::PluginView::createWebEvent const):
3234         * WebProcess/WebPage/WebPage.cpp:
3235         (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
3236         (WebKit::WebPage::simulateMouseDown):
3237         (WebKit::WebPage::simulateMouseUp):
3238         (WebKit::WebPage::simulateMouseMotion):
3239
3240 2017-10-12  Youenn Fablet  <youenn@apple.com>
3241
3242         Add API to clean CacheStorage data
3243         https://bugs.webkit.org/show_bug.cgi?id=178034
3244
3245         Unreviewed.
3246
3247         * Shared/WebsiteData/WebsiteDataType.h: fixing the DOMCache value. 
3248
3249 2017-10-12  Stephan Szabo  <stephan.szabo@sony.com>
3250
3251         [WinCairo] add WebProcess files for wincairo webkit
3252         https://bugs.webkit.org/show_bug.cgi?id=178024
3253
3254         Reviewed by Alex Christensen.
3255
3256         * PlatformWin.cmake:
3257         * WebProcess/Cookies/curl/WebCookieManagerCurl.cpp: Added.
3258         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
3259         (WebKit::WebCookieManager::platformGetHTTPCookieAcceptPolicy):
3260         * WebProcess/InjectedBundle/win/InjectedBundleWin.cpp: Added.
3261         (WebKit::InjectedBundle::initialize):
3262         (WebKit::InjectedBundle::setBundleParameter):
3263         (WebKit::InjectedBundle::setBundleParameters):
3264         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
3265         * WebProcess/Plugins/Netscape/win/PluginProxyWin.cpp: Added.
3266         (WebKit::PluginProxy::needsBackingStore const):
3267         * WebProcess/WebCoreSupport/win/WebContextMenuClientWin.cpp: Added.
3268         (WebKit::WebContextMenuClient::lookUpInDictionary):
3269         (WebKit::WebContextMenuClient::isSpeaking):
3270         (WebKit::WebContextMenuClient::speak):
3271         (WebKit::WebContextMenuClient::stopSpeaking):
3272         * WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.cpp: Added.
3273         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
3274         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
3275         (WebKit::WebFrameNetworkingContext::WebFrameNetworkingContext):
3276         (WebKit::WebFrameNetworkingContext::storageSession const):
3277         (WebKit::WebFrameNetworkingContext::webFrameLoaderClient const):
3278         (WebKit::WebFrameNetworkingContext::blockedError const):
3279         * WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h: Added.
3280         (WebKit::WebFrameNetworkingContext::create):
3281         * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp: Added.
3282         (WebKit::WebPopupMenu::setUpPlatformData):
3283         * WebProcess/WebPage/win/WebInspectorUIWin.cpp: Added.
3284         (WebKit::WebInspectorUI::canSave):
3285         (WebKit::WebInspectorUI::localizedStringsURL):
3286         (WebKit::RemoteWebInspectorUI::localizedStringsURL):
3287         * WebProcess/WebPage/win/WebPageWin.cpp: Added.
3288         (WebKit::WebPage::platformInitialize):
3289         (WebKit::WebPage::platformDetach):
3290         (WebKit::WebPage::platformEditorState const):
3291         (WebKit::WebPage::platformPreferencesDidChange):
3292         (WebKit::WebPage::performDefaultBehaviorForKeyEvent):
3293         (WebKit::WebPage::platformHasLocalDataForURL):
3294         (WebKit::WebPage::cachedResponseMIMETypeForURL):
3295         (WebKit::WebPage::platformCanHandleRequest):
3296         (WebKit::WebPage::cachedSuggestedFilenameForURL):
3297         (WebKit::WebPage::cachedResponseDataForURL):
3298         (WebKit::WebPage::platformUserAgent const):
3299         (WebKit::WebPage::interpretKeyEvent):
3300         * WebProcess/WebProcess.cpp:
3301         (WebKit::WebProcess::ensureWebToStorageProcessConnection):
3302         * WebProcess/win/WebProcessWin.cpp: Added.
3303         (loadResourceIntoBuffer):
3304         (WebKit::WebProcess::platformInitializeWebProcess):
3305         (WebKit::WebProcess::platformTerminate):
3306         (WebKit::WebProcess::platformSetCacheModel):
3307
3308 2017-10-12  David Kilzer  <ddkilzer@apple.com>
3309
3310         [iOS] Fix -Wunused-lambda-capture warnings in WebCore/WebKit with new clang compiler
3311         <https://webkit.org/b/178226>
3312
3313         Reviewed by Chris Fleizach.
3314
3315         * UIProcess/ios/WKContentViewInteraction.mm:
3316         (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:withFlags:]):
3317         - Remove unused lambda variable 'touch' which was also passed as
3318           an argument.
3319         (-[WKContentView changeSelectionWithTouchesFrom:to:withGesture:withState:]):
3320         - Remove unused lambda variable 'gestureState' which was also
3321           passed as an argument.
3322         (-[WKContentView _simulateLongPressActionAtLocation:]):
3323         - Remove unused lambda variable 'location'.
3324
3325 2017-10-12  John Wilander  <wilander@apple.com>
3326
3327         ResourceLoadObserver::logFrameNavigation() should use redirectResponse.url()
3328         https://bugs.webkit.org/show_bug.cgi?id=175257
3329         <rdar://problem/33359866>
3330
3331         Reviewed by Brent Fulgham.
3332
3333         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3334         (-[WKWebsiteDataStore _resourceLoadStatisticsIsRegisteredAsSubFrameUnder:topFrameHost:completionHandler:]):
3335         (-[WKWebsiteDataStore _resourceLoadStatisticsIsRegisteredAsRedirectingTo:hostRedirectedTo:completionHandler:]):
3336             Test infrastructure.
3337         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3338         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3339         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
3340         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
3341             Test infrastructure.
3342         * UIProcess/WebResourceLoadStatisticsStore.h:
3343
3344 2017-10-12  Andy Estes  <aestes@apple.com>
3345
3346         [iOS] Conditionally rename DatabaseProcess to StorageProcess when building for iOS devices
3347         https://bugs.webkit.org/show_bug.cgi?id=178181
3348         <rdar://problem/33660282>
3349
3350         Reviewed by Dan Bernstein.
3351
3352         * Configurations/BaseTarget.xcconfig:
3353         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
3354         (WebKit::serviceName):
3355         * WebKit.xcodeproj/project.pbxproj:
3356
3357 2017-10-12  Youenn Fablet  <youenn@apple.com>
3358
3359         CacheStorage persistent folder should be in /Library/Cache
3360         https://bugs.webkit.org/show_bug.cgi?id=178193
3361
3362         Reviewed by Brady Eidson.
3363
3364         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
3365         (API::WebsiteDataStore::defaultCacheStorageDirectory): Making CacheStorage
3366         directory a subfolder of Caches folder.
3367         (API::WebsiteDataStore::defaultDataStoreConfiguration):
3368         * UIProcess/WebProcessPool.cpp:
3369         (WebKit::legacyWebsiteDataStoreConfiguration):
3370         (WebKit::WebProcessPool::ensureNetworkProcess): Make sure the web site data store
3371         has the right cache directory path. Also make sure that the quota is set even if there is no folder specified.
3372         Quota may still be useful in case of non persistent sessions.
3373         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3374         (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
3375         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
3376         (API::WebsiteDataStore::defaultCacheStorageDirectory):
3377
3378 2017-10-11  Sam Weinig  <sam@webkit.org>
3379
3380         Remove out-parameter variants of copyToVector
3381         https://bugs.webkit.org/show_bug.cgi?id=178155
3382
3383         Reviewed by Tim Horton.
3384
3385         * Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
3386         (-[_WKRemoteObjectInterface debugDescription]):
3387         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
3388         (WebKit::dump):
3389         * UIProcess/WebPageProxy.cpp:
3390         (WebKit::WebPageProxy::resetState):
3391         * UIProcess/WebProcessPool.cpp:
3392         (WebKit::WebProcessPool::createNewWebProcess):
3393         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3394         (WebKit::WebsiteDataStore::parameters):
3395         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3396         (WebKit::WebsiteDataStore::pendingCookies const):
3397         * UIProcess/ios/ProcessAssertionIOS.mm:
3398         (-[WKProcessAssertionBackgroundTaskManager _notifyClientsOfImminentSuspension]):
3399         * WebProcess/Cookies/WebCookieManager.cpp:
3400         (WebKit::WebCookieManager::getHostnamesWithCookies):
3401         * WebProcess/Geolocation/WebGeolocationManager.cpp:
3402         (WebKit::WebGeolocationManager::didChangePosition):
3403         (WebKit::WebGeolocationManager::didFailToDeterminePosition):
3404         * WebProcess/Network/WebLoaderStrategy.cpp:
3405         (WebKit::WebLoaderStrategy::internallyFailedLoadTimerFired):
3406
3407             Replace out-parameter based copyToVector, with one that returns a Vector.
3408
3409 2017-10-11  Jaehun Lim  <ljaehun.lim@samsung.com>
3410
3411         Fix debug build
3412
3413         Unreviewed.
3414
3415         Add ENABLE(SERVICE_WORKER) guard.
3416
3417         * UIProcess/WebProcessPool.cpp:
3418         (WebKit::WebProcessPool::createWebPage):
3419
3420 2017-10-11  Youenn Fablet  <youenn@apple.com>
3421
3422         Add API to clean CacheStorage data
3423         https://bugs.webkit.org/show_bug.cgi?id=178034
3424
3425         Unreviewed.
3426
3427         * NetworkProcess/NetworkProcess.cpp:
3428         (WebKit::NetworkProcess::fetchWebsiteData): Fixing lifetime of aggregator.
3429
3430 2017-10-11  Youenn Fablet  <youenn@apple.com>
3431
3432         Add API to clean CacheStorage data
3433         https://bugs.webkit.org/show_bug.cgi?id=178034
3434
3435         Reviewed by Chris Dumez.
3436
3437         Introducing a new website data type for DOMCache.
3438         Adding API to delete DOMCache for a given origin or for all origins.
3439         This is added to WKWebsiteDataStore.
3440
3441         Cleaning a CacheStorage will remove all data in the Cache object