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