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