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