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