Propagate the source origin as much as possible
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2016-12-25  Yusuke Suzuki  <utatane.tea@gmail.com>
2
3         Propagate the source origin as much as possible
4         https://bugs.webkit.org/show_bug.cgi?id=166348
5
6         Reviewed by Darin Adler.
7
8         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
9         (WebKit::NPRuntimeObjectMap::evaluate):
10
11 2016-12-22  Andy Estes  <aestes@apple.com>
12
13         Reduce QuickLook.h include overhead
14         https://bugs.webkit.org/show_bug.cgi?id=166454
15
16         Reviewed by Andreas Kling.
17
18         * WebProcess/Network/WebLoaderStrategy.cpp: Included QuickLook.h for QLPreviewProtocol().
19         * WebProcess/Network/WebResourceLoader.cpp: Included QuickLook.h for QuickLookHandle.
20         * WebProcess/Network/WebResourceLoader.h: Stopped including QuickLook.h.
21
22 2016-12-22  Tim Horton  <timothy_horton@apple.com>
23
24         Null deref under WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground
25         https://bugs.webkit.org/show_bug.cgi?id=166433
26         <rdar://problem/29732407>
27
28         Reviewed by Daniel Bates.
29
30         * UIProcess/ios/WebPageProxyIOS.mm:
31         (WebKit::WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground):
32         m_drawingArea can be null if the process is not valid.
33
34 2016-12-22  Andy Estes  <aestes@apple.com>
35
36         Make WebCore::EditorInsertAction an enum class
37         https://bugs.webkit.org/show_bug.cgi?id=166424
38
39         Reviewed by Brent Fulgham.
40
41         * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
42         (WebKit::toAPI):
43         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
44         (toWK):
45
46 2016-12-22  Zhuo Li  <zachli@apple.com>
47
48         [Cocoa] SPI for setloadsImagesAutomatically
49         https://bugs.webkit.org/show_bug.cgi?id=166401
50
51         Reviewed by Darin Adler.
52
53         * UIProcess/API/Cocoa/WKPreferences.mm: Call the C API under the hood.
54         (-[WKPreferences _loadsImagesAutomatically]):
55         (-[WKPreferences _setLoadsImagesAutomatically:]):
56
57         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
58         Add `_loadsImagesAutomatically` property.
59
60 2016-12-22  Eric Carlson  <eric.carlson@apple.com>
61
62         AVPlayerLayer isn't available on every system
63         https://bugs.webkit.org/show_bug.cgi?id=166399
64
65         Reviewed by Jer Noble.
66
67         * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm: Use SOFT_LINK_CLASS_OPTIONAL.
68
69 2016-12-22  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
70
71         MediaStream: ASSERTION FAILED: m_ids.size() == m_handles.size() in MediaDeviceSandboxExtensions
72         https://bugs.webkit.org/show_bug.cgi?id=166328
73
74         Reviewed by Eric Carlson.
75
76         This assertion failure happens for ports with sandbox extensions disabled. SandboxExtension is empty and
77         HandleArray:size() always returns 0. Disable creation of MediaDevicesSandboxExtension in UserMediaProcessManager
78         when building without support of sandbox extension. Disable also WebPage::grantUserMediaDeviceSandboxExtensions
79         and WebPage::revokeUserMediaDeviceSandboxExtensions which can be avoided when sandbox extension is empty.
80
81         * UIProcess/UserMediaProcessManager.cpp:
82         (WebKit::UserMediaProcessManager::willCreateMediaStream):
83         (WebKit::UserMediaProcessManager::endedCaptureSession):
84         * WebProcess/WebPage/WebPage.cpp:
85         * WebProcess/WebPage/WebPage.h:
86         * WebProcess/WebPage/WebPage.messages.in:
87
88 2016-12-22  Alejandro G. Castro  <alex@igalia.com>
89
90         [WebRTC] Add support for runtime PeeConnection setting, required after r209757
91         https://bugs.webkit.org/show_bug.cgi?id=166346
92
93         Reviewed by Carlos Garcia Campos.
94
95         After that commit we have to enable the peerConnection runtime
96         flag if we want webrtc to work. We are not adding a new API for
97         the moment to control the peerConnection feature.
98
99         * UIProcess/API/gtk/WebKitSettings.cpp:
100         (webkit_settings_set_enable_media_stream): Use the mediaStream
101         setting to control the peerConnection
102
103 2016-12-21  Brent Fulgham  <bfulgham@apple.com>
104
105         [Mac][WK2] Stop using file* rules in WebProcess sandbox profiles
106         https://bugs.webkit.org/show_bug.cgi?id=165824
107         <rdar://problem/14024823>
108
109         Reviewed by Alexey Proskuryakov
110
111         Switch from blanket 'file*' sandbox rules, to the specific 'file-read*' and 'file-write*' rules
112         we actually need.
113
114         * DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in:
115         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
116         * WebProcess/com.apple.WebProcess.sb.in:
117
118 2016-12-21  Beth Dakin  <bdakin@apple.com>
119
120         Holding down on candidates in the TouchBar should show panel on screen
121         https://bugs.webkit.org/show_bug.cgi?id=166367
122         -and corresponding-
123         <rdar://problem/28479236>
124
125         Reviewed by Tim Horton.
126
127         The showCandidates() helper function is not needed. We can call the AppKit method 
128         directly at the one call site.
129         * UIProcess/Cocoa/WebViewImpl.h:
130         * UIProcess/Cocoa/WebViewImpl.mm:
131
132         The panel should appear under the selection, so offset the selection rect.
133         (WebKit::WebViewImpl::handleRequestedCandidates):
134
135         No more showCandidates() since we can call it directly. 
136         (WebKit::WebViewImpl::showCandidates): Deleted.
137
138 2016-12-20  Taras Tsugrii  <ttsugrii@fb.com>
139
140         Fix undefined behavior caused by macro expansion producing 'defined'
141         https://bugs.webkit.org/show_bug.cgi?id=166047
142
143         Reviewed by Darin Adler.
144
145         * Shared/API/Cocoa/WKFoundation.h:
146
147 2016-12-20  Brent Fulgham  <bfulgham@apple.com>
148
149         Address some style problems found by static analysis
150         https://bugs.webkit.org/show_bug.cgi?id=165975
151
152         Reviewed by Alex Christensen.
153
154         Avoid passing large ANGLE data structures through the ANGLEWebKitBridge methods.
155
156         * Shared/WebBackForwardListItem.cpp:
157         (WebKit::WebBackForwardListItem::create):
158         (WebKit::WebBackForwardListItem::WebBackForwardListItem):
159         * Shared/WebBackForwardListItem.h:
160
161 2016-12-20  Simon Fraser  <simon.fraser@apple.com>
162
163         [iOS WK2] Switching or closing a tab leads to all-white tab content if the status bar is double height
164         https://bugs.webkit.org/show_bug.cgi?id=166286
165         rdar://problem/29593525
166
167         Reviewed by Tim Horton.
168
169         A double-height status bar triggers view resize while snapshotting in the background,
170         which also triggers calls to _endAnimatedResize on tab resume. However, it was possible
171         for _endAnimatedResize to re-enter via synchronizeDynamicViewportUpdate()/didCommitLayerTree(),
172         causing us to use a nil _resizeAnimationView for scale computations, thus setting a zero
173         scale on the WKContentView.
174
175         Fix by checking _dynamicViewportUpdateMode again after the call to synchronizeDynamicViewportUpdate(),
176         and do a belt-and-braces check for a nil _resizeAnimationView.
177
178         * UIProcess/API/Cocoa/WKWebView.mm:
179         (-[WKWebView _endAnimatedResize]):
180
181 2016-12-20  Andy Estes  <aestes@apple.com>
182
183         [Cocoa] REGRESSION (r209558): Calling decisionHandler multiple times in webView:decidePolicyForNavigationAction:decisionHandler: leads to a crash
184         https://bugs.webkit.org/show_bug.cgi?id=165992
185         <rdar://problem/29693817>
186
187         Reviewed by Brady Eidson.
188
189         r209558 added additional move semantics to the decisionHandler block passed to
190         -webView:decidePolicyForNavigationAction:decisionHandler:, resulting in a null pointer
191         dereference in clients that call the decisionHandler block more than once.
192
193         None of the completion handlers we expose in the WebKit API are intended to be called more
194         than once, and we ASSERT in CompletionHandlerCallChecker::didCallCompletionHandler() that
195         this doesn't happen.
196
197         This change strenghtens that protection by returning immediately in completion handlers
198         called more than once. And in programs linked on or after WebKit 603.1.17, an NSException is
199         thrown if a completion handler is called a second time, like we do for completion handlers
200         that are never called.
201
202         New API test: WebKit2.DuplicateCompletionHandlerCalls
203
204         * Shared/Cocoa/CompletionHandlerCallChecker.h: Declared completionHandlerHasBeenCalled().
205         * Shared/Cocoa/CompletionHandlerCallChecker.mm:
206         (WebKit::shouldThrowExceptionForDuplicateCompletionHandlerCall): Added. Returns true if the
207         program is linked on or after
208         LibraryVersion::FirstWithExceptionsForDuplicateCompletionHandlerCalls.
209         (WebKit::CompletionHandlerCallChecker::completionHandlerHasBeenCalled): Added. Returns
210         whether or not the completion handler has been called. If it has, and
211         shouldThrowExceptionForDuplicateCompletionHandlerCall() returns true, throws an
212         NSInternalInconsistencyException.
213         * UIProcess/API/Cocoa/WKWebView.mm:
214         (-[WKWebView _setInputDelegate:]): Added an early return if the completion handler has
215         already been called.
216         * UIProcess/Cocoa/NavigationState.mm:
217         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): Ditto.
218         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse): Ditto.
219         (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge): Ditto.
220         * UIProcess/Cocoa/UIDelegate.mm:
221         (WebKit::UIDelegate::UIClient::runJavaScriptAlert): Ditto.
222         (WebKit::UIDelegate::UIClient::runJavaScriptConfirm): Ditto.
223         (WebKit::UIDelegate::UIClient::runJavaScriptPrompt): Ditto.
224         (WebKit::UIDelegate::UIClient::exceededDatabaseQuota): Ditto.
225         (WebKit::UIDelegate::UIClient::runOpenPanel): Ditto.
226         (WebKit::UIDelegate::UIClient::reachedApplicationCacheOriginQuota): Ditto.
227         * UIProcess/Cocoa/VersionChecks.h: Added
228         FirstWithExceptionsForDuplicateCompletionHandlerCalls with the version number for 603.1.17.
229
230 2016-12-20  Dean Jackson  <dino@apple.com>
231
232         Remove INDIE_UI
233         https://bugs.webkit.org/show_bug.cgi?id=165881
234         <rdar://problem/29672532>
235
236         Reviewed by Simon Fraser.
237
238         The Indie UI work has been discontinued.
239
240         * Configurations/FeatureDefines.xcconfig:
241
242 2016-12-20  Wenson Hsieh  <wenson_hsieh@apple.com>
243
244         Implement the updated port/area-based Scroll Snap Module Level 1 Spec
245         https://bugs.webkit.org/show_bug.cgi?id=165317
246         <rdar://problem/29490956>
247
248         Reviewed by Dean Jackson.
249
250         Remove unused code for adopting scroll snapping in the PDF plugin.
251
252         * WebProcess/Plugins/PDF/PDFPlugin.mm:
253         (WebKit::PDFPlugin::didCalculateSizes):
254
255 2016-12-19  Yusuke Suzuki  <utatane.tea@gmail.com>
256
257         [ES6] Enable ES6 Modules
258         https://bugs.webkit.org/show_bug.cgi?id=165849
259
260         Reviewed by Geoffrey Garen.
261
262         * Shared/WebPreferencesDefinitions.h:
263         * UIProcess/API/C/WKPreferences.cpp:
264         (WKPreferencesSetES6ModulesEnabled): Deleted.
265         (WKPreferencesGetES6ModulesEnabled): Deleted.
266         * UIProcess/API/C/WKPreferencesRefPrivate.h:
267         * WebProcess/InjectedBundle/InjectedBundle.cpp:
268         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
269         * WebProcess/WebPage/WebPage.cpp:
270         (WebKit::WebPage::updatePreferences):
271
272 2016-12-19  Keith Rollin  <krollin@apple.com>
273
274         Fix unwanted deletion of record/replay files
275         https://bugs.webkit.org/show_bug.cgi?id=166040
276
277         Reviewed by Alex Christensen.
278
279         As part of some refactoring, the objects that create the meta files
280         that are part of the record/replay cache would get deleted. They were
281         always getting opened in "write" mode", which would truncate the
282         files. Fix this so that the files are opened in the right modes for
283         record, replay, and neither.
284
285         * NetworkProcess/capture/NetworkCaptureManager.cpp:
286         (WebKit::NetworkCapture::Manager::initialize):
287
288 2016-12-19  Gavin Barraclough  <barraclough@apple.com>
289
290         [CSS Parser] Enable CSS Deferred Parsing
291         https://bugs.webkit.org/show_bug.cgi?id=165869
292
293         Unreviewed rollout – looks like this regressed performance.
294
295         * Shared/WebPreferencesDefinitions.h:
296
297 2016-12-19  Anders Carlsson  <andersca@apple.com>
298
299         REGRESSION: Crash in com.apple.WebKit:IPC::Connection::platformCanSendOutgoingMessages() const + 0
300         https://bugs.webkit.org/show_bug.cgi?id=165817
301         rdar://problem/29626731
302
303         Reviewed by Dan Bernstein.
304
305         If the receive right is invalidated before we send the message, the kernel won't be able to create a send right,
306         and we'll crash due to mach_msg returning MACH_SEND_INVALID_RIGHT.
307         
308         Fix this by immediately creating a send right, and passing MACH_MSG_TYPE_MOVE_SEND to the attachment constructor.
309
310         * WebProcess/WebPage/WebInspector.cpp:
311         (WebKit::WebInspector::openFrontendConnection):
312
313 2016-12-18  Simon Fraser  <simon.fraser@apple.com>
314
315         Expose a way for MiniBrowser to simulate header and footer banners
316         https://bugs.webkit.org/show_bug.cgi?id=166005
317
318         Reviewed by Wenson Hsieh.
319         
320         Expose testing SPI that allows a client to simulate the presence of header
321         and footer banners. These are simply plumbed through to set FrameView's
322         m_headerHeight and m_footerHeight.
323
324         * UIProcess/API/Cocoa/WKWebView.mm:
325         (-[WKWebView _setHeaderBannerHeightForTesting:]):
326         (-[WKWebView _setFooterBannerHeightForTesting:]):
327         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
328         * UIProcess/WebPageProxy.cpp:
329         (WebKit::WebPageProxy::setHeaderBannerHeightForTesting):
330         (WebKit::WebPageProxy::setFooterBannerHeightForTesting):
331         * UIProcess/WebPageProxy.h:
332         * WebProcess/WebPage/WebPage.cpp:
333         (WebKit::WebPage::setHeaderBannerHeightForTesting):
334         (WebKit::WebPage::setFooterBannerHeightForTesting):
335         * WebProcess/WebPage/WebPage.h:
336         * WebProcess/WebPage/WebPage.messages.in:
337
338 2016-12-16  Dave Hyatt  <hyatt@apple.com>
339
340         [CSS Values] Make separate wrapper classes for the deprecated CSS Values OM
341         https://bugs.webkit.org/show_bug.cgi?id=165968
342
343         Reviewed by Andreas Kling.
344
345         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValue.cpp:
346         (WebKit::kit):
347         (WebKit::core):
348         (WebKit::wrapCSSValue):
349         (webkit_dom_css_value_constructor):
350         (webkit_dom_css_value_get_css_text):
351         (webkit_dom_css_value_set_css_text):
352         (webkit_dom_css_value_get_css_value_type):
353         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValuePrivate.h:
354
355 2016-12-17  Wenson Hsieh  <wenson_hsieh@apple.com>
356
357         Visual viewports: bottom fixed elements disappear behind the keyboard
358         https://bugs.webkit.org/show_bug.cgi?id=165983
359         <rdar://problem/29409852>
360
361         Reviewed by Simon Fraser.
362
363         Accounts for input view bounds in WebPageProxy::computeCustomFixedPositionRect. To do this, we introduce and
364         pass unobscuredContentRectRespectingInputViewBounds along with the regular unobscuredContentRect (which does not
365         respect the obscuring keyboard rect). This unobscuredContentRectRespectingInputViewBounds is then used when
366         computing the origin of the updated layout viewport rect (and also, when we are _not_ below minimum scale),
367         
368         Additionally, the size is computed using the (unconstrained) unobscured rect. This is because we previously
369         would use the document-constrained version of the unobscured rect, which caused the layout viewport to shrink
370         when approaching the max scroll extents of the document while the keyboard is up, since the unobscured rect
371         would spill out of the document rect. However, using this unconstrained rect's size also means that if the user
372         rubber-bands out of the document rect, we would end up pushing the layout viewport rect out of the document,
373         with no way of adjusting it back in without the user scrolling to push the layout viewport into back document
374         bounds. To address this, we move the layout rect to be within document bounds after computing its size and
375         location.
376
377         Added a new layout test: fast/visual-viewport/ios/fixed-element-on-bottom-with-keyboard.html, and also tweaked
378         fixed-caret-position-after-scroll.html to cover these changes.
379
380         * Shared/VisibleContentRectUpdateInfo.cpp:
381         (WebKit::operator<<):
382         * Shared/VisibleContentRectUpdateInfo.h:
383         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
384         (WebKit::VisibleContentRectUpdateInfo::unobscuredContentRectRespectingInputViewBounds):
385         * UIProcess/API/Cocoa/WKWebView.mm:
386         (-[WKWebView _updateContentRectsWithState:]):
387         (-[WKWebView _inputViewBounds]):
388
389         Returns the current bounds of the input view. For testing purposes.
390
391         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
392         * UIProcess/WebPageProxy.h:
393         (WebKit::WebPageProxy::unobscuredContentRectRespectingInputViewBounds):
394         * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
395         (WebKit::RemoteScrollingCoordinatorProxy::customFixedPositionRect):
396         * UIProcess/ios/WKContentView.h:
397         * UIProcess/ios/WKContentView.mm:
398         (-[WKContentView _computeUnobscuredContentRectRespectingInputViewBounds:unobscuredContentRect:inputViewBounds:scale:]):
399
400         Helper to compute the unobscured rect, accounting for the bounds of the current input view.
401
402         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
403         (-[WKContentView _didCommitLayerTree:]):
404         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): Deleted.
405         * UIProcess/ios/WebPageProxyIOS.mm:
406         (WebKit::WebPageProxy::computeCustomFixedPositionRect):
407         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
408         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
409
410 2016-12-16  Ryosuke Niwa  <rniwa@webkit.org>
411
412         Deleting a character converted from pinyin after an image causes a Safari crash
413         https://bugs.webkit.org/show_bug.cgi?id=165839
414
415         Reviewed by Darin Adler.
416
417         The crash was caused by the payload of the IPC not being decoded correctly when the encoded attributed string
418         contains a NSTextAttachment but send<> would still gladly send it to the UIProcess.
419
420         Fixed it by omitting the image as done in r176412 since encoding NSFileWrapper, etc... would require
421         quite a bit of work, and IME doesn't really need to see the image in its attributed string.
422
423         * WebProcess/WebPage/mac/WebPageMac.mm:
424         (WebKit::WebPage::attributedSubstringForCharacterRangeAsync): Fixed the bug.
425
426 2016-12-16  Andy Estes  <aestes@apple.com>
427
428         Add a setting to suppress keyboard input during provisional navigation
429         https://bugs.webkit.org/show_bug.cgi?id=165830
430
431         Reviewed by Brent Fulgham.
432
433         * Shared/WebPreferencesDefinitions.h: Defined
434         shouldSuppressKeyboardDOMEventsDuringProvisionalNavigation.
435         * UIProcess/API/C/WKPreferences.cpp:
436         (WKPreferencesSetShouldSuppressKeyboardInputDuringProvisionalNavigation): Added.
437         (WKPreferencesGetShouldSuppressKeyboardInputDuringProvisionalNavigation): Added.
438         * UIProcess/API/C/WKPreferencesRefPrivate.h: Declared a getter and setter for the new
439         preference.
440         * UIProcess/API/Cocoa/WKPreferences.mm:
441         (-[WKPreferences _shouldSuppressKeyboardInputDuringProvisionalNavigation]): Added.
442         (-[WKPreferences _setShouldSuppressKeyboardInputDuringProvisionalNavigation:]): Added.
443         * UIProcess/API/Cocoa/WKPreferencesPrivate.h: Declared a property for the new preference.
444         * WebProcess/WebPage/WebPage.cpp:
445         (WebKit::WebPage::updatePreferences): Mapped the new preference to its corresponding
446         WebCore::Setting.
447
448 2016-12-16  Chris Dumez  <cdumez@apple.com>
449
450         HTML form validation bubble should be dismissed on navigation
451         https://bugs.webkit.org/show_bug.cgi?id=165960
452         <rdar://problem/29668086>
453
454         Reviewed by Simon Fraser.
455
456         Dismiss HTML form validation bubble on top-level navigation on WK2.
457
458         * UIProcess/WebPageProxy.cpp:
459         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
460
461 2016-12-16  Jer Noble  <jer.noble@apple.com>
462
463         Small refactor: Use HashCountedSet rather than HashMap<..., int> to store client counts in WebPlaybackSessionManager{,Proxy}.
464         https://bugs.webkit.org/show_bug.cgi?id=165807
465
466         Reviewed by Eric Carlson.
467
468         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
469         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
470         (WebKit::WebPlaybackSessionManagerProxy::addClientForContext):
471         (WebKit::WebPlaybackSessionManagerProxy::removeClientForContext):
472         * WebProcess/cocoa/WebPlaybackSessionManager.h:
473         * WebProcess/cocoa/WebPlaybackSessionManager.mm:
474         (WebKit::WebPlaybackSessionManager::addClientForContext):
475         (WebKit::WebPlaybackSessionManager::removeClientForContext):
476
477 2016-12-16  Wenson Hsieh  <wenson_hsieh@apple.com>
478
479         Visual viewports: carets and selection UI are incorrectly positioned when editing fixed elements
480         https://bugs.webkit.org/show_bug.cgi?id=165767
481         <rdar://problem/29602382>
482
483         Reviewed by Simon Fraser.
484
485         When focusing an input, the position of the caret on iOS is determined by the overridden layout viewport rect in
486         the web process. However, this rect is not updated until the end the scroll gesture. Whereas this is fine for
487         non-fixed inputs since their document location does not change, fixed inputs effectively change their position
488         in the document as the user scrolls. This causes the caret to be 'left behind' in the document position it was
489         in at the start of the scroll. To fix this, we deactivate the selection when exiting stable state if the
490         assisted node is in a fixed position container, and reenable it upon receiving the next stable state EditorState
491         update (as indicated by postLayoutData().isStableStateUpdate). Additionally, we apply similar treatment to the
492         web selection assistant -- this time, we need to force the selection view to hide (analagous to deactivating
493         the text selection assistant) and show it again upon receiving the next selection change update when the WebPage
494         (in the web process) is stable.
495
496         Furthermore, adds test support for querying text caret and selection rects, as well as perform a callback after
497         the WebPage has indicated that it is stable, both as SPI on the WKWebView.
498
499         Covered by 4 new layout tests in fast/editing/caret/ios and fast/editing/selection/ios.
500
501         * Platform/spi/ios/UIKitSPI.h:
502         * Shared/EditorState.cpp:
503         (WebKit::EditorState::PostLayoutData::encode):
504         (WebKit::EditorState::PostLayoutData::decode):
505         * Shared/EditorState.h:
506
507         Introduce isStableStateUpdate, which is true when the WebPage is known to be in stable state, as well as
508         insideFixedPosition, which is true when the current selection is inside a fixed position container.
509
510         * Shared/mac/RemoteLayerTreeTransaction.h:
511         (WebKit::RemoteLayerTreeTransaction::isInStableState):
512         (WebKit::RemoteLayerTreeTransaction::setIsInStableState):
513         * Shared/mac/RemoteLayerTreeTransaction.mm:
514         (WebKit::RemoteLayerTreeTransaction::encode):
515         (WebKit::RemoteLayerTreeTransaction::decode):
516         (WebKit::RemoteLayerTreeTransaction::description):
517         * UIProcess/API/Cocoa/WKWebView.mm:
518         (-[WKWebView _didCommitLayerTree:]):
519         (-[WKWebView _uiTextCaretRect]):
520
521         Introduced a new SPI method for fetching the current rect of the text assistant's caret view, at keyPath
522         "selectionView.selection.caretRect".
523
524         (-[WKWebView _uiTextSelectionRects]):
525
526         Renamed (and refactored) from _uiTextSelectionRectViews, which was previously fetching an array of UIViews. I
527         found this to cause character-granularity-rect.html to fail due to the array of UIViews here being empty, so I
528         refactored this to simply return an array of rects from the keyPath "selectionView.selection.selectionRects" for
529         the text selection assistant and @"selectionView.selectionRects" for the web selection assistant.
530
531         (-[WKWebView _doAfterNextStablePresentationUpdate:]):
532
533         Runs the given block after both the UI process and web processes agree that the visible content rect state is 
534         stable. To do this, we fire presentation updates until the UI process (via RemoteLayerTreeTransactions)
535         discovers that the web page is in stable state. This is used solely for testing purposes.
536
537         (-[WKWebView _firePresentationUpdateForPendingStableStatePresentationCallbacks]):
538         (-[WKWebView _uiTextSelectionRectViews]): Deleted.
539         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
540         * UIProcess/WebPageProxy.h:
541         (WebKit::WebPageProxy::inStableState):
542         * UIProcess/ios/WKContentView.mm:
543         (-[WKContentView _didExitStableState]):
544
545         Deactivate the text selection if the assisted node is inside a fixed container.
546
547         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
548         * UIProcess/ios/WKContentViewInteraction.h:
549         * UIProcess/ios/WKContentViewInteraction.mm:
550         (-[WKContentView setupInteraction]):
551         (-[WKContentView cleanupInteraction]):
552         (-[WKContentView shouldHideSelectionWhenScrolling]):
553         (-[WKContentView _uiTextSelectionRects]):
554         (-[WKContentView _didEndScrollingOrZooming]):
555         (-[WKContentView _updateChangedSelection:]):
556
557         If the EditorState was created after a stable state update, reactivate the text selection assistant if it exists.
558         Additionally, if we are deferring the end scrolling selection update until after the first stable editor state
559         update arrives from the web process, we need to also call [_textSelectionAssistant didEndScrollingOverflow]
560         and [_webSelectionAssistant didEndScrollingOrZoomingPage] here instead of doing so immediately after scrolling
561         finishes. This ensures that selection UI (the callout and selection highlights) do not flicker from their old
562         position to the new position when scrolling finishes.
563
564         * WebProcess/WebPage/WebPage.cpp:
565         (WebKit::WebPage::willCommitLayerTree):
566         * WebProcess/WebPage/ios/WebPageIOS.mm:
567         (WebKit::WebPage::platformEditorState):
568         (WebKit::WebPage::updateVisibleContentRects):
569
570         When updating the layout viewport override rect, also recompute the caret if needed and send an updated
571         EditorState over to the UI process.
572
573 2016-12-16  Claudio Saavedra  <csaavedra@igalia.com>
574
575         [WK2] SharedMemory: include cleanups
576         https://bugs.webkit.org/show_bug.cgi?id=165950
577
578         Reviewed by Žan Doberšek.
579
580         The WTFString include is not needed in the header, so move to the
581         Unix file. Use the existing UNIX_DOMAIN_SOCKETS define. Also
582         include the WTFOptional header where needed.
583
584         * Platform/SharedMemory.h:
585         * Platform/unix/SharedMemoryUnix.cpp:
586
587 2016-12-16  Joonghun Park  <jh718.park@samsung.com>
588
589         [EFL] Fix build break since r209907. Unreviewed.
590         https://bugs.webkit.org/show_bug.cgi?id=165954
591
592         * UIProcess/efl/TextCheckerEfl.cpp: Change the remaining TextBreakIterator to UBreakIterator
593         (WebKit::nextWordOffset):
594         (WebKit::TextChecker::checkTextOfParagraph):
595
596 2016-12-15  Darin Adler  <darin@apple.com>
597
598         Use asString instead of toWTFString, toString, or getString when we already checked isString
599         https://bugs.webkit.org/show_bug.cgi?id=165895
600
601         Reviewed by Yusuke Suzuki.
602
603         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
604         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant): Use asString/value instead of toWTFString.
605
606 2016-12-15  Chris Dumez  <cdumez@apple.com>
607
608         Make sure HTML validation bubble's state is updated after layout
609         https://bugs.webkit.org/show_bug.cgi?id=165922
610         <rdar://problem/29694730>
611
612         Reviewed by Simon Fraser.
613
614         Make sure HTML validation bubble's state is updated after layout.
615         In particular, if the validation bubble's associated element has
616         moved or is no longer visible, we now hide the bubble.
617
618         * WebProcess/WebCoreSupport/WebValidationMessageClient.cpp:
619         (WebKit::WebValidationMessageClient::showValidationMessage):
620         (WebKit::WebValidationMessageClient::hideValidationMessage):
621         (WebKit::WebValidationMessageClient::updateValidationBubbleStateIfNeeded):
622         * WebProcess/WebCoreSupport/WebValidationMessageClient.h:
623
624 2016-12-15  Alex Christensen  <achristensen@webkit.org>
625
626         Improve NetworkSession logging
627         https://bugs.webkit.org/show_bug.cgi?id=165941
628
629         Reviewed by Tim Horton.
630
631         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
632         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
633         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
634         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
635         One of the "didReceiveResponse completionHandler (cancel)" messages was wrong,
636         and other messages could have more useful information without being overwhelming.
637
638 2016-12-15  Myles C. Maxfield  <mmaxfield@apple.com>
639
640         Sort Xcode project files
641         https://bugs.webkit.org/show_bug.cgi?id=165937
642
643         Reviewed by Simon Fraser.
644
645         * WebKit2.xcodeproj/project.pbxproj:
646
647 2016-12-15  Anders Carlsson  <andersca@apple.com>
648
649         Add more mach_msg logging instrumentation
650         https://bugs.webkit.org/show_bug.cgi?id=165914
651
652         Reviewed by Darin Adler.
653
654         * Platform/IPC/mac/ConnectionMac.mm:
655         (IPC::Connection::sendMessage):
656         (IPC::Connection::sendOutgoingMessage):
657         * Platform/IPC/mac/MachMessage.h:
658         (IPC::MachMessage::messageName):
659         (IPC::MachMessage::setMessageName):
660
661 2016-12-15  Konstantin Tokarev  <annulen@yandex.ru>
662
663         Added missing override and final specifiers
664         https://bugs.webkit.org/show_bug.cgi?id=165903
665
666         Reviewed by Darin Adler.
667
668         * UIProcess/API/gtk/WebKitGeolocationProvider.h:
669         * UIProcess/WebFormSubmissionListenerProxy.h:
670         * UIProcess/WebFramePolicyListenerProxy.h:
671         * WebProcess/Automation/WebAutomationSessionProxy.h:
672         * WebProcess/InjectedBundle/API/gtk/DOM/GObjectXPathNSResolver.h:
673         * WebProcess/MediaCache/WebMediaKeyStorageManager.h:
674         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h:
675         * WebProcess/WebCoreSupport/WebPlugInClient.h:
676         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h:
677         * WebProcess/WebPage/FindController.h:
678
679 2016-12-15  Simon Fraser  <simon.fraser@apple.com>
680
681         [iOS WK2] Don't disable position:fixed when a form element has focus
682         https://bugs.webkit.org/show_bug.cgi?id=165891
683         rdar://problem/29271694
684
685         Reviewed by Wenson Hsieh.
686
687         Before visual viewports, we had to lay out position:fixed relative to the document rect (effectively
688         disabling position:fixed) when a form element was focused, to ensure that we could scroll to inputs
689         inside position:Fixed.
690
691         When visual viewports are enabled, we can do a better job of this, and keep position:fixed active.
692         
693         Test: fast/visual-viewport/ios/zoomed-focus-in-fixed.html
694
695         * UIProcess/API/Cocoa/WKWebView.mm: 
696         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Soon this will use
697         insideFixed to have better scroll-into-view behavior.
698         (-[WKWebView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Deleted.
699         * UIProcess/API/Cocoa/WKWebViewInternal.h:
700         * UIProcess/ios/WKContentView.h:
701         * UIProcess/ios/WKContentView.mm:
702         (-[WKContentView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
703         (-[WKContentView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Deleted.
704         * UIProcess/ios/WKContentViewInteraction.mm:
705         (-[WKContentView _displayFormNodeInputView]):
706         * UIProcess/ios/WebPageProxyIOS.mm:
707         (WebKit::WebPageProxy::computeCustomFixedPositionRect): Don't fall back to using the documentRect as the fixed
708         position rect if visual viewports are enabled.
709         * WebProcess/WebPage/ios/WebPageIOS.mm:
710         (WebKit::WebPage::getAssistedNodeInformation): Don't reset the customtFixedPositionRect around computing element
711         coordinates if visual viewports are enabled.
712
713 2016-12-15  Andreas Kling  <akling@apple.com>
714
715         Always clear RenderLayer backing stores when going into page cache.
716         <https://webkit.org/b/165901>
717
718         Reviewed by Simon Fraser.
719
720         * WebProcess/WebProcess.cpp:
721         (WebKit::WebProcess::WebProcess):
722
723 2016-12-15  Darin Adler  <darin@apple.com>
724
725         Remove custom binding for MediaDevices
726         https://bugs.webkit.org/show_bug.cgi?id=165894
727
728         Reviewed by Eric Carlson.
729
730         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
731         Added include of MediaConstraintsImpl.h, now needed because we
732         removed some unneeded includes from the WebCore headers.
733
734 2016-12-15  Dave Hyatt  <hyatt@apple.com>
735
736         [CSS Parser] Enable CSS Deferred Parsing
737         https://bugs.webkit.org/show_bug.cgi?id=165869
738
739         Reviewed by Sam Weinig.
740
741         * Shared/WebPreferencesDefinitions.h:
742
743 2016-12-14  Andreas Kling  <akling@apple.com>
744
745         Only send Messages::WebPageProxy::DidSaveToPageCache once when entering page cache.
746         <https://webkit.org/b/165887>
747
748         Reviewed by Brady Eidson.
749
750         We were sending one of these IPC messages per frame when a page enters the page cache,
751         and we really only need one, so only do it for the main frame.
752
753         (This message is used to adopt the page cache on the UI process side, in case another
754         web process currently owns the cache. That happens in WebProcessPool::processDidCachePage().)
755
756         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
757         (WebKit::WebFrameLoaderClient::didSaveToPageCache):
758
759 2016-12-14  Simon Fraser  <simon.fraser@apple.com>
760
761         Fix cause of viewport-related flakiness in iOS tests
762         https://bugs.webkit.org/show_bug.cgi?id=165878
763
764         Reviewed by Tim Horton.
765
766         When TestController::platformConfigureViewForTest() changes the view size for a flexible
767         viewport test, the page would not have updated with the new scale by the time the load event
768         fired, causing flakiness depending on test order.
769
770         This was caused by code added in r170325 that delayed visible content rect updates until
771         after the UI process has received the transaction after didCommitLoad. So fix by overriding
772         this mechanism if the view has been resized.
773
774         * Shared/VisibleContentRectUpdateInfo.cpp:
775         (WebKit::VisibleContentRectUpdateInfo::encode):
776         (WebKit::VisibleContentRectUpdateInfo::decode):
777         (WebKit::operator<<):
778         * Shared/VisibleContentRectUpdateInfo.h:
779         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
780         (WebKit::VisibleContentRectUpdateInfo::isFirstUpdateForNewViewSize):
781         (WebKit::operator==):
782         * UIProcess/API/Cocoa/WKWebView.mm:
783         (-[WKWebView _frameOrBoundsChanged]):
784         (-[WKWebView _updateContentRectsWithState:]):
785         * UIProcess/DrawingAreaProxy.cpp:
786         (WebKit::DrawingAreaProxy::setSize):
787         * UIProcess/DrawingAreaProxy.h:
788         * UIProcess/WebPageProxy.cpp:
789         (WebKit::WebPageProxy::WebPageProxy):
790         * UIProcess/WebPageProxy.h:
791         * UIProcess/ios/WKContentView.h:
792         * UIProcess/ios/WKContentView.mm:
793         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
794         * WebProcess/WebPage/ios/WebPageIOS.mm:
795         (WebKit::WebPage::updateVisibleContentRects):
796
797 2016-12-04  Sam Weinig  <sam@webkit.org>
798
799         [WebIDL] Add support for converting dictionaries to JS
800         https://bugs.webkit.org/show_bug.cgi?id=165367
801
802         Reviewed by Chris Dumez.
803
804         * CMakeLists.txt:
805         Add missing directories to look in for headers.
806
807 2016-12-14  Anders Carlsson  <andersca@apple.com>
808
809         Add WKContextRefreshPlugIns
810         https://bugs.webkit.org/show_bug.cgi?id=165879
811         rdar://problem/29602414
812
813         Reviewed by Tim Horton.
814
815         * UIProcess/API/C/WKContext.cpp:
816         (WKContextRefreshPlugIns):
817         * UIProcess/API/C/WKContext.h:
818         * UIProcess/WebProcessPool.cpp:
819         (WebKit::WebProcessPool::refreshPlugins):
820         * UIProcess/WebProcessPool.h:
821         * WebProcess/Plugins/WebPluginInfoProvider.h:
822         * WebProcess/WebProcess.cpp:
823         (WebKit::WebProcess::refreshPlugins):
824         * WebProcess/WebProcess.h:
825         * WebProcess/WebProcess.messages.in:
826
827 2016-12-14  Tim Horton  <timothy_horton@apple.com>
828
829         API Test Fullscreen.TopContentInset is asserting on Yosemite
830         https://bugs.webkit.org/show_bug.cgi?id=165877
831
832         Reviewed by Brady Eidson.
833
834         * UIProcess/WebPageProxy.cpp:
835         (WebKit::WebPageProxy::setTopContentInset):
836         * WebProcess/WebPage/WebPage.cpp:
837         * WebProcess/WebPage/WebPage.h:
838         * WebProcess/WebPage/WebPage.messages.in:
839         We don't use fences on Yosemite, but this codepath still tried to.
840         Instead of guarding with PLATFORM(COCOA), make use of the more accurate
841         HAVE(COREANIMATION_FENCES) guard.
842
843 2016-12-14  Anders Carlsson  <andersca@apple.com>
844
845         Add some instrumentation to try to detect a crash on the bots
846         https://bugs.webkit.org/show_bug.cgi?id=165866
847
848         Reviewed by Sam Weinig.
849
850         * Platform/IPC/mac/ConnectionMac.mm:
851         (IPC::Connection::sendMessage):
852
853 2016-12-14  Dave Hyatt  <hyatt@apple.com>
854
855         [CSS Parser] Implement deferred parsing of properties, @media, @supports and @keyframes
856         https://bugs.webkit.org/show_bug.cgi?id=165743
857
858         Reviewed by Dean Jackson.
859
860         Repurpose the newCSSParserEnabled preference for deferred parsing. Just change the name
861         from "new" to "deferred."
862
863         * Shared/WebPreferencesDefinitions.h:
864         * UIProcess/API/C/WKPreferences.cpp:
865         (WKPreferencesSetDeferredCSSParserEnabled):
866         (WKPreferencesGetDeferredCSSParserEnabled):
867         (WKPreferencesSetNewCSSParserEnabled): Deleted.
868         (WKPreferencesGetNewCSSParserEnabled): Deleted.
869         * UIProcess/API/C/WKPreferencesRefPrivate.h:
870         * WebProcess/WebPage/WebPage.cpp:
871         (WebKit::WebPage::updatePreferences):
872
873 2016-12-14  Brent Fulgham  <bfulgham@apple.com>
874
875         Unreviewed test fix after r209806.
876
877         Plugin-common doesn't define 'home-subpath'. Instead it has 'home-library-subpath'. Switch to the correct
878         function. Also, 'home-library-subpath' adds '/Library' to the path, so revise the arguments so that we
879         do not generate paths like '/home/username/Library/Library/Keychains'.
880
881         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
882
883 2016-12-14  Brent Fulgham  <bfulgham@apple.com>
884
885         Unreviewed test fix after r209779.
886
887         The 'Keygen' element requires the ability to create new keys in '$HOME/Library/Keychains'. Remove the
888         WebProcess and Plugin sandbox restrictions on per-user Keychain creation to support this use.
889
890         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
891         * WebProcess/com.apple.WebProcess.sb.in:
892
893 2016-12-13  Yusuke Suzuki  <utatane.tea@gmail.com>
894
895         Use JSValue::toWTFString instead of calling toString(exec) and value(exec)
896         https://bugs.webkit.org/show_bug.cgi?id=165795
897
898         Reviewed by Saam Barati.
899
900         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
901         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
902
903 2016-12-14  Enrique Ocaña González  <eocanha@igalia.com>
904
905         REGRESSION(r207879-207891): [GStreamer] Introduced many layout test failures and crashes, bots exiting early
906         https://bugs.webkit.org/show_bug.cgi?id=164022
907
908         Reviewed by Xabier Rodriguez-Calvar.
909
910         * Shared/WebPreferencesDefinitions.h:
911         New GStreamerEnabled preference, defaults to true.
912         * WebProcess/WebPage/WebPage.cpp: Ditto.
913         (WebKit::WebPage::updatePreferences):
914
915 2016-12-13  Commit Queue  <commit-queue@webkit.org>
916
917         Unreviewed, rolling out r209792.
918         https://bugs.webkit.org/show_bug.cgi?id=165841
919
920         Cause build failures (Requested by yusukesuzuki on #webkit).
921
922         Reverted changeset:
923
924         "Use JSValue::toWTFString instead of calling toString(exec)
925         and value(exec)"
926         https://bugs.webkit.org/show_bug.cgi?id=165795
927         http://trac.webkit.org/changeset/209792
928
929 2016-12-13  Yusuke Suzuki  <utatane.tea@gmail.com>
930
931         Use JSValue::toWTFString instead of calling toString(exec) and value(exec)
932         https://bugs.webkit.org/show_bug.cgi?id=165795
933
934         Reviewed by Saam Barati.
935
936         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
937         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
938
939 2016-12-13  Alex Christensen  <achristensen@webkit.org>
940
941         Fix CMake build.
942
943         * PlatformMac.cmake:
944
945 2016-12-13  Jer Noble  <jer.noble@apple.com>
946
947         Fullscreen in WebKit2 does not restore topContentInset upon exiting; leaves top of page not visible
948         https://bugs.webkit.org/show_bug.cgi?id=165697
949
950         Delegate the values of topContentInset() from WebViewImpl (used by WKWebView and WKView) to the
951         WebPageProxy, so that setting the topContentInset() on WebPageProxy is reflected in the getters
952         for the two view classes.
953
954         Reviewed by Tim Horton.
955
956         * UIProcess/Cocoa/WebViewImpl.h:
957         (WebKit::WebViewImpl::topContentInset): Deleted.
958         * UIProcess/Cocoa/WebViewImpl.mm:
959         (WebKit::WebViewImpl::updateContentInsetsIfAutomatic):
960         (WebKit::WebViewImpl::topContentInset):
961         (WebKit::WebViewImpl::setTopContentInset):
962         (WebKit::WebViewImpl::dispatchSetTopContentInset):
963         * UIProcess/mac/WKFullScreenWindowController.mm:
964         (-[WKFullScreenWindowController enterFullScreen:]):
965         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
966         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
967         (-[WKFullScreenWindowController _saveTopContentInset]): Deleted.
968         (-[WKFullScreenWindowController _restoreTopContentInset]): Deleted.
969
970 2016-12-13  Brent Fulgham  <bfulgham@apple.com>
971
972         [Mac][WK2] Tighten Keychain directory access
973         https://bugs.webkit.org/show_bug.cgi?id=165818
974         <rdar://problem/16863857>
975
976         Reviewed by Anders Carlsson.
977
978         Lock down Keychain directory access to just the file-read-data, file-read-metadata, and
979         file-write-data operations we actually need.
980
981         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
982         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
983         * WebProcess/com.apple.WebProcess.sb.in:
984
985 2016-12-13  Andy Estes  <aestes@apple.com>
986
987         [Cocoa] Implement -shouldInsertText: on WKWebProcessPlugInEditingDelegate
988         https://bugs.webkit.org/show_bug.cgi?id=165785
989         <rdar://problem/26929398>
990
991         Reviewed by Darin Adler.
992
993         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h: Defined
994         WKEditorInsertAction and declared
995         -_webProcessPlugInBrowserContextController:shouldInsertText:replacingRange:givenAction:.
996         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
997         (toWK): Added. Mapped a WebCore::EditorInsertAction to a WKEditorInsertAction.
998         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): Implemented
999         EditorClient::shouldInsertText() by calling
1000         -_webProcessPlugInBrowserContextController:shouldInsertText:replacingRange:givenAction: with
1001         the text, wrapped range handle, and action. Added shouldInsertText to DelegateMethods and
1002         initialized it according to whether the delegate responds to shouldInsertText:.
1003
1004 2016-12-13  Joseph Pecoraro  <pecoraro@apple.com>
1005
1006         NSArray leaks seen in Safari, allocated under WKIconDatabaseTryCopyCGImageArrayForURL
1007         https://bugs.webkit.org/show_bug.cgi?id=165809
1008
1009         Reviewed by Dan Bernstein.
1010
1011         * UIProcess/API/C/cg/WKIconDatabaseCG.cpp:
1012         (WKIconDatabaseTryCopyCGImageArrayForURL):
1013         Avoid an extra retain on already newly created array.
1014
1015 2016-12-13  Eric Carlson  <eric.carlson@apple.com>
1016
1017         Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
1018         https://bugs.webkit.org/show_bug.cgi?id=165251
1019
1020         Reviewed by Youenn Fablet.
1021
1022         * WebProcess/WebPage/WebPage.cpp:
1023         (WebKit::WebPage::updatePreferences): Update the media stream and peer connection runtime
1024         feature instead of the setting.
1025
1026 2016-12-13  Sergio Villar Senin  <svillar@igalia.com>
1027
1028         Fix GTK build after r209733
1029         https://bugs.webkit.org/show_bug.cgi?id=165794
1030
1031         Document::visibilityState() now returns an IDL string enumeration.
1032
1033         Reviewed by Žan Doberšek.
1034
1035         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp:
1036         (webkit_dom_document_get_visibility_state):
1037
1038 2016-12-12  Dean Jackson  <dino@apple.com>
1039
1040         [iOS] MediaDocument "Done" button should navigate the page back
1041         https://bugs.webkit.org/show_bug.cgi?id=165779
1042
1043         Reviewed by Sam Weinig.
1044
1045         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
1046         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
1047         (WebKit::WebVideoFullscreenModelContext::requestFullscreenMode):
1048         (WebKit::WebVideoFullscreenManagerProxy::requestFullscreenMode):
1049         * WebProcess/cocoa/WebVideoFullscreenManager.h:
1050         * WebProcess/cocoa/WebVideoFullscreenManager.messages.in:
1051         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
1052         (WebKit::WebVideoFullscreenManager::requestFullscreenMode):
1053
1054 2016-12-12  Tim Horton  <timothy_horton@apple.com>
1055
1056         Provide SPI to avoid blocking on painting when coming into view
1057         https://bugs.webkit.org/show_bug.cgi?id=165780
1058         <rdar://problem/29009559>
1059
1060         Reviewed by Simon Fraser.
1061
1062         By default, when parenting a WKWebView which was previously in-window,
1063         we block on painting to ensure that we don't flash stale content.
1064         We added SPI to disable this behavior to WKWebViewConfiguration, but
1065         some clients might want the behavior most of the time, but sometimes
1066         instead want to not block the UI process main thread, but instead do
1067         their own work (e.g. removing a snapshot) when painting eventually occurs.
1068
1069         * UIProcess/API/Cocoa/WKWebView.mm:
1070         (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]):
1071         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1072         Tell WebPageProxy not to block on painting next time we are parented,
1073         and use doAfterNextPresentationUpdate to call the block when the painting
1074         does eventually happen. This SPI must be called before - but in the same
1075         runloop cycle - the WKWebView is brought back in-window to work correctly.
1076         
1077         * UIProcess/WebPageProxy.cpp:
1078         (WebKit::WebPageProxy::dispatchActivityStateChange):
1079         * UIProcess/WebPageProxy.h:
1080         (WebKit::WebPageProxy::skipWaitingForPaintAfterNextViewDidMoveToWindow):
1081         If we would block because we're coming in-window, but the bit to skip
1082         blocking the next time we get brought in-window is set, reset the bit, 
1083         and avoid blocking.
1084
1085 2016-12-12  Chris Dumez  <cdumez@apple.com>
1086
1087         Document.visibilityState should use an IDL string enumeration
1088         https://bugs.webkit.org/show_bug.cgi?id=165774
1089
1090         Reviewed by Daniel Bates.
1091
1092         * Shared/API/c/WKSharedAPICast.h:
1093         (WebKit::toPageVisibilityState):
1094
1095 2016-12-11  Konstantin Tokarev  <annulen@yandex.ru>
1096
1097         Unreviewed attempt to fix EFL and Mac/cmake builds after r209665.
1098         https://bugs.webkit.org/show_bug.cgi?id=165686
1099
1100         * PlatformEfl.cmake: WebKit2 should precede other target so that right
1101         config.h comes first in include path.
1102
1103 2016-12-11  Tim Horton  <timothy_horton@apple.com>
1104
1105         Quarter-second stalls scrolling images that are links because of sync getPositionInformation
1106         https://bugs.webkit.org/show_bug.cgi?id=165707
1107
1108         Reviewed by Simon Fraser.
1109
1110         * UIProcess/ios/WKContentViewInteraction.mm:
1111         (-[WKContentView positionInformationForActionSheetAssistant:]):
1112         (-[WKContentView updatePositionInformationForActionSheetAssistant:]):
1113         For now, synchronously block when presenting the action sheet if we
1114         don't have a snapshot ready.
1115
1116         * WebProcess/WebPage/ios/WebPageIOS.mm:
1117         (WebKit::WebPage::getPositionInformation):
1118         Respect includeSnapshot in another place in getPositionInformation,
1119         so that many getPositionInformations don't have to do extra snapshotting work.
1120
1121 2016-12-10  Filip Pizlo  <fpizlo@apple.com>
1122
1123         The DOM should have an advancing wavefront opaque root barrier
1124         https://bugs.webkit.org/show_bug.cgi?id=165712
1125
1126         Reviewed by Yusuke Suzuki.
1127         
1128         Propagate the JSDOMWindowBase::commonVM() -> commonVM() change.
1129
1130         * Shared/linux/WebMemorySamplerLinux.cpp:
1131         (WebKit::WebMemorySampler::sampleWebKit):
1132         * Shared/mac/WebMemorySampler.mac.mm:
1133         (WebKit::WebMemorySampler::sampleWebKit):
1134         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1135         (WebKit::InjectedBundle::javaScriptObjectsCount):
1136         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
1137         (WebKit::JSNPObject::callMethod):
1138         (WebKit::JSNPObject::callObject):
1139         (WebKit::JSNPObject::callConstructor):
1140         (WebKit::JSNPObject::put):
1141         (WebKit::JSNPObject::deleteProperty):
1142         (WebKit::JSNPObject::getOwnPropertyNames):
1143         (WebKit::JSNPObject::propertyGetter):
1144         * WebProcess/WebPage/WebPage.cpp:
1145         (WebKit::WebPage::runJavaScriptInMainFrame):
1146         (WebKit::WebPage::getBytecodeProfile):
1147         (WebKit::WebPage::getSamplingProfilerOutput):
1148         * WebProcess/WebProcess.cpp:
1149         (WebKit::WebProcess::getWebCoreStatistics):
1150
1151 2016-12-11  Konstantin Tokarev  <annulen@yandex.ru>
1152
1153         Unreviewed build fix for EFL after r209665
1154
1155         * UIProcess/efl/TextCheckerClientEfl.h:
1156
1157 2016-12-10  Konstantin Tokarev  <annulen@yandex.ru>
1158
1159         [cmake] Include WTF, JSC, and WebCore headers automatically to targers using them
1160         https://bugs.webkit.org/show_bug.cgi?id=165686
1161
1162         Reviewed by Michael Catanzaro.
1163
1164         This change reduces duplication of include path lists between modules,
1165         and reduces future need for fixes like r209605 (broken build because of
1166         WebCore header suddenly becoming used in WebKit2).
1167
1168         * CMakeLists.txt:
1169         * PlatformEfl.cmake:
1170         * PlatformGTK.cmake:
1171         * PlatformMac.cmake:
1172
1173 2016-12-10  Antti Koivisto  <antti@apple.com>
1174
1175         CrashTracer: com.apple.WebKit.Networking at WTF::ThreadSafeRefCounted<WebKit::NetworkCache::IOChannel>::deref
1176         https://bugs.webkit.org/show_bug.cgi?id=165659
1177         <rdar://problem/27077977>
1178
1179         Reviewed by Darin Adler.
1180
1181         * NetworkProcess/cache/NetworkCacheIOChannel.h:
1182         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
1183         (WebKit::NetworkCache::IOChannel::~IOChannel):
1184
1185             Add non-inlined destructor and release assert against double deletion to narrow down this crash.
1186
1187 2016-12-09  Brent Fulgham  <bfulgham@apple.com>
1188
1189         WebCore::Timer is not compatible with UIProcess
1190         https://bugs.webkit.org/show_bug.cgi?id=165706
1191         <rdar://problem/29360564>
1192
1193         Reviewed by Andy Estes.
1194
1195         Anders has explained to me (at least twice) that WebCore::Timer must not
1196         be used in UIProcess code. A recent bug fix introduced a WebCore::Timer,
1197         which led to another crash.
1198         
1199         This patch switches from WebCore::Timer to WTF::RunLoop::Timer to avoid
1200         the problem.
1201
1202         * UIProcess/Cocoa/NavigationState.h:
1203         * UIProcess/Cocoa/NavigationState.mm:
1204         (WebKit::NavigationState::NavigationState):
1205
1206 2016-12-09  Eric Carlson  <eric.carlson@apple.com>
1207
1208         Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
1209         https://bugs.webkit.org/show_bug.cgi?id=165251
1210
1211         Reviewed by Dean Jackson.
1212
1213         Based on a patch by Dr Alex Gouaillard <agouaillard@gmail.com>
1214
1215         * Shared/WebPreferencesDefinitions.h: Add peerConnectionEnabled.
1216
1217         * UIProcess/API/C/WKPreferences.cpp:
1218         (WKPreferencesSetPeerConnectionEnabled): Added.
1219         (WKPreferencesGetPeerConnectionEnabled): Added.
1220         * UIProcess/API/C/WKPreferencesRef.h:
1221
1222         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1223         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Add WebKitMediaStreamEnabled
1224           and WebKitPeerConnectionEnabled.
1225
1226         * WebProcess/WebPage/WebPage.cpp:
1227         (WebKit::WebPage::updatePreferences): Initialize the peerConnection preference.
1228
1229 2016-12-09  Brady Eidson  <beidson@apple.com>
1230
1231         Re-landing:
1232         Add _WKIconLoadingDelegate SPI.
1233         https://bugs.webkit.org/show_bug.cgi?id=164894
1234
1235         Reviewed by Alex Christensen.
1236
1237         With this client, WebCore will ask the FrameLoaderClient about each icon found in the <head>.
1238
1239         WebKit2 will then ask the embedding app - for each icon - if it wants that icon to load.
1240
1241         For icons the app decides to load, WebKit will pass the data to the app without storing locally.
1242
1243         * UIProcess/API/APIIconLoadingClient.h: Copied from Source/WebCore/html/LinkIconCollector.h.
1244         (API::IconLoadingClient::~IconLoadingClient):
1245         (API::IconLoadingClient::getLoadDecisionForIcon):
1246
1247         * UIProcess/API/Cocoa/WKWebView.mm:
1248         (-[WKWebView _initializeWithConfiguration:]):
1249         (-[WKWebView _iconLoadingDelegate]):
1250         (-[WKWebView _setIconLoadingDelegate:]):
1251         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1252
1253         * UIProcess/API/Cocoa/_WKIconLoadingDelegate.h: Copied from Source/WebCore/html/LinkIconCollector.h.
1254
1255         * UIProcess/API/Cocoa/_WKLinkIconParameters.h: Copied from Source/WebCore/html/LinkIconCollector.h.
1256         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm: Copied from Source/WebCore/html/LinkIconCollector.h.
1257         (-[_WKLinkIconParameters _initWithLinkIcon:]):
1258         (-[_WKLinkIconParameters url]):
1259         (-[_WKLinkIconParameters mimeType]):
1260         (-[_WKLinkIconParameters size]):
1261         (-[_WKLinkIconParameters iconType]):
1262         * UIProcess/API/Cocoa/_WKLinkIconParametersInternal.h: Copied from Source/WebCore/html/LinkIconCollector.h.
1263
1264         * UIProcess/Cocoa/IconLoadingDelegate.h: Copied from Source/WebCore/html/LinkIconCollector.h.
1265         * UIProcess/Cocoa/IconLoadingDelegate.mm: Added.
1266         (WebKit::IconLoadingDelegate::IconLoadingDelegate):
1267         (WebKit::IconLoadingDelegate::~IconLoadingDelegate):
1268         (WebKit::IconLoadingDelegate::createIconLoadingClient):
1269         (WebKit::IconLoadingDelegate::delegate):
1270         (WebKit::IconLoadingDelegate::setDelegate):
1271         (WebKit::IconLoadingDelegate::IconLoadingClient::IconLoadingClient):
1272         (WebKit::IconLoadingDelegate::IconLoadingClient::~IconLoadingClient):
1273         (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon):
1274
1275         * UIProcess/WebPageProxy.cpp:
1276         (WebKit::WebPageProxy::setIconLoadingClient):
1277         (WebKit::WebPageProxy::getLoadDecisionForIcon):
1278         (WebKit::WebPageProxy::finishedLoadingIcon):
1279         * UIProcess/WebPageProxy.h:
1280         (WebKit::WebPageProxy::iconLoadingClient):
1281         * UIProcess/WebPageProxy.messages.in:
1282
1283         * WebKit2.xcodeproj/project.pbxproj:
1284
1285         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1286         (WebKit::WebFrameLoaderClient::useIconLoadingClient):
1287         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon):
1288         (WebKit::WebFrameLoaderClient::finishedLoadingIcon):
1289         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1290         (WebKit::WebFrameLoaderClient::setUseIconLoadingClient):
1291
1292         * WebProcess/WebPage/WebPage.cpp:
1293         (WebKit::WebPage::didGetLoadDecisionForIcon):
1294         (WebKit::WebPage::setUseIconLoadingClient):
1295         * WebProcess/WebPage/WebPage.h:
1296         * WebProcess/WebPage/WebPage.messages.in:
1297
1298 2016-12-09  Simon Fraser  <simon.fraser@apple.com>
1299
1300         Fix initialization of contentUpdateFrequency
1301         https://bugs.webkit.org/show_bug.cgi?id=165705
1302         rdar://problem/29602039
1303
1304         Reviewed by Tim Horton.
1305
1306         The value that controls web content update frequency was not being initialized.
1307
1308         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1309         (-[WKWebViewConfiguration init]):
1310
1311 2016-12-09  Anders Carlsson  <andersca@apple.com>
1312
1313         Once we can send Mach messages again, make sure to send any pending outgoing messages
1314         https://bugs.webkit.org/show_bug.cgi?id=165693
1315
1316         Reviewed by Brady Eidson.
1317
1318         * Platform/IPC/mac/ConnectionMac.mm:
1319         (IPC::Connection::initializeSendSource):
1320
1321 2016-12-09  Beth Dakin  <bdakin@apple.com>
1322
1323         Password fields should not show the emoji button in TouchBar
1324         https://bugs.webkit.org/show_bug.cgi?id=165673
1325         -and corresponding-
1326         rdar://problem/29235739
1327
1328         Reviewed by Wenson Hsieh.
1329
1330         This patch adds a new member variable for the password touch bar and password 
1331         candidateListTouchBarItem. Since this TouchBar will actually have a different set 
1332         of identifiers than the plain text TouchBar, it should just have its own variable.
1333         * UIProcess/Cocoa/WebViewImpl.h:
1334         * UIProcess/Cocoa/WebViewImpl.mm:
1335
1336         Return m_passwordTextCandidateListTouchBarItem when appropriate.
1337         (WebKit::WebViewImpl::candidateListTouchBarItem):
1338
1339         The candidate list should be the only item for passwords.
1340         (WebKit::passwordTextTouchBarDefaultItemIdentifiers):
1341
1342         Account for m_passwordTextTouchBar.
1343         (WebKit::WebViewImpl::updateTouchBarAndRefreshTextBarIdentifiers):
1344         (WebKit::WebViewImpl::setUpTextTouchBar):
1345         (WebKit::WebViewImpl::textTouchBar):
1346
1347         The empty candidates array is not needed. We can just set @[ ] as the candidates 
1348         for the m_passwordTextCandidateListTouchBarItem. Safe guards already exist in the 
1349         other parts of the code to prevent us from requesting or setting other candidates 
1350         when in a password field. 
1351         (WebKit::WebViewImpl::updateTextTouchBar):
1352
1353 2016-12-09  Keith Rollin  <krollin@apple.com>
1354
1355         Fix string specification in print format
1356         https://bugs.webkit.org/show_bug.cgi?id=165650
1357
1358         Reviewed by Alex Christensen.
1359
1360         Change "%{public}s" string specifier to something that can be changed
1361         to "%s" at compile time when the build environment doesn't support the
1362         former.
1363
1364         * NetworkProcess/capture/NetworkCaptureLogging.h:
1365         * NetworkProcess/capture/NetworkCaptureManager.cpp:
1366         (WebKit::NetworkCapture::Manager::initialize):
1367         (WebKit::NetworkCapture::Manager::findMatch):
1368         (WebKit::NetworkCapture::Manager::findExactMatch):
1369         (WebKit::NetworkCapture::Manager::findBestFuzzyMatch):
1370         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
1371         (WebKit::NetworkCapture::Manager::logPlayedBackResource):
1372         (WebKit::NetworkCapture::Manager::openCacheFile):
1373         (WebKit::NetworkCapture::Manager::getLine):
1374         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
1375         (WebKit::NetworkCapture::Recorder::recordRequestSent):
1376         (WebKit::NetworkCapture::Recorder::recordResponseReceived):
1377         (WebKit::NetworkCapture::Recorder::recordRedirectReceived):
1378         (WebKit::NetworkCapture::Recorder::recordRedirectSent):
1379         (WebKit::NetworkCapture::Recorder::writeEvents):
1380         * NetworkProcess/capture/NetworkCaptureResource.cpp:
1381         (WebKit::NetworkCapture::Resource::url):
1382         (WebKit::NetworkCapture::Resource::EventStream::nextEvent):
1383         * NetworkProcess/capture/NetworkDataTaskReplay.cpp:
1384         (WebKit::NetworkCapture::NetworkDataTaskReplay::NetworkDataTaskReplay):
1385         (WebKit::NetworkCapture::NetworkDataTaskReplay::~NetworkDataTaskReplay):
1386         (WebKit::NetworkCapture::NetworkDataTaskReplay::resume):
1387         (WebKit::NetworkCapture::NetworkDataTaskReplay::suspend):
1388         (WebKit::NetworkCapture::NetworkDataTaskReplay::complete):
1389         (WebKit::NetworkCapture::NetworkDataTaskReplay::invalidateAndCancel):
1390         (WebKit::NetworkCapture::NetworkDataTaskReplay::enqueueEventHandler):
1391         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRequestSent):
1392         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayResponseReceived):
1393         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectReceived):
1394         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectSent):
1395         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayDataReceived):
1396         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayFinished):
1397         (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse):
1398
1399 2016-12-09  Jeremy Jones  <jeremyj@apple.com>
1400
1401         WebView doesn't become first responder in element fullscreen.
1402         https://bugs.webkit.org/show_bug.cgi?id=165664
1403         rdar://problem/28927252
1404
1405         Reviewed by Tim Horton.
1406
1407         WebView was being set as the first responder while the contentView was still hidden.
1408         A view can not become first responder while it or its ancestor is hidden.
1409
1410         This change waits until after the contentView is visible to make the web view the first responder.
1411
1412         * UIProcess/mac/WKFullScreenWindowController.mm:
1413         (-[WKFullScreenWindowController enterFullScreen:]):
1414         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
1415
1416 2016-12-09  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
1417
1418         Unreviewed build fix. Thanks to Konstantin Tokarev and Csaba Osztrogonác
1419         for pointing out the fix.
1420
1421         * CMakeLists.txt: add WebCore/html/canvas to include paths.
1422
1423 2016-12-09  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
1424
1425         [GTK] Fix build after r209558
1426         https://bugs.webkit.org/show_bug.cgi?id=165653
1427
1428         Unreviewed build fix.
1429
1430         * UIProcess/API/APIPolicyClient.h: include WebsitePolicies.h.
1431         * UIProcess/API/gtk/WebKitPolicyClient.cpp: ditto.
1432         * UIProcess/API/gtk/WebKitPolicyDecision.cpp:
1433         (webkit_policy_decision_use):  pass empty structure to new required argument.
1434
1435 2016-12-09  Gavin Barraclough  <barraclough@apple.com>
1436
1437         Revert - Add _WKIconLoadingDelegate SPI
1438         https://bugs.webkit.org/show_bug.cgi?id=164894
1439
1440         Unreviewed rollout due to performance regression.
1441
1442         * PlatformMac.cmake:
1443         * UIProcess/API/APIIconLoadingClient.h: Removed.
1444         * UIProcess/API/Cocoa/WKWebView.mm:
1445         (-[WKWebView _initializeWithConfiguration:]):
1446         (-[WKWebView _iconLoadingDelegate]): Deleted.
1447         (-[WKWebView _setIconLoadingDelegate:]): Deleted.
1448         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1449         * UIProcess/API/Cocoa/_WKIconLoadingDelegate.h: Removed.
1450         * UIProcess/API/Cocoa/_WKLinkIconParameters.h: Removed.
1451         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm: Removed.
1452         * UIProcess/API/Cocoa/_WKLinkIconParametersInternal.h: Removed.
1453         * UIProcess/Cocoa/IconLoadingDelegate.h: Removed.
1454         * UIProcess/Cocoa/IconLoadingDelegate.mm: Removed.
1455         * UIProcess/WebPageProxy.cpp:
1456         (WebKit::WebPageProxy::setIconLoadingClient): Deleted.
1457         (WebKit::WebPageProxy::getLoadDecisionForIcon): Deleted.
1458         (WebKit::WebPageProxy::finishedLoadingIcon): Deleted.
1459         * UIProcess/WebPageProxy.h:
1460         (WebKit::WebPageProxy::iconLoadingClient): Deleted.
1461         * UIProcess/WebPageProxy.messages.in:
1462         * WebKit2.xcodeproj/project.pbxproj:
1463         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1464         (WebKit::WebFrameLoaderClient::useIconLoadingClient): Deleted.
1465         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon): Deleted.
1466         (WebKit::WebFrameLoaderClient::finishedLoadingIcon): Deleted.
1467         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1468         (WebKit::WebFrameLoaderClient::setUseIconLoadingClient): Deleted.
1469         (): Deleted.
1470         * WebProcess/WebPage/WebPage.cpp:
1471         (WebKit::WebPage::didGetLoadDecisionForIcon): Deleted.
1472         (WebKit::WebPage::setUseIconLoadingClient): Deleted.
1473         * WebProcess/WebPage/WebPage.h:
1474         * WebProcess/WebPage/WebPage.messages.in:
1475
1476 2016-12-08  Keith Rollin  <krollin@apple.com>
1477
1478         Move FileHandle to WebCore FileHandle.h
1479         https://bugs.webkit.org/show_bug.cgi?id=165562
1480
1481         Reviewed by Alex Christensen.
1482
1483         Move FileHandle from NetworkCaptureTypes.h (which can now be deleted)
1484         to WebCore. Update client code to use the new version.
1485
1486         * NetworkProcess/capture/NetworkCaptureEvent.cpp:
1487         * NetworkProcess/capture/NetworkCaptureEvent.h:
1488         * NetworkProcess/capture/NetworkCaptureManager.cpp:
1489         (WebKit::NetworkCapture::Manager::initialize):
1490         (WebKit::NetworkCapture::Manager::terminate):
1491         (WebKit::NetworkCapture::Manager::logRecordedResource):
1492         (WebKit::NetworkCapture::Manager::logLoadedResource):
1493         (WebKit::NetworkCapture::Manager::logPlayedBackResource):
1494         (WebKit::NetworkCapture::Manager::openCacheFile):
1495         (WebKit::NetworkCapture::Manager::ensureFileHandle): Deleted.
1496         (WebKit::NetworkCapture::Manager::printToFile): Deleted.
1497         * NetworkProcess/capture/NetworkCaptureManager.h:
1498         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
1499         (WebKit::NetworkCapture::Recorder::writeEvents):
1500         * NetworkProcess/capture/NetworkCaptureTypes.h: Removed.
1501         * WebKit2.xcodeproj/project.pbxproj:
1502
1503 2016-12-08  Anders Carlsson  <andersca@apple.com>
1504
1505         Attempt to fix the iOS build.
1506
1507         * Platform/IPC/mac/MachMessage.cpp:
1508
1509 2016-12-08  Anders Carlsson  <andersca@apple.com>
1510
1511         Defer sending Mach messages if the queue is full
1512         https://bugs.webkit.org/show_bug.cgi?id=165622
1513         rdar://problem/29518036
1514
1515         Reviewed by Brady Eidson.
1516
1517         * Platform/IPC/Connection.cpp:
1518         Include MachMessage.h so the Connection destructor can do its thing.
1519
1520         * Platform/IPC/Connection.h:
1521         Add new members.
1522
1523         * Platform/IPC/mac/ConnectionMac.mm:
1524         (IPC::Connection::platformInvalidate):
1525         Null out the pending outgoing mach message.
1526
1527         (IPC::Connection::sendMessage):
1528         New helper that will send a Mach message. If we time out, store the message in m_pendingOutgoingMachMessage.
1529         When our send source will be triggered we'll try to send the message again.
1530
1531         (IPC::Connection::platformCanSendOutgoingMessages):
1532         We can only send messages if we don't have a pending outgoing message.
1533
1534         (IPC::Connection::sendOutgoingMessage):
1535         Call the newly added sendMessage function.
1536
1537         (IPC::Connection::initializeSendSource):
1538         Add the DISPATCH_MACH_SEND_POSSIBLE mask (and DISPATCH_MACH_SEND_DEAD which was previously implicit).
1539         In our event handler, check for DISPATCH_MACH_SEND_POSSIBLE and try to send the pending outgoing message again.
1540
1541         * Platform/IPC/mac/MachMessage.cpp:
1542         (IPC::MachMessage::create):
1543         Rename length to size.
1544
1545         (IPC::MachMessage::MachMessage):
1546         Initialize m_shouldFreeDescriptors.
1547
1548         (IPC::MachMessage::~MachMessage):
1549         Call mach_msg_destroy, which will free the descriptors.
1550
1551         (IPC::MachMessage::leakDescriptors):
1552         Set m_shouldFreeDescriptors to false.
1553
1554         * Platform/IPC/mac/MachMessage.h:
1555         (IPC::MachMessage::size):
1556         (IPC::MachMessage::length): Deleted.
1557
1558 2016-12-08  Chelsea Pugh  <cpugh@apple.com>
1559
1560         [iOS] WKWebView should not allow app links to be opened on back or forward navigation
1561         https://bugs.webkit.org/show_bug.cgi?id=165502
1562
1563         Reviewed by Dan Bernstein.
1564
1565         * UIProcess/WebPageProxy.cpp:
1566         (WebKit::WebPageProxy::decidePolicyForNavigationAction): Add a condition to shouldOpenAppLinks
1567         (which we use when creating a NavigationAction) that the navigationActionData is not a navigation
1568         of type BackForward. This way, we don't open app links when a navigation is done via back or
1569         forward.
1570
1571 2016-12-08  Filip Pizlo  <fpizlo@apple.com>
1572
1573         Enable SharedArrayBuffer, remove the flag
1574         https://bugs.webkit.org/show_bug.cgi?id=165614
1575
1576         Rubber stamped by Geoffrey Garen.
1577
1578         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1579         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1580
1581 2016-12-08  Alex Christensen  <achristensen@webkit.org>
1582
1583         Add SPI for sending WebsiteSettings to WebProcess during navigation
1584         https://bugs.webkit.org/show_bug.cgi?id=165517
1585         <rdar://29341068>
1586
1587         We add the ability for the navigation client to send settings to the WebProcess 
1588         based on the URL of the document being navigated to. This approach adds no new IPC 
1589         messages and allows the application to decide what settings to use during navigation 
1590         instead of declaratively before navigation. Right now there is only one setting, 
1591         whether to disable content blockers, but this infrastructure can be used for more settings.
1592
1593         Reviewed by Anders Carlsson.
1594
1595         * CMakeLists.txt:
1596         * PlatformMac.cmake:
1597         * Shared/API/APIObject.h:
1598         * Shared/API/c/WKBase.h:
1599         * Shared/WebsitePolicies.h: Added.
1600         (WebKit::WebsitePolicies::encode):
1601         (WebKit::WebsitePolicies::decode):
1602         * UIProcess/API/APINavigationClient.h:
1603         (API::NavigationClient::decidePolicyForNavigationAction):
1604         (API::NavigationClient::decidePolicyForNavigationResponse):
1605         * UIProcess/API/APIPolicyClient.h:
1606         (API::PolicyClient::decidePolicyForNavigationAction):
1607         (API::PolicyClient::decidePolicyForNewWindowAction):
1608         (API::PolicyClient::decidePolicyForResponse):
1609         * UIProcess/API/APIWebsitePolicies.cpp: Added.
1610         (API::WebsitePolicies::create):
1611         * UIProcess/API/APIWebsitePolicies.h: Added.
1612         * UIProcess/API/C/WKAPICast.h:
1613         * UIProcess/API/C/WKFramePolicyListener.cpp:
1614         (WKFramePolicyListenerUse):
1615         (WKFramePolicyListenerUseWithPolicies):
1616         * UIProcess/API/C/WKFramePolicyListener.h:
1617         * UIProcess/API/C/WKPage.cpp:
1618         (WKPageSetPagePolicyClient):
1619         * UIProcess/API/C/WKWebsitePolicies.cpp: Added.
1620         (WKWebsitePoliciesGetTypeID):
1621         (WKWebsitePoliciesCreate):
1622         (WKWebsitePoliciesSetContentBlockersEnabled):
1623         (WKWebsitePoliciesGetContentBlockersEnabled):
1624         * UIProcess/API/C/WKWebsitePolicies.h: Added.
1625         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1626         * UIProcess/API/Cocoa/_WKWebsitePolicies.h: Added.
1627         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm: Added.
1628         (-[_WKWebsitePolicies dealloc]):
1629         (-[_WKWebsitePolicies init]):
1630         (-[_WKWebsitePolicies setContentBlockersEnabled:]):
1631         (-[_WKWebsitePolicies contentBlockersEnabled]):
1632         (-[_WKWebsitePolicies description]):
1633         (-[_WKWebsitePolicies _apiObject]):
1634         * UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h: Added.
1635         (WebKit::wrapper):
1636         * UIProcess/Automation/WebAutomationSession.cpp:
1637         (WebKit::WebAutomationSession::reloadBrowsingContext):
1638         * UIProcess/Cocoa/NavigationState.h:
1639         * UIProcess/Cocoa/NavigationState.mm:
1640         (WebKit::NavigationState::setNavigationDelegate):
1641         (WebKit::tryAppLink):
1642         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1643         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
1644         * UIProcess/WebFormSubmissionListenerProxy.cpp:
1645         (WebKit::WebFormSubmissionListenerProxy::continueSubmission):
1646         * UIProcess/WebFrameListenerProxy.cpp:
1647         (WebKit::WebFrameListenerProxy::receivedPolicyDecision):
1648         * UIProcess/WebFrameListenerProxy.h:
1649         * UIProcess/WebFramePolicyListenerProxy.cpp:
1650         (WebKit::WebFramePolicyListenerProxy::use):
1651         (WebKit::WebFramePolicyListenerProxy::download):
1652         (WebKit::WebFramePolicyListenerProxy::ignore):
1653         * UIProcess/WebFramePolicyListenerProxy.h:
1654         (WebKit::WebFramePolicyListenerProxy::create):
1655         * UIProcess/WebFrameProxy.cpp:
1656         (WebKit::WebFrameProxy::receivedPolicyDecision):
1657         * UIProcess/WebFrameProxy.h:
1658         * UIProcess/WebInspectorProxy.cpp:
1659         (WebKit::decidePolicyForNavigationAction):
1660         * UIProcess/WebPageProxy.cpp:
1661         (WebKit::WebPageProxy::receivedPolicyDecision):
1662         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1663         * UIProcess/WebPageProxy.h:
1664         * UIProcess/WebPageProxy.messages.in:
1665         * WebKit2.xcodeproj/project.pbxproj:
1666         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1667         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1668
1669 2016-12-08  Antti Koivisto  <antti@apple.com>
1670
1671         Salt network cache hashes
1672         https://bugs.webkit.org/show_bug.cgi?id=164924
1673
1674         Reviewed by Alex Christensen.
1675
1676         To enhance privacy make cache content unidentifiable from file names alone.
1677         This is done by generating a unique persistent salt for each cache instance.
1678         It is used when computing hashes used in file names.
1679
1680         The patch also replaces plain text partition directory names with salted hashes.
1681
1682         * NetworkProcess/cache/NetworkCache.cpp:
1683         (WebKit::NetworkCache::Cache::makeCacheKey):
1684         (WebKit::NetworkCache::makeCacheKey): Deleted.
1685         * NetworkProcess/cache/NetworkCache.h:
1686
1687             Increment cache version.
1688
1689         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
1690         (WebKit::NetworkCache::BlobStorage::BlobStorage):
1691         (WebKit::NetworkCache::BlobStorage::add):
1692         (WebKit::NetworkCache::BlobStorage::get):
1693
1694             Use salt for blob content hash.
1695
1696         * NetworkProcess/cache/NetworkCacheBlobStorage.h:
1697         * NetworkProcess/cache/NetworkCacheData.cpp:
1698         (WebKit::NetworkCache::computeSHA1):
1699
1700             For simplicity all SHA1s are now salted.
1701
1702         (WebKit::NetworkCache::makeSalt):
1703         (WebKit::NetworkCache::readOrMakeSalt):
1704
1705             Read salt if it exists, generate and persist it otherwise.
1706
1707         * NetworkProcess/cache/NetworkCacheData.h:
1708         * NetworkProcess/cache/NetworkCacheKey.cpp:
1709         (WebKit::NetworkCache::Key::Key):
1710
1711             Remove the "No partition" string and just empty.
1712             That was only needed to have a directory name of some sort.
1713
1714         (WebKit::NetworkCache::Key::computeHash):
1715
1716             Use salt for key hash.
1717
1718         (WebKit::NetworkCache::Key::computePartitionHash):
1719
1720             Separate hash for partition.
1721
1722         * NetworkProcess/cache/NetworkCacheKey.h:
1723         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
1724         (WebKit::NetworkCache::makeSubresourcesKey):
1725         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady):
1726         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
1727         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1728         (WebKit::NetworkCache::makeSaltFilePath):
1729         (WebKit::NetworkCache::Storage::open):
1730
1731             Cache can't be opened if we can't read or persist a salt.
1732
1733         (WebKit::NetworkCache::traverseRecordsFiles):
1734         (WebKit::NetworkCache::Storage::Storage):
1735         (WebKit::NetworkCache::Storage::synchronize):
1736         (WebKit::NetworkCache::Storage::recordDirectoryPathForKey):
1737
1738             Use the partition hash in the directory name instead of a plain text name.
1739
1740         (WebKit::NetworkCache::decodeRecordHeader):
1741         (WebKit::NetworkCache::Storage::readRecord):
1742         (WebKit::NetworkCache::Storage::encodeRecord):
1743         (WebKit::NetworkCache::Storage::traverse):
1744         (WebKit::NetworkCache::Storage::clear):
1745         * NetworkProcess/cache/NetworkCacheStorage.h:
1746         (WebKit::NetworkCache::Storage::salt):
1747
1748 2016-12-08  Eric Carlson  <eric.carlson@apple.com>
1749
1750         Fix the EFL build.
1751
1752         * UIProcess/WebPageProxy.cpp:
1753         (WebKit::WebPageProxy::isPlayingMediaDidChange): Add another ENABLE(MEDIA_STREAM) guard.
1754
1755 2016-12-08  Tomas Popela  <tpopela@redhat.com>
1756
1757         [GTK] Process accelerated compositing env variables only if they are really enabled
1758         https://bugs.webkit.org/show_bug.cgi?id=165300
1759
1760         Don't process the WEBKIT_FORCE_COMPOSITING_MODE and
1761         WEBKIT_DISABLE_COMPOSITING_MODE env variables if they are disabled
1762         (eg. WEBKIT_DISABLE_COMPOSITING_MODE=0).
1763
1764         Reviewed by Michael Catanzaro.
1765
1766         * UIProcess/gtk/WebPreferencesGtk.cpp:
1767         (WebKit::WebPreferences::platformInitializeStore):
1768
1769 2016-12-08  Alex Christensen  <achristensen@webkit.org>
1770
1771         Fix CMake build.
1772
1773         * CMakeLists.txt:
1774         Add the new NetworkProcess/capture include directory to find new headers from r209498.
1775         * NetworkProcess/capture/NetworkCaptureEvent.cpp:
1776         (WebKit::NetworkCapture::Response::Response):
1777         (WebKit::NetworkCapture::Error::Error):
1778         The String constructor was ambiguous after r209498 because URL has an operator NSString* and String has an NSString constructor.
1779         We should get rid of operator NSString* and operator String on URL.
1780         * UIProcess/WebPageProxy.cpp:
1781         * UIProcess/WebPageProxy.h:
1782         Add some ENABLE(MEDIA_STREAM) macros to fix the build without it enabled after r209512.
1783
1784 2016-12-08  Alex Christensen  <achristensen@webkit.org>
1785
1786         Fix iOS debug build after r209498
1787         https://bugs.webkit.org/show_bug.cgi?id=164527
1788
1789         * NetworkProcess/capture/NetworkCaptureLogging.h:
1790         Logs were causing compile warnings/errors.  Disable logs for now.
1791
1792 2016-12-07  Dean Jackson  <dino@apple.com>
1793
1794         Remove runtime toggle for pointer-lock
1795         https://bugs.webkit.org/show_bug.cgi?id=165577
1796         <rdar://problems/29566996>
1797
1798         Reviewed by Jon Lee.
1799
1800         Remove any runtime calls to check if pointer-lock is enabled. It's
1801         either compiled in or out.
1802
1803         * Shared/WebPreferencesDefinitions.h:
1804         * UIProcess/API/C/WKPreferences.cpp:
1805         (WKPreferencesSetPointerLockEnabled): Deleted.
1806         (WKPreferencesGetPointerLockEnabled): Deleted.
1807         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1808         * WebProcess/WebPage/WebPage.cpp:
1809         (WebKit::WebPage::updatePreferences):
1810
1811 2016-12-07  Eric Carlson  <eric.carlson@apple.com>
1812
1813         [MediaStream][Mac] Revoke sandbox extensions when capture ends
1814         https://bugs.webkit.org/show_bug.cgi?id=165476
1815
1816         Reviewed by Brady Eidson.
1817
1818         Track media capture by process so it is possible to revoke the sandbox extensions issued to
1819         a web process when capture stops. Allocate WK2 user media permission manager lazily rather
1820         than every time a page is created as most pages won't need one.
1821
1822         * CMakeLists.txt: Add new files.
1823
1824         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1825         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy): Register
1826           with process manager.
1827         (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
1828         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): Move sandbox 
1829           extension code to the process manager.
1830         (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture): New.
1831         (WebKit::UserMediaPermissionRequestManagerProxy::startedCaptureSession): New, report state
1832           change to the process manager.
1833         (WebKit::UserMediaPermissionRequestManagerProxy::endedCaptureSession): Ditto.
1834         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1835
1836         * UIProcess/UserMediaProcessManager.cpp: Added.
1837         (WebKit::ProcessState::ProcessState):
1838         (WebKit::ProcessState::managers):
1839         (WebKit::ProcessState::sandboxExtensionsGranted):
1840         (WebKit::ProcessState::setSandboxExtensionsGranted):
1841         (WebKit::stateMap):
1842         (WebKit::processState):
1843         (WebKit::ProcessState::addRequestManager):
1844         (WebKit::ProcessState::removeRequestManager):
1845         (WebKit::UserMediaProcessManager::singleton):
1846         (WebKit::UserMediaProcessManager::addUserMediaPermissionRequestManagerProxy):
1847         (WebKit::UserMediaProcessManager::removeUserMediaPermissionRequestManagerProxy):
1848         (WebKit::UserMediaProcessManager::willCreateMediaStream):
1849         (WebKit::UserMediaProcessManager::startedCaptureSession):
1850         (WebKit::UserMediaProcessManager::endedCaptureSession):
1851         * UIProcess/UserMediaProcessManager.h: Added.
1852
1853         * UIProcess/WebPageProxy.cpp:
1854         (WebKit::WebPageProxy::WebPageProxy): Don't allocate m_userMediaPermissionRequestManager.
1855         (WebKit::WebPageProxy::resetState): Set m_userMediaPermissionRequestManager to null.
1856         (WebKit::WebPageProxy::userMediaPermissionRequestManager): Allocate m_userMediaPermissionRequestManager
1857           lazily as most pages don't need it.
1858         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame): Call userMediaPermissionRequestManager().
1859         (WebKit::WebPageProxy::enumerateMediaDevicesForFrame): Ditto.
1860         (WebKit::WebPageProxy::clearUserMediaState): Ditto.
1861         (WebKit::WebPageProxy::isPlayingMediaDidChange): Report capture state changes to the request
1862           manager proxy.
1863         * UIProcess/WebPageProxy.h:
1864
1865         * WebKit2.xcodeproj/project.pbxproj: Add new files.
1866
1867         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp: Added.
1868         (WebKit::MediaDeviceSandboxExtensions::MediaDeviceSandboxExtensions):
1869         (WebKit::MediaDeviceSandboxExtensions::encode):
1870         (WebKit::MediaDeviceSandboxExtensions::decode):
1871         (WebKit::MediaDeviceSandboxExtensions::operator[]):
1872         (WebKit::MediaDeviceSandboxExtensions::size):
1873         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h: Added.
1874
1875         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1876         (WebKit::UserMediaPermissionRequestManager::~UserMediaPermissionRequestManager): Sandbox extension
1877           is now in a HashMap, not a Vector.
1878         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions): Record
1879           IDs with extensions so they can be revoked later.
1880         (WebKit::UserMediaPermissionRequestManager::revokeUserMediaDeviceSandboxExtensions): New.
1881         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDevicesSandboxExtension): Deleted.
1882         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
1883
1884         * WebProcess/WebPage/WebPage.cpp:
1885         (WebKit::WebPage::grantUserMediaDeviceSandboxExtensions):
1886         (WebKit::WebPage::revokeUserMediaDeviceSandboxExtensions):
1887         (WebKit::WebPage::grantUserMediaDevicesSandboxExtension): Deleted.
1888         * WebProcess/WebPage/WebPage.h:
1889         * WebProcess/WebPage/WebPage.messages.in:
1890
1891 2016-12-07  Jeremy Jones  <jeremyj@apple.com>
1892
1893         One esc to exit fullscreen and pointer lock
1894         https://bugs.webkit.org/show_bug.cgi?id=165416
1895         rdar://problem/29430711
1896
1897         Reviewed by Jer Noble.
1898
1899         Fix a crash when didLosePointerLock is not specified.
1900
1901         * UIProcess/API/C/WKPage.cpp:
1902         (WKPageSetPageUIClient):
1903
1904 2016-12-07  Keith Rollin  <krollin@apple.com>
1905
1906         Network event record/replay
1907         https://bugs.webkit.org/show_bug.cgi?id=164527
1908         <rdar://problem/29168157>
1909
1910         Reviewed by Alex Christensen.
1911
1912         Add WebKit2/NetworkProcess/capture/* for recording the network events
1913         that occur when loading a page and for replaying them later. Update
1914         NetworkLoad to invoke capture facilities. Add preferences for enabling
1915         record or replay.
1916
1917         * CMakeLists.txt:
1918         * NetworkProcess/NetworkLoad.cpp:
1919         (WebKit::NetworkLoad::NetworkLoad):
1920         (WebKit::NetworkLoad::initializeForRecord):
1921         (WebKit::NetworkLoad::initializeForReplay):
1922         (WebKit::NetworkLoad::initialize):
1923         (WebKit::NetworkLoad::setDefersLoading):
1924         (WebKit::NetworkLoad::continueWillSendRequest):
1925         (WebKit::NetworkLoad::sharedWillSendRedirectedRequest):
1926         (WebKit::NetworkLoad::notifyDidReceiveResponse):
1927         (WebKit::NetworkLoad::didReceiveData):
1928         (WebKit::NetworkLoad::didCompleteWithError):
1929         * NetworkProcess/NetworkLoad.h:
1930         * NetworkProcess/NetworkProcess.cpp:
1931         (WebKit::NetworkProcess::initializeNetworkProcess):
1932         (WebKit::NetworkProcess::terminate):
1933         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1934         (WebKit::NetworkProcessCreationParameters::encode):
1935         (WebKit::NetworkProcessCreationParameters::decode):
1936         * NetworkProcess/NetworkProcessCreationParameters.h:
1937         * NetworkProcess/capture/NetworkCaptureEvent.cpp: Added.
1938         (WebKit::NetworkCapture::copyHeaders):
1939         (WebKit::NetworkCapture::KeyValuePair::KeyValuePair):
1940         (WebKit::NetworkCapture::ResourceRequest::ResourceRequest):
1941         (WebKit::NetworkCapture::ResourceRequest::operator WebCore::ResourceRequest):
1942         (WebKit::NetworkCapture::ResourceResponse::ResourceResponse):
1943         (WebKit::NetworkCapture::ResourceResponse::operator WebCore::ResourceResponse):
1944         (WebKit::NetworkCapture::ResourceError::ResourceError):
1945         (WebKit::NetworkCapture::ResourceError::operator WebCore::ResourceError):
1946         (WebKit::NetworkCapture::JSONCoder::encode):
1947         (WebKit::NetworkCapture::JSONCoder::decode):
1948         (WebKit::NetworkCapture::JSONCoder<String>::encode):
1949         (WebKit::NetworkCapture::JSONCoder<String>::decode):
1950         (WebKit::NetworkCapture::JSONCoder<CaptureTimeType>::encode):
1951         (WebKit::NetworkCapture::JSONCoder<CaptureTimeType>::decode):
1952         (WebKit::NetworkCapture::JSONCoder<KeyValuePair>::encode):
1953         (WebKit::NetworkCapture::JSONCoder<KeyValuePair>::decode):
1954         (WebKit::NetworkCapture::JSONCoder<Vector<T>>::encode):
1955         (WebKit::NetworkCapture::JSONCoder<Vector<T>>::decode):
1956         (WebKit::NetworkCapture::JSONCoder<ResourceRequest>::encode):
1957         (WebKit::NetworkCapture::JSONCoder<ResourceRequest>::decode):
1958         (WebKit::NetworkCapture::JSONCoder<ResourceResponse>::encode):
1959         (WebKit::NetworkCapture::JSONCoder<ResourceResponse>::decode):
1960         (WebKit::NetworkCapture::JSONCoder<ResourceError>::encode):
1961         (WebKit::NetworkCapture::JSONCoder<ResourceError>::decode):
1962         (WebKit::NetworkCapture::JSONCoder<WebCore::SharedBuffer>::encode):
1963         (WebKit::NetworkCapture::JSONCoder<WebCore::SharedBuffer>::decode):
1964         (WebKit::NetworkCapture::JSONCoder<RequestSentEvent>::encode):
1965         (WebKit::NetworkCapture::JSONCoder<RequestSentEvent>::decode):
1966         (WebKit::NetworkCapture::JSONCoder<ResponseReceivedEvent>::encode):
1967         (WebKit::NetworkCapture::JSONCoder<ResponseReceivedEvent>::decode):
1968         (WebKit::NetworkCapture::JSONCoder<RedirectReceivedEvent>::encode):
1969         (WebKit::NetworkCapture::JSONCoder<RedirectReceivedEvent>::decode):
1970         (WebKit::NetworkCapture::JSONCoder<RedirectSentEvent>::encode):
1971         (WebKit::NetworkCapture::JSONCoder<RedirectSentEvent>::decode):
1972         (WebKit::NetworkCapture::JSONCoder<DataReceivedEvent>::encode):
1973         (WebKit::NetworkCapture::JSONCoder<DataReceivedEvent>::decode):
1974         (WebKit::NetworkCapture::JSONCoder<FinishedEvent>::encode):
1975         (WebKit::NetworkCapture::JSONCoder<FinishedEvent>::decode):
1976         (WebKit::NetworkCapture::eventToString):
1977         (WebKit::NetworkCapture::stringToEvent):
1978         * NetworkProcess/capture/NetworkCaptureEvent.h: Added.
1979         (WebKit::NetworkCapture::TimedEvent::TimedEvent):
1980         * NetworkProcess/capture/NetworkCaptureLogging.h: Added.
1981         * NetworkProcess/capture/NetworkCaptureManager.cpp: Added.
1982         (WebKit::NetworkCapture::Manager::singleton):
1983         (WebKit::NetworkCapture::Manager::initialize):
1984         (WebKit::NetworkCapture::Manager::terminate):
1985         (WebKit::NetworkCapture::Manager::findMatch):
1986         (WebKit::NetworkCapture::Manager::findExactMatch):
1987         (WebKit::NetworkCapture::Manager::findBestFuzzyMatch):
1988         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
1989         (WebKit::NetworkCapture::Manager::loadResources):
1990         (WebKit::NetworkCapture::Manager::reportLoadPath):
1991         (WebKit::NetworkCapture::Manager::reportRecordPath):
1992         (WebKit::NetworkCapture::Manager::reportReplayPath):
1993         (WebKit::NetworkCapture::Manager::requestToPath):
1994         (WebKit::NetworkCapture::Manager::stringToHash):
1995         (WebKit::NetworkCapture::Manager::hashToPath):
1996         (WebKit::NetworkCapture::Manager::logRecordedResource):
1997         (WebKit::NetworkCapture::Manager::logLoadedResource):
1998         (WebKit::NetworkCapture::Manager::logPlayedBackResource):
1999         (WebKit::NetworkCapture::Manager::ensureFileHandle):
2000         (WebKit::NetworkCapture::Manager::openCacheFile):
2001         (WebKit::NetworkCapture::Manager::readFile):
2002         (WebKit::NetworkCapture::Manager::getLine):
2003         (WebKit::NetworkCapture::Manager::getWord):
2004         (WebKit::NetworkCapture::Manager::printToFile):
2005         * NetworkProcess/capture/NetworkCaptureManager.h: Added.
2006         (WebKit::NetworkCapture::Manager::isRecording):
2007         (WebKit::NetworkCapture::Manager::isReplaying):
2008         (WebKit::NetworkCapture::Manager::mode):
2009         * NetworkProcess/capture/NetworkCaptureRecorder.cpp: Added.
2010         (WebKit::NetworkCapture::Recorder::recordRequestSent):
2011         (WebKit::NetworkCapture::Recorder::recordResponseReceived):
2012         (WebKit::NetworkCapture::Recorder::recordRedirectReceived):
2013         (WebKit::NetworkCapture::Recorder::recordRedirectSent):
2014         (WebKit::NetworkCapture::Recorder::recordDataReceived):
2015         (WebKit::NetworkCapture::Recorder::recordFinish):
2016         (WebKit::NetworkCapture::Recorder::writeEvents):
2017         * NetworkProcess/capture/NetworkCaptureRecorder.h: Added.
2018         (WebKit::NetworkCapture::Recorder::recordEvent):
2019         * NetworkProcess/capture/NetworkCaptureReplayer.cpp: Added.
2020         (WebKit::NetworkCapture::Replayer::replayResource):
2021         * NetworkProcess/capture/NetworkCaptureReplayer.h: Added.
2022         * NetworkProcess/capture/NetworkCaptureResource.cpp: Added.
2023         (WebKit::NetworkCapture::Resource::Resource):
2024         (WebKit::NetworkCapture::Resource::url):
2025         (WebKit::NetworkCapture::Resource::baseURL):
2026         (WebKit::NetworkCapture::Resource::queryParameters):
2027         (WebKit::NetworkCapture::Resource::eventStream):
2028         (WebKit::NetworkCapture::Resource::EventStream::EventStream):
2029         (WebKit::NetworkCapture::Resource::EventStream::nextEvent):
2030         * NetworkProcess/capture/NetworkCaptureResource.h: Added.
2031         * NetworkProcess/capture/NetworkCaptureTypes.h: Added.
2032         (WebKit::NetworkCapture::TypeHolder::forEachTypeImpl):
2033         (WebKit::NetworkCapture::TypeHolder::forEachType):
2034         * NetworkProcess/capture/NetworkDataTaskReplay.cpp: Added.
2035         (WebKit::NetworkCapture::NetworkDataTaskReplay::NetworkDataTaskReplay):
2036         (WebKit::NetworkCapture::NetworkDataTaskReplay::~NetworkDataTaskReplay):
2037         (WebKit::NetworkCapture::NetworkDataTaskReplay::resume):
2038         (WebKit::NetworkCapture::NetworkDataTaskReplay::suspend):
2039         (WebKit::NetworkCapture::NetworkDataTaskReplay::cancel):
2040         (WebKit::NetworkCapture::NetworkDataTaskReplay::complete):
2041         (WebKit::NetworkCapture::NetworkDataTaskReplay::invalidateAndCancel):
2042         (WebKit::NetworkCapture::NetworkDataTaskReplay::enqueueEventHandler):
2043         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRequestSent):
2044         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayResponseReceived):
2045         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectReceived):
2046         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectSent):
2047         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayDataReceived):
2048         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayFinished):
2049         (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse):
2050         (WebKit::NetworkCapture::NetworkDataTaskReplay::didFinish):
2051         * NetworkProcess/capture/NetworkDataTaskReplay.h: Added.
2052         (WebKit::NetworkCapture::NetworkDataTaskReplay::create):
2053         * NetworkProcess/capture/json.hpp: Added.
2054         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2055         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2056         * WebKit2.xcodeproj/project.pbxproj:
2057         * config.h:
2058
2059 2016-12-07  Anders Carlsson  <andersca@apple.com>
2060
2061         Fix build.
2062
2063         * Platform/IPC/mac/ConnectionMac.mm:
2064         (IPC::Connection::open):
2065
2066 2016-12-07  Anders Carlsson  <andersca@apple.com>
2067
2068         Rename the connection sources to better indicate what data direction they are used for
2069         https://bugs.webkit.org/show_bug.cgi?id=165548
2070
2071         Reviewed by Tim Horton.
2072
2073         * Platform/IPC/Connection.h:
2074         * Platform/IPC/mac/ConnectionMac.mm:
2075         (IPC::Connection::platformInvalidate):
2076         (IPC::Connection::platformInitialize):
2077         (IPC::createReceiveSource):
2078         (IPC::Connection::initializeSendSource):
2079         (IPC::Connection::receiveSourceEventHandler):
2080         (IPC::createDataAvailableSource): Deleted.
2081         (IPC::Connection::initializeDeadNameSource): Deleted.
2082         Rename m_deadNameSource to m_sendSource, and m_receivePortDataAvailableSource to m_receiveSource.
2083
2084         (IPC::Connection::open):
2085         Initialize the send source before we attempt to send a first message.
2086
2087 2016-12-07  Simon Fraser  <simon.fraser@apple.com>
2088
2089         Fix use of enum in a WK2 C SPI header.
2090         rdar://problem/28725583
2091
2092         Followup to correctly prefix the enum values.
2093
2094         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2095         (WKBundlePageSetEventThrottlingBehaviorOverride):
2096         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
2097
2098 2016-12-07  Simon Fraser  <simon.fraser@apple.com>
2099
2100         Fix use of enum in a WK2 C SPI header.
2101         rdar://problem/28725583
2102
2103         Reviewed by Dan Bernstein.
2104
2105         Use correct enum style for a C SPI header and fix the callers.
2106
2107         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2108         (WKBundlePageSetEventThrottlingBehaviorOverride):
2109         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
2110
2111 2016-12-07  Beth Dakin  <bdakin@apple.com>
2112
2113         Remove iCloud Pages and Keynote site-specific hacks
2114         https://bugs.webkit.org/show_bug.cgi?id=165544
2115         -and corresponding-
2116         rdar://problem/29082536
2117
2118         Reviewed by Wenson Hsieh.
2119
2120         * WebProcess/WebPage/WebPage.cpp:
2121         (WebKit::needsHiddenContentEditableQuirk):
2122         (WebKit::needsPlainTextQuirk):
2123
2124 2016-12-05  Ada Chan  <adachan@apple.com>
2125
2126         Add a getter for serverTrust in _WKObservablePageState
2127         https://bugs.webkit.org/show_bug.cgi?id=165433
2128
2129         Reviewed by Anders Carlsson.
2130
2131         * UIProcess/API/C/mac/WKPagePrivateMac.h:
2132         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
2133         (-[WKObservablePageState serverTrust]):
2134
2135 2016-12-07  Jer Noble  <jer.noble@apple.com>
2136
2137         Exiting Element Fullscreen mode loses focus on WKWebView.
2138         https://bugs.webkit.org/show_bug.cgi?id=165512
2139
2140         Reviewed by Eric Carlson.
2141
2142         Setting 'window.contentView.hidden = YES' will reset the first-responder (whereas
2143         previously setting 'window.contentView.layer.hidden = YES' did not). Grab the first-
2144         responder before doing so, so that it can be reset correctly when moving the WKWebView
2145         back to it's original window.
2146
2147         * UIProcess/mac/WKFullScreenWindowController.mm:
2148         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
2149
2150 2016-12-07  Alex Christensen  <achristensen@webkit.org>
2151
2152         Fix CMake build after r209418.
2153         https://bugs.webkit.org/show_bug.cgi?id=165484
2154
2155         * PlatformMac.cmake:
2156
2157 2016-12-07  Philippe Normand  <pnormand@igalia.com>
2158
2159         Unreviewed, GTK build fix after r209407.
2160
2161         * Platform/IPC/unix/ConnectionUnix.cpp:
2162         (IPC::Connection::processMessage):
2163         * UIProcess/LegacySessionStateCodingNone.cpp:
2164         (WebKit::decodeLegacySessionState):
2165
2166 2016-12-06  Ryan Haddad  <ryanhaddad@apple.com>
2167
2168         Unreviewed, rolling out r209422.
2169
2170         This change caused assertion failures during API tests.
2171
2172         Reverted changeset:
2173
2174         "[MediaStream][Mac] Revoke sandbox extensions when capture
2175         ends"
2176         https://bugs.webkit.org/show_bug.cgi?id=165476
2177         http://trac.webkit.org/changeset/209422
2178
2179 2016-12-06  Dean Jackson  <dino@apple.com>
2180
2181         Include default value in Experimental Feature information
2182         https://bugs.webkit.org/show_bug.cgi?id=165509
2183         <rdar://problems/29547177>
2184
2185         Reviewed by Tim Horton.
2186
2187         Add a defaultValue member variable to experimental
2188         features, both the C++ and ObjC interfaces.
2189
2190         * UIProcess/API/APIExperimentalFeature.cpp:
2191         (API::ExperimentalFeature::create):
2192         (API::ExperimentalFeature::ExperimentalFeature):
2193         * UIProcess/API/APIExperimentalFeature.h:
2194         * UIProcess/API/Cocoa/_WKExperimentalFeature.h:
2195         * UIProcess/API/Cocoa/_WKExperimentalFeature.mm:
2196         (-[_WKExperimentalFeature description]):
2197         (-[_WKExperimentalFeature defaultValue]):
2198         * UIProcess/WebPreferences.cpp:
2199         (WebKit::createExperimentalFeaturesVector):
2200
2201 2016-12-06  Commit Queue  <commit-queue@webkit.org>
2202
2203         Unreviewed, rolling out r209391.
2204         https://bugs.webkit.org/show_bug.cgi?id=165501
2205
2206         requires explicit nullptr checks so missing env vars don't
2207         flip AC mode (Requested by mcatanzaro on #webkit).
2208
2209         Reverted changeset:
2210
2211         "[GTK] Process accelerated compositing env variables only if
2212         they are really enabled"
2213         https://bugs.webkit.org/show_bug.cgi?id=165300
2214         http://trac.webkit.org/changeset/209391
2215
2216 2016-12-06  Alexey Proskuryakov  <ap@apple.com>
2217
2218         Correct SDKROOT values in xcconfig files
2219         https://bugs.webkit.org/show_bug.cgi?id=165487
2220         rdar://problem/29539209
2221
2222         Reviewed by Dan Bernstein.
2223
2224         Fix suggested by Dan Bernstein.
2225
2226         * Configurations/DebugRelease.xcconfig:
2227
2228 2016-12-06  Andreas Kling  <akling@apple.com>
2229
2230         [Cocoa] Add some memory usage related information to sysdiagnose state dumps
2231         <https://webkit.org/b/165375>
2232         <rdar://problem/29057243>
2233
2234         Reviewed by Darin Adler.
2235
2236         Follow-up to address two more review comments.
2237
2238         * WebProcess/cocoa/WebProcessCocoa.mm:
2239         (WebKit::WebProcess::registerWithStateDumper): Use adoptNS() instead of autorelease for NSStrings.
2240
2241 2016-12-06  Eric Carlson  <eric.carlson@apple.com>
2242
2243         [MediaStream][Mac] Revoke sandbox extensions when capture ends
2244         https://bugs.webkit.org/show_bug.cgi?id=165476
2245
2246         Reviewed by Brady Eidson.
2247         
2248         Track media capture by process so it is possible to revoke the sandbox extensions issued to
2249         a web process when capture stops.
2250
2251         * CMakeLists.txt: Add new files.
2252
2253         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2254         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy): Register
2255           with process manager.
2256         (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
2257         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): Move sandbox 
2258           extension code to the process manager.
2259         (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture): New.
2260         (WebKit::UserMediaPermissionRequestManagerProxy::startedCaptureSession): New, report state
2261           change to the process manager.
2262         (WebKit::UserMediaPermissionRequestManagerProxy::endedCaptureSession): Ditto.
2263         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2264
2265         * UIProcess/UserMediaProcessManager.cpp: Added.
2266         (WebKit::ProcessState::ProcessState):
2267         (WebKit::ProcessState::managers):
2268         (WebKit::ProcessState::sandboxExtensionsGranted):
2269         (WebKit::ProcessState::setSandboxExtensionsGranted):
2270         (WebKit::stateMap):
2271         (WebKit::processState):
2272         (WebKit::ProcessState::addRequestManager):
2273         (WebKit::ProcessState::removeRequestManager):
2274         (WebKit::UserMediaProcessManager::singleton):
2275         (WebKit::UserMediaProcessManager::addUserMediaPermissionRequestManagerProxy):
2276         (WebKit::UserMediaProcessManager::removeUserMediaPermissionRequestManagerProxy):
2277         (WebKit::UserMediaProcessManager::willCreateMediaStream):
2278         (WebKit::UserMediaProcessManager::startedCaptureSession):
2279         (WebKit::UserMediaProcessManager::endedCaptureSession):
2280         * UIProcess/UserMediaProcessManager.h: Added.
2281
2282         * UIProcess/WebPageProxy.cpp:
2283         (WebKit::WebPageProxy::isPlayingMediaDidChange): Report capture state changes to the request
2284           manager proxy.
2285         * UIProcess/WebPageProxy.h:
2286
2287         * WebKit2.xcodeproj/project.pbxproj: Add new files.
2288
2289         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp: Added.
2290         (WebKit::MediaDeviceSandboxExtensions::MediaDeviceSandboxExtensions):
2291         (WebKit::MediaDeviceSandboxExtensions::encode):
2292         (WebKit::MediaDeviceSandboxExtensions::decode):
2293         (WebKit::MediaDeviceSandboxExtensions::operator[]):
2294         (WebKit::MediaDeviceSandboxExtensions::size):
2295         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h: Added.
2296
2297         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
2298         (WebKit::UserMediaPermissionRequestManager::~UserMediaPermissionRequestManager): Sandbox extension
2299           is now in a HashMap, not a Vector.
2300         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions): Record
2301           IDs with extensions so they can be revoked later.
2302         (WebKit::UserMediaPermissionRequestManager::revokeUserMediaDeviceSandboxExtensions): New.
2303         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDevicesSandboxExtension): Deleted.
2304         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
2305
2306         * WebProcess/WebPage/WebPage.cpp:
2307         (WebKit::WebPage::grantUserMediaDeviceSandboxExtensions):
2308         (WebKit::WebPage::revokeUserMediaDeviceSandboxExtensions):
2309         (WebKit::WebPage::grantUserMediaDevicesSandboxExtension): Deleted.
2310         * WebProcess/WebPage/WebPage.h:
2311         * WebProcess/WebPage/WebPage.messages.in:
2312
2313 2016-12-06  Anders Carlsson  <andersca@apple.com>
2314
2315         Add a new MachMessage class and use it for sending outgoing messages
2316         https://bugs.webkit.org/show_bug.cgi?id=165484
2317
2318         Reviewed by Sam Weinig.
2319
2320         * Platform/IPC/mac/ConnectionMac.mm:
2321         (IPC::Connection::sendOutgoingMessage):
2322         Instead of trying to randomly use memory from the stack as well as using mmap for the message data for out of line messages
2323         (which makes no sense at all, since the body data is already mmapped), just always create a MachMessage object and use it.
2324         
2325         (IPC::machMessageSize): Deleted.
2326         This has been moved to MachMessage::messageSize().
2327         
2328         * Platform/IPC/mac/MachMessage.cpp: Added.
2329         (IPC::MachMessage::create):
2330         Allocate extra memory to store the actual buffer.
2331
2332         (IPC::MachMessage::MachMessage):
2333         Initialize variables. m_size isn't really used right now, but will be in a subsequent patch.
2334
2335         (IPC::MachMessage::header):
2336         Return the header.
2337         
2338         * Platform/IPC/mac/MachMessage.h: Added.
2339         (IPC::MachMessage::length):
2340
2341         * WebKit2.xcodeproj/project.pbxproj:
2342         Add new files.
2343
2344 2016-12-06  Simon Fraser  <simon.fraser@apple.com>
2345
2346         Enable visual viewports by default on Mac, and iOS Wk2
2347         https://bugs.webkit.org/show_bug.cgi?id=165452
2348
2349         Reviewed by Zalan Bujtas.
2350
2351         Turn visual viewports on by default for WK2.
2352
2353         * Shared/WebPreferencesDefinitions.h:
2354
2355 2016-12-06  Daniel Bates  <dabates@apple.com>
2356
2357         WebKitTestRunner: Plugins are disabled in new windows
2358         https://bugs.webkit.org/show_bug.cgi?id=165410
2359
2360         Reviewed by Alex Christensen.
2361
2362         Remove SPI exposed to explicitly toggle plugins from WebKitTestRunner.
2363         Instead we will update WebKitTestRunner to make use of the SPI
2364         WKBundleOverrideBoolPreferenceForTestRunner() to toggle plugins in
2365         all windows.
2366
2367         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
2368         (WKBundleSetPluginsEnabled): Deleted.
2369         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
2370         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2371         (WebKit::InjectedBundle::setPluginsEnabled): Deleted.
2372
2373 2016-12-05  Anders Carlsson  <andersca@apple.com>
2374
2375         Don't memcpy out of line data
2376         https://bugs.webkit.org/show_bug.cgi?id=165434
2377
2378         Reviewed by Sam Weinig.
2379
2380         Change the Decoder constructor to take a buffer deallocator parameter. If the buffer deallocator is null, the
2381         data will be copied as before. Otherwise, the memory will be adopted by the Decoder object, and will be deallocated
2382         by invoking the data deallocator.
2383
2384         * Platform/IPC/Decoder.cpp:
2385         (IPC::copyBuffer):
2386         Add a new helper.
2387
2388         (IPC::Decoder::Decoder):
2389         Copy the buffer if the deallocator is null.
2390
2391         (IPC::Decoder::~Decoder):
2392         Invoke the deallocator or call fastFree if it is null.
2393
2394         (IPC::Decoder::unwrapForTesting):
2395         Update constructor.
2396         
2397         (IPC::roundUpToAlignment):
2398         (IPC::Decoder::alignBufferPosition):
2399         (IPC::Decoder::decodeVariableLengthByteArray):
2400         (IPC::decodeValueFromBuffer):
2401         Change all these to deal with const pointers.
2402
2403         * Platform/IPC/Decoder.h:
2404         Add new members.
2405
2406         * Platform/IPC/mac/ConnectionMac.mm:
2407         (IPC::createMessageDecoder):
2408         When we have out of line data, pass a deallocator that calls vm_deallocate, instead of copying the data
2409         and then immediately throwing the original away.
2410
2411 2016-12-06  Tim Horton  <timothy_horton@apple.com>
2412
2413         Almost half-second stall scrolling apple.com because of synchronous getPositionInformation
2414         https://bugs.webkit.org/show_bug.cgi?id=165403
2415         <rdar://problem/29493285>
2416
2417         Reviewed by Enrica Casucci.
2418
2419         When retrieving interaction information, we don't always need to do
2420         snapshots for 3D Touch or the action sheet, especially if we're
2421         synchronously blocking the UI process main thread waiting for the reply.
2422
2423         Add a new InteractionInformationRequest, which allows callers of
2424         getPositionInformation and requestPositionInformation to specify which
2425         optional pieces of information they would like to compute.
2426
2427         * Shared/AssistedNodeInformation.h:
2428         Fix a incorrect comment.
2429
2430         * Shared/ios/InteractionInformationRequest.cpp: Added.
2431         (WebKit::InteractionInformationRequest::encode):
2432         (WebKit::InteractionInformationRequest::decode):
2433         (WebKit::InteractionInformationRequest::isValidForRequest):
2434         * Shared/ios/InteractionInformationRequest.h: Added.
2435         (WebKit::InteractionInformationRequest::InteractionInformationRequest):
2436         * WebKit2.xcodeproj/project.pbxproj:
2437         Add InteractionInformationRequest, which encapsulates all of the
2438         parameters required to generate an InteractionInformationAtPosition.
2439         Previously, that was just a point, but now we have two new parameters:
2440         whether we should generate a snapshot of the element, and whether
2441         we should generate a TextIndicator if the element is a link.
2442
2443         * Shared/ios/InteractionInformationAtPosition.h:
2444         * Shared/ios/InteractionInformationAtPosition.mm:
2445         (WebKit::InteractionInformationAtPosition::encode):
2446         (WebKit::InteractionInformationAtPosition::decode):
2447         (WebKit::InteractionInformationAtPosition::mergeCompatibleOptionalInformation):
2448         Adopt InteractionInformationRequest.
2449
2450         * UIProcess/WebPageProxy.h:
2451         * UIProcess/ios/WebPageProxyIOS.mm:
2452         (WebKit::WebPageProxy::getPositionInformation):
2453         (WebKit::WebPageProxy::requestPositionInformation):
2454         * UIProcess/ios/WKActionSheetAssistant.mm:
2455         (-[WKActionSheetAssistant initialPresentationRectInHostViewForSheet]):
2456         (-[WKActionSheetAssistant presentationRectInHostViewForSheet]):
2457         (-[WKActionSheetAssistant showImageSheet]):
2458         (-[WKActionSheetAssistant showLinkSheet]):
2459         * UIProcess/ios/WKPDFView.mm:
2460         (-[WKPDFView annotation:isBeingPressedAtPoint:controller:]):
2461         * WebProcess/WebPage/WebPage.h:
2462         * WebProcess/WebPage/WebPage.messages.in:
2463         Adopt InteractionInformationRequest.
2464         
2465         * UIProcess/ios/WKContentViewInteraction.h:
2466         * UIProcess/ios/WKContentViewInteraction.mm:
2467         (-[WKContentView _showAttachmentSheet]):
2468         (-[WKContentView ensurePositionInformationIsUpToDate:]):
2469         If we have a outstanding asynchronous position information request
2470         for the current point, instead of sending a second separate request,
2471         just wait for the async one to come in.
2472
2473         (-[WKContentView requestAsynchronousPositionInformationUpdate:]):
2474         If asked to do an asynchronous request with more optional bits than
2475         the current otherwise-valid response's request, update the position information.
2476
2477         (-[WKContentView gestureRecognizerShouldBegin:]):
2478         The design of this mechanism is that during the highlight long press,
2479         we do an async position information update, and then when we actually
2480         begin a 3D Touch gesture, we hope to already have the requisite snapshots
2481         ready (so that we can avoid synchronously blocking for them, there).
2482         So, in the highlight long-press async request, ask for all the goodies.
2483
2484         (-[WKContentView hasSelectablePositionAtPoint:]):
2485         (-[WKContentView pointIsNearMarkedText:]):
2486         (-[WKContentView pointIsInAssistedNode:]):
2487         (-[WKContentView _didNotHandleTapAsClick:]):
2488         (-[WKContentView _positionInformationDidChange:]):
2489         If we get a position information update for the same point, but with less
2490         goodies attached (the snapshot/link indicator), copy them over from the old
2491         position information, so that we never accidentally "downgrade" our info.
2492
2493         (-[WKContentView updatePositionInformationForActionSheetAssistant:]):
2494         (-[WKContentView actionSheetAssistant:willStartInteractionWithElement:]):
2495         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
2496         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
2497         (-[WKContentView _presentedViewControllerForPreviewItemController:]):        
2498         More adoption.
2499         
2500         * WebProcess/WebPage/ios/WebPageIOS.mm:
2501         (WebKit::WebPage::handleTap):
2502         (WebKit::WebPage::handleTwoFingerTapAtPoint):
2503         (WebKit::WebPage::commitPotentialTap):
2504         Adopt InteractionInformationRequest.
2505
2506         (WebKit::WebPage::getPositionInformation):
2507         (WebKit::WebPage::requestPositionInformation):
2508         Copy the request into the response.
2509         Only snapshot if the request wants a snapshot.
2510         Only make a link indicator if the request wants one.
2511
2512 2016-12-06  Daniel Bates  <dabates@apple.com>
2513
2514         Cleanup: Rename some HTTP 0.9-specific functions to conform to WebKit Code Style Guidelines
2515         https://bugs.webkit.org/show_bug.cgi?id=165451
2516
2517         Reviewed by Alex Christensen.
2518
2519         * NetworkProcess/NetworkDataTask.cpp:
2520         (WebKit::NetworkDataTask::didReceiveResponse):
2521
2522 2016-12-06  Daniel Bates  <dabates@apple.com>
2523
2524         Remove unused InjectedBundle::overrideXSSAuditorEnabledForTestRunner()
2525         https://bugs.webkit.org/show_bug.cgi?id=165408
2526
2527         Reviewed by Alex Christensen.
2528
2529         InjectedBundle::overrideXSSAuditorEnabledForTestRunner() is unused. This function was only
2530         called by WKBundleOverrideXSSAuditorEnabledForTestRunner(), which was removed in r106005.
2531
2532         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2533         (WebKit::InjectedBundle::overrideXSSAuditorEnabledForTestRunner): Deleted.
2534         * WebProcess/InjectedBundle/InjectedBundle.h:
2535
2536 2016-12-04  Darin Adler  <darin@apple.com>
2537
2538         Use ASCIICType more, and improve it a little bit
2539         https://bugs.webkit.org/show_bug.cgi?id=165360
2540
2541         Reviewed by Sam Weinig.
2542
2543         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
2544         (WebKit::capitalizeRFC822HeaderFieldName): Removed unneeded checks to simplify code.
2545
2546 2016-12-06  Dave Hyatt  <hyatt@apple.com>
2547
2548         [CSS Parser] Turn on the new CSS parser
2549         https://bugs.webkit.org/show_bug.cgi?id=165213
2550
2551         Reviewed by Zalan Bujtas.
2552
2553         * Shared/WebPreferencesDefinitions.h:
2554
2555 2016-12-06  Tomas Popela  <tpopela@redhat.com>
2556
2557         [GTK] Process accelerated compositing env variables only if they are really enabled
2558         https://bugs.webkit.org/show_bug.cgi?id=165300
2559
2560         Don't process the WEBKIT_FORCE_COMPOSITING_MODE and
2561         WEBKIT_DISABLE_COMPOSITING_MODE env variables if they are disabled
2562         (eg. WEBKIT_DISABLE_COMPOSITING_MODE=0).
2563
2564         Reviewed by Michael Catanzaro.
2565
2566         * UIProcess/gtk/WebPreferencesGtk.cpp:
2567         (WebKit::WebPreferences::platformInitializeStore):
2568
2569 2016-12-06  Sam Weinig  <sam@webkit.org>
2570
2571         [WebIDL] Add support for converting dictionaries to JS
2572         https://bugs.webkit.org/show_bug.cgi?id=165367
2573
2574         Reviewed by Darin Adler and Alex Christensen.
2575
2576         * CMakeLists.txt:
2577         Add missing directories to look in for headers.
2578
2579 2016-12-05  Tim Horton  <timothy_horton@apple.com>
2580
2581         Try to fix the iOS Simulator build.
2582
2583         * UIProcess/mac/RemoteLayerTreeHost.mm:
2584         (WebKit::RemoteLayerTreeHost::mapAllIOSurfaceBackingStore):
2585
2586 2016-12-03  Simon Fraser  <simon.fraser@apple.com>
2587
2588         Minor reformat and renames in -didUpdateVisibleRect:
2589         https://bugs.webkit.org/show_bug.cgi?id=165365
2590
2591         Reviewed by Dave Hyatt.
2592         
2593         didUpdateVisibleRect:... has lots of parameters. Put one on each line.
2594
2595         Rename the rects to make it clear they are "content" rects (i.e. in document coordinates).
2596
2597         * UIProcess/ios/WKContentView.h:
2598         * UIProcess/ios/WKContentView.mm:
2599         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
2600
2601 2016-12-05  Tim Horton  <timothy_horton@apple.com>
2602
2603         Adopt CAMachPort-as-layer-contents
2604         https://bugs.webkit.org/show_bug.cgi?id=141687
2605         <rdar://problem/19393233>
2606
2607         Reviewed by Darin Adler.
2608
2609         * Shared/mac/RemoteLayerBackingStore.h:
2610         * Shared/mac/RemoteLayerBackingStore.mm:
2611         (WebKit::RemoteLayerBackingStore::decode):
2612         On the UI process side, instead of actually looking up the surface,
2613         just keep the MachSendRight around, to later be turned into a CAMachPort.
2614
2615         (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
2616         Make a CAMachPort and leak our send right into it. CAMachPort
2617         will adopt the port and destroy it when needed.
2618
2619         (WebKit::RemoteLayerBackingStore::setBufferVolatility):
2620         Tiny style fix.
2621
2622         * Shared/mac/RemoteLayerTreePropertyApplier.h:
2623         * Shared/mac/RemoteLayerTreePropertyApplier.mm:
2624         (WebKit::applyPropertiesToLayer):
2625         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
2626         * UIProcess/DrawingAreaProxy.h:
2627         (WebKit::DrawingAreaProxy::prepareForAppSuspension):
2628         * UIProcess/ios/WebPageProxyIOS.mm:
2629         (WebKit::WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground):
2630         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
2631         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
2632         (WebKit::RemoteLayerTreeDrawingAreaProxy::prepareForAppSuspension):
2633         * UIProcess/mac/RemoteLayerTreeHost.h:
2634         * UIProcess/mac/RemoteLayerTreeHost.mm:
2635         (WebKit::RemoteLayerTreeHost::updateLayerTree):
2636         (WebKit::RemoteLayerTreeHost::mapAllIOSurfaceBackingStore):
2637         * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
2638         (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
2639         Two supporting changes in order to fix the two regressions that this
2640         caused when we tried to land it two years ago:
2641
2642         When an app is being suspended, resolve all CAMachPort backing store
2643         into actual IOSurfaces. Otherwise, any live CAMachPorts will keep a
2644         +1 on their respective IOSurface's use count, causing us to fail to
2645         mark them volatile, keeping the app alive for more time (re-trying the
2646         volatility change), and increasing the likelihood of background jetsam.
2647
2648         If the debugging tile map is enabled, do not use CAMachPort, because
2649         we don't have a great way to plumb the same CAMachPort to two layers
2650         (and it doesn't seem to work even if you do). Instead, just map the
2651         IOSurface into the UI process like we used to.
2652
2653 2016-12-05  Dean Jackson  <dino@apple.com>
2654
2655         pointer lock needs to be feature detectable
2656         https://bugs.webkit.org/show_bug.cgi?id=165426
2657         <rdar://problem/29486715>
2658
2659         Reviewed by Antoine Quint.
2660
2661         Set the RuntimeEnabledFeature as preferences
2662         change.
2663
2664         * UIProcess/API/C/WKPreferences.cpp:
2665         (WKPreferencesSetPointerLockEnabled):
2666         (WKPreferencesGetPointerLockEnabled):
2667         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2668         * WebProcess/WebPage/WebPage.cpp:
2669         (WebKit::WebPage::updatePreferences):
2670
2671 2016-12-05  Andreas Kling  <akling@apple.com>
2672
2673         [Cocoa] Add some memory usage related information to sysdiagnose state dumps
2674         <https://webkit.org/b/165375>
2675         <rdar://problem/29057243>
2676
2677         Reviewed by Darin Adler.
2678
2679         Add two new entries to the sysdiagnose state dumps for WebContent processes:
2680         "Memory Usage Stats" and "JavaScript Object Counts".
2681
2682         The first category contains all the interesting stuff from task_info()
2683         along with some WebCore and JavaScriptCore object/memory counters.
2684
2685         The second category contains a list of all the JS object types currently live
2686         on the heap, along with a count.
2687
2688         * WebProcess/cocoa/WebProcessCocoa.mm:
2689         (WebKit::WebProcess::registerWithStateDumper): Add two new entries to the
2690         state dictionary: "Memory Usage Stats" and "JavaScript Object Counts".
2691
2692 2016-12-05  Csaba Osztrogonác  <ossy@webkit.org>
2693
2694         Unreviewed cmake buildfix after r209307.
2695
2696         * PlatformMac.cmake:
2697
2698 2016-12-03  Dan Bernstein  <mitz@apple.com>
2699
2700         [Cocoa] Expose InjectedBundlePageEditorClient via the Objective-C bundle SPI
2701         https://bugs.webkit.org/show_bug.cgi?id=165276
2702         <rdar://problem/29467040>
2703
2704         Reviewed by Darin Adler.
2705
2706         Test: TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegate.mm
2707
2708         * Shared/Cocoa/APIObject.mm:
2709         (API::Object::newObject): Wrap InjectedBundleRangeHandle in WKWebProcessPlugInRangeHandle.
2710
2711         * WebKit2.xcodeproj/project.pbxproj: Added references to new files, making
2712           WKWebProcessPlugInEditingDelegate.h and WKWebProcessPlugInRangeHandle.h private headers.
2713
2714         * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h: Added. An base class
2715           based on InjectedBundlePageEditorClient.
2716         (API::InjectedBundle::EditorClient::~EditorClient):
2717         (API::InjectedBundle::EditorClient::shouldBeginEditing):
2718         (API::InjectedBundle::EditorClient::shouldEndEditing):
2719         (API::InjectedBundle::EditorClient::shouldInsertNode):
2720         (API::InjectedBundle::EditorClient::shouldInsertText):
2721         (API::InjectedBundle::EditorClient::shouldDeleteRange):
2722         (API::InjectedBundle::EditorClient::shouldChangeSelectedRange):
2723         (API::InjectedBundle::EditorClient::shouldApplyStyle):
2724         (API::InjectedBundle::EditorClient::didBeginEditing):
2725         (API::InjectedBundle::EditorClient::didEndEditing):
2726         (API::InjectedBundle::EditorClient::didChange):
2727         (API::InjectedBundle::EditorClient::didChangeSelection):
2728         (API::InjectedBundle::EditorClient::willWriteToPasteboard):
2729         (API::InjectedBundle::EditorClient::getPasteboardDataForRange):
2730         (API::InjectedBundle::EditorClient::didWriteToPasteboard):
2731
2732         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h: Added. Declares
2733           the new delegate protocol, currently comprising three methods corresponding to
2734           willWriteToPasteboard, getPasteboardDataForRange, and didWriteToPasteboard.
2735
2736         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
2737         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
2738         (-[WKWebProcessPlugInFrame jsRangeForRangeHandle:inWorld:]): Added. Gets the JS wrapper for
2739           the specified range handle.
2740
2741         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h: Added.
2742         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm: Added.
2743         (-[WKWebProcessPlugInRangeHandle dealloc]): Call the InjectedBundleRangeHandle destructor.
2744         (+[WKWebProcessPlugInRangeHandle rangeHandleWithJSValue:inContext:]): Get or create an
2745           InjectedBundleRangeHandle for the specified object.
2746         (-[WKWebProcessPlugInRangeHandle frame]): Return the range’s owner document’s frame.
2747         (-[WKWebProcessPlugInRangeHandle _rangeHandle]): Return the InjectedBundleRangeHandle.
2748         (-[WKWebProcessPlugInRangeHandle _apiObject]): Ditto.
2749
2750         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandleInternal.h: Added.
2751         (WebKit::wrapper):
2752
2753         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2754         (WKBundlePageSetEditorClient): Updated for WebPage change.
2755
2756         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2757         (-[WKWebProcessPlugInBrowserContextController _editingDelegate]): Added. Returns the
2758           delegate.
2759         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): Added. Defines a
2760           Client class, which derives from API::InjectedBundle::EditorClient, and invokes the
2761           delegate methods. Instantiates a Client and sets it on the WebPage.
2762
2763         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
2764           Declared new _editingDelegate property.
2765
2766         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
2767         (WebKit::InjectedBundleRangeHandle::document): Added. Returns an InjectedBundleNodeHandle
2768           for the range’s owner document.
2769         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h:
2770
2771         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
2772         (WebKit::InjectedBundlePageEditorClient::InjectedBundlePageEditorClient): Added. Calls
2773           initialize().
2774         (WebKit::InjectedBundlePageEditorClient::shouldBeginEditing): Updated for type change.
2775         (WebKit::InjectedBundlePageEditorClient::shouldEndEditing): Ditto.
2776         (WebKit::InjectedBundlePageEditorClient::shouldInsertNode): Ditto.
2777         (WebKit::InjectedBundlePageEditorClient::shouldInsertText): Ditto.
2778         (WebKit::InjectedBundlePageEditorClient::shouldDeleteRange): Ditto.
2779         (WebKit::InjectedBundlePageEditorClient::shouldChangeSelectedRange): Ditto.
2780         (WebKit::InjectedBundlePageEditorClient::shouldApplyStyle): Ditto.
2781         (WebKit::InjectedBundlePageEditorClient::didBeginEditing): Ditto.
2782         (WebKit::InjectedBundlePageEditorClient::didEndEditing): Ditto.
2783         (WebKit::InjectedBundlePageEditorClient::didChange): Ditto.
2784         (WebKit::InjectedBundlePageEditorClient::didChangeSelection): Ditto.
2785         (WebKit::InjectedBundlePageEditorClient::willWriteToPasteboard): Ditto.
2786         (WebKit::InjectedBundlePageEditorClient::getPasteboardDataForRange): Ditto.
2787         (WebKit::InjectedBundlePageEditorClient::didWriteToPasteboard): Ditto.
2788         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: Now derives from
2789           API::InjectedBundle::EditorClient.
2790
2791         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
2792         (WebKit::WebEditorClient::shouldDeleteRange): Ditto.
2793         (WebKit::WebEditorClient::shouldBeginEditing): Ditto.
2794         (WebKit::WebEditorClient::shouldEndEditing): Ditto.
2795         (WebKit::WebEditorClient::shouldInsertNode): Ditto.
2796         (WebKit::WebEditorClient::shouldInsertText): Ditto.
2797         (WebKit::WebEditorClient::shouldChangeSelectedRange): Ditto.
2798         (WebKit::WebEditorClient::shouldApplyStyle): Ditto.
2799         (WebKit::WebEditorClient::didBeginEditing): Ditto.
2800         (WebKit::WebEditorClient::respondToChangedContents): Ditto.
2801         (WebKit::WebEditorClient::respondToChangedSelection): Ditto.
2802         (WebKit::WebEditorClient::didEndEditing): Ditto.
2803         (WebKit::WebEditorClient::didWriteSelectionToPasteboard): Ditto.
2804         (WebKit::WebEditorClient::willWriteSelectionToPasteboard): Ditto.
2805         (WebKit::WebEditorClient::getClientPasteboardDataForRange): Ditto.
2806
2807         * WebProcess/WebPage/WebPage.cpp:
2808         (WebKit::WebPage::WebPage): Initialize m_editorClient.
2809         (WebKit::WebPage::setInjectedBundleEditorClient): Replaces
2810           initializeInjectedBundleEditorClient and just sets m_editorClient.
2811         (WebKit::WebPage::close): Resets m_editorClient.
2812
2813         * WebProcess/WebPage/WebPage.h: Changed m_editorClient to a unique_ptr.
2814
2815 2016-12-02  Said Abou-Hallawa  <sabouhallawa@apple.com>
2816
2817         [iOS] Add a WebView private configuration for changing the WebContent update frequency
2818         https://bugs.webkit.org/show_bug.cgi?id=165289
2819         <rdar://problem/29472577>
2820
2821         Reviewed by Tim Horton.
2822         
2823         Expose a preference which allows us to control the fps of web content updates.
2824
2825         * UIProcess/API/APIPageConfiguration.h:
2826         (API::PageConfiguration::contentUpdateFrequency):
2827         (API::PageConfiguration::setContentUpdateFrequency):
2828         * UIProcess/API/Cocoa/WKWebView.mm:
2829         (-[WKWebView _initializeWithConfiguration:]):
2830         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2831         (-[WKWebViewConfiguration copyWithZone:]):
2832         (-[WKWebViewConfiguration _contentUpdateFrequency]):
2833         (-[WKWebViewConfiguration _setContentUpdateFrequency:]):
2834         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2835         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
2836         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
2837         (-[WKOneShotDisplayLinkHandler initWithDrawingAreaProxy:]):
2838         (WebKit::RemoteLayerTreeDrawingAreaProxy::contentUpdateFrequency):
2839
2840 2016-12-02  Andy Estes  <aestes@apple.com>
2841
2842         [Cocoa] Adopt the PRODUCT_BUNDLE_IDENTIFIER build setting
2843         https://bugs.webkit.org/show_bug.cgi?id=164492
2844
2845         Reviewed by Dan Bernstein.
2846
2847         * Configurations/DatabaseService.xcconfig: Set PRODUCT_BUNDLE_IDENTIFIER to
2848         $(PRODUCT_NAME).
2849         * Configurations/NetworkService.xcconfig: Ditto.
2850         * Configurations/PluginService.32.xcconfig: Ditto.
2851         * Configurations/PluginService.64.xcconfig: Ditto.
2852         * Configurations/WebContentService.xcconfig: Ditto.
2853         * Configurations/WebKit.xcconfig: Set PRODUCT_BUNDLE_IDENTIFIER to
2854         com.apple.$(PRODUCT_NAME:rfc1034identifier).
2855         * DatabaseProcess/EntryPoint/mac/XPCService/DatabaseService/Info.plist: Changed
2856         CFBundleIdentifier's value from ${PRODUCT_NAME} to ${PRODUCT_BUNDLE_IDENTIFIER}.
2857         * Info.plist: Changed CFBundleIdentifier's value from com.apple.${PRODUCT_NAME} to
2858         ${PRODUCT_BUNDLE_IDENTIFIER}.
2859         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX-10.9-10.10.plist: Changed
2860         CFBundleIdentifier's value from ${PRODUCT_NAME} to ${PRODUCT_BUNDLE_IDENTIFIER}.
2861         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX.plist: Ditto.
2862         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-iOS.plist: Ditto.
2863         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64-10.9-10.10.Info.plist: Ditto.
2864         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist: Ditto.
2865         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX-10.9-10.10.plist: Ditto.
2866         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist: Ditto.
2867         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist: Ditto.
2868
2869 2016-12-02  Brent Fulgham  <bfulgham@apple.com>
2870
2871         [Mac] Update sandbox profiles to use modern syntax and avoid duplication
2872         https://bugs.webkit.org/show_bug.cgi?id=165332
2873         <rdar://problem/26898991>
2874
2875         Reviewed by Anders Carlsson.
2876
2877         Update the Mac sandbox profiles to reflect that modern Cocoa applications
2878         communicate with cfprefsd, rather than plists on disk (and have done so
2879         for the past several releases).
2880
2881         Get rid of some duplicated rules, as well as old compatibility rules that
2882         are never triggered under supported operating systems.
2883
2884         * DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in:
2885         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2886         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
2887         * WebProcess/com.apple.WebProcess.sb.in:
2888
2889 2016-12-02  Gustavo Sverzut Barbieri  <barbieri@profusion.mobi>
2890
2891         Fix build break when disabling some features.
2892         https://bugs.webkit.org/show_bug.cgi?id=165254
2893
2894         The EFL port was broken if SPELLCHECK was disabled or
2895         PLUGIN_ARCHITECTURE is not x11.
2896
2897         Reviewed by Michael Catanzaro.
2898
2899         * UIProcess/efl/TextCheckerEfl.cpp:
2900         (WebKit::TextChecker::checkTextOfParagraph):
2901         (WebKit::TextChecker::checkSpellingOfString):
2902         Fix UNUSED_PARAM() usage if SPELLCHECK is disabled.
2903         * UIProcess/efl/WebPageProxyEfl.cpp:
2904         Isolate methods within #if PLUGIN_ARCHITECTURE(X11).
2905
2906 2016-12-01  Jiewen Tan  <jiewen_tan@apple.com>
2907
2908         Add a runtime flag for SubtleCrypto
2909         https://bugs.webkit.org/show_bug.cgi?id=164982
2910
2911         Reviewed by Brent Fulgham.
2912
2913         * Shared/WebPreferencesDefinitions.h:
2914         * UIProcess/API/C/WKPreferences.cpp:
2915         (WKPreferencesSetSubtleCryptoEnabled):
2916         (WKPreferencesGetSubtleCryptoEnabled):
2917         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2918         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2919         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2920         * WebProcess/WebPage/WebPage.cpp:
2921         (WebKit::WebPage::updatePreferences):
2922
2923 2016-12-01  Saam Barati  <sbarati@apple.com>
2924
2925         Rename CallFrame::callee() to CallFrame::jsCallee()
2926         https://bugs.webkit.org/show_bug.cgi?id=165293
2927
2928         Reviewed by Keith Miller.
2929
2930         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
2931         (WebKit::callMethod):
2932         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
2933         (WebKit::callNPJSObject):
2934         (WebKit::constructWithConstructor):
2935
2936 2016-12-01  Chris Dumez  <cdumez@apple.com>
2937
2938         [iOS][WK2] Tapping an element generates a 'click' event that has 0 as timeStamp
2939         https://bugs.webkit.org/show_bug.cgi?id=165270
2940         <rdar://problem/29224355>
2941
2942         Reviewed by Simon Fraser.
2943
2944         Tapping an element generates a 'click' event that has 0 as timeStamp
2945         instead of having a proper timeStamp value. This is breaking some
2946         sites.
2947
2948         * WebProcess/WebPage/ios/WebPageIOS.mm:
2949         (WebKit::WebPage::handleSyntheticClick):
2950         (WebKit::WebPage::completeSyntheticClick):
2951
2952 2016-12-01  Tim Horton  <timothy_horton@apple.com>
2953
2954         Try to fix the EFL/Gtk build
2955
2956         * UIProcess/efl/WebProcessPoolEfl.cpp:
2957         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
2958         * UIProcess/gtk/WebProcessPoolGtk.cpp:
2959         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
2960
2961 2016-12-01  Tim Horton  <timothy_horton@apple.com>
2962
2963         Every WKWebView initialization spends a few milliseconds hitting the disk
2964         https://bugs.webkit.org/show_bug.cgi?id=165268
2965         <rdar://problem/29010113>
2966
2967         Reviewed by Brady Eidson.
2968
2969         Every WKWebView init currently involves doing directory creation and
2970         symlink resolution for a number of paths (to create sandbox extensions
2971         for all of our storage directories), which means touching the disk a
2972         lot during init. All of these paths are immutable per-WebProcessPool,
2973         so, instead, cache them on WebProcessPool and create sandbox extensions
2974         from the already-resolved paths. This is a sizable (~4x) speedup when
2975         initializing subsequent web views.
2976
2977         * Shared/SandboxExtension.h:
2978         (WebKit::SandboxExtension::createHandleWithoutResolvingPath):
2979         Add createHandleWithoutResolvingPath, which makes a sandbox extension
2980         handle without doing symlink resolution.
2981
2982         (WebKit::resolvePathForSandboxExtension):
2983         (WebKit::resolveAndCreateReadWriteDirectoryForSandboxExtension):
2984         Add two functions that do the same resolution that SandboxExtension::createHandle
2985         and ::createHandleForReadWriteDirectory do, but just return the paths,
2986         for later use with createHandleWithoutResolvingPath.
2987
2988         * Shared/mac/SandboxExtensionMac.mm:
2989         (WebKit::resolveAndCreateReadWriteDirectoryForSandboxExtension):
2990         (WebKit::resolvePathForSandboxExtension):
2991         (WebKit::SandboxExtension::createHandleWithoutResolvingPath):
2992         (WebKit::SandboxExtension::createHandle):
2993         (WebKit::SandboxExtension::createHandleForReadWriteDirectory):
2994         Implement the aforementioned functions, and reimplement the existing
2995         createHandle{ForReadWriteDirectory} functions in terms of them.
2996
2997         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2998         (WebKit::WebProcessPool::platformDefaultIconDatabasePath):
2999         Stop wasting time generating and resolving a platform default icon
3000         database path, since we don't actually use it for anything anymore except
3001         to determine whether the icon database is enabled, and we only want to
3002         enable it if the client has provided a path.
3003
3004         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
3005         (WebKit::WebProcessPool::platformInitializeWebProcess):
3006         * UIProcess/WebProcessPool.cpp:
3007         (WebKit::m_hiddenPageThrottlingTimer):
3008         (WebKit::WebProcessPool::resolvePathsForSandboxExtensions):
3009         (WebKit::WebProcessPool::createNewWebProcess):
3010         * UIProcess/WebProcessPool.h:
3011         Resolve paths in resolvePathsForSandboxExtensions, and use the resolved
3012         paths along with createHandleWithoutResolvingPath in order to effectively
3013         cache the resolution operation.
3014
3015 2016-12-01  Antti Koivisto  <antti@apple.com>
3016
3017         Revert r208931
3018         https://bugs.webkit.org/show_bug.cgi?id=164924
3019
3020         PLT regression.
3021
3022         * NetworkProcess/cache/NetworkCache.cpp:
3023         (WebKit::NetworkCache::makeCacheKey):
3024         (WebKit::NetworkCache::Cache::makeCacheKey): Deleted.
3025         * NetworkProcess/cache/NetworkCache.h:
3026         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
3027         (WebKit::NetworkCache::BlobStorage::BlobStorage):
3028         (WebKit::NetworkCache::BlobStorage::add):
3029         (WebKit::NetworkCache::BlobStorage::get):
3030         * NetworkProcess/cache/NetworkCacheBlobStorage.h:
3031         * NetworkProcess/cache/NetworkCacheData.cpp:
3032         (WebKit::NetworkCache::computeSHA1):
3033         (WebKit::NetworkCache::makeSalt): Deleted.
3034         (WebKit::NetworkCache::readOrMakeSalt): Deleted.
3035         * NetworkProcess/cache/NetworkCacheData.h:
3036         * NetworkProcess/cache/NetworkCacheKey.cpp:
3037         (WebKit::NetworkCache::noPartitionString):
3038         (WebKit::NetworkCache::Key::Key):
3039         (WebKit::NetworkCache::Key::hasPartition):
3040         (WebKit::NetworkCache::Key::computeHash):
3041         (WebKit::NetworkCache::Key::hashAsString):
3042         (WebKit::NetworkCache::Key::computePartitionHash): Deleted.
3043         * NetworkProcess/cache/NetworkCacheKey.h:
3044         (WebKit::NetworkCache::Key::hash):
3045         (WebKit::NetworkCache::Key::partitionHash): Deleted.
3046         (WebKit::NetworkCache::Key::hashAsString): Deleted.
3047         (WebKit::NetworkCache::Key::partitionHashAsString): Deleted.
3048         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
3049         (WebKit::NetworkCache::makeSubresourcesKey):
3050         (WebKit::NetworkCache::constructRevalidationRequest):
3051         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady):
3052         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
3053         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3054         (WebKit::NetworkCache::Storage::open):
3055         (WebKit::NetworkCache::traverseRecordsFiles):
3056         (WebKit::NetworkCache::Storage::Storage):
3057         (WebKit::NetworkCache::Storage::recordDirectoryPathForKey):
3058         (WebKit::NetworkCache::decodeRecordHeader):
3059         (WebKit::NetworkCache::Storage::readRecord):
3060         (WebKit::NetworkCache::Storage::encodeRecord):
3061         (WebKit::NetworkCache::Storage::traverse):
3062         (WebKit::NetworkCache::makeSaltFilePath): Deleted.
3063         * NetworkProcess/cache/NetworkCacheStorage.h:
3064         (WebKit::NetworkCache::Storage::salt): Deleted.
3065
3066 2016-11-30  Sam Weinig  <sam@webkit.org>
3067
3068         [WebIDL] Remove custom bindings for File and Blob constructors
3069         https://bugs.webkit.org/show_bug.cgi?id=165218
3070
3071         Reviewed by Darin Adler.
3072
3073         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
3074         (WebKit::NetworkBlobRegistry::registerBlobURL):
3075         * NetworkProcess/FileAPI/NetworkBlobRegistry.h:
3076         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3077         (WebKit::NetworkConnectionToWebProcess::registerBlobURL):
3078         * NetworkProcess/NetworkConnectionToWebProcess.h:
3079         * WebProcess/FileAPI/BlobRegistryProxy.cpp:
3080         (WebKit::BlobRegistryProxy::registerBlobURL):
3081         * WebProcess/FileAPI/BlobRegistryProxy.h:
3082         Avoid copies of the BlobPart Vector.
3083
3084 2016-11-30  Carlos Garcia Campos  <cgarcia@igalia.com>
3085
3086         [GTK] UI process crash in WebKit::WaylandCompositor::Surface::prepareTextureForPainting
3087         https://bugs.webkit.org/show_bug.cgi?id=164911
3088
3089         Reviewed by Michael Catanzaro.
3090
3091         The problem is that m_buffer is nullptr in Surface::prepareTextureForPainting() even though we have already an
3092         image. We only use the buffer to get the image size, so we could save the image size when the image is created,
3093         and then we don't need to care about the buffer anymore.
3094
3095         * UIProcess/gtk/WaylandCompositor.cpp:
3096         (WebKit::WaylandCompositor::Surface::prepareTextureForPainting):
3097         (WebKit::WaylandCompositor::Surface::commit):
3098         * UIProcess/gtk/WaylandCompositor.h:
3099
3100 2016-11-30  Antoine Quint  <graouts@apple.com>
3101
3102         [Modern Media Controls] Add an HTML comment flag to turn the feature on
3103         https://bugs.webkit.org/show_bug.cgi?id=165226
3104
3105         Reviewed by Dean Jackson.
3106
3107         Add new methods to set the Modern Media Controls preference.
3108
3109         * UIProcess/API/C/WKPreferences.cpp:
3110         (WKPreferencesSetModernMediaControlsEnabled):
3111         (WKPreferencesGetModernMediaControlsEnabled):
3112         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3113
3114 2016-11-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
3115
3116         Add separate settings and preferences to enable/disable async decoding for large images and animated images
3117         https://bugs.webkit.org/show_bug.cgi?id=165177
3118
3119         Reviewed by Simon Fraser.
3120         
3121         Hook up the async image decoding settings for WebKit2.
3122
3123         * Shared/WebPreferencesDefinitions.h:
3124         * UIProcess/API/Cocoa/WKPreferences.mm:
3125         (-[WKPreferences _largeImageAsyncDecodingEnabled]):
3126         (-[WKPreferences _setLargeImageAsyncDecodingEnabled:]):
3127         (-[WKPreferences _animatedImageAsyncDecodingEnabled]):
3128         (-[WKPreferences _setAnimatedImageAsyncDecodingEnabled:]):
3129         (-[WKPreferences _asyncImageDecodingEnabled]): Deleted.
3130         (-[WKPreferences _setAsyncImageDecodingEnabled:]): Deleted.
3131         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3132         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3133         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3134         * WebProcess/WebPage/WebPage.cpp:
3135         (WebKit::WebPage::updatePreferences):
3136
3137 2016-11-30  Chris Dumez  <cdumez@apple.com>
3138
3139         [iOS][WK2] Turn on HTML interactive form validation feature
3140         https://bugs.webkit.org/show_bug.cgi?id=165212
3141         <rdar://problem/29444356>
3142
3143         Reviewed by Simon Fraser.
3144
3145         Turn on HTML interactive form validation feature on iOS WK2
3146         now that we have a native UI.
3147
3148         * Shared/WebPreferencesDefinitions.h:
3149
3150 2016-11-30  Brent Fulgham  <bfulgham@apple.com>
3151
3152         Correct plugin sandbox after r208611
3153         https://bugs.webkit.org/show_bug.cgi?id=165187
3154         <rdar://problem/29431165>
3155
3156         Reviewed by Alex Christensen.
3157
3158         In r208611 I removed the 'else' clause of a Scheme conditional
3159         that was needed to properly run plugins (such as Flash Player).
3160
3161         This change retains the relevant current sandbox content, while
3162         still stripping out the old code that is no longer needed.
3163
3164         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
3165
3166 2016-11-29  Carlos Garcia Campos  <cgarcia@igalia.com>
3167
3168         [GTK] Database process should not initialize gtk
3169         https://bugs.webkit.org/show_bug.cgi?id=165138
3170
3171         Reviewed by Sergio Villar Senin.
3172
3173         It doesn't use GTK+ at all.
3174
3175         * DatabaseProcess/gtk/DatabaseProcessMainGtk.cpp:
3176         (WebKit::DatabaseProcessMainUnix):
3177         (): Deleted.
3178
3179 2016-11-29  Gavin Barraclough  <barraclough@apple.com>
3180
3181         Remove WebPage::SetPageSuppressed
3182         https://bugs.webkit.org/show_bug.cgi?id=165158
3183
3184         Unreviewed revert accidental change.
3185
3186         * WebProcess/WebPage/WebPage.cpp:
3187         (WebKit::WebPage::setActivityState):
3188
3189 2016-11-29  Gavin Barraclough  <barraclough@apple.com>
3190
3191         Remove WebPage::SetPageSuppressed
3192         https://bugs.webkit.org/show_bug.cgi?id=165158
3193
3194         Reviewed by Tim Horton.
3195
3196         This was scaffolding. We've now refactored to the point that the information driving throttling originates
3197         from the UI process (so UI and web processes can have a consistent view of what should throttle), but we
3198         don't need a separate message to handle this - necessary state to determine is provided in ActivityState.
3199
3200         * UIProcess/WebPageProxy.cpp:
3201         (WebKit::WebPageProxy::updateThrottleState):
3202             - used to send SetPageSuppressed; no longer does.
3203         * UIProcess/WebPageProxy.h:
3204             - removed m_pageSuppressed (was used to avoid duplicated messages).
3205         * WebProcess/WebPage/WebPage.cpp:
3206         (WebKit::WebPage::updateThrottleState):
3207             - compute throttle state based on m_activityState.
3208         (WebKit::WebPage::setActivityState):
3209             - update throttle state whenever activity state changes.
3210         (WebKit::WebPage::updatePreferences):
3211             - update throttle state whenever preferences change (throttling can be disabled via preference).
3212         (WebKit::WebPage::setPageSuppressed): Deleted.
3213             - Removed WebPage::SetPageSuppressed.
3214         * WebProcess/WebPage/WebPage.h:
3215             - Removed WebPage::SetPageSuppressed.
3216             - Added m_processSuppressionEnabled, to cache preference state.
3217         * WebProcess/WebPage/WebPage.messages.in:
3218             - Removed WebPage::SetPageSuppressed.
3219
3220 2016-11-29  Andy Estes  <aestes@apple.com>
3221
3222         [Cocoa] Enable two clang warnings recommended by Xcode
3223         https://bugs.webkit.org/show_bug.cgi?id=164498
3224
3225         Reviewed by Mark Lam.
3226
3227         * Configurations/Base.xcconfig: Enabled CLANG_WARN_INFINITE_RECURSION and CLANG_WARN_SUSPICIOUS_MOVE.
3228
3229 2016-11-29  Eric Carlson  <eric.carlson@apple.com>
3230
3231         [MediaStream] Don't request user permission for a device if it has already been granted in the current browsing context
3232         https://bugs.webkit.org/show_bug.cgi?id=164760
3233         <rdar://problem/29261266>
3234
3235         Reviewed by Youenn Fablet.
3236
3237         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3238         (WebKit::FrameAuthorizationState::FrameAuthorizationState):
3239         (WebKit::FrameAuthorizationState::hasPermissionToUseCaptureDevice):
3240         (WebKit::FrameAuthorizationState::setHasPermissionToUseCaptureDevice):
3241         (WebKit::FrameAuthorizationState::reset):
3242         (WebKit::FrameAuthorizationState::securityOriginsAreEqual):
3243         (WebKit::UserMediaPermissionRequestManagerProxy::stateForRequest):
3244         (WebKit::UserMediaPermissionRequestManagerProxy::invalidateRequests):
3245         (WebKit::UserMediaPermissionRequestManagerProxy::createRequest):
3246         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
3247         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
3248         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
3249         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
3250         (WebKit::FrameAuthorizationState::~FrameAuthorizationState):
3251         (WebKit::FrameAuthorizationState::frameID):
3252         * UIProcess/UserMediaPermissionRequestProxy.cpp:
3253         (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
3254         * UIProcess/UserMediaPermissionRequestProxy.h:
3255         (WebKit::UserMediaPermissionRequestProxy::create):
3256         (WebKit::UserMediaPermissionRequestProxy::frameID):
3257         (WebKit::UserMediaPermissionRequestProxy::userMediaDocumentSecurityOrigin):
3258         (WebKit::UserMediaPermissionRequestProxy::topLevelDocumentSecurityOrigin):
3259         * UIProcess/WebPageProxy.cpp:
3260         (WebKit::WebPageProxy::didCommitLoadForFrame):
3261         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
3262         (WebKit::UserMediaPermissionRequestManager::removeMediaRequestFromMaps):
3263
3264 2016-11-29  Wenson Hsieh  <wenson_hsieh@apple.com>
3265
3266         Scroll snapping on Mac should use AppKit animations
3267         https://bugs.webkit.org/show_bug.cgi?id=147261
3268         <rdar://problem/29395293>
3269
3270         Reviewed by Brent Fulgham.
3271
3272         Add some logic to plumb filtered wheel velocity over to WebCore in the case of mainframe scrolling. See
3273         WebCore/ChangeLog for more details.
3274
3275         * WebProcess/WebPage/EventDispatcher.cpp:
3276         (WebKit::EventDispatcher::wheelEvent):
3277
3278 2016-11-21  Brian Burg  <bburg@apple.com>
3279
3280         Web Automation: add ObjC SPI to set whether a page is controlled by automation
3281         https://bugs.webkit.org/show_bug.cgi?id=165001
3282         <rdar://problem/29350432>
3283
3284         Reviewed by Dan Bernstein.
3285
3286         Add SPI property to WKWebViewConfiguration and plumb it through to
3287         initialize WebPageProxy::m_controlledByAutomation. This is propagated
3288         to the WebProcess on creation via WebPageCreationParameters.
3289
3290         * UIProcess/API/APIPageConfiguration.cpp:
3291         (API::PageConfiguration::copy):
3292         * UIProcess/API/APIPageConfiguration.h:
3293         (API::PageConfiguration::isControlledByAutomation):
3294         (API::PageConfiguration::setControlledByAutomation):
3295         * UIProcess/API/Cocoa/WKWebView.mm:
3296         (-[WKWebView _initializeWithConfiguration:]):
3297         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3298         (-[WKWebViewConfiguration init]):
3299         (-[WKWebViewConfiguration copyWithZone:]):
3300         (-[WKWebViewConfiguration _isControlledByAutomation]):
3301         (-[WKWebViewConfiguration _setControlledByAutomation:]):
3302         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
3303         * UIProcess/WebPageProxy.cpp:
3304         (WebKit::WebPageProxy::WebPageProxy):
3305
3306 2016-11-28  Carlos Garcia Campos  <cgarcia@igalia.com>
3307
3308         [GTK] BadDamage X Window System error in WebKit::AcceleratedBackingStoreX11::update when called from WebPageProxy::exitAcceleratedCompositingMode
3309         https://bugs.webkit.org/show_bug.cgi?id=164303
3310
3311         Reviewed by Michael Catanzaro.
3312
3313         Trap also BadDrawable and BadDamage X errors when creating the surface and damage.
3314
3315         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
3316         (WebKit::AcceleratedBackingStoreX11::update):
3317
3318 2016-11-28  Chris Dumez  <cdumez@apple.com>
3319
3320         [Mac][WK2] Enable HTML interactive form validation
3321         https://bugs.webkit.org/show_bug.cgi?id=165123
3322         <rdar://problem/28944652>
3323
3324         Reviewed by Simon Fraser.
3325
3326         Enable HTML interactive form validation now that we have a native UI
3327         for it.
3328
3329         * Shared/WebPreferencesDefinitions.h:
3330
3331 2016-11-28  Brent Fulgham  <bfulgham@apple.com>
3332
3333         Generated sandbox profile is not being put in the correct Resources directory
3334         https://bugs.webkit.org/show_bug.cgi?id=165126
3335
3336         Reviewed by Tim Horton.
3337
3338         * WebKit2.xcodeproj/project.pbxproj: Copy the generated file to the 'PlugInSandboxProfiles'
3339         sub-directory.
3340
3341 2016-11-28  Ryan Haddad  <ryanhaddad@apple.com>
3342
3343         Unreviewed, rolling out r209008.
3344
3345         This change appears to have caused two fast/mediastrem
3346         LayoutTests to fail.
3347
3348         Reverted changeset:
3349
3350         "[MediaStream] Don't request user permission for a device if
3351         it has already been granted in the current browsing context"
3352         https://bugs.webkit.org/show_bug.cgi?id=164760
3353         http://trac.webkit.org/changeset/209008
3354
3355 2016-11-28  Andrew Gold  <agold@apple.com>
3356
3357         Support for HTML Media Capture API
3358         https://bugs.webkit.org/show_bug.cgi?id=43239
3359
3360         Reviewed by Tim Horton.
3361
3362         In order to enable media capture on iOS, we must first use the AVFoundation API to 
3363         check/request capture permission from the user for Safari. Then, Safari must request
3364         permission on behalf of the webpage to use the capture devices. Additionally, Safari
3365         must present UI when the capture is taking place, so WebKit needs to notify the client
3366         of a capture session beginning and ending. To do this, we added four methods to 
3367         WKUIDelegatePrivate to request permission from the user, check for permissions, notify
3368         that a capture session has begun, and notify that a capture session has ended. Additionally,
3369         we added a private method to WKWebView that allows the client to stop a capture session.
3370
3371         * UIProcess/API/APIUIClient.h:
3372         (API::UIClient::didBeginCaptureSession): Notifies the client of a capture session beginning.
3373         (API::UIClient::didEndCaptureSession): Notifies the client of a capture session ending.
3374
3375         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Added new delegate methods to request permission,
3376         check for permission, notify of a capture session beginning, and notify of a capture session
3377         ending.
3378
3379         * UIProcess/API/Cocoa/WKWebView.mm:
3380         (-[WKWebView _stopMediaCapture]): Cancels a media capture session.
3381         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3382
3383         * UIProcess/Cocoa/UIDelegate.h:
3384         * UIProcess/Cocoa/UIDelegate.mm:
3385         (WebKit::UIDelegate::setDelegate): Added the new delegate methods.
3386         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
3387         First checks if the user has authorized the client application access capture devices,
3388         then uses the WKUIDelegate to request permission for a site from the user.
3389         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin): Checks the client
3390         for permission to access capture devices.
3391         (WebKit::UIDelegate::UIClient::didBeginCaptureSession): Notifies the client of a capture
3392         session beginning.
3393         (WebKit::UIDelegate::UIClient::didEndCaptureSession): Notifies the client of a capture
3394         session ending.
3395
3396         * UIProcess/WebPageProxy.cpp:
3397         (WebKit::WebPageProxy::isPlayingMediaDidChange): Calls UIDelegate method to notify the
3398         client of a capture session beginning/ending.
3399
3400 2016-11-28  Eric Carlson  <eric.carlson@apple.com>
3401
3402         [MediaStream] Don't request user permission for a device if it has already been granted in the current browsing context
3403         https://bugs.webkit.org/show_bug.cgi?id=164760
3404         <rdar://problem/29261266>
3405
3406         Reviewed by Youenn Fablet.
3407
3408         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3409         (WebKit::FrameAuthorizationState::FrameAuthorizationState):
3410         (WebKit::FrameAuthorizationState::hasPermissionToUseCaptureDevice):
3411         (WebKit::FrameAuthorizationState::setHasPermissionToUseCaptureDevice):
3412         (WebKit::FrameAuthorizationState::reset):
3413         (WebKit::FrameAuthorizationState::securityOriginsAreEqual):
3414         (WebKit::UserMediaPermissionRequestManagerProxy::stateForRequest):
3415         (WebKit::UserMediaPermissionRequestManagerProxy::invalidateRequests):
3416         (WebKit::UserMediaPermissionRequestManagerProxy::createRequest):
3417         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
3418         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
3419         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
3420         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
3421         (WebKit::FrameAuthorizationState::~FrameAuthorizationState):
3422         (WebKit::FrameAuthorizationState::frameID):
3423         * UIProcess/UserMediaPermissionRequestProxy.cpp:
3424         (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
3425         * UIProcess/UserMediaPermissionRequestProxy.h:
3426         (WebKit::UserMediaPermissionRequestProxy::create):
3427         (WebKit::UserMediaPermissionRequestProxy::frameID):
3428         (WebKit::UserMediaPermissionRequestProxy::userMediaDocumentSecurityOrigin):
3429         (WebKit::UserMediaPermissionRequestProxy::topLevelDocumentSecurityOrigin):
3430         * UIProcess/WebPageProxy.cpp:
3431         (WebKit::WebPageProxy::didCommitLoadForFrame):
3432         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
3433         (WebKit::UserMediaPermissionRequestManager::removeMediaRequestFromMaps):
3434
3435 2016-11-27  Dean Jackson  <dino@apple.com>
3436
3437         Removed a WTFLogAlways I left in with a recent commit.
3438
3439         * UIProcess/Cocoa/WebViewImpl.mm:
3440         (-[WKAccessibilitySettingsObserver _settingsDidChange:]):
3441
3442 2016-11-27  Csaba Osztrogonác  <ossy@webkit.org>
3443
3444         Fix unused-private-field build warning in WebKit2/Platform/SharedMemory.h
3445         https://bugs.webkit.org/show_bug.cgi?id=165069
3446
3447         Reviewed by Darin Adler.
3448
3449         * Platform/SharedMemory.h:
3450
3451 2016-11-26  Simon Fraser  <simon.fraser@apple.com>
3452
3453         Fix the iOS build.
3454
3455         * WebProcess/WebPage/ios/WebPageIOS.mm:
3456         (WebKit::WebPage::eventThrottlingDelay):
3457
3458 2016-11-26  Yusuke Suzuki  <utatane.tea@gmail.com>
3459
3460         [WTF] Import std::optional reference implementation as WTF::Optional
3461         https://bugs.webkit.org/show_bug.cgi?id=164199
3462
3463         Reviewed by Saam Barati and Sam Weinig.
3464