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