Make PluginData cache its web visible plugins
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-04-20  Youenn Fablet  <youenn@apple.com>
2
3         Make PluginData cache its web visible plugins
4         https://bugs.webkit.org/show_bug.cgi?id=184421
5
6         Reviewed by Chris Dumez.
7
8         Buffer visible plugins until the page URL changes.
9         For that purpose, we now cache the visible plugins and the URL it was computed from in PluginData.
10
11         Update plugin info provider API to pass the URL used to check for plugin visibility.
12
13         No observable change of behavior.
14
15         * loader/EmptyClients.cpp:
16         * plugins/PluginData.cpp:
17         (WebCore::PluginData::webVisiblePlugins const):
18         (WebCore::PluginData::publiclyVisiblePlugins const):
19         (WebCore::PluginData::supportsMimeType const):
20         * plugins/PluginData.h:
21         * plugins/PluginInfoProvider.h:
22
23 2018-04-20  Chris Dumez  <cdumez@apple.com>
24
25         Unreviewed build fix after r230840.
26
27         * bindings/js/JSWindowProxy.cpp:
28         (WebCore::JSWindowProxy::attachDebugger):
29
30 2018-04-20  Chris Dumez  <cdumez@apple.com>
31
32         Unreviewed attempt to fix the Windows build after r230831.
33
34         * bindings/js/JSWindowProxy.cpp:
35         (WebCore::JSWindowProxy::create):
36         (WebCore::JSWindowProxy::attachDebugger):
37
38 2018-04-20  Chris Nardi  <cnardi@chromium.org>
39
40         Omit default value when serializing font-feature-settings
41         https://bugs.webkit.org/show_bug.cgi?id=182382
42
43         Reviewed by Myles C. Maxfield.
44
45         According to the shortest-serialization principle [1], values should be omitted if their omission
46         wouldn't change the value of reparsing. As "1"/"on" is the default value for font-feature-settings,
47         omit this when serializing, matching the behavior of Firefox and Chrome.
48
49         [1]: https://github.com/w3c/csswg-drafts/issues/1564
50
51         Updated css3/font-feature-settings-parsing.html, fast/css/inherited-properties-rare-text.html,
52         and fast/text/font-face-javascript.html.
53
54         * css/CSSFontFeatureValue.cpp:
55         (WebCore::CSSFontFeatureValue::customCSSText const):
56
57 2018-04-19  Alexey Proskuryakov  <ap@apple.com>
58
59         More WK_ALTERNATE_FRAMEWORKS_DIR adoption in WebCore
60         https://bugs.webkit.org/show_bug.cgi?id=184805
61
62         Reviewed by Dan Bernstein.
63
64         * Configurations/WebCoreTestShim.xcconfig:
65         * Configurations/WebCoreTestSupport.xcconfig:
66
67 2018-04-19  Brady Eidson  <beidson@apple.com>
68
69         Make back forward cache work with process swapping.
70         <rdar://problem/38676604> and https://bugs.webkit.org/show_bug.cgi?id=184793
71
72         Reviewed by Chris Dumez.
73
74         Covered by API tests.
75
76         * loader/FrameLoader.cpp:
77         (WebCore::FrameLoader::loadWithNavigationAction):
78         (WebCore::FrameLoader::load):
79         (WebCore::FrameLoader::loadWithDocumentLoader):
80         (WebCore::FrameLoader::reloadWithOverrideEncoding):
81         (WebCore::FrameLoader::reload):
82         (WebCore::FrameLoader::commitProvisionalLoad):
83         (WebCore::FrameLoader::loadDifferentDocumentItem):
84         * loader/FrameLoader.h:
85
86 2018-04-19  Chris Dumez  <cdumez@apple.com>
87
88         Rename JSDOMWindowProxy to JSWindowProxy
89         https://bugs.webkit.org/show_bug.cgi?id=184797
90
91         Reviewed by Sam Weinig.
92
93         Rename JSDOMWindowProxy to JSWindowProxy for consistency with WindowProxy.
94
95         * Sources.txt:
96         * WebCore.xcodeproj/project.pbxproj:
97         * bindings/IDLTypes.h:
98         * bindings/js/JSBindingsAllInOne.cpp:
99         * bindings/js/JSDOMConvertWindowProxy.h:
100         * bindings/js/JSDOMWindowBase.cpp:
101         (WebCore::JSDOMWindowBase::JSDOMWindowBase):
102         (WebCore::JSDOMWindowBase::finishCreation):
103         (WebCore::JSDOMWindowBase::proxy const):
104         (WebCore::toJSDOMWindow):
105         * bindings/js/JSDOMWindowBase.h:
106         * bindings/js/JSDOMWindowCustom.cpp:
107         (WebCore::JSDOMWindow::toWrapped):
108         * bindings/js/JSEventTargetCustom.cpp:
109         (WebCore::JSEventTarget::toWrapped):
110         * bindings/js/JSRemoteDOMWindowBase.cpp:
111         (WebCore::JSRemoteDOMWindowBase::JSRemoteDOMWindowBase):
112         (WebCore::toJSRemoteDOMWindow):
113         * bindings/js/JSRemoteDOMWindowBase.h:
114         * bindings/js/JSWindowProxy.cpp: Renamed from Source/WebCore/bindings/js/JSDOMWindowProxy.cpp.
115         (WebCore::JSWindowProxy::JSWindowProxy):
116         (WebCore::JSWindowProxy::finishCreation):
117         (WebCore::JSWindowProxy::create):
118         (WebCore::JSWindowProxy::destroy):
119         (WebCore::JSWindowProxy::setWindow):
120         (WebCore::JSWindowProxy::attachDebugger):
121         (WebCore::JSWindowProxy::wrapped const):
122         (WebCore::JSWindowProxy::toWrapped):
123         (WebCore::toJS):
124         (WebCore::toJSWindowProxy):
125         * bindings/js/JSWindowProxy.h: Renamed from Source/WebCore/bindings/js/JSDOMWindowProxy.h.
126         (WebCore::toJS):
127         (WebCore::toJSWindowProxy):
128         * bindings/js/ScriptController.cpp:
129         (WebCore::ScriptController::initScriptForWindowProxy):
130         * bindings/js/ScriptController.h:
131         * bindings/js/WindowProxy.cpp:
132         (WebCore::WindowProxy::createJSWindowProxy):
133         (WebCore::WindowProxy::jsWindowProxiesAsVector const):
134         (WebCore::WindowProxy::createJSWindowProxyWithInitializedScript):
135         * bindings/js/WindowProxy.h:
136         (WebCore::WindowProxy::jsWindowProxy):
137         (WebCore::WindowProxy::existingJSWindowProxy const):
138         * bindings/scripts/CodeGeneratorJS.pm:
139         (AddToIncludesForIDLType):
140         (GenerateHeader):
141         (GenerateOverloadDispatcher):
142         (GenerateImplementation):
143         * bindings/scripts/test/JS/JSTestObj.cpp:
144         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher):
145         * page/Frame.cpp:
146         * page/csp/ContentSecurityPolicy.cpp:
147         (WebCore::ContentSecurityPolicy::didCreateWindowProxy const):
148         * page/csp/ContentSecurityPolicy.h:
149
150 2018-04-19  Dirk Schulze  <krit@webbkit.org>
151
152         Introduce SVGGeometryElement interface
153         https://bugs.webkit.org/show_bug.cgi?id=184768
154
155         Reviewed by Antti Koivisto.
156
157         Start implementing SVGGeometryElement interface from SVG2.
158         https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement
159
160         Start with SVGPathElement only for now. Also, just inferface gets implemented
161         by this patch. No new functionality like isPointInFill yet.
162         Fix getPointAtLength and make it more restrictive. This follows the spec and
163         all other implementations.
164
165         Added additional test scenarios to existing tests.
166
167         * CMakeLists.txt:
168         * DerivedSources.make:
169         * Sources.txt:
170         * WebCore.xcodeproj/project.pbxproj:
171         * bindings/scripts/CodeGeneratorJS.pm:
172         (GetGnuVTableOffsetForType):
173         * svg/SVGAllInOne.cpp:
174         * svg/SVGGeometryElement.cpp: Added.
175         (WebCore::SVGGeometryElement::SVGGeometryElement):
176         (WebCore::SVGGeometryElement::isSupportedAttribute):
177         (WebCore::SVGGeometryElement::parseAttribute):
178         (WebCore::SVGGeometryElement::svgAttributeChanged):
179         (WebCore::SVGGeometryElement::createElementRenderer):
180         * svg/SVGGeometryElement.h: Added.
181         * svg/SVGGeometryElement.idl: Added.
182         * svg/SVGGradientElement.cpp:
183         * svg/SVGPathElement.cpp:
184         (WebCore::SVGPathElement::SVGPathElement):
185         (WebCore::SVGPathElement::parseAttribute):
186         (WebCore::SVGPathElement::svgAttributeChanged):
187         (WebCore::SVGPathElement::insertedIntoAncestor):
188         (WebCore::SVGPathElement::removedFromAncestor):
189         * svg/SVGPathElement.h:
190         * svg/SVGPathElement.idl:
191
192 2018-04-19  Tadeu Zagallo  <tzagallo@apple.com>
193
194         REGRESSION(r227340): ArrayBuffers were not being serialized when sent via MessagePorts
195         https://bugs.webkit.org/show_bug.cgi?id=184254
196         <rdar://problem/39140200>
197
198         Reviewed by Daniel Bates.
199
200         Add a new encoding method to SerializedScriptValue that includes ArrayBuffers.
201
202         Test: workers/message-port.html
203
204         * bindings/js/SerializedScriptValue.h:
205         (WebCore::SerializedScriptValue::encode const):
206         (WebCore::SerializedScriptValue::decode):
207         * dom/messageports/MessageWithMessagePorts.h:
208         (WebCore::MessageWithMessagePorts::encode const):
209         (WebCore::MessageWithMessagePorts::decode):
210
211 2018-04-19  David Kilzer  <ddkilzer@apple.com>
212
213         Enable Objective-C weak references
214         <https://webkit.org/b/184789>
215         <rdar://problem/39571716>
216
217         Reviewed by Dan Bernstein.
218
219         * Configurations/Base.xcconfig:
220         (CLANG_ENABLE_OBJC_WEAK): Enable.
221
222 2018-04-19  Antti Koivisto  <antti@apple.com>
223
224         Don't use RenderTreeBuilder::current() in RenderTreeUpdater
225         https://bugs.webkit.org/show_bug.cgi?id=184794
226
227         Reviewed by Zalan Bujtas.
228
229         Pass the builder as a parameter where needed.
230
231         * rendering/updating/RenderTreeUpdater.cpp:
232         (WebCore::RenderTreeUpdater::updateElementRenderer):
233         (WebCore::RenderTreeUpdater::updateTextRenderer):
234         (WebCore::RenderTreeUpdater::tearDownRenderers):
235         (WebCore::RenderTreeUpdater::tearDownRenderer):
236         (WebCore::RenderTreeUpdater::tearDownTextRenderer):
237         (WebCore::RenderTreeUpdater::tearDownLeftoverPaginationRenderersIfNeeded):
238         (WebCore::RenderTreeUpdater::tearDownLeftoverShadowHostChildren):
239         * rendering/updating/RenderTreeUpdater.h:
240         * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp:
241         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
242         (WebCore::RenderTreeUpdater::GeneratedContent::removeBeforePseudoElement):
243         (WebCore::RenderTreeUpdater::GeneratedContent::removeAfterPseudoElement):
244         * rendering/updating/RenderTreeUpdaterGeneratedContent.h:
245
246 2018-04-19  Eric Carlson  <eric.carlson@apple.com>
247
248         Runtime logging during GC can cause crash
249         https://bugs.webkit.org/show_bug.cgi?id=184792
250         <rdar://problem/39567927>
251
252         Reviewed by Jer Noble.
253
254         Test: media/destructor-logging-crash.html
255
256         * dom/Document.cpp:
257         (WebCore::Document::~Document): Clear the logger observer immediately so anything logged
258         as a side effect of the destructor won't cause a problem.
259         (WebCore::Document::didLogMessage): Create the ConsoleMessage in a task.
260         * dom/Document.h:
261
262 2018-04-19  Youenn Fablet  <youenn@apple.com>
263
264         Web Inspector backend should get headers & cookies from network process separately from resource requests
265         https://bugs.webkit.org/show_bug.cgi?id=184396
266         <rdar://problem/38877384>
267
268         Reviewed by Brian Burg.
269
270         Add two new loader strategies to get response and network metrics directly from
271         NetworkProcess based on resource loader identifier.
272         Use these methods in InspectorNetworkAgent when response/metrics might be filtered.
273
274         Covered by existing tests, in particular http/tests/inspector/network/fetch-network-data.html which would fail
275         without this since we are now setting the sourceOrigin for NetworkResourceLoader, which is used to sanitize response headers.
276
277         * inspector/agents/InspectorNetworkAgent.cpp:
278         (WebCore::InspectorNetworkAgent::didReceiveResponse):
279         (WebCore::InspectorNetworkAgent::didFinishLoading):
280         * loader/LoaderStrategy.cpp:
281         (WebCore::LoaderStrategy::responseFromResourceLoaIdentifier):
282         (WebCore::LoaderStrategy::networkMetricsFromResourceLoaIdentifier):
283         * loader/LoaderStrategy.h:
284
285 2018-04-19  Wenson Hsieh  <wenson_hsieh@apple.com>
286
287         [Extra zoom mode] Add a mechanism to extend the height of the layout viewport in extra zoom mode
288         https://bugs.webkit.org/show_bug.cgi?id=184782
289         <rdar://problem/38346712>
290
291         Reviewed by Tim Horton.
292
293         Add a new helper on FrameView to compute an expanded layout viewport size, as well as a new setting for the
294         height expansion factor when computing visual viewport dimensions. See WebKit/ChangeLog for more detail.
295
296         Test: fast/visual-viewport/extrazoom/layout-viewport-after-scrolling-and-resizing.html
297
298         * page/FrameView.cpp:
299         (WebCore::FrameView::expandedLayoutViewportSize):
300         * page/FrameView.h:
301         * page/Settings.yaml:
302
303 2018-04-19  Chris Dumez  <cdumez@apple.com>
304
305         REGRESSION (r229133): decidePolicyForNavigationAction not called for loading an HTML string
306         https://bugs.webkit.org/show_bug.cgi?id=184209
307         <rdar://problem/39145306>
308
309         Reviewed by Ryosuke Niwa.
310
311         In r229133, we stopped doing navigation policy checks for about:blank because about:blank
312         loads need to happen synchronously for Web-compatibility. However, this regressed loading
313         an HTML string in a WebView because in such cases, the URL is also about:blank with
314         substitute data.
315
316         In this patch, we take a more conservative approach and restore policy checking for
317         'about:blank' but using synchronous IPC.
318
319         * loader/PolicyChecker.cpp:
320         (WebCore::PolicyChecker::checkNavigationPolicy):
321
322 2018-04-19  Chris Nardi  <cnardi@chromium.org>
323
324         Support calc() in webkit-gradient and cross-fade
325         https://bugs.webkit.org/show_bug.cgi?id=182225
326
327         Reviewed by Simon Fraser.
328
329         calc() was previously unsupported in webkit-gradient and webkit-cross-fade, but both should take calc() values.
330         Update the code to support calc() values.
331
332         Tests: LayoutTests/css3/calc/cross-fade-calc.html
333                LayoutTests/css3/calc/webkit-gradient-calc.html
334
335         * css/parser/CSSPropertyParserHelpers.cpp:
336         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStop):
337         (WebCore::CSSPropertyParserHelpers::consumeCrossFade):
338
339 2018-04-17  Filip Pizlo  <fpizlo@apple.com>
340
341         The InternalFunction hierarchy should be in IsoSubspaces
342         https://bugs.webkit.org/show_bug.cgi?id=184721
343
344         Reviewed by Saam Barati.
345
346         No new tests because no new behavior.
347
348         * bindings/js/WebCoreJSClientData.cpp:
349         (WebCore::JSVMClientData::JSVMClientData):
350         * bindings/js/WebCoreJSClientData.h:
351         (WebCore::JSVMClientData::runtimeMethodSpace):
352         * bridge/runtime_method.cpp:
353         (JSC::RuntimeMethod::subspaceForImpl):
354         * bridge/runtime_method.h:
355
356 2018-04-19  Brady Eidson  <beidson@apple.com>
357
358         Add globally-unique HistoryItem identifiers (and have WebKit2 adopt them).
359         <rdar://problem/39533949> and https://bugs.webkit.org/show_bug.cgi?id=184750
360
361         Reviewed by Ryosuke Niwa.
362
363         No new tests (Refactor, no behavior change).
364
365         In WebCore, we:
366         - Add a process-unique "BackForwardItemIdentifier"
367         - Make all HistoryItems have such an identifier as a member
368
369         * WebCore.xcodeproj/project.pbxproj:
370
371         * history/BackForwardItemIdentifier.h: Added.
372         (WebCore::BackForwardItemIdentifier::logString const):
373         (WebCore::operator==):
374         (WebCore::BackForwardItemIdentifier::encode const):
375         (WebCore::BackForwardItemIdentifier::decode):
376         (WebCore::BackForwardItemIdentifier::hash const):
377         (WTF::BackForwardItemIdentifierHash::hash):
378         (WTF::BackForwardItemIdentifierHash::equal):
379         (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::emptyValue):
380         (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::constructDeletedValue):
381         (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::isDeletedValue):
382
383         * history/HistoryItem.cpp:
384         (WebCore::HistoryItem::generateSequenceNumber):
385         (WebCore::HistoryItem::HistoryItem):
386         (WebCore::generateSequenceNumber): Deleted.
387
388         * history/HistoryItem.h:
389         (WebCore::HistoryItem::create):
390         (WebCore::HistoryItem::identifier const):
391
392 2018-04-19  Nan Wang  <n_wang@apple.com>
393
394         AX: AOM: respect the accessibility setting for dispatching the accessible events
395         https://bugs.webkit.org/show_bug.cgi?id=184619
396
397         Reviewed by Ryosuke Niwa.
398
399         Added accessibilityEventsEnabled as a setting on the page.
400
401         Test: accessibility/ios-simulator/accessibility-events-setting.html
402
403         * accessibility/AccessibilityObject.cpp:
404         (WebCore::AccessibilityObject::shouldDispatchAccessibilityEvent const):
405         * page/Settings.yaml:
406         * testing/InternalSettings.cpp:
407         (WebCore::InternalSettings::Backup::Backup):
408         (WebCore::InternalSettings::Backup::restoreTo):
409         (WebCore::InternalSettings::setAccessibilityEventsEnabled):
410         * testing/InternalSettings.h:
411         * testing/InternalSettings.idl:
412
413 2018-04-18  Jer Noble  <jer.noble@apple.com>
414
415         Fix build when WK_ALTERNATE_FRAMEWORKS_DIR is set to non-empty value
416         https://bugs.webkit.org/show_bug.cgi?id=184693
417         <rdar://problem/39491884>
418
419         Reviewed by Tim Horton.
420
421         * Configurations/WebCore.xcconfig:
422
423 2018-04-19  Eric Stobbart  <ericstobbart@gmail.com>
424
425         Change MediaSource WebCore to return NewObject for SourceBuffers
426         https://bugs.webkit.org/show_bug.cgi?id=184642
427
428         Reviewed by Chris Dumez.
429
430         Minor change inline with IDL documentation
431
432         * Modules/mediasource/MediaSource.cpp:
433         (WebCore::MediaSource::addSourceBuffer):
434         (): Deleted.
435         * Modules/mediasource/MediaSource.h:
436         * Modules/mediasource/MediaSource.idl:
437
438 2018-04-19  Yusuke Suzuki  <utatane.tea@gmail.com>
439
440         Unreviewed, build fix for Ubuntu LTS GCC
441         https://bugs.webkit.org/show_bug.cgi?id=184756
442
443         The variable name "windowProxy" (with auto&) conflicts with the function name "windowProxy".
444
445         * bindings/js/ScriptController.cpp:
446         (WebCore::ScriptController::updateDocument):
447         (WebCore::ScriptController::collectIsolatedContexts):
448
449 2018-04-19  Manuel Rego Casasnovas  <rego@igalia.com>
450
451         Caret rendered at incorrect location inside empty table cell
452         https://bugs.webkit.org/show_bug.cgi?id=85385
453
454         Reviewed by Zalan Bujtas.
455
456         This is based on a previous patch by Shezan Baig <shezbaig.wk@gmail.com>.
457
458         This fixes the position of the caret in empty cells,
459         that was painted lower than expected
460         (and then modified when you start to edit the cell).
461
462         Ensures that editable table cells have at least one line when
463         they are laid out. This ensures that the cell's intrinsic before/after
464         padding is calculated correctly, which results in the caret location
465         being calculated correctly.
466
467         Test: editing/caret/caret-in-empty-cell.html
468
469         * rendering/RenderTableCell.cpp:
470         (WebCore::RenderTableCell::hasLineIfEmpty): Override method to consider
471         that it has an an empty line if the table cell is editable.
472         * rendering/RenderTableCell.h:
473
474 2018-04-18  Daniel Bates  <dabates@apple.com>
475
476         Cleanup TextControlInnerElements
477         https://bugs.webkit.org/show_bug.cgi?id=184475
478
479         Reviewed by Antti Koivisto.
480
481         Clean up TextControlInnerElement::resolveCustomStyle(), move the implementation of
482         TextControlPlaceholderElement::create() from the header to the cpp file, replace
483         fancy comments to demarcate classes with MARK: so that they show up in Xcode's
484         function menu.
485
486         * html/shadow/TextControlInnerElements.cpp:
487         (WebCore::TextControlInnerElement::resolveCustomStyle):
488         (WebCore::TextControlPlaceholderElement::TextControlPlaceholderElement):
489         (WebCore::TextControlPlaceholderElement::create):
490         * html/shadow/TextControlInnerElements.h:
491
492 2018-04-18  Chris Dumez  <cdumez@apple.com>
493
494         Rename WindowProxyController to WindowProxy
495         https://bugs.webkit.org/show_bug.cgi?id=184756
496
497         Reviewed by Sam Weinig.
498
499         Rename WindowProxyController to WindowProxy for clarity. When the IDL uses WindowProxy, the implementation
500         needed use WindowProxyController type, which was a bit confusing.
501
502         * Sources.txt:
503         * WebCore.xcodeproj/project.pbxproj:
504         * bindings/js/DOMWrapperWorld.cpp:
505         (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
506         (WebCore::DOMWrapperWorld::clearWrappers):
507         * bindings/js/DOMWrapperWorld.h:
508         (WebCore::DOMWrapperWorld::didCreateWindowProxy):
509         (WebCore::DOMWrapperWorld::didDestroyWindowProxy):
510         * bindings/js/JSBindingsAllInOne.cpp:
511         * bindings/js/JSDOMWindowBase.cpp:
512         (WebCore::toJS):
513         * bindings/js/JSDOMWindowProxy.cpp:
514         (WebCore::toJS):
515         (WebCore::toJSDOMWindowProxy):
516         * bindings/js/JSDOMWindowProxy.h:
517         (WebCore::toJS):
518         (WebCore::toJSDOMWindowProxy):
519         * bindings/js/ScriptCachedFrameData.cpp:
520         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
521         (WebCore::ScriptCachedFrameData::restore):
522         * bindings/js/ScriptController.cpp:
523         (WebCore::ScriptController::evaluateInWorld):
524         (WebCore::ScriptController::loadModuleScriptInWorld):
525         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
526         (WebCore::ScriptController::evaluateModule):
527         (WebCore::ScriptController::setupModuleScriptHandlers):
528         (WebCore::ScriptController::windowProxy):
529         (WebCore::ScriptController::enableEval):
530         (WebCore::ScriptController::enableWebAssembly):
531         (WebCore::ScriptController::disableEval):
532         (WebCore::ScriptController::disableWebAssembly):
533         (WebCore::ScriptController::updateDocument):
534         (WebCore::ScriptController::collectIsolatedContexts):
535         (WebCore::ScriptController::windowScriptNPObject):
536         (WebCore::ScriptController::executeIfJavaScriptURL):
537         * bindings/js/ScriptController.h:
538         (WebCore::ScriptController::globalObject):
539         * bindings/js/ScriptControllerMac.mm:
540         (WebCore::ScriptController::windowScriptObject):
541         * bindings/js/ScriptState.cpp:
542         (WebCore::mainWorldExecState):
543         * bindings/js/WindowProxy.cpp: Renamed from Source/WebCore/bindings/js/WindowProxyController.cpp.
544         (WebCore::WindowProxy::WindowProxy):
545         (WebCore::WindowProxy::~WindowProxy):
546         (WebCore::WindowProxy::destroyJSWindowProxy):
547         (WebCore::WindowProxy::createJSWindowProxy):
548         (WebCore::WindowProxy::jsWindowProxiesAsVector const):
549         (WebCore::WindowProxy::createJSWindowProxyWithInitializedScript):
550         (WebCore::WindowProxy::clearJSWindowProxiesNotMatchingDOMWindow):
551         (WebCore::WindowProxy::setDOMWindow):
552         (WebCore::WindowProxy::attachDebugger):
553         * bindings/js/WindowProxy.h: Renamed from Source/WebCore/bindings/js/WindowProxyController.h.
554         (WebCore::WindowProxy::jsWindowProxies const):
555         (WebCore::WindowProxy::releaseJSWindowProxies):
556         (WebCore::WindowProxy::setJSWindowProxies):
557         (WebCore::WindowProxy::jsWindowProxy):
558         (WebCore::WindowProxy::existingJSWindowProxy const):
559         (WebCore::WindowProxy::globalObject):
560         * loader/FrameLoader.cpp:
561         (WebCore::FrameLoader::clear):
562         (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
563         * page/AbstractFrame.cpp:
564         (WebCore::AbstractFrame::AbstractFrame):
565         * page/AbstractFrame.h:
566         (WebCore::AbstractFrame::windowProxy):
567         (WebCore::AbstractFrame::windowProxy const):
568         * page/Page.cpp:
569         (WebCore::Page::setDebugger):
570         * page/RemoteDOMWindow.cpp:
571         (WebCore::RemoteDOMWindow::self const):
572         (WebCore::RemoteDOMWindow::top const):
573         (WebCore::RemoteDOMWindow::opener const):
574         (WebCore::RemoteDOMWindow::parent const):
575         * page/RemoteDOMWindow.h:
576
577 2018-04-18  Chris Dumez  <cdumez@apple.com>
578
579         Set RemoteDOMWindow's initial opener
580         https://bugs.webkit.org/show_bug.cgi?id=184716
581
582         Reviewed by Sam Weinig.
583
584         Add support for WindowProxy type in the IDL. The implementation should
585         return a WindowProxyController and toJS() will take care of converting
586         this into a JSValue via JSDOMWindowProxy.
587
588         No new tests, rebaselined existing test.
589
590         * WebCore.xcodeproj/project.pbxproj:
591         * bindings/IDLTypes.h:
592         * bindings/js/JSDOMConvertWindowProxy.h: Added.
593         (WebCore::JSConverter<IDLWindowProxy>::convert):
594         * bindings/js/JSDOMWindowBase.cpp:
595         (WebCore::toJS):
596         * bindings/js/JSDOMWindowBase.h:
597         (WebCore::toJS):
598         * bindings/js/JSDOMWindowProxy.cpp:
599         (WebCore::toJS):
600         (WebCore::toJSDOMWindowProxy):
601         * bindings/js/JSDOMWindowProxy.h:
602         (WebCore::toJS):
603         (WebCore::toJSDOMWindowProxy):
604         * bindings/js/JSRemoteDOMWindowBase.cpp:
605         * bindings/js/JSRemoteDOMWindowBase.h:
606         * bindings/scripts/CodeGenerator.pm:
607         (IsBuiltinType):
608         * bindings/scripts/CodeGeneratorJS.pm:
609         (AddToIncludesForIDLType):
610         (GetBaseIDLType):
611         * page/RemoteDOMWindow.cpp:
612         (WebCore::RemoteDOMWindow::self const):
613         (WebCore::RemoteDOMWindow::top const):
614         (WebCore::RemoteDOMWindow::opener const):
615         (WebCore::RemoteDOMWindow::parent const):
616         * page/RemoteDOMWindow.h:
617         * page/RemoteDOMWindow.idl:
618         * page/RemoteFrame.h:
619
620 2018-04-18  Dean Jackson  <dino@apple.com>
621
622         Detect system preview links
623         https://bugs.webkit.org/show_bug.cgi?id=184753
624         <rdar://problem/39500514>
625
626         Reviewed by Antoine Quint.
627
628         Detect a special type of link anchor, which we're calling System Previews.
629         Ultimately this will allow WebKit to present such links in a special
630         way.
631
632         A System Preview link is an <a> element, with a rel attribute that
633         includes "system-preview". It has a single element child, which is
634         either an <img> or a <picture>.
635
636         Test: system-preview/detection.html
637
638         * html/HTMLAnchorElement.cpp:
639         (WebCore::HTMLAnchorElement::relList): Add braces.
640         (WebCore::HTMLAnchorElement::isSystemPreviewLink const): New
641         function.
642         * html/HTMLAnchorElement.h:
643
644         * html/HTMLImageElement.cpp:
645         (WebCore::HTMLImageElement::isSystemPreviewImage const): Ask the
646         parent if it is a system preview link.
647         * html/HTMLImageElement.h:
648         * html/HTMLPictureElement.cpp:
649         (WebCore::HTMLPictureElement::isSystemPreviewImage const): Ditto.
650         * html/HTMLPictureElement.h:
651
652         * testing/Internals.cpp: Testing helpers.
653         (WebCore::Internals::systemPreviewRelType):
654         (WebCore::Internals::isSystemPreviewLink const):
655         (WebCore::Internals::isSystemPreviewImage const):
656         * testing/Internals.h:
657         * testing/Internals.idl:
658
659 2018-04-18  Antti Koivisto  <antti@apple.com>
660
661         :active pseudo class doesn't deactivate when using pressure sensitive trackpad
662         https://bugs.webkit.org/show_bug.cgi?id=181680
663
664         Reviewed by Beth Dakin.
665
666         Trackpad sends a mouse force event with force of zero after mouse up event. This causes the element under cursor
667         activate again.
668
669         Even a fake event test doesn't appear to be currently possible as TestRunner crashes if you try to send mouseForceChanged.
670         All the tests using it are skipped.
671
672         * page/EventHandler.cpp:
673         (WebCore::EventHandler::handleMouseForceEvent):
674
675         Don't add HitTestRequest::Active if the force of the force event is zero.
676
677 2018-04-18  Megan Gardner  <megan_gardner@apple.com>
678
679         Ensure correct screen sizes
680         https://bugs.webkit.org/show_bug.cgi?id=184757
681         
682         Reviewed by Wenson Hsieh.
683         
684         Make sure that the screen sizes are actually correct.
685
686         Not currently testable, will add tests when it is.
687
688         * platform/ios/PlatformScreenIOS.mm:
689
690 2018-04-18  Nan Wang  <n_wang@apple.com>
691
692         AX: [macOS] WebKit hangs when triggering an alert from an AOM increment event
693         https://bugs.webkit.org/show_bug.cgi?id=184742
694
695         Reviewed by Chris Fleizach.
696
697         Made increment and decrement actions on the macOS to be async. So that VoiceOver
698         won't hang indefinitely if performing the actions causes an alert or other modal
699         behaviors.
700
701         Test: accessibility/mac/async-increment-decrement-action.html
702
703         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
704         (-[WebAccessibilityObjectWrapper accessibilityPerformIncrementAction]):
705         (-[WebAccessibilityObjectWrapper _accessibilityPerformIncrementAction]):
706         (-[WebAccessibilityObjectWrapper accessibilityPerformDecrementAction]):
707         (-[WebAccessibilityObjectWrapper _accessibilityPerformDecrementAction]):
708         (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]):
709
710 2018-04-18  Youenn Fablet  <youenn@apple.com>
711
712         MediaResourceLoader should set its fetch destination
713         https://bugs.webkit.org/show_bug.cgi?id=184746
714
715         Reviewed by Eric Carlson.
716
717         Covered by updated test.
718
719         * loader/MediaResourceLoader.cpp:
720         (WebCore::MediaResourceLoader::requestResource):
721
722 2018-04-18  Jer Noble  <jer.noble@apple.com>
723
724         Fix runtime errors in simulator while playing media
725         https://bugs.webkit.org/show_bug.cgi?id=184751
726
727         Reviewed by Eric Carlson.
728
729         AVURLAssetHTTPCookiesKey may not be present, and AVPlayer may not respond to certain methods.
730
731         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
732         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
733         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
734         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateDisableExternalPlayback):
735         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep):
736
737 2018-04-18  Jer Noble  <jer.noble@apple.com>
738
739         Ignore ASSERT when setting AVAudioSessionCategory returns an error on simulator.
740         https://bugs.webkit.org/show_bug.cgi?id=184698
741
742         Reviewed by Eric Carlson.
743
744         * platform/audio/ios/AudioSessionIOS.mm:
745         * platform/audio/mac/AudioSessionMac.cpp:
746
747 2018-04-18  Sihui Liu  <sihui_liu@apple.com>
748
749         REGRESSION: Using the reload button while offline pushes identical pages onto the back/forward list
750         https://bugs.webkit.org/show_bug.cgi?id=184570
751         <rdar://problem/34807323>
752
753         Reviewed by Chris Dumez.
754
755         Set FrameLoadType properly when error occurs in reload.
756
757         tests: Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm
758
759         * loader/FrameLoader.cpp:
760         (WebCore::FrameLoader::load):
761
762 2018-04-18  Chris Dumez  <cdumez@apple.com>
763
764         Add support for converting a local window to a remote window
765         https://bugs.webkit.org/show_bug.cgi?id=184515
766         <rdar://problem/39011318>
767
768         Reviewed by Ryosuke Niwa.
769
770         Add initial support for process-swapping when navigating cross-origin as a result
771         of a window.open(). The window object returned by window.open() is initially same
772         origin and is for about:blank. The navigation cross-origin then happens and the
773         JS wrappers for the window then point to a cross-origin window which is remote (i.e.
774         hosted in another WebProcess).
775
776         The RemoteDOMWindow exposed to JS looks like a regular cross-origin Window with a few
777         exceptions due to our incomplete implementation (e.g. w.location returns null) and 
778         most of its API is currently not functional. The RemoteDOMWindow API will be implemented
779         in a follow-up by relying on IPC.
780
781         Test: http/tests/navigation/process-swap-window-open.html
782
783         * bindings/js/JSDOMGlobalObject.cpp:
784         (WebCore::JSDOMGlobalObject::scriptExecutionContext const):
785         * bindings/js/JSDOMPromiseDeferred.h:
786         * bindings/js/JSDOMWindowProperties.cpp:
787         (WebCore::JSDOMWindowProperties::getOwnPropertySlot):
788         * bindings/js/JSDOMWindowProxy.cpp:
789         (WebCore::JSDOMWindowProxy::finishCreation):
790         (WebCore::JSDOMWindowProxy::create):
791         * bindings/js/JSDOMWindowProxy.h:
792         * bindings/js/JSDOMWrapper.cpp:
793         (WebCore::JSDOMObject::JSDOMObject):
794         * bindings/js/JSDOMWrapper.h:
795         * bindings/js/WindowProxyController.cpp:
796         (WebCore::WindowProxyController::createWindowProxy):
797         (WebCore::WindowProxyController::setDOMWindowForWindowProxy):
798         * bridge/objc/WebScriptObject.mm:
799         (-[WebScriptObject _isSafeScript]):
800         Teach more of our bindings code about RemoteDOMWindows.
801
802         * dom/Document.cpp:
803         (WebCore::Document::createDOMWindow):
804         * loader/FrameLoaderClient.h:
805         Add FrameLoaderClient function to notify the client when a DOMWindow is constructed in
806         the frame. This is needed for WebKit2 to link the old window to its new representation
807         in the new WebProcess.
808
809 2018-04-17  Zan Dobersek  <zdobersek@igalia.com>
810
811         [CMake] Add and enable the ENABLE_CSS_ANIMATIONS_LEVEL_2 feature define
812         https://bugs.webkit.org/show_bug.cgi?id=184681
813
814         Reviewed by Carlos Garcia Campos.
815
816         * Sources.txt: Include CSSAnimationTriggerScrollValue.cpp in the build.
817         * WebCore.xcodeproj/project.pbxproj: Remove CSSAnimationTriggerScrollValue.cpp
818         build target now that it's built via Sources.txt.
819
820 2018-04-17  Zan Dobersek  <zdobersek@igalia.com>
821
822         [CoordGraphics] CoordinatedImageBacking can simplify image drawing
823         https://bugs.webkit.org/show_bug.cgi?id=183986
824
825         Reviewed by Michael Catanzaro.
826
827         In CoordinatedImageBacking::update(), when drawing the image into a
828         freshly-created image backing, we can avoid save-and-restoring the
829         painting context. We also don't have to clip it, since the clipping area
830         is the same as the image (and buffer) bounds. Since the buffer is
831         initialized to transparent color, we can use the CompositeCopy operator
832         to just copy image data into the destination since there's nothing to
833         paint the source over.
834
835         No new tests -- no change in functionality.
836
837         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
838         (WebCore::CoordinatedImageBacking::update):
839
840 2018-04-17  Michael Catanzaro  <mcatanzaro@igalia.com>
841
842         [GTK] Webkit should spoof as Safari on a Mac for Outlook.com
843         https://bugs.webkit.org/show_bug.cgi?id=184573
844
845         Reviewed by Carlos Alberto Lopez Perez.
846
847         Add quirk for outlook.live.com.
848
849         * platform/UserAgentQuirks.cpp:
850         (WebCore::urlRequiresMacintoshPlatform):
851
852 2018-04-17  Mark Lam  <mark.lam@apple.com>
853
854         Templatize CodePtr/Refs/FunctionPtrs with PtrTags.
855         https://bugs.webkit.org/show_bug.cgi?id=184702
856         <rdar://problem/35391681>
857
858         Reviewed by Filip Pizlo and Saam Barati.
859
860         No new tests. This is covered by existing tests.
861
862         * WebCore.xcodeproj/project.pbxproj:
863         * css/ElementRuleCollector.cpp:
864         (WebCore::ElementRuleCollector::ruleMatches):
865         * cssjit/CSSPtrTag.h: Added.
866         * cssjit/CompiledSelector.h:
867         * cssjit/FunctionCall.h:
868         (WebCore::FunctionCall::FunctionCall):
869         (WebCore::FunctionCall::setFunctionAddress):
870         (WebCore::FunctionCall::prepareAndCall):
871         * cssjit/SelectorCompiler.cpp:
872         (WebCore::SelectorCompiler::compileSelector):
873         (WebCore::SelectorCompiler::SelectorFragment::appendUnoptimizedPseudoClassWithContext):
874         (WebCore::SelectorCompiler::addPseudoClassType):
875         (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
876         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeFunctionCallValueMatching):
877         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementFunctionCallTest):
878         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateContextFunctionCallTest):
879         * cssjit/SelectorCompiler.h:
880         (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction):
881         (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction):
882         (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext):
883         (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext):
884         * dom/SelectorQuery.cpp:
885         (WebCore::SelectorDataList::executeCompiledSingleMultiSelectorData const):
886         (WebCore::SelectorDataList::execute const):
887         * dom/SelectorQuery.h:
888
889 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
890
891         Retain MessagePortChannel for transfer when disentangling ports
892         https://bugs.webkit.org/show_bug.cgi?id=184502
893         <rdar://problem/39372771>
894
895         Reviewed by Geoffrey Garen.
896
897         MessagePortChannels should be retained while ports are being transferred, but that was only
898         happening when sending a port through another port, but not when sending it through a worker.
899
900         Test: workers/worker-to-worker.html
901
902         * dom/messageports/MessagePortChannel.cpp:
903         (WebCore::MessagePortChannel::entanglePortWithProcess):
904         (WebCore::MessagePortChannel::disentanglePort):
905         (WebCore::MessagePortChannel::postMessageToRemote):
906         (WebCore::MessagePortChannel::takeAllMessagesForPort):
907
908 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
909
910         References from CSSStyleDeclaration to CSSValues should be weak
911         https://bugs.webkit.org/show_bug.cgi?id=180280
912         <rdar://problem/35804869>
913
914         Reviewed by Geoffrey Garen.
915
916         No new tests - used the existing test to verify the leak
917
918         * css/DeprecatedCSSOMValue.h:
919         (WebCore::DeprecatedCSSOMValue::weakPtrFactory):
920         * css/PropertySetCSSStyleDeclaration.cpp:
921         (WebCore::PropertySetCSSStyleDeclaration::wrapForDeprecatedCSSOM):
922         * css/PropertySetCSSStyleDeclaration.h:
923
924 2018-04-17  Jonathan Bedard  <jbedard@apple.com>
925
926         Unreviewed rollout of r230632. Regression in memory usage.
927
928         That bug tracked in https://bugs.webkit.org/show_bug.cgi?id=184569.
929
930         Tests: animations/animation-internals-api-multiple-keyframes.html
931                animations/animation-internals-api.html
932                transitions/transition-drt-api-delay.html
933                transitions/transition-drt-api.html
934
935         * page/RuntimeEnabledFeatures.h:
936         * testing/Internals.cpp:
937         (WebCore::Internals::pseudoElement): Deleted.
938         * testing/Internals.h:
939         * testing/Internals.idl:
940
941 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
942
943         Do not unregister MessagePorts on deallocation if it has been disentangled
944         https://bugs.webkit.org/show_bug.cgi?id=184285
945         <rdar://problem/39256714>
946
947         Reviewed by Darin Adler.
948
949         Test: workers/message-port-gc.html
950
951         * dom/MessagePort.cpp:
952         (WebCore::MessagePort::deref const):
953
954 2018-04-17  Basuke Suzuki  <Basuke.Suzuki@sony.com>
955
956         [Curl] Fix timing of reporting error to the client
957         https://bugs.webkit.org/show_bug.cgi?id=184707
958
959         Before checking the result code, check the status of callback invocation and
960         do the right thing.
961
962         Reviewed by Youenn Fablet.
963
964         No new tests because there's no new behavior.
965
966         * platform/network/curl/CurlRequest.cpp:
967         (WebCore::CurlRequest::didCompleteTransfer):
968         * platform/network/curl/CurlRequest.h:
969         (WebCore::CurlRequest::needToInvokeDidReceiveResponse const):
970
971 2018-04-17  Basuke Suzuki  <Basuke.Suzuki@sony.com>
972
973         [Curl] Export authentication information to be used by the client.
974         https://bugs.webkit.org/show_bug.cgi?id=184709
975
976         Just added getters for username and password member variables.
977
978         Reviewed by Alex Christensen.
979
980         No new tests because there's no new behavior.
981
982         * platform/network/curl/CurlRequest.h:
983         (WebCore::CurlRequest::user const):
984         (WebCore::CurlRequest::password const):
985
986 2018-04-17  Chris Dumez  <cdumez@apple.com>
987
988         REGRESSION (r229831): CMD-clicking an iCloud web app link unexpectedly opens that link in a new tab and the current tab
989         https://bugs.webkit.org/show_bug.cgi?id=184678
990         <rdar://problem/39422122>
991
992         Reviewed by Alex Christensen.
993
994         Frament navigations need to happen synchronously for Web-compatibility. Because of this,
995         r225657 added code to make sure that if the client does not make the navigation policy
996         decision synchronously for frament navigations, then we'll stop waiting for the client
997         and proceed with the navigation. However, r229831 make the navigation policy decision
998         IPC decision, meaning that even if the client responds synchronously, it would be
999         asynchronously from WebCore's point of view. As a result, we would always ignore the
1000         client's policy decision when doing a fragment navigation.
1001
1002         This is an issue on iclould.com because the web-app links are fragment URLs. When you
1003         CMD+click one of these link, we do the navigation policy check. As a result of this
1004         check, Safari responds IGNORE to the policy decision and instead decides to load the
1005         link in a new tab (because CMD key is pressed). Due to the bug mentioned above, we
1006         would not obey the IGNORE policy decision from Safari and load the link in the current
1007         tab, even though Safari would already be loading it in a new tab.
1008
1009         To address the issue, I reintroduced a synchronous code path for navigation policy
1010         decision making, backed by synchronous IPC. This synchronous code path is now used for
1011         fragment navigations to restore pre-r229831 behavior. If the client does not answer
1012         synchronously, we'll proceed with the navigation anyway, as was happening pre-r229831.
1013
1014         Test: http/tests/navigation/fragment-navigation-policy-ignore.html
1015
1016         * loader/EmptyClients.cpp:
1017         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1018         * loader/EmptyFrameLoaderClient.h:
1019         * loader/FrameLoader.cpp:
1020         (WebCore::FrameLoader::loadURL):
1021         (WebCore::FrameLoader::loadWithDocumentLoader):
1022         * loader/FrameLoaderClient.h:
1023         * loader/PolicyChecker.cpp:
1024         (WebCore::PolicyChecker::checkNavigationPolicy):
1025         * loader/PolicyChecker.h:
1026
1027 2018-04-17  Matt Lewis  <jlewis3@apple.com>
1028
1029         Unreviewed, rolling out r230713.
1030
1031         This caused internal build failures.
1032
1033         Reverted changeset:
1034
1035         "Implement checked cast for DDResultRef once
1036         DDResultGetTypeID() is available"
1037         https://bugs.webkit.org/show_bug.cgi?id=184554
1038         https://trac.webkit.org/changeset/230713
1039
1040 2018-04-17  Chris Dumez  <cdumez@apple.com>
1041
1042         Add bindings code for RemoteDOMWindow
1043         https://bugs.webkit.org/show_bug.cgi?id=184653
1044
1045         Reviewed by Ryosuke Niwa.
1046
1047         Add bindings code for RemoteDOMWindow. A RemoteDOMWindow behaves exactly like a cross-origin
1048         DOMWindow, which is backed by a RemoteDOMWindow object instead of a DOMWindow one. Since
1049         a RemoteDOMWindow is always cross origin, we do not need cross-origin checks and the bindings
1050         code is identical to the DOMWindow code paths from cross-origin handling.
1051
1052         No new tests, this code will be used and tested via Bug 184515.
1053
1054         * CMakeLists.txt:
1055         * DerivedSources.make:
1056         * Sources.txt:
1057         * WebCore.xcodeproj/project.pbxproj:
1058         * bindings/js/JSBindingsAllInOne.cpp:
1059         * bindings/js/JSDOMWindowCustom.cpp:
1060         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
1061         (WebCore::JSDOMWindow::getOwnPropertySlot):
1062         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
1063         (WebCore::addCrossOriginWindowOwnPropertyNames):
1064         * bindings/js/JSDOMWindowCustom.h:
1065
1066         * bindings/js/JSRemoteDOMWindowBase.cpp: Added.
1067         (WebCore::JSRemoteDOMWindowBase::JSRemoteDOMWindowBase):
1068         (WebCore::JSRemoteDOMWindowBase::destroy):
1069         (WebCore::JSRemoteDOMWindowBase::javaScriptRuntimeFlags):
1070         (WebCore::toJS):
1071         (WebCore::toJSRemoteDOMWindow):
1072         * bindings/js/JSRemoteDOMWindowBase.h: Added.
1073         JSRemoteDOMWindow unfortunately currently needs to be a global object because of:
1074         1. a JSProxy's target needs to be a JSGlobalObject currently
1075         2. The 'structure()->setGlobalObject(vm, &window);' call in
1076            JSDOMWindowProxy::setWindow(VM&, JSDOMGlobalObject&) which requires a JSGlobalObject.
1077         Ideally, this wouldn't be the case in the future but this would require some code refactoring.
1078         Our DOM global objects normally subclass JSDOMGlobalObject so I decided to subclass JSDOMGlobalObject,
1079         which brings some things our bindings code expect. However, subclassing JSDOMGlobalObject directly is
1080         problematic because it does not hold the m_wrapped implementation pointer. To address this issue, all
1081         our our DOM global objects have a JS*Base base class which subclasses JSDOMGlobalObject and stores the
1082         m_wrapped implementation pointer. I followed the same pattern here.
1083
1084         (WebCore::toJS):
1085         * bindings/js/JSRemoteDOMWindowCustom.cpp: Added.
1086         (WebCore::JSRemoteDOMWindow::getOwnPropertySlot):
1087         (WebCore::JSRemoteDOMWindow::getOwnPropertySlotByIndex):
1088         (WebCore::JSRemoteDOMWindow::put):
1089         (WebCore::JSRemoteDOMWindow::putByIndex):
1090         (WebCore::JSRemoteDOMWindow::deleteProperty):
1091         (WebCore::JSRemoteDOMWindow::deletePropertyByIndex):
1092         (WebCore::JSRemoteDOMWindow::getOwnPropertyNames):
1093         (WebCore::JSRemoteDOMWindow::defineOwnProperty):
1094         (WebCore::JSRemoteDOMWindow::getPrototype):
1095         (WebCore::JSRemoteDOMWindow::preventExtensions):
1096         (WebCore::JSRemoteDOMWindow::toStringName):
1097         * bindings/scripts/CodeGeneratorJS.pm:
1098         (IsDOMGlobalObject):
1099         (GenerateHeader):
1100         (GenerateOverloadDispatcher):
1101         (GenerateImplementation):
1102         * page/RemoteDOMWindow.idl: Added.
1103
1104 2018-04-17  David Kilzer  <ddkilzer@apple.com>
1105
1106         Implement checked cast for DDResultRef once DDResultGetTypeID() is available
1107         <https://webkit.org/b/184554>
1108         <rdar://problem/36241894>
1109
1110         Reviewed by Brent Fulgham.
1111
1112         * editing/cocoa/DataDetection.mm:
1113         (WebCore::detectItemAtPositionWithRange): Implement checked cast
1114         for DDResultRef.
1115
1116 2018-04-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
1117
1118         Animated GIF imagery with finite looping are falling one loop short
1119         https://bugs.webkit.org/show_bug.cgi?id=183153
1120
1121         Reviewed by Simon Fraser.
1122
1123         The Netscape Looping Application Extension is a block which may be added
1124         to a GIF file to tell the viewer to loop through the entire GIF frames.
1125         This is communicated through two bytes designated for the "loopCount" in
1126         this block.
1127
1128         The entire block may not be found in the GIF, in which case the GIF is 
1129         supposed to animate its entire frames only once.
1130
1131         If the block exists and loopCount = 0, this means the image has to loop
1132         through its frames indefinitely.
1133
1134         If the block exist and loopCount > 0, this should mean the image has to
1135         loop through its frames loopCount + 1 times. The extra loop seems to be
1136         the consensus among most of the GIF generators and viewers. For example,
1137         if the image designer wants the image to loop through its frames n times:
1138         -- The GIF generator (e.g. Adobe Photoshop and https://ezgif.com/maker) 
1139            will write n - 1 for loopCount. However http://gifmaker.me and 
1140            http://gifmaker.org write n for loopCount.
1141         -- The browser (e.g. Chrome 65.0.3325 181 and FireFox Quantum 59.0.2) will
1142            translate loopCount = n - 1 to: animate GIF once + loop n - 1, which 
1143            means loop the GIF n times.
1144
1145         Because the specs are not really clear about this, we are going to consider
1146         the agreed-upon behavior among most of the web browsers the specs here.
1147
1148         * platform/graphics/cg/ImageDecoderCG.cpp:
1149         (WebCore::ImageDecoderCG::repetitionCount const):
1150         * platform/image-decoders/gif/GIFImageDecoder.cpp:
1151         (WebCore::GIFImageDecoder::repetitionCount const):
1152
1153 2018-04-17  Saam Barati  <sbarati@apple.com>
1154
1155         Add system trace points for process launch and for initializeWebProcess
1156         https://bugs.webkit.org/show_bug.cgi?id=184669
1157
1158         Reviewed by Simon Fraser.
1159
1160         No testing needed because there is no new functionality here.
1161
1162         * loader/FrameLoader.cpp:
1163         (WebCore::FrameLoader::provisionalLoadStarted):
1164         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
1165         * loader/SubresourceLoader.cpp:
1166         (WebCore::SubresourceLoader::willSendRequestInternal):
1167         (WebCore::SubresourceLoader::didFinishLoading):
1168         (WebCore::SubresourceLoader::didFail):
1169         (WebCore::SubresourceLoader::didCancel):
1170
1171 2018-04-17  Eric Carlson  <eric.carlson@apple.com>
1172
1173         [iOS] AirPlay device name is sometimes wrong
1174         https://bugs.webkit.org/show_bug.cgi?id=184543
1175         <rdar://problem/39105498>
1176
1177         Reviewed by Jer Noble.
1178
1179         No new tests, this can only be tested with a specific hardware setup.
1180
1181         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1182         (WebCore::exernalDeviceDisplayNameForPlayer): Get the device name from the AVOutputContext
1183         when possible.
1184
1185 2018-04-17  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1186
1187         [GTK] Build fix after r230529 (WaylandCompositorDisplay leaks its wl_display)
1188         https://bugs.webkit.org/show_bug.cgi?id=184406
1189
1190         Rubber-stamped by Michael Catanzaro.
1191
1192         Fix build with clang 3.8
1193
1194         No new tests, it is a build fix.
1195
1196         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
1197         (WebCore::PlatformDisplayWayland::create):
1198
1199 2018-04-16  Antoine Quint  <graouts@apple.com>
1200
1201         Layout Test animations/needs-layout.html is a flaky Image Failure.
1202         https://bugs.webkit.org/show_bug.cgi?id=172397
1203
1204         Reviewed by Dean Jackson.
1205
1206         Animations that animate a transform and uses a relative value for either the x or y components
1207         require a layout before starting, which CSSAnimationController would perform in the call to
1208         CSSAnimationControllerPrivate::animationTimerFired() made immediately after a CSS animation was
1209         created.
1210
1211         We now perform a similar task where upon setting new blending keyframes we compute a flag indicating
1212         if the keyframe effect is animating a transform with relative x or y components. Then, when we perform
1213         the first invalidation task, which runs in the next run loop after a change to the timing model has
1214         been made, such as a call to play() on a CSSAnimation made in the TreeResolver::createAnimatedElementUpdate()
1215         where the CSSAnimation was created, we call forceLayout() on this element's FrameView. We also ensure
1216         we commit animations on the compositor immediately after that too, instead of waiting until the next
1217         DisplayRefreshMonitor callback.
1218
1219         * animation/DocumentTimeline.cpp:
1220         (WebCore::DocumentTimeline::performInvalidationTask):
1221         (WebCore::DocumentTimeline::updateAnimations):
1222         * animation/KeyframeEffectReadOnly.cpp:
1223         (WebCore::KeyframeEffectReadOnly::forceLayoutIfNeeded):
1224         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes):
1225         (WebCore::KeyframeEffectReadOnly::computedNeedsForcedLayout):
1226         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
1227         * animation/KeyframeEffectReadOnly.h:
1228
1229 2018-04-16  Pablo Saavedra  <psaavedra@igalia.com>
1230
1231         Inconsistent EGL defines in ImageBufferCairo
1232         https://bugs.webkit.org/show_bug.cgi?id=184661
1233
1234         Reviewed by Žan Doberšek.
1235
1236         On revision r219391 libepoxy is added. The headers in
1237         ImageBufferCairo.cpp become inconsistent when 2D canvas is enabled
1238         (-DENABLE_ACCELERATED_2D_CANVAS=ON) due to a redefinition error during
1239         the Webkit build:
1240
1241             ...
1242             /usr/include/GLES2/gl2.h:503:82: error: 'voi
1243             epoxy_glAttachShader(GLuint, GLuint)' redeclared as different kind
1244             of symbol
1245             GL_APICALL void         GL_APIENTRY glAttachShader (GLuint
1246             program, GLuint shader);
1247
1248         No new tests.
1249
1250         * platform/graphics/cairo/ImageBufferCairo.cpp:
1251
1252 2018-04-16  Filip Pizlo  <fpizlo@apple.com>
1253
1254         MutationObserver should be in an IsoHeap
1255         https://bugs.webkit.org/show_bug.cgi?id=184671
1256         <rdar://problem/36081981>
1257
1258         Reviewed by Sam Weinig.
1259
1260         No new tests because no new behavior.
1261
1262         * dom/MutationObserver.cpp:
1263         * dom/MutationObserver.h:
1264
1265 2018-04-16  Youenn Fablet  <youenn@apple.com>
1266
1267         Use NetworkLoadChecker to handle synchronous HTTP loads
1268         https://bugs.webkit.org/show_bug.cgi?id=184240
1269
1270         Reviewed by Chris Dumez.
1271
1272         Update LoaderStrategy::loadResourceSynchronously to pass FetchOptions directly.
1273         Update various call sites accordingly. This allows NetworkProcess to do all necessary checks.
1274         Add an option to disable security checks if NetworkProcess does it for WebProcess.
1275         This option will be also used for regular asynchronous loads in future patches.
1276
1277         Update DocumentThreadableLoader to bypass preflighting and response validation checks in case they are done in NetworkProcess.
1278
1279         Covered by existing and rebased tests.
1280
1281         * loader/CrossOriginPreflightChecker.cpp:
1282         (WebCore::CrossOriginPreflightChecker::doPreflight):
1283         * loader/DocumentThreadableLoader.cpp:
1284         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
1285         (WebCore::DocumentThreadableLoader::loadRequest):
1286         * loader/FrameLoader.cpp:
1287         (WebCore::FrameLoader::loadResourceSynchronously):
1288         * loader/FrameLoader.h:
1289         * loader/LoaderStrategy.h:
1290         * xml/XSLTProcessorLibxslt.cpp:
1291         (WebCore::docLoaderFunc):
1292         * xml/parser/XMLDocumentParserLibxml2.cpp:
1293         (WebCore::openFunc):
1294
1295 2018-04-16  Christopher Reid  <chris.reid@sony.com>
1296
1297         [WinCairo] Media elements should be enabled by default
1298         https://bugs.webkit.org/show_bug.cgi?id=184597
1299
1300         Reviewed by Per Arne Vollan.
1301
1302         Enabling media elements by default with media foundation.
1303
1304         * page/SettingsDefaultValues.h:
1305
1306 2018-04-16  Christopher Reid  <chris.reid@sony.com>
1307
1308         [Curl] Add the Accept-Language field to curl request headers
1309         https://bugs.webkit.org/show_bug.cgi?id=184605
1310
1311         Reviewed by Alex Christensen.
1312
1313         Add Accept-Language field to curl request headers
1314
1315         * platform/network/curl/CurlRequest.cpp:
1316         * platform/network/curl/CurlRequest.h:
1317
1318 2018-04-16  Chris Dumez  <cdumez@apple.com>
1319
1320         Move more WindowProxy-related logic from ScriptController to WindowProxyController
1321         https://bugs.webkit.org/show_bug.cgi?id=184640
1322
1323         Reviewed by Ryosuke Niwa.
1324
1325         Move more WindowProxy-related logic from ScriptController to WindowProxyController,
1326         for clarity.
1327
1328         * bindings/js/JSDOMWindowProxy.cpp:
1329         (WebCore::JSDOMWindowProxy::attachDebugger):
1330         * bindings/js/JSDOMWindowProxy.h:
1331         * bindings/js/ScriptCachedFrameData.cpp:
1332         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
1333         (WebCore::ScriptCachedFrameData::restore):
1334         * bindings/js/ScriptController.cpp:
1335         (WebCore::ScriptController::~ScriptController):
1336         (WebCore::ScriptController::initScriptForWindowProxy):
1337         * bindings/js/ScriptController.h:
1338         (WebCore::ScriptController::existingCacheableBindingRootObject const):
1339         * bindings/js/WindowProxyController.cpp:
1340         (WebCore::collectGarbageAfterWindowProxyDestruction):
1341         (WebCore::WindowProxyController::~WindowProxyController):
1342         (WebCore::WindowProxyController::clearWindowProxiesNotMatchingDOMWindow):
1343         (WebCore::WindowProxyController::setDOMWindowForWindowProxy):
1344         (WebCore::WindowProxyController::attachDebugger):
1345         * bindings/js/WindowProxyController.h:
1346         * loader/FrameLoader.cpp:
1347         (WebCore::FrameLoader::clear):
1348         * page/Page.cpp:
1349         (WebCore::Page::setDebugger):
1350
1351 2018-04-16  Thibault Saunier  <tsaunier@igalia.com>
1352
1353         [GStreamer] Set *TrackPrivateGStreamer::active based on GstStream default select in constructor
1354         https://bugs.webkit.org/show_bug.cgi?id=184652
1355
1356         Reviewed by Philippe Normand.
1357
1358         In the constructor we should mark selected streams based on the default values from GstStream,
1359         if the user changes them, they will be updated as required later on.
1360
1361         No new tests are added as we already have a few ones that are currently disabled in
1362         the mediastream testsuite. This patch is part of the work to enable them.
1363
1364         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
1365         (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
1366         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
1367         (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
1368
1369 2018-04-16  Thibault Saunier  <tsaunier@igalia.com>
1370
1371         [GStreamer] Set TrackPrivateBaseGStreamer metadata information even if no client is avalaible
1372         https://bugs.webkit.org/show_bug.cgi?id=184651
1373
1374         Reviewed by Philippe Normand.
1375
1376         We can't notify the client if none is connected, but still we need to fill our metadatas from
1377         the provided GstTagList, especially in the case of playbin3 where the client is not set yet
1378         at construct time but the metadata might already be preset (and won't be updated later on).
1379
1380         No new tests are added as we already have a few ones that are currently disabled in
1381         the mediastream testsuite. This patch is part of the work to enable them.
1382
1383         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
1384         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged):
1385
1386 2018-04-16  Antoine Quint  <graouts@apple.com>
1387
1388         [Web Animations] Ensure we never return -0 through the API
1389         https://bugs.webkit.org/show_bug.cgi?id=184644
1390
1391         Reviewed by Dean Jackson.
1392
1393         We could sometimes return -0 instead of 0, which is surprising and leads to an error in WPT tests.
1394         This would happen when playbackRate < 0.
1395
1396         * animation/WebAnimationUtilities.h:
1397         (WebCore::secondsToWebAnimationsAPITime):
1398
1399 2018-04-15  Antoine Quint  <graouts@apple.com>
1400
1401         [Web Animations] Animations do not naturally get a finish event
1402         https://bugs.webkit.org/show_bug.cgi?id=184639
1403         <rdar://problem/39397649>
1404
1405         Reviewed by Jon Lee.
1406
1407         We must call updateFinishedState() when an animation gets sampled as it means its timeline's time has progressed
1408         and it may have crossed to a finished state. Calling updateFinishedState() when sampling means that we'll correctly
1409         set the animation's hold time to its end value, which means that currentTime() will now always be clamped to return
1410         the end time once its has reached it, so we must not schedule animations to resolve immediately anymore since otherwise
1411         they will keep being scheduled in a loop.
1412
1413         * animation/WebAnimation.cpp:
1414         (WebCore::WebAnimation::timeToNextRequiredTick const):
1415         (WebCore::WebAnimation::resolve):
1416
1417 2018-04-15  Chris Dumez  <cdumez@apple.com>
1418
1419         Change Event's returnValue so it doesn't expose a new primitive
1420         https://bugs.webkit.org/show_bug.cgi?id=184415
1421
1422         Reviewed by Darin Adler.
1423
1424         Update Event.returnValue setter to match the latest DOM specification after:
1425         - https://github.com/whatwg/dom/pull/626
1426
1427         In particular, the returnValue setter is now a no-op if the new flag value
1428         is true. If the input flag value is false, it only sets the 'canceled' flag
1429         if the event is cancelable and the event’s in passive listener flag is unset.
1430
1431         Test: imported/w3c/web-platform-tests/dom/events/Event-returnValue.html
1432
1433         * dom/Event.cpp:
1434         (WebCore::Event::setLegacyReturnValue):
1435         (WebCore::Event::setCanceledFlagIfPossible):
1436         (WebCore::Event::preventDefault):
1437         * dom/Event.h:
1438
1439 2018-04-14  Thibault Saunier  <tsaunier@igalia.com>
1440
1441         [GStreamer] Expose a method to retrieve the GstStream from a TrackPrivateBaseGStreamer
1442         https://bugs.webkit.org/show_bug.cgi?id=184620
1443
1444         Reviewed by Philippe Normand.
1445
1446         This is a minor change, a dedicated test doesn't really make sense here.
1447
1448         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
1449         (WebCore::TrackPrivateBaseGStreamer::stream):
1450
1451 2018-04-13  Ryosuke Niwa  <rniwa@webkit.org>
1452
1453         WebKit crashes when libwebrtc.dylib is missing
1454         https://bugs.webkit.org/show_bug.cgi?id=184607
1455
1456         Rubber-stamped by Jer Noble.
1457
1458         Don't call LibWebRTC related code when libwebrtc is not available.
1459
1460         * dom/Document.cpp:
1461         (WebCore::Document::prepareForDestruction):
1462         (WebCore::Document::suspend):
1463
1464 2018-04-13  Chris Dumez  <cdumez@apple.com>
1465
1466         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame
1467         https://bugs.webkit.org/show_bug.cgi?id=184591
1468
1469         Reviewed by Sam Weinig.
1470
1471         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame.
1472         RemoteFrames do not need a ScriptController but do need to maintain WindowProxies.
1473         This is work towards fixing Bug 184515.
1474
1475         * Sources.txt:
1476         * WebCore.xcodeproj/project.pbxproj:
1477         * bindings/js/DOMWrapperWorld.cpp:
1478         (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
1479         (WebCore::DOMWrapperWorld::clearWrappers):
1480         * bindings/js/DOMWrapperWorld.h:
1481         (WebCore::DOMWrapperWorld::didCreateWindowProxy):
1482         (WebCore::DOMWrapperWorld::didDestroyWindowProxy):
1483         * bindings/js/JSBindingsAllInOne.cpp:
1484         * bindings/js/JSDOMWindowBase.cpp:
1485         (WebCore::toJSDOMWindow):
1486         * bindings/js/JSDOMWindowProxy.cpp:
1487         (WebCore::toJS):
1488         (WebCore::toJSDOMWindowProxy):
1489         * bindings/js/ScriptCachedFrameData.cpp:
1490         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
1491         (WebCore::ScriptCachedFrameData::restore):
1492         * bindings/js/ScriptController.cpp:
1493         (WebCore::ScriptController::~ScriptController):
1494         (WebCore::ScriptController::evaluateInWorld):
1495         (WebCore::ScriptController::loadModuleScriptInWorld):
1496         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
1497         (WebCore::ScriptController::evaluateModule):
1498         (WebCore::ScriptController::clearWindowProxiesNotMatchingDOMWindow):
1499         (WebCore::ScriptController::setDOMWindowForWindowProxy):
1500         (WebCore::ScriptController::initScriptForWindowProxy):
1501         (WebCore::ScriptController::setupModuleScriptHandlers):
1502         (WebCore::ScriptController::windowProxyController):
1503         (WebCore::ScriptController::enableEval):
1504         (WebCore::ScriptController::enableWebAssembly):
1505         (WebCore::ScriptController::disableEval):
1506         (WebCore::ScriptController::disableWebAssembly):
1507         (WebCore::ScriptController::attachDebugger):
1508         (WebCore::ScriptController::updateDocument):
1509         (WebCore::ScriptController::collectIsolatedContexts):
1510         (WebCore::ScriptController::windowScriptNPObject):
1511         (WebCore::ScriptController::executeIfJavaScriptURL):
1512         * bindings/js/ScriptController.h:
1513         (WebCore::ScriptController::globalObject):
1514         * bindings/js/ScriptControllerMac.mm:
1515         (WebCore::ScriptController::windowScriptObject):
1516         * bindings/js/ScriptState.cpp:
1517         (WebCore::mainWorldExecState):
1518         * bindings/js/WindowProxyController.cpp: Added.
1519         (WebCore::WindowProxyController::WindowProxyController):
1520         (WebCore::WindowProxyController::destroyWindowProxy):
1521         (WebCore::WindowProxyController::createWindowProxy):
1522         (WebCore::WindowProxyController::windowProxies):
1523         (WebCore::WindowProxyController::createWindowProxyWithInitializedScript):
1524         * bindings/js/WindowProxyController.h: Added.
1525         (WebCore::WindowProxyController::releaseWindowProxies):
1526         (WebCore::WindowProxyController::setWindowProxies):
1527         (WebCore::WindowProxyController::windowProxy):
1528         (WebCore::WindowProxyController::existingWindowProxy const):
1529         (WebCore::WindowProxyController::globalObject):
1530         * loader/FrameLoader.cpp:
1531         (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
1532         * page/AbstractFrame.cpp:
1533         (WebCore::AbstractFrame::AbstractFrame):
1534         * page/AbstractFrame.h:
1535         (WebCore::AbstractFrame::windowProxyController):
1536         (WebCore::AbstractFrame::windowProxyController const):
1537
1538 2018-04-13  Brady Eidson  <beidson@apple.com>
1539
1540         Introduce SuspendedPageProxy to keep old web processes around after their WebPageProxy has been swapped to a new one.
1541         https://bugs.webkit.org/show_bug.cgi?id=184559
1542
1543         Reviewed by Alex Christensen.
1544
1545         Covered by new API test.
1546
1547         WebCore changes rework the meaning of a "ForSuspension" policy to simply navigate the page to about:blank.
1548
1549         * loader/DocumentLoader.cpp:
1550         (WebCore::DocumentLoader::redirectReceived):
1551         (WebCore::DocumentLoader::willSendRequest):
1552         (WebCore::DocumentLoader::startLoadingMainResource):
1553         * loader/DocumentLoader.h:
1554
1555         * loader/FrameLoader.cpp:
1556         (WebCore::FrameLoader::init):
1557         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
1558
1559 2018-04-13  Chris Dumez  <cdumez@apple.com>
1560
1561         input.webkitEntries does not work as expected when folder contains accented chars
1562         https://bugs.webkit.org/show_bug.cgi?id=184517
1563         <rdar://problem/39265537>
1564
1565         Reviewed by Alex Christensen.
1566
1567         Use String::fromUTF8() to construct a WTF String from the char* returned by
1568         dirname() in FileSystem::directoryName(). Previously, we were just calling
1569         the String constructor, which would treat the input as latin 1 instead of
1570         UTF-8.
1571
1572         Change is covered by an API test rather than a layout test due to file versioning
1573         limitations.
1574
1575         * platform/posix/FileSystemPOSIX.cpp:
1576         (WebCore::FileSystem::directoryName):
1577
1578 2018-04-13  Yusuke Suzuki  <utatane.tea@gmail.com>
1579
1580         [WebCore] Use @getByIdDirectPrivate / @putByIdDirectPrivate in WebCore JS
1581         https://bugs.webkit.org/show_bug.cgi?id=184401
1582
1583         Rubber stamped by Saam Barati.
1584
1585         Apply bug 183970 changes to WebCore JS too. This offers solid type checking
1586         with @getByIdDirectPrivate().
1587
1588         * Modules/mediastream/RTCPeerConnection.js:
1589         (initializeRTCPeerConnection):
1590         (getLocalStreams):
1591         (getStreamById):
1592         (addStream):
1593         * Modules/mediastream/RTCPeerConnectionInternals.js:
1594         (isRTCPeerConnection):
1595         * Modules/streams/ReadableByteStreamController.js:
1596         (enqueue):
1597         (error):
1598         (close):
1599         (getter.byobRequest):
1600         * Modules/streams/ReadableByteStreamInternals.js:
1601         (privateInitializeReadableStreamBYOBReader):
1602         (privateInitializeReadableByteStreamController):
1603         (privateInitializeReadableStreamBYOBRequest):
1604         (isReadableByteStreamController):
1605         (isReadableStreamBYOBRequest):
1606         (isReadableStreamBYOBReader):
1607         (readableByteStreamControllerCancel):
1608         (readableByteStreamControllerError):
1609         (readableByteStreamControllerClose):
1610         (readableByteStreamControllerClearPendingPullIntos):
1611         (readableByteStreamControllerGetDesiredSize):
1612         (readableStreamHasBYOBReader):
1613         (readableStreamHasDefaultReader):
1614         (readableByteStreamControllerHandleQueueDrain):
1615         (readableByteStreamControllerPull):
1616         (readableByteStreamControllerShouldCallPull):
1617         (readableByteStreamControllerCallPullIfNeeded):
1618         (readableByteStreamControllerEnqueue):
1619         (readableByteStreamControllerEnqueueChunk):
1620         (readableByteStreamControllerRespondWithNewView):
1621         (readableByteStreamControllerRespond):
1622         (readableByteStreamControllerRespondInternal):
1623         (readableByteStreamControllerRespondInReadableState):
1624         (readableByteStreamControllerRespondInClosedState):
1625         (readableByteStreamControllerProcessPullDescriptors):
1626         (readableByteStreamControllerFillDescriptorFromQueue):
1627         (readableByteStreamControllerShiftPendingDescriptor):
1628         (readableByteStreamControllerInvalidateBYOBRequest):
1629         (readableByteStreamControllerCommitDescriptor):
1630         (readableStreamFulfillReadIntoRequest):
1631         (readableByteStreamControllerPullInto):
1632         (readableStreamAddReadIntoRequest):
1633         * Modules/streams/ReadableStream.js:
1634         (initializeReadableStream):
1635         (pipeThrough):
1636         * Modules/streams/ReadableStreamBYOBReader.js:
1637         (cancel):
1638         (read):
1639         (releaseLock):
1640         (getter.closed):
1641         * Modules/streams/ReadableStreamBYOBRequest.js:
1642         (respond):
1643         (respondWithNewView):
1644         (getter.view):
1645         * Modules/streams/ReadableStreamDefaultController.js:
1646         (error):
1647         * Modules/streams/ReadableStreamDefaultReader.js:
1648         (cancel):
1649         (read):
1650         (releaseLock):
1651         (getter.closed):
1652         * Modules/streams/ReadableStreamInternals.js:
1653         (privateInitializeReadableStreamDefaultReader):
1654         (readableStreamReaderGenericInitialize):
1655         (readableStreamDefaultControllerError):
1656         (readableStreamPipeTo):
1657         (readableStreamTee):
1658         (isReadableStream):
1659         (isReadableStreamDefaultReader):
1660         (isReadableStreamDefaultController):
1661         (readableStreamError):
1662         (readableStreamDefaultControllerCallPullIfNeeded):
1663         (readableStreamDefaultControllerGetDesiredSize):
1664         (readableStreamReaderGenericCancel):
1665         (readableStreamCancel):
1666         (readableStreamDefaultControllerCancel):
1667         (readableStreamDefaultControllerPull):
1668         (readableStreamDefaultControllerClose):
1669         (readableStreamClose):
1670         (readableStreamFulfillReadRequest):
1671         (readableStreamDefaultReaderRead):
1672         (readableStreamAddReadRequest):
1673         (isReadableStreamDisturbed):
1674         (readableStreamReaderGenericRelease):
1675         (readableStreamDefaultControllerCanCloseOrEnqueue):
1676         (privateInitializeReadableStreamDefaultController): Deleted.
1677         * Modules/streams/StreamInternals.js:
1678         (validateAndNormalizeQueuingStrategy):
1679         * Modules/streams/WritableStream.js:
1680         (initializeWritableStream):
1681         (abort):
1682         (close):
1683         (write):
1684         (getter.closed):
1685         (getter.ready):
1686         (getter.state):
1687         * Modules/streams/WritableStreamInternals.js:
1688         (isWritableStream):
1689         (syncWritableStreamStateWithQueue):
1690         (errorWritableStream):
1691         (callOrScheduleWritableStreamAdvanceQueue):
1692         * bindings/js/JSDOMBindingInternals.js:
1693         (mapLikeForEach):
1694
1695 2018-04-12  Antoine Quint  <graouts@apple.com>
1696
1697         [Web Animations] Turn CSS Animations and CSS Transitions as Web Animations on by default
1698         https://bugs.webkit.org/show_bug.cgi?id=184569
1699         <rdar://problem/38671301>
1700
1701         Reviewed by Jon Lee.
1702
1703         We now set the CSS Animations and CSS Transitions as Web Animations flag on by default. To ensure that some remaining
1704         tests pass with this flag on, we expose a way to get to a PseudoElement via a new internals.pseudoElement() method. This
1705         allows tests that used internals.pauseAnimationAtTimeOnPseudoElement() and internals.pauseTransitionAtTimeOnPseudoElement()
1706         to now work with the Web Animations API.
1707
1708         * page/RuntimeEnabledFeatures.h:
1709         * testing/Internals.cpp:
1710         (WebCore::Internals::pseudoElement):
1711         * testing/Internals.h:
1712         * testing/Internals.idl:
1713
1714 2018-04-13  Sergio Villar Senin  <svillar@igalia.com>
1715
1716         [WebVR][OpenVR] Implement requestPresent()/exitPresent() and getLayers()
1717         https://bugs.webkit.org/show_bug.cgi?id=184530
1718
1719         Reviewed by Žan Doberšek.
1720
1721         WebVR apps should invoke requestPresent() to start presenting contents of a VRLayerInit
1722         (right now a HTML canvas with a WebGL context) on the VRDisplay. This request might fail for
1723         a variety of reasons and can be eventually cancelled with exitPresent(). Once we are
1724         presenting we could access the presenting layers (right now just one) with getLayers().
1725
1726         Note that we are not presenting anything to the HMD yet, that will be done later in a follow
1727         up patch.
1728
1729         I took the chance to correct a mistak in the VRDisplayCapabilities object which has a method
1730         that should be called maxLayers instead of maxLayer.
1731
1732         * Modules/webvr/VRDisplay.cpp:
1733         (WebCore::VRDisplay::requestPresent):
1734         (WebCore::VRDisplay::stopPresenting):
1735         (WebCore::VRDisplay::exitPresent):
1736         (WebCore::VRDisplay::getLayers const):
1737         (WebCore::VRDisplay::isPresenting const): Deleted. Implemented in the header file.
1738         * Modules/webvr/VRDisplay.h:
1739         (WebCore::VRDisplay::isPresenting const):
1740         * Modules/webvr/VRDisplayCapabilities.h:
1741         (WebCore::VRDisplayCapabilities::maxLayers const): Renamed from maxLayer().
1742         (WebCore::VRDisplayCapabilities::maxLayer const): Deleted.
1743         * Modules/webvr/VRDisplayCapabilities.idl:
1744
1745 2018-04-13  Miguel Gomez  <magomez@igalia.com>
1746
1747         REGRESSION(r230627): [GTK][WPE] Possible deadlock when destroying the player in non AC mode
1748         https://bugs.webkit.org/show_bug.cgi?id=184583
1749
1750         Reviewed by Carlos Garcia Campos.
1751
1752         In non AC mode, ensure that a deadlock can't happen when destroying MediaPlayerPrivateGStreamerBase.
1753
1754         Covered by existent tests.
1755
1756         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1757         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
1758         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
1759         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
1760         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1761
1762 2018-04-13  Miguel Gomez  <magomez@igalia.com>
1763
1764         [GTK] [gstreamer] video won't unpause when built with -DUSE_GSTREAMER_GL=OFF
1765         https://bugs.webkit.org/show_bug.cgi?id=183362
1766
1767         Reviewed by Carlos Garcia Campos.
1768
1769         Remove the drawCancelled flag and use a new one to indicate that the player is being destroyed.
1770         That new flag is only enabled on destruction and it's not modified by cancelRepaint(), which
1771         can be used to handle the pause event without avoiding future renderings. Also cancelRepaint()
1772         has only effect when not in AC mode.
1773
1774         Covered by existent tests.
1775
1776         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1777         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
1778         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
1779         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
1780         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1781
1782 2018-04-13  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1783
1784         [GStreamer] Convert GStreamerUtilities in GStreamerCommon and include the GStreamer smart pointer traits
1785         https://bugs.webkit.org/show_bug.cgi?id=184533
1786
1787         Reviewed by Philippe Normand.
1788
1789         Renamed GStreamerUtilities* files into GStreamerCommon* and
1790         modified files including them accordingly. Include
1791         GRefPtrGStreamer.h and GUniquePtrGStreamer.h in GStreamerCommon.h
1792         to avoid problems destroying objects when those files are
1793         forgotten to be included.
1794
1795         * Modules/webaudio/AudioContext.cpp:
1796         * platform/GStreamer.cmake:
1797         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
1798         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
1799         * platform/graphics/gstreamer/GStreamerCommon.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp.
1800         * platform/graphics/gstreamer/GStreamerCommon.h: Renamed from Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h.
1801         * platform/graphics/gstreamer/ImageGStreamer.h:
1802         * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
1803         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
1804         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
1805         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1806         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1807         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1808         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1809         * platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
1810         * platform/graphics/gstreamer/MediaSampleGStreamer.h:
1811         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
1812         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
1813         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
1814         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
1815         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
1816         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1817         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp:
1818         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
1819         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
1820         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
1821         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1822         * platform/graphics/gstreamer/mse/AppendPipeline.h:
1823         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp:
1824         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.h:
1825         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1826         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
1827         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
1828         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
1829         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
1830         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
1831         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h:
1832
1833 2018-04-12  Christopher Reid  <chris.reid@sony.com>
1834
1835         [Curl] Fix clang build error in CurlContext.cpp
1836         https://bugs.webkit.org/show_bug.cgi?id=184561
1837
1838         Reviewed by Darin Adler.
1839
1840         MSVC allows explicit template specialization in classes but gcc/clang do not.
1841
1842         * platform/network/curl/CurlContext.cpp:
1843
1844 2018-04-12  Christopher Reid  <chris.reid@sony.com>
1845
1846         [Curl] Cookie Database on memory path should be :memory:
1847         https://bugs.webkit.org/show_bug.cgi?id=184572
1848
1849         Reviewed by Alex Christensen.
1850
1851         CookieJarDB::isOnMemory is comparing the database path with :onmemory: but it should be using :memory:
1852         For reference, see: https://www.sqlite.org/inmemorydb.html
1853
1854         * platform/network/curl/CookieJarDB.h:
1855
1856 2018-04-12  Daniel Bates  <dabates@apple.com>
1857
1858         Attmept to fix the Windows build following <https://trac.webkit.org/changeset/230602/>
1859         (https://bugs.webkit.org/show_bug.cgi?id=184386)
1860
1861         Visual Studio cannot prove that all cases in the switch are covered :(
1862         So, add an ASSERT_NOT_REACHED() and a return a value outside of the switch block. 
1863
1864         * loader/cache/CachedResourceLoader.cpp:
1865         (WebCore::destinationForType):
1866
1867 2018-04-12  Chris Dumez  <cdumez@apple.com>
1868
1869         Introduce remote variants of Frame / DOMWindow classes
1870         https://bugs.webkit.org/show_bug.cgi?id=184467
1871         <rdar://problem/39011267>
1872
1873         Reviewed by Ryosuke Niwa.
1874
1875         Introduce remote variants of Frame / DOMWindow classes, for when these frames / windows
1876         are hosted on another WebProcess. Those will be used in a follow-up patch.
1877
1878         The hierarchy is as follows (class naming will be improved in a follow-up patch to minimise
1879         patch size):
1880         - AbstractFrame: A frame that can be either local or remote (hosted on another WebProcess)
1881             - Frame: A local frame
1882             - RemoteFrame: A frame hosted on another WebProcess. A RemoteFrame's window is also remote.
1883         - AbstractDOMWindow: A window that be either local or remote (hosted on another WebProcess)
1884             - DOMWindow: A local DOMWindow
1885             - RemoteDOMWindow: A window hosted on another WebProcess. A RemoteDOMWindow's frame is also
1886               remote. A RemoteDOMWindow is always cross-origin.
1887
1888         This patch introduces global identifiers (unique across all WebProcesses) for both Frames and
1889         Windows. This is useful as we need to know which Frame / DOMWindow a particular RemoteFrame /
1890         RemoteDOMWindow is pointing to.
1891
1892         Follow-up patch will add support for converting a local DOMWindow / Frame into a remote ones,
1893         when a newly opened window (via window.open) is navigated cross-origin (Bug 184515).
1894
1895         Other things we'll need to implement in follow-ups:
1896         - RemoteDOMWindow will need to know about its opener in order to support the window.opener
1897           API. Internally, the opener will be stored as a RemoteFrame so that window.opener always
1898           returns the current window in the opener frame (which changes upon navigation).
1899         - Nullify a RemoteDOMWindow's frame whenever the window it is pointing to becomes frameless.
1900           A frameless window behaves very differently (e.g. very little API is exposed to the Web).
1901           This happens when either the newly opened window is either closed or navigated.
1902
1903         * Sources.txt:
1904         * WebCore.xcodeproj/project.pbxproj:
1905         * loader/ContentFilter.cpp:
1906         (WebCore::ContentFilter::didDecide):
1907         * page/AbstractDOMWindow.cpp: Added.
1908         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
1909         (WebCore::AbstractDOMWindow::~AbstractDOMWindow):
1910         * page/AbstractDOMWindow.h: Added.
1911         (WebCore::AbstractDOMWindow::identifier const):
1912         * page/AbstractFrame.cpp: Added.
1913         (WebCore::AbstractFrame::AbstractFrame):
1914         (WebCore::AbstractFrame::~AbstractFrame):
1915         * page/AbstractFrame.h: Added.
1916         (WebCore::AbstractFrame::window const):
1917         * page/DOMWindow.cpp:
1918         (WebCore::DOMWindow::DOMWindow):
1919         * page/DOMWindow.h:
1920         (isType):
1921         * page/Frame.cpp:
1922         (WebCore::Frame::window const):
1923         (WebCore::Frame::virtualWindow const):
1924         * page/Frame.h:
1925         (isType):
1926         * page/GlobalFrameIdentifier.h: Added.
1927         (WebCore::GlobalFrameIdentifier::encode const):
1928         (WebCore::GlobalFrameIdentifier::decode):
1929         * page/GlobalWindowIdentifier.h: Added.
1930         (WebCore::operator==):
1931         (WebCore::GlobalWindowIdentifier::hash const):
1932         (WebCore::GlobalWindowIdentifier::encode const):
1933         (WebCore::GlobalWindowIdentifier::decode):
1934         (WTF::GlobalWindowIdentifierHash::hash):
1935         (WTF::GlobalWindowIdentifierHash::equal):
1936         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::emptyValue):
1937         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::constructDeletedValue):
1938         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::isDeletedValue):
1939
1940         * page/RemoteDOMWindow.cpp: Added.
1941         (WebCore::RemoteDOMWindow::RemoteDOMWindow):
1942         (WebCore::RemoteDOMWindow::~RemoteDOMWindow):
1943         (WebCore::RemoteDOMWindow::self const):
1944         (WebCore::RemoteDOMWindow::location const):
1945         (WebCore::RemoteDOMWindow::close):
1946         (WebCore::RemoteDOMWindow::closed const):
1947         (WebCore::RemoteDOMWindow::focus):
1948         (WebCore::RemoteDOMWindow::blur):
1949         (WebCore::RemoteDOMWindow::length const):
1950         (WebCore::RemoteDOMWindow::top const):
1951         (WebCore::RemoteDOMWindow::opener const):
1952         (WebCore::RemoteDOMWindow::parent const):
1953         (WebCore::RemoteDOMWindow::postMessage):
1954         The DOM API exposed on RemoteDOMWindow is only the subset of the DOMWindow API that is exposed cross origin,
1955         since remote DOMWindow are always from a different origin. The short-term plan is to implement these in a
1956         follow-up by relying on IPC (synchronous when necessary) to fetch the information from the real window in
1957         the WebProcess where it lives. Longer term, we should probably keep RemoteDOMWindow members in sync with the
1958         DOMWindow they're pointing to, so we do not have to rely on synchronous IPC.
1959
1960         * page/RemoteDOMWindow.h: Added.
1961         (isType):
1962         * page/RemoteFrame.cpp: Added.
1963         (WebCore::RemoteFrame::RemoteFrame):
1964         (WebCore::RemoteFrame::~RemoteFrame):
1965         (WebCore::RemoteFrame::virtualWindow const):
1966         * page/RemoteFrame.h: Added.
1967         (isType):
1968
1969 2018-04-12  Daniel Bates  <dabates@apple.com>
1970
1971         Content-Type not enforced for <script> allows for XSS
1972         https://bugs.webkit.org/show_bug.cgi?id=184386
1973         <rdar://problem/39112268>
1974
1975         Reviewed by Brady Eidson.
1976
1977         As per the Fetch standard, <https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-mime-type?> (16 March 2018),
1978         we should block JavaScript scripts that are served with MIME type text/csv, or a MIME type
1979         that begins with "audio/", "image/" or "video/".
1980
1981         As a side benefit of this change we now set the destination property [1] on preload requests.
1982
1983         [1] <https://fetch.spec.whatwg.org/#concept-request-destination>
1984
1985         Tests: http/tests/security/script-with-banned-mimetype.html
1986                http/tests/workers/worker-importScripts-banned-mimetype.html
1987
1988         * Sources.txt: Add file FetchIdioms.cpp.
1989         * WebCore.xcodeproj/project.pbxproj: Add files FetchIdioms.{cpp, h}.
1990         * dom/LoadableClassicScript.cpp:
1991         (WebCore::LoadableClassicScript::notifyFinished): Check the MIME type of the response and
1992         block the script if applicable.
1993         * dom/LoadableScript.h: Add error type MIMEType.
1994         * loader/FetchIdioms.cpp: Added.
1995         (WebCore::shouldBlockResponseDueToMIMEType): Implements the "Should response to request be blocked
1996         due to its MIME type?" algorithm from the Fetch standard.
1997         * loader/FetchIdioms.h: Added.
1998         * loader/FetchOptions.h:
1999         (WebCore::isScriptLikeDestination): Implements the definition of "script like" as per <https://fetch.spec.whatwg.org/#request-destination-script-like>.
2000         * loader/cache/CachedResourceLoader.cpp:
2001         (WebCore::CachedResourceLoader::requestImage): Removed logic to set the destination property as
2002         CachedResourceLoader::requestResource() is now responsible for doing this.
2003         (WebCore::CachedResourceLoader::requestFont): Ditto.
2004         (WebCore::CachedResourceLoader::requestTextTrack): Ditto.
2005         (WebCore::CachedResourceLoader::requestCSSStyleSheet): Ditto.
2006         (WebCore::CachedResourceLoader::requestScript): Ditto.
2007         (WebCore::CachedResourceLoader::requestXSLStyleSheet): Ditto.
2008         (WebCore::CachedResourceLoader::requestMedia): Update comment to express that we should assert
2009         that the destination property is either video or audio.
2010         (WebCore::CachedResourceLoader::requestIcon): Remove logic to set the destination property as
2011         CachedResourceLoader::requestResource() is now responsible for doing this.
2012         (WebCore::CachedResourceLoader::requestRawResource): Removed assertion as this function is used to
2013         load many kinds of requests that have different destination properties. The caller is responsible
2014         for setting the appropriate destintion property.
2015         (WebCore::CachedResourceLoader::requestMainResource): Remove logic to set the destination property
2016         as CachedResourceLoader::requestResource() is now responsible for doing this.
2017         (WebCore::destinationForType): Helper function that maps CachedResource::Type to FetchOptions::Destination.
2018         (WebCore::CachedResourceLoader::requestResource): Set the destination property on the request if not
2019         already set.
2020         * loader/cache/CachedResourceLoader.h: Segregate requestRawResource() from the other request functions
2021         and add a comment to explain what it is used for.
2022         * workers/Worker.cpp:
2023         (WebCore::Worker::create):
2024         * workers/WorkerScriptLoader.cpp:
2025         (WebCore::WorkerScriptLoader::loadSynchronously): Set the destination property to FetchOptions::Destination::Script
2026         and store it in an instance variable as we will need to reference it once we receive the HTTP response.
2027         Note that this function is only used to support the Web API importScripts().
2028         (WebCore::WorkerScriptLoader::loadAsynchronously): Store the passed destination property in an
2029         instance as we will need to reference it once we receive the HTTP response.
2030         (WebCore::WorkerScriptLoader::didReceiveResponse): Check the MIME type of the response and
2031         block the script if applicable.
2032         * workers/WorkerScriptLoader.h:
2033         * workers/service/ServiceWorkerJob.cpp:
2034         (WebCore::ServiceWorkerJob::fetchScriptWithContext): Set the destination property to FetchOptions::Destination::Serviceworker.
2035
2036 2018-04-12  Antoine Quint  <graouts@apple.com>
2037
2038         [Web Animations] Fix a host of small CSS Animations and CSS Transitions issues
2039         https://bugs.webkit.org/show_bug.cgi?id=184555
2040
2041         Reviewed by Dean Jackson.
2042
2043         A series of small and intertwined issues were preventing a number of CSS Animations and CSS Trantions
2044         tests to fail when expressed as Web Animations.
2045
2046         * animation/AnimationTimeline.cpp:
2047         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): Pass the old and new RenderStyles to CSSAnimation::create()
2048         since we're refactoring DeclarativeAnimation to create blending keyframes in initialize(), no longer requiring each subclass
2049         to create them.
2050         (WebCore::AnimationTimeline::cssAnimationForElementAndProperty): Return the animation, if any, for a property animated by
2051         a CSS animation, so that we can determine if a property is already being animated when running a CSS Transition.
2052         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Since a property can be specified twice in a "transition" property,
2053         once via "all" and once explicitly, ensure we look at all currently running transitions for the currently-processed property to
2054         see if we need to cancel this transition. Previously, we used to only see if it had been transitioned in the old style. We also
2055         start transitions even if the duration is 0 provided the delay is a positive, non-zero value. Then, if there is a CSS Animation
2056         for this property already running, use that animation's original unanimated style as the from value.
2057         * animation/AnimationTimeline.h:
2058         * animation/CSSAnimation.cpp:
2059         (WebCore::CSSAnimation::create): The animation name is now set in the CSSAnimation constructor.
2060         (WebCore::CSSAnimation::CSSAnimation): Set the animation name and keep a copy of the unanimated style such that we can
2061         get it when a CSS Transition is created and takes precedence over this CSS Animation.
2062         (WebCore::CSSAnimation::initialize): Deleted.
2063         * animation/CSSAnimation.h:
2064         * animation/CSSTransition.cpp:
2065         (WebCore::CSSTransition::create):
2066         (WebCore::CSSTransition::initialize):
2067         * animation/CSSTransition.h:
2068         * animation/DeclarativeAnimation.cpp:
2069         (WebCore::DeclarativeAnimation::initialize): Call the new computeDeclarativeAnimationBlendingKeyframes() on the KeyframeEffect
2070         directly in this method so that subclasses don't need to create it manually, but most important so that keyframes are created
2071         before timing properties are set based on the backing animation.
2072         * animation/DeclarativeAnimation.h:
2073         * animation/KeyframeEffectReadOnly.cpp:
2074         (WebCore::KeyframeEffectReadOnly::getKeyframes): Ensure we have a CSSValue before trying to serialize it.
2075         (WebCore::KeyframeEffectReadOnly::computeDeclarativeAnimationBlendingKeyframes):
2076         (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes): Use the animation's unanimated style to compute keyframes,
2077         instead of a default RenderStyle which would not use the right values for implicit keyframes.
2078         (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Look at the property used to create
2079         the transition rather than that specified on the backing Animation object since it can be CSSPropertyInvalid in the case of
2080         "transition: all".
2081         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle): If we're dealing with a CSS animation, we consider the first and
2082         last keyframes to always have the property listed since the underlying style was provided and should be captured.
2083         * animation/KeyframeEffectReadOnly.h:
2084         * style/StyleTreeResolver.cpp:
2085         (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Apply CSS Animations after CSS Trasitions since they take precedence.
2086
2087 2018-04-12  Antoine Quint  <graouts@apple.com>
2088
2089         [Web Animations] Only cancel declarative animations upon element removal
2090         https://bugs.webkit.org/show_bug.cgi?id=184553
2091
2092         Reviewed by Dean Jackson.
2093
2094         Ensure we only call cancel() on CSSAnimation and CSSTransition objects as we might otherwise reject
2095         the ready promise and produce spurious logging from WPT tests.
2096
2097         * animation/AnimationTimeline.cpp:
2098         (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForElement):
2099         (WebCore::AnimationTimeline::cancelAnimationsForElement): Deleted.
2100         * animation/AnimationTimeline.h:
2101         * dom/Element.cpp:
2102         (WebCore::Element::removedFromAncestor):
2103         * dom/PseudoElement.cpp:
2104         (WebCore::PseudoElement::clearHostElement):
2105         * rendering/updating/RenderTreeUpdater.cpp:
2106         (WebCore::RenderTreeUpdater::tearDownRenderers):
2107
2108 2018-04-12  Ryan Haddad  <ryanhaddad@apple.com>
2109
2110         Unreviewed, rolling out r230554.
2111
2112         The non-ASCII character in the filename causes issues with SVN
2113
2114         Reverted changeset:
2115
2116         "input.webkitEntries does not work as expected when folder
2117         contains accented chars"
2118         https://bugs.webkit.org/show_bug.cgi?id=184517
2119         https://trac.webkit.org/changeset/230554
2120
2121 2018-04-12  Alicia Boya García  <aboya@igalia.com>
2122
2123         [MSE] Add isValid() assertions on PlatformTimeRanges::add() range ends
2124         https://bugs.webkit.org/show_bug.cgi?id=180253
2125
2126         Right now it's checked that start <= end but it's not checked that
2127         neither of them is undefined.
2128
2129         When this happens, the bug can be hard to track down.
2130
2131         The assertion is not enabled for Mac because there is currently a test
2132         that is hitting it.
2133
2134         Reviewed by Jer Noble.
2135
2136         * platform/graphics/PlatformTimeRanges.cpp:
2137         (WebCore::PlatformTimeRanges::add):
2138
2139 2018-04-12  Chris Dumez  <cdumez@apple.com>
2140
2141         Process::setIdentifier() / Process::identifier() do not need a lock
2142         https://bugs.webkit.org/show_bug.cgi?id=184544
2143
2144         Reviewed by Brady Eidson.
2145
2146         Process::setIdentifier() / Process::identifier() do not need a lock.
2147         Process::setIdentifier() gets called in ChildProcess::initialize(),
2148         before we start any background threads. It is then safe to query
2149         this process identifier later on from background threads without
2150         locks.
2151
2152         * platform/Process.cpp:
2153         (WebCore::Process::setIdentifier):
2154         (WebCore::Process::identifier):
2155
2156 2018-04-12  Antoine Quint  <graouts@apple.com>
2157
2158         Unreviewed, fix the Windows build.
2159
2160         * animation/DocumentTimeline.cpp:
2161         (WebCore::DocumentTimeline::computeExtentOfAnimation const):
2162
2163 2018-04-12  Antoine Quint  <graouts@apple.com>
2164
2165         [Web Animations] Suspend animations when required
2166         https://bugs.webkit.org/show_bug.cgi?id=184541
2167
2168         Reviewed by Jon Lee.
2169
2170         Animations managed by CSSAnimationController get suspended under a number of scenarios, we now add the possibility
2171         to suspend animations on a DocumentTimeline as well such that Web Animations and CSS Animations and CSS Transitions
2172         implemented as Web Animations get suspended under the same conditions as well. We also update the implementation for
2173         Internals::numberOfActiveAnimations() such that tests checking that animations get suspended pass.
2174
2175         * animation/DocumentTimeline.cpp:
2176         (WebCore::DocumentTimeline::suspendAnimations): When asked to be suspended, the DocumentTimeline cancels pending
2177         invalidation tasks and updates all of the animations it manages, including those running on the compositor.
2178         (WebCore::DocumentTimeline::resumeAnimations): When asked to be resumed, the DocumentTimeline resumes animations
2179         it manages and rewinds its invalidation timer.
2180         (WebCore::DocumentTimeline::animationsAreSuspended):
2181         (WebCore::DocumentTimeline::numberOfActiveAnimationsForTesting const): Called by Internals::numberOfActiveAnimations(),
2182         this returns the number of animations managed by this timeline that are not suspended.
2183         (WebCore::DocumentTimeline::currentTime):
2184         (WebCore::DocumentTimeline::timingModelDidChange): Ensure the invalidation timer is not rewound if the timeline
2185         is suspended.
2186         * animation/DocumentTimeline.h:
2187         * animation/WebAnimation.cpp:
2188         (WebCore::WebAnimation::setTimeline): When moving to a new timeline, ensure we match the new timeline's animation state.
2189         (WebCore::WebAnimation::setSuspended): Toggle the accelerated running state of any backing hardware animations when
2190         the suspension state of an animation changes.
2191         * animation/WebAnimation.h:
2192         (WebCore::WebAnimation::isSuspended const):
2193         * dom/Document.cpp:
2194         (WebCore::Document::didBecomeCurrentDocumentInFrame):
2195         (WebCore::Document::resume):
2196         * dom/Document.h:
2197         * history/CachedFrame.cpp:
2198         (WebCore::CachedFrameBase::restore):
2199         * page/Frame.cpp:
2200         (WebCore::Frame::clearTimers):
2201         * page/Page.cpp:
2202         (WebCore::Page::setIsVisibleInternal):
2203         (WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged):
2204         * testing/Internals.cpp:
2205         (WebCore::Internals::numberOfActiveAnimations const):
2206         (WebCore::Internals::animationsAreSuspended const):
2207         (WebCore::Internals::suspendAnimations const):
2208         (WebCore::Internals::resumeAnimations const):
2209
2210 2018-04-12  Antoine Quint  <graouts@apple.com>
2211
2212         [Web Animations] Throttle animations when lowPowerMode is on
2213         https://bugs.webkit.org/show_bug.cgi?id=184540
2214
2215         Reviewed by Jon Lee.
2216
2217         Ensure animations are sampled at a lower frequency when lowPowerMode is on.
2218
2219         * animation/DocumentTimeline.cpp:
2220         (WebCore::DocumentTimeline::updateThrottlingState):
2221         (WebCore::DocumentTimeline::animationInterval const):
2222         (WebCore::DocumentTimeline::updateAnimationSchedule):
2223         (WebCore::DocumentTimeline::scheduleAnimationResolution):
2224         * animation/DocumentTimeline.h:
2225         * page/Page.cpp:
2226         (WebCore::Page::handleLowModePowerChange):
2227         * testing/Internals.cpp:
2228         (WebCore::Internals::animationsInterval const):
2229
2230 2018-04-12  Antoine Quint  <graouts@apple.com>
2231
2232         [Web Animations] Ensure elements overlapping with elements animating also get composited
2233         https://bugs.webkit.org/show_bug.cgi?id=184539
2234
2235         Reviewed by Jon Lee.
2236
2237         A number of compositing tests failed because we didn't call into the Web Animations engine while various calls
2238         on RenderLayer and RenderLayerBacking were made. We bring the functionality over from CSSAnimationController to
2239         DocumentTimeline and KeyframeAnimation to KeyframeEffectReadOnly.
2240
2241         * animation/AnimationTimeline.cpp:
2242         (WebCore::AnimationTimeline::animationsForElement const): Update this method's signature to be const since it
2243         should be callable by other const method.
2244         (WebCore::AnimationTimeline::animationsForElement): Deleted.
2245         * animation/AnimationTimeline.h:
2246         * animation/DocumentTimeline.cpp:
2247         (WebCore::DocumentTimeline::computeExtentOfAnimation const): Adapt this method from CSSAnimationController.
2248         (WebCore::DocumentTimeline::isRunningAnimationOnRenderer const): Adapt this method from CSSAnimationController.
2249         (WebCore::DocumentTimeline::isRunningAcceleratedAnimationOnRenderer const): Adapt this method from CSSAnimationController.
2250         * animation/DocumentTimeline.h:
2251         * animation/KeyframeEffectReadOnly.cpp:
2252         (WebCore::KeyframeEffectReadOnly::computeExtentOfTransformAnimation const): Bring this method over from KeyframeAnimation.
2253         (WebCore::containsRotation): Bring this method over from KeyframeAnimation.
2254         (WebCore::KeyframeEffectReadOnly::computeTransformedExtentViaTransformList const): Bring this method over from KeyframeAnimation.
2255         (WebCore::KeyframeEffectReadOnly::computeTransformedExtentViaMatrix const): Bring this method over from KeyframeAnimation.
2256         * animation/KeyframeEffectReadOnly.h:
2257         (WebCore::KeyframeEffectReadOnly::animatedProperties const): DocumentTimeline::computeExtentOfAnimation() needs to get a list
2258         of all animated properties to see if a transform is animated, so we now expose such a list.
2259         * rendering/RenderLayer.cpp:
2260         (WebCore::RenderLayer::currentTransform const): Update this method to call into DocumentTimeline if the CSS Animations
2261         and CSS Transitions as Web Animations flag is on.
2262         (WebCore::RenderLayer::calculateClipRects const): Update this method to call into DocumentTimeline if the CSS Animations
2263         and CSS Transitions as Web Animations flag is on.
2264         * rendering/RenderLayerBacking.cpp:
2265         (WebCore::RenderLayerBacking::updateGeometry): Update this method to call into DocumentTimeline if the CSS Animations
2266         and CSS Transitions as Web Animations flag is on.
2267         * rendering/RenderLayerCompositor.cpp:
2268         (WebCore::RenderLayerCompositor::isRunningTransformAnimation const): Update this method to call into DocumentTimeline
2269         if the CSS Animations and CSS Transitions as Web Animations flag is on.
2270         * rendering/RenderObject.h:
2271         (WebCore::RenderObject::documentTimeline const):
2272
2273 2018-04-11  Antoine Quint  <graouts@apple.com>
2274
2275         [Web Animations] Enable seeking for hardware animations
2276         https://bugs.webkit.org/show_bug.cgi?id=184518
2277
2278         Reviewed by Dean Jackson.
2279
2280         Hardware animations had lagged behind software animations in support and this patch bring their respective level
2281         of support closer to one another. Importantly, we add the ability to seek an animation added to a GraphicsLayerCA
2282         since many tests pause and seek animations to test their state. Animations may also have their playback state changed
2283         along with their current time in the same run loop, so we now maintain a list of pending processing actions for
2284         hardware animations.
2285
2286         * animation/DocumentTimeline.cpp:
2287         (WebCore::DocumentTimeline::updateAnimationSchedule): If we have animations queued up for updates to their accelerated
2288         state we can schedule animation resolution immediately since we've already established we'll have work to do.
2289         (WebCore::DocumentTimeline::updateAnimations): Factor the updates of pending accelerated animations out in a dedicated
2290         method.
2291         (WebCore::DocumentTimeline::applyPendingAcceleratedAnimations): Go through all pending accelerated animations and update
2292         their state.
2293         * animation/KeyframeEffectReadOnly.cpp:
2294         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes): Update the m_shouldRunAccelerated flag when setting blending keyframes.
2295         (WebCore::KeyframeEffectReadOnly::apply): Ensure we finish accelerated animations if the progress is 1 or null (no longer active).
2296         start accelerated animations if the animation is starting and always resolve styles in software as well to ensure that
2297         hit testing will work as expected.
2298         (WebCore::KeyframeEffectReadOnly::computeShouldRunAccelerated):
2299         (WebCore::KeyframeEffectReadOnly::animationPlayStateDidChange): Called by WebAnimation when play() or pause() is called
2300         with the appropriate flag.
2301         (WebCore::KeyframeEffectReadOnly::animationDidSeek): Called by WebAnimation when the currentTime property is set.
2302         (WebCore::KeyframeEffectReadOnly::addPendingAcceleratedAction): Add the provided action to the list of pending accelerated
2303         actions and notify the animation that the accelerated state needs changing.
2304         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Called by DocumentTimeline, through WebAnimation, to apply
2305         all pending accelerated actions.
2306         (WebCore::KeyframeEffectReadOnly::backingAnimationForCompositedRenderer const): If we're dealing with a declarative animation,
2307         we already have a backing Animation object, so use it directly. Otherwise, create one and ensure it reflects all timing properties
2308         for the animation.
2309         (WebCore::KeyframeEffectReadOnly::shouldRunAccelerated): Deleted.
2310         (WebCore::KeyframeEffectReadOnly::startOrStopAccelerated): Deleted.
2311         * animation/WebAnimation.cpp:
2312         (WebCore::WebAnimation::setCurrentTime): Call animationDidSeek() on the effect to ensure its accelerated animation gets seeked.
2313         (WebCore::WebAnimation::play): Call animationPlayStateDidChange() on the effect to ensure its accelerated animation is started or resumed.
2314         (WebCore::WebAnimation::pause): Call animationPlayStateDidChange() on the effect to ensure its accelerated animation gets paused.
2315         (WebCore::WebAnimation::acceleratedStateDidChange): 
2316         (WebCore::WebAnimation::applyPendingAcceleratedActions):
2317         (WebCore::WebAnimation::acceleratedRunningStateDidChange): Deleted.
2318         (WebCore::WebAnimation::startOrStopAccelerated): Deleted.
2319         * platform/graphics/GraphicsLayer.h:
2320         (WebCore::GraphicsLayer::seekAnimation):
2321         * platform/graphics/ca/GraphicsLayerCA.cpp:
2322         (WebCore::GraphicsLayerCA::addProcessingActionForAnimation): Add an AnimationProcessingAction to the list of such actions for a
2323         given animation name. In case we already have a Remove action, we ignore the action since the hardware animation will have been
2324         removed by the time we try to apply this processing action.
2325         (WebCore::GraphicsLayerCA::pauseAnimation): Add a Pause processing action.
2326         (WebCore::GraphicsLayerCA::seekAnimation): Add a Seek processing action.
2327         (WebCore::GraphicsLayerCA::removeAnimation): Add a Remove processing action.
2328         (WebCore::GraphicsLayerCA::updateAnimations): First ensure that all animations pending commit are committed and then update
2329         all animations based on the actions added through addProcessingActionForAnimation().
2330         (WebCore::GraphicsLayerCA::seekCAAnimationOnLayer): Generate a new animation based on the new seek time provided.
2331         * platform/graphics/ca/GraphicsLayerCA.h:
2332         (WebCore::GraphicsLayerCA::AnimationProcessingAction::AnimationProcessingAction):
2333         * rendering/RenderBoxModelObject.cpp:
2334         (WebCore::RenderBoxModelObject::animationSeeked):
2335         * rendering/RenderLayerBacking.cpp:
2336         (WebCore::RenderLayerBacking::animationSeeked):
2337         * rendering/RenderLayerCompositor.cpp:
2338         (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const): Fix an issue where we would run the CSSAnimationController
2339         logic even when the legacy animation engine was disabled.
2340
2341 2018-04-12  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2342
2343         Unreviewed, fix GStreamer builds
2344
2345         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2346         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): We were
2347         passing a String to a GST_WARNING call.
2348
2349 2018-04-11  Chris Dumez  <cdumez@apple.com>
2350
2351         input.webkitEntries does not work as expected when folder contains accented chars
2352         https://bugs.webkit.org/show_bug.cgi?id=184517
2353         <rdar://problem/39265537>
2354
2355         Reviewed by Ryosuke Niwa.
2356
2357         Use String::fromUTF8() to construct a WTF String from the char* returned by
2358         dirname() in FileSystem::directoryName(). Previously, we were just calling
2359         the String constructor, which would treat the input as latin 1 instead of
2360         UTF-8.
2361
2362         Test: fast/forms/file/entries-api/webkitEntries-nonascii-folder-name.html
2363
2364         * platform/posix/FileSystemPOSIX.cpp:
2365         (WebCore::FileSystem::directoryName):
2366
2367 2018-04-11  Youenn Fablet  <youenn@apple.com>
2368
2369         Preventively expect UTF8 strings from libwebrtc SDP and error messages
2370         https://bugs.webkit.org/show_bug.cgi?id=184509
2371
2372         Reviewed by Eric Carlson.
2373
2374         Make WebCore code expect any libwebrtc string to contain UTF-8.
2375         Currently SDPs do not contain any UTF-8 specific character
2376         but https://tools.ietf.org/html/rfc4566 allows it.
2377
2378         Add Internals API to set track id so that we can inject UTF-8 inside some WebRTC tests.
2379         Test: webrtc/utf8-sdp.html
2380
2381         * Modules/mediastream/MediaStreamTrack.h:
2382         (WebCore::MediaStreamTrack::setIdForTesting):
2383         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2384         (WebCore::fromStdString):
2385         (WebCore::fromSessionDescription):
2386         (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription):
2387         (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
2388         (WebCore::LibWebRTCMediaEndpoint::mediaStreamFromRTCStream):
2389         (WebCore::LibWebRTCMediaEndpoint::addRemoteTrack):
2390         (WebCore::LibWebRTCMediaEndpoint::addDataChannel):
2391         (WebCore::LibWebRTCMediaEndpoint::OnIceCandidate):
2392         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionSucceeded):
2393         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed):
2394         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed):
2395         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed):
2396         (WebCore::trackId): Deleted.
2397         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2398         (WebCore::fromStdString):
2399         (WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate):
2400         (WebCore::createReceiverForSource):
2401         * platform/mediastream/MediaStreamTrackPrivate.h:
2402         (WebCore::MediaStreamTrackPrivate::setIdForTesting):
2403         * testing/Internals.cpp:
2404         (WebCore::Internals::setMediaStreamTrackIdentifier):
2405         * testing/Internals.h:
2406         * testing/Internals.idl:
2407
2408 2018-04-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
2409
2410         Cache glyphs (using display lists) when painting at high frequency
2411         https://bugs.webkit.org/show_bug.cgi?id=178750
2412         <rdar://problem/35201729>
2413
2414         Reviewed by Antti Koivisto.
2415
2416         This patch adds support for caching of glyph drawing commands when painting
2417         at high frequency. Caching the glyph drawing will be done using DisplayLists.
2418
2419         GlyphDisplayListCache is basically a hash map which maps InlineTextBox
2420         or SimpleLineLayout::Run to DisplayList. Before adding a new entry to it
2421         we have to check whether the conditions for caching the glyph DisplayList
2422         are met or not. If no entry is found for a given run, a new DisplayList
2423         is created and a new entry is add to the cache.
2424
2425         * WebCore.xcodeproj/project.pbxproj:
2426         * page/MemoryRelease.cpp:
2427         (WebCore::releaseNoncriticalMemory): Make GlyphDisplayListCache respond
2428         to memory pressure.
2429
2430         * platform/graphics/FontCascade.cpp:
2431         (WebCore::FontCascade::displayListForTextRun const):
2432         * platform/graphics/FontCascade.h:
2433         (WebCore::FontCascade::displayListForTextRun):
2434         Record the drawing of a glyph run into a DisplayList.
2435
2436         * rendering/GlyphDisplayListCache.h: Added.
2437         (WebCore::GlyphDisplayListCache::singleton):
2438         (WebCore::GlyphDisplayListCache::get):
2439         (WebCore::GlyphDisplayListCache::remove):
2440         (WebCore::GlyphDisplayListCache::clear):
2441         (WebCore::GlyphDisplayListCache::size const):
2442         (WebCore::GlyphDisplayListCache::sizeInBytes const):
2443         A simple cache for the TextRun DisplayList. Adding a new entry in the
2444         cache happens under restricted conditions. So this cache is not expected
2445         to grow much.
2446
2447         * rendering/InlineTextBox.cpp:
2448         (WebCore::InlineTextBox::~InlineTextBox):
2449         (WebCore::InlineTextBox::paint):
2450         (WebCore::InlineTextBox::paintMarkedTexts):
2451         (WebCore::InlineTextBox::paintMarkedTextBackground):
2452         (WebCore::InlineTextBox::paintMarkedTextForeground):
2453         (WebCore::InlineTextBox::paintMarkedTextDecoration):
2454         (WebCore::InlineTextBox::paintCompositionBackground):
2455         (WebCore::InlineTextBox::paintCompositionUnderlines const):
2456         (WebCore::InlineTextBox::paintCompositionUnderline const):
2457         * rendering/InlineTextBox.h:
2458         (WebCore::InlineTextBox::paintMarkedTexts):
2459         InlineTextBox::paintMarkedTextForeground() now requires PaintInfo to know
2460         whether the entry in the GlyphDisplayListCache should be removed or not.
2461         Change all the GraphicsContext arguments to be PaintInfo.
2462
2463         * rendering/SimpleLineLayout.cpp:
2464         (WebCore::SimpleLineLayout::Layout::~Layout):
2465         * rendering/SimpleLineLayout.h:
2466         * rendering/SimpleLineLayoutFunctions.cpp:
2467         (WebCore::SimpleLineLayout::paintFlow):
2468         (WebCore::SimpleLineLayout::simpleLineLayoutWillBeDeleted):
2469         * rendering/SimpleLineLayoutFunctions.h:
2470         * rendering/SimpleLineLayoutResolver.h:
2471         (WebCore::SimpleLineLayout::RunResolver::Run::simpleRun const):
2472         Implement the glyph caching for SimpleLineLayout::Run.
2473
2474         * rendering/TextPainter.cpp:
2475         (WebCore::TextPainter::paintTextOrEmphasisMarks): If the DisplayList is
2476         available, replay it back into the GraphicsContext. Make sure to reset to
2477         the DisplayList pointer to nullptr after painting.
2478
2479         (WebCore::TextPainter::clearGlyphDisplayLists):
2480         (WebCore::TextPainter::shouldUseGlyphDisplayList): Check whether we should
2481         use DisplayList to the draw glyph run.
2482
2483         * rendering/TextPainter.h:
2484         (WebCore::TextPainter::setGlyphDisplayListIfNeeded): Check whether we should
2485         should use DisplayList to the draw glyph run and if we should, ensure first
2486         the DisplayList is cached and set it in the TextPainter so it uses it when
2487         the run is painted.
2488
2489         (WebCore::TextPainter::removeGlyphDisplayList): Remove the cached DisplayList
2490         entry for a glyph layout run.
2491
2492 2018-04-11  Brent Fulgham  <bfulgham@apple.com>
2493
2494         GraphicsLayerCA::createPlatformCALayer always disables extended color in its backing store
2495         https://bugs.webkit.org/show_bug.cgi?id=184367
2496         <rdar://problem/39249074>
2497
2498         Reviewed by Simon Fraser.
2499
2500         'createPlatformCALayer' always passes a nil widget, which early returns from 'screenSupportsExtendedColor'
2501         with false. Instead, we should just pass the widget (nil or not) to the screen properties methods,
2502         which will use the primary screen if no screen is specified. I.e., we shouldn't do an early return
2503         here if the passed widget is nil.
2504
2505         * platform/mac/PlatformScreenMac.mm:
2506         (WebCore::screenSupportsExtendedColor):
2507
2508 2018-04-11  Youenn Fablet  <youenn@apple.com>
2509
2510         Pass FetchOptions and SecurityOrigin as load parameters from WebProcess to NetworkProcess
2511         https://bugs.webkit.org/show_bug.cgi?id=184374
2512
2513         Reviewed by Chris Dumez.
2514
2515         Add support for SecurityOrigin encode/decode routines.
2516
2517         * page/SecurityOrigin.h:
2518
2519 2018-04-11  Thibault Saunier  <tsaunier@igalia.com>
2520
2521         [GStreamer] Use of playbin3 when USE_PLAYBIN3 environment variable is set
2522         https://bugs.webkit.org/show_bug.cgi?id=184498
2523
2524         Reviewed by Philippe Normand.
2525
2526         [GStreamer] Use of playbin3 when USE_PLAYBIN3 environment variable is set
2527
2528         This is the same behaviour as with playbin itself.
2529
2530         Make sure to keep using "playbin" for MediaSource.
2531
2532         No test added as this is basically a small rework of the way we expose a feature.
2533
2534         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
2535         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
2536         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
2537         * platform/graphics/gstreamer/GRefPtrGStreamer.h:
2538         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
2539         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
2540         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2541         (WebCore::MediaPlayerPrivateGStreamer::load):
2542         (WebCore::MediaPlayerPrivateGStreamer::enableTrack):
2543         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
2544         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
2545         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2546         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2547         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
2548         (WebCore::TrackPrivateBaseGStreamer::disconnect):
2549         (WebCore::TrackPrivateBaseGStreamer::tagsChanged):
2550         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
2551         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
2552         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
2553
2554 2018-04-10  Alex Christensen  <achristensen@webkit.org>
2555
2556         IDN spoofing with Hebrew combining characters
2557         https://bugs.webkit.org/show_bug.cgi?id=184472
2558         <rdar://problem/39148687>
2559
2560         Reviewed by Brent Fulgham.
2561
2562         Covered by new API tests.
2563
2564         * platform/mac/WebCoreNSURLExtras.mm:
2565         (WebCore::isLookalikeCharacter):
2566         Punycode-encode hosts with Hebrew combining marks that look like dots
2567         and Vav with a combining dot above like we do with dotless i and j.
2568
2569 2018-04-11  Brent Fulgham  <bfulgham@apple.com>
2570
2571         Show punycode if URL contains Latin dum character
2572         https://bugs.webkit.org/show_bug.cgi?id=184477
2573         <rdar://problem/39121999>
2574
2575         Reviewed by David Kilzer.
2576
2577         Revise our "lookalike character" logic to include the small
2578         Latin dum character.
2579
2580         Test: fast/url/host.html
2581
2582         * platform/mac/WebCoreNSURLExtras.mm:
2583         (WebCore::isLookalikeCharacter):
2584
2585 2018-04-11  Michael Catanzaro  <mcatanzaro@igalia.com>
2586
2587         [GTK] WaylandCompositorDisplay leaks its wl_display
2588         https://bugs.webkit.org/show_bug.cgi?id=184406
2589
2590         Reviewed by Carlos Garcia Campos.
2591
2592         Well, this was harder than expected. We really just want to fix a small leak in the WebKit
2593         layer, but that requires a change in how WaylandCompositorDisplay calls the
2594         PlatformDisplayWayland constructor, to pass NativeDisplayOwned::Yes. That means
2595         WaylandCompositorDisplay can no longer use PlatformDisplayWayland's protected default
2596         constructor. Problem is that the normal PlatformDisplayWayland constructor calls
2597         PlatformDisplayWayland::initialize, which calls PlatformDisplayWayland::registryGlobal,
2598         which is a virtual function. The WaylandCompositorDisplay portion of the object is not
2599         constructed yet at this point, so WaylandCompositorDisplay::registryGlobal will never be
2600         called if we do that. I had to revert the previous version of this fix due to this problem.
2601         It had broken accelerated compositing.
2602
2603         I'm reminded of Effective C++ item #9: Never call virtual functions during construction or
2604         destruction ("because such calls will never go to a more derived class than that of the
2605         currently executing constructor or destructor"). This code is fragile and likely to break
2606         again in the future, so let's refactor it a bit. Instead of calling initialize in the
2607         constructor, we'll call it from create functions. We'll have to add a couple create
2608         functions, and make the constructor protected to ensure it's not possible to create a
2609         PlatformDisplayWayland without initializing it. For good parallelism, do the same for the
2610         other PlatformDisplay classes.
2611
2612         This commit additionally removes PlatformDisplayWayland's protected default constructor,
2613         since it's not needed anymore.
2614
2615         The NativeDisplayOwned arguments to the PlatformDisplay constructors are now mandatory,
2616         instead of using NativeDisplayOwned::No as the default value, since that was dangerously
2617         close to being the cause of this leak, and the constructors are now accessed from private
2618         create functions anyway. Some more caution when using default parameter values is warranted
2619         in the future.
2620
2621         Lastly, since we have to change PlatformDisplay::createPlatformDisplay to use the new create
2622         functions, take the opportunity to move things around a bit for clarity. There should be no
2623         change in behavior. I was just disappointed that the PlatformDisplayWPE creation was at the
2624         bottom of the function, after a comment indicating that normal display creation has failed,
2625         which is not the case for WPE.
2626
2627         This all might have been a bit overkill, since the leak could probably have been fixed by
2628         passing nullptr to the PlatformDisplayWayland constructor for the wl_display and not
2629         removing WaylandCompositorDisplay's call to PlatformDisplayWayland::initialize. But the
2630         correctness of that code would then rely on implementation details of initialize, so this
2631         refactor seems better.
2632
2633         No new tests since there *should* be no behavior change. Then again, I'm touching
2634         PlatformDisplay, and history shows we don't have the greatest track record of touching this
2635         code without introducing problems.
2636
2637         * platform/graphics/PlatformDisplay.cpp:
2638         (WebCore::PlatformDisplay::createPlatformDisplay):
2639         * platform/graphics/PlatformDisplay.h:
2640         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
2641         (WebCore::PlatformDisplayWayland::create):
2642         (WebCore::PlatformDisplayWayland::create):
2643         (WebCore::PlatformDisplayWayland::createHeadless):
2644         (WebCore::PlatformDisplayWayland::PlatformDisplayWayland):
2645         (WebCore::PlatformDisplayWayland::initialize):
2646         * platform/graphics/wayland/PlatformDisplayWayland.h:
2647         * platform/graphics/win/PlatformDisplayWin.h:
2648         * platform/graphics/wpe/PlatformDisplayWPE.cpp:
2649         (WebCore::create):
2650         * platform/graphics/wpe/PlatformDisplayWPE.h:
2651         * platform/graphics/x11/PlatformDisplayX11.cpp:
2652         (WebCore::PlatformDisplayX11::create):
2653         (WebCore::PlatformDisplayX11::create):
2654         (WebCore::PlatformDisplayX11::createHeadless):
2655         * platform/graphics/x11/PlatformDisplayX11.h:
2656
2657 2018-04-11  Jianjun Zhu  <jianjun.zhu@intel.com>
2658
2659         Fix a WebRTC data channel issue for non-ASCII characters.
2660
2661         At the sender side, buffer size are calulcated after UTF8 encoding. At the
2662         receiver side, strings are constructed with UTF8 data.
2663
2664         https://bugs.webkit.org/show_bug.cgi?id=184481
2665
2666         Reviewed by Youenn Fablet.
2667
2668         Updated test:
2669         LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDataChannel-send-expected.txt
2670
2671         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
2672         (WebCore::LibWebRTCDataChannelHandler::sendStringData):
2673         (WebCore::LibWebRTCDataChannelHandler::OnMessage):
2674
2675 2018-04-11  Antti Koivisto  <antti@apple.com>
2676
2677         ImageFrame type used by non-Cocoa image decoder should not be the same as that used by ImageSource
2678         https://bugs.webkit.org/show_bug.cgi?id=184418
2679
2680         Reviewed by Said Abou-Hallawa.
2681
2682         ScalableImageDecoder uses ImageFrame class which is meant to be an implementation detail of ImageSource.
2683         There are bunch of fields and methods in the type that are only used by one or the other client. For hackability
2684         there should be an unrelated frame type for ScalableImageDecoder.
2685
2686         This patch adds ScalableImageDecoderFrame type used in ScalableImageDecoder only. It then cleans up
2687         unneeded things from both ImageFrame and ScalableImageDecoderFrame.
2688
2689         * platform/ImageDecoders.cmake:
2690         * platform/graphics/ImageFrame.cpp:
2691         (WebCore::ImageFrame::operator=):
2692         (WebCore::ImageFrame::clearImage):
2693         (WebCore::ImageFrame::size const):
2694         (WebCore::ImageFrame::initialize): Deleted.
2695         * platform/graphics/ImageFrame.h:
2696         (WebCore::ImageFrame::setDisposalMethod): Deleted.
2697         (WebCore::ImageFrame::disposalMethod const): Deleted.
2698         (WebCore::ImageFrame::backingStore const): Deleted.
2699         (WebCore::ImageFrame::hasBackingStore const): Deleted.
2700         * platform/image-decoders/ScalableImageDecoder.cpp:
2701         (WebCore::ScalableImageDecoder::frameIsCompleteAtIndex const):
2702         (WebCore::ScalableImageDecoder::frameDurationAtIndex const):
2703         (WebCore::ScalableImageDecoder::createFrameImageAtIndex):
2704         * platform/image-decoders/ScalableImageDecoder.h:
2705         * platform/image-decoders/ScalableImageDecoderFrame.cpp: Copied from Source/WebCore/platform/graphics/ImageFrame.cpp.
2706         (WebCore::ScalableImageDecoderFrame::ScalableImageDecoderFrame):
2707         (WebCore::ScalableImageDecoderFrame::~ScalableImageDecoderFrame):
2708         (WebCore::ScalableImageDecoderFrame::operator=):
2709         (WebCore::ScalableImageDecoderFrame::setDecodingStatus):
2710         (WebCore::ScalableImageDecoderFrame::decodingStatus const):
2711         (WebCore::ScalableImageDecoderFrame::clearImage):
2712         (WebCore::ScalableImageDecoderFrame::clear):
2713         (WebCore::ScalableImageDecoderFrame::initialize):
2714         (WebCore::ScalableImageDecoderFrame::size const):
2715         (WebCore::ImageFrame::ImageFrame): Deleted.
2716         (WebCore::ImageFrame::~ImageFrame): Deleted.
2717         (WebCore::ImageFrame::defaultFrame): Deleted.
2718         (WebCore::ImageFrame::operator=): Deleted.
2719         (WebCore::ImageFrame::setDecodingStatus): Deleted.
2720         (WebCore::ImageFrame::decodingStatus const): Deleted.
2721         (WebCore::ImageFrame::clearImage): Deleted.
2722         (WebCore::ImageFrame::clear): Deleted.
2723         (WebCore::ImageFrame::initialize): Deleted.
2724         (WebCore::ImageFrame::size const): Deleted.
2725         (WebCore::ImageFrame::hasNativeImage const): Deleted.
2726         (WebCore::ImageFrame::hasFullSizeNativeImage const): Deleted.
2727         (WebCore::ImageFrame::hasDecodedNativeImageCompatibleWithOptions const): Deleted.
2728         (WebCore::ImageFrame::singlePixelSolidColor const): Deleted.
2729         * platform/image-decoders/ScalableImageDecoderFrame.h: Copied from Source/WebCore/platform/graphics/ImageFrame.h.
2730         (WebCore::ScalableImageDecoderFrame::ScalableImageDecoderFrame):
2731         (WebCore::ScalableImageDecoderFrame::disposalMethod const):
2732         (WebCore::ScalableImageDecoderFrame::hasAlpha const):
2733         (WebCore::ScalableImageDecoderFrame::hasBackingStore const):
2734         (WebCore::ImageFrame::ImageFrame): Deleted.
2735         (WebCore::ImageFrame::isInvalid const): Deleted.
2736         (WebCore::ImageFrame::isPartial const): Deleted.
2737         (WebCore::ImageFrame::isComplete const): Deleted.
2738         (WebCore::ImageFrame::sizeRespectingOrientation const): Deleted.
2739         (WebCore::ImageFrame::frameBytes const): Deleted.
2740         (WebCore::ImageFrame::subsamplingLevel const): Deleted.
2741         (WebCore::ImageFrame::setDisposalMethod): Deleted.
2742         (WebCore::ImageFrame::disposalMethod const): Deleted.
2743         (WebCore::ImageFrame::nativeImage const): Deleted.
2744         (WebCore::ImageFrame::setOrientation): Deleted.
2745         (WebCore::ImageFrame::orientation const): Deleted.
2746         (WebCore::ImageFrame::setDuration): Deleted.
2747         (WebCore::ImageFrame::duration const): Deleted.
2748         (WebCore::ImageFrame::setHasAlpha): Deleted.
2749         (WebCore::ImageFrame::hasAlpha const): Deleted.
2750         (WebCore::ImageFrame::hasNativeImage): Deleted.
2751         (WebCore::ImageFrame::hasFullSizeNativeImage): Deleted.
2752         (WebCore::ImageFrame::hasMetadata const): Deleted.
2753         (WebCore::ImageFrame::backingStore const): Deleted.
2754         (WebCore::ImageFrame::hasBackingStore const): Deleted.
2755         * platform/image-decoders/bmp/BMPImageDecoder.cpp:
2756         (WebCore::BMPImageDecoder::frameBufferAtIndex):
2757         * platform/image-decoders/bmp/BMPImageDecoder.h:
2758         * platform/image-decoders/bmp/BMPImageReader.h:
2759         (WebCore::BMPImageReader::setBuffer):
2760         * platform/image-decoders/gif/GIFImageDecoder.cpp:
2761         (WebCore::GIFImageDecoder::findFirstRequiredFrameToDecode):
2762         (WebCore::GIFImageDecoder::frameBufferAtIndex):
2763         (WebCore::GIFImageDecoder::clearFrameBufferCache):
2764         (WebCore::GIFImageDecoder::haveDecodedRow):
2765         (WebCore::GIFImageDecoder::frameComplete):
2766         (WebCore::GIFImageDecoder::initFrameBuffer):
2767         * platform/image-decoders/gif/GIFImageDecoder.h:
2768         * platform/image-decoders/gif/GIFImageReader.cpp:
2769         (GIFImageReader::parse):
2770         * platform/image-decoders/gif/GIFImageReader.h:
2771         (GIFFrameContext::GIFFrameContext):
2772         * platform/image-decoders/ico/ICOImageDecoder.cpp:
2773         (WebCore::ICOImageDecoder::frameBufferAtIndex):
2774         * platform/image-decoders/ico/ICOImageDecoder.h:
2775         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
2776         (WebCore::JPEGImageDecoder::frameBufferAtIndex):
2777         (WebCore::setPixel):
2778         (WebCore::JPEGImageDecoder::outputScanlines):
2779         (WebCore::JPEGImageDecoder::jpegComplete):
2780         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
2781         * platform/image-decoders/png/PNGImageDecoder.cpp:
2782         (WebCore::PNGImageDecoder::frameBufferAtIndex):
2783         (WebCore::PNGImageDecoder::rowAvailable):
2784         (WebCore::PNGImageDecoder::readChunks):
2785         (WebCore::PNGImageDecoder::clearFrameBufferCache):
2786         (WebCore::PNGImageDecoder::initFrameBuffer):
2787         (WebCore::PNGImageDecoder::frameComplete):
2788         * platform/image-decoders/png/PNGImageDecoder.h:
2789         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
2790         (WebCore::WEBPImageDecoder::frameBufferAtIndex):
2791         (WebCore::WEBPImageDecoder::findFirstRequiredFrameToDecode):
2792         (WebCore::WEBPImageDecoder::decodeFrame):
2793         (WebCore::WEBPImageDecoder::initFrameBuffer):
2794         (WebCore::WEBPImageDecoder::applyPostProcessing):
2795         (WebCore::WEBPImageDecoder::clearFrameBufferCache):
2796         * platform/image-decoders/webp/WEBPImageDecoder.h:
2797
2798 2018-04-11  Antoine Quint  <graouts@apple.com>
2799
2800         [Web Animations] Turn Web Animations on by default
2801         https://bugs.webkit.org/show_bug.cgi?id=184491
2802
2803         Reviewed by Simon Fraser.
2804
2805         * page/RuntimeEnabledFeatures.h:
2806
2807 2018-04-11  Ryosuke Niwa  <rniwa@webkit.org>
2808
2809         Fix warning in HashTools.h for newer versions of clang
2810         https://bugs.webkit.org/show_bug.cgi?id=184489
2811
2812         Reviewed by Alexey Proskuryakov.
2813
2814         Removed "register" storage class specififer as it has been deprecated in C++11.
2815
2816         * platform/HashTools.h:
2817
2818 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2819
2820         FrameSelection::appearanceUpdateTimerFired should be robust against layout passes underneath it
2821         https://bugs.webkit.org/show_bug.cgi?id=183395
2822         <rdar://problem/38055732>
2823
2824         Reviewed by Zalan Bujtas.
2825
2826         In the case where a FrameSelection updates its appearance when m_appearanceUpdateTimer is fired, the
2827         FrameSelection's Frame is unprotected, and can be removed by arbitrary script. This patch applies a simple
2828         mitigation by wrapping the Frame in a Ref when firing the appearance update timer.
2829
2830         Test: editing/selection/iframe-update-selection-appearance.html
2831
2832         * editing/FrameSelection.cpp:
2833         (WebCore::FrameSelection::appearanceUpdateTimerFired):
2834
2835 2018-04-10  Brent Fulgham  <bfulgham@apple.com>
2836
2837         Unreviewed follow-up to r230468.
2838
2839         Switch some RELEASE_ASSERTs in hot codepaths to normal DEBUG asserts.
2840
2841         * page/mac/EventHandlerMac.mm:
2842         (WebCore::lastEventIsMouseUp):
2843         (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
2844         * platform/mac/EventLoopMac.mm:
2845         (WebCore::EventLoop::cycle):
2846
2847 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2848
2849         Unreviewed, fix the iOS build
2850
2851         I accidentally exported an inline function in r230506.
2852
2853         * page/ViewportConfiguration.h:
2854         (WebCore::ViewportConfiguration::viewSize const):
2855
2856 2018-04-10  Nan Wang  <n_wang@apple.com>
2857
2858         AX: Expose strong password fields on iOS
2859         https://bugs.webkit.org/show_bug.cgi?id=184465
2860         <rdar://problem/39325104>
2861
2862         Reviewed by Chris Fleizach.
2863
2864         Exposed the strong password field on iOS. And made sure
2865         we are returning its actual value in accessibilityValue.
2866
2867         Test: accessibility/ios-simulator/strong-password-field.html
2868
2869         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2870         (-[WebAccessibilityObjectWrapper _accessibilityIsStrongPasswordField]):
2871         (-[WebAccessibilityObjectWrapper accessibilityValue]):
2872
2873 2018-04-10  Fujii Hironori  <Hironori.Fujii@sony.com>
2874
2875         [Win] Add UserAgentWin.cpp
2876         https://bugs.webkit.org/show_bug.cgi?id=184438
2877
2878         Reviewed by Michael Catanzaro.
2879
2880         No new tests (No behavior change).
2881
2882         * PlatformWin.cmake:
2883         * platform/win/UserAgentWin.cpp: Added.
2884         (WebCore::standardUserAgent):
2885         (WebCore::standardUserAgentForURL):
2886
2887 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2888
2889         [Extra zoom mode] Add a mechanism to zoom to fixed scales when double tapping in extra zoom mode
2890         https://bugs.webkit.org/show_bug.cgi?id=184435
2891         <rdar://problem/38726260>
2892
2893         Reviewed by Dean Jackson.
2894
2895         Expose the size of the platform view. By default, in extra zoom mode, this *not* the same as the minimum layout
2896         size, since we lay out at a large width and then shrink down to real device dimensions when computing the
2897         initial scale (see r229063).
2898
2899         ViewGestureGeometryCollector uses this in the process of computing a target zoom scale when double tapping.
2900
2901         * page/ViewportConfiguration.h:
2902         (WebCore::ViewportConfiguration::viewSize const):
2903
2904 2018-04-10  Fujii Hironori  <Hironori.Fujii@sony.com>
2905
2906         [Win][WebKit] LibWebRTCProvider::webRTCAvailable is an undefined symbol
2907         https://bugs.webkit.org/show_bug.cgi?id=184437
2908
2909         Reviewed by Michael Catanzaro.
2910
2911         No new tests (No behavior change).
2912
2913         * PlatformWin.cmake: Added LibWebRTCProviderWin.cpp.
2914         * platform/mediastream/libwebrtc/LibWebRTCProviderWin.cpp: Added.
2915         (WebCore::LibWebRTCProvider::webRTCAvailable):
2916
2917 2018-04-10  Chris Dumez  <cdumez@apple.com>
2918
2919         Unreviewed build fix.
2920
2921         Those enum value names were too generic and would cause conflicts.
2922
2923         * Modules/webvr/VRDisplayCapabilities.h:
2924         (WebCore::VRDisplayCapabilities::hasPosition const):
2925         (WebCore::VRDisplayCapabilities::hasOrientation const):
2926         (WebCore::VRDisplayCapabilities::hasExternalDisplay const):
2927         (WebCore::VRDisplayCapabilities::canPresent const):
2928         * platform/vr/VRPlatformDisplay.h:
2929         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
2930         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
2931
2932 2018-04-10  Chris Dumez  <cdumez@apple.com>
2933
2934         Avoid constructing a service worker RegistrationStore for private sessions
2935         https://bugs.webkit.org/show_bug.cgi?id=184463
2936         <rdar://problem/36613948>
2937
2938         Reviewed by Youenn Fablet.
2939
2940         Avoid constructing a service worker RegistrationStore for private sessions since there
2941         is no need for persistence and the registrationDatabaseDirectory is the empty string in
2942         such cases.
2943
2944         * workers/service/server/SWServer.cpp:
2945         (WebCore::SWServer::removeRegistration):
2946         (WebCore::SWServer::clearAll):
2947         (WebCore::SWServer::clear):
2948         (WebCore::SWServer::SWServer):
2949         (WebCore::SWServer::didFinishActivation):
2950         * workers/service/server/SWServer.h:
2951
2952 2018-04-10  Chris Dumez  <cdumez@apple.com>
2953
2954         Unreviewed build fix.
2955
2956         * page/LayoutContext.cpp:
2957         (WebCore::LayoutContext::~LayoutContext):
2958         * page/LayoutContext.h:
2959
2960 2018-04-10  Jeremy Jones  <jeremyj@apple.com>
2961
2962         MediaSessionManageriOS should defer creation of MPVolumeView until it needs to monitor AirPlay routes
2963         https://bugs.webkit.org/show_bug.cgi?id=184373
2964         <rdar://problem/35177606>
2965
2966         Reviewed by Eric Carlson.
2967
2968         No change of behavior.
2969
2970         This delays the creation of MPVolumeView until airplay routes are monitored.
2971         MPVolumeView is now also released when monitoring ends. 
2972         This makes sure the MP* objects are only accessed from a UI safe thread. WebCore's "MainThread" may be different that the UI thread.
2973         Since this state change is necessarily asynchronous, starting and stopping must prevent races to keep state coherent.
2974
2975         * platform/audio/ios/MediaSessionManagerIOS.mm:
2976         (-[WebMediaSessionHelper initWithCallback:]):
2977         (-[WebMediaSessionHelper dealloc]):
2978         (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]):
2979         (-[WebMediaSessionHelper stopMonitoringAirPlayRoutes]):
2980         (-[WebMediaSessionHelper allocateVolumeView]): Deleted.
2981         (-[WebMediaSessionHelper setVolumeView:]): Deleted.
2982
2983 2018-04-10  Sihui Liu  <sihui_liu@apple.com>
2984
2985         Loading of multipart response was cancelled because of content policy set in WebFrameLoaderClient::dispatchDecidePolicyForResponse
2986         https://bugs.webkit.org/show_bug.cgi?id=184268
2987         <rdar://problem/39144446>
2988
2989         Reviewed by Chris Dumez.
2990
2991         The assertion is no longer true after the change, because multiple resources could have same
2992         url. Used if condition here to make sure we only delete specified resource.
2993
2994         No new tests. Updated an existing test to test the stop loading case by not using injected 
2995         bundle policy: http/tests/multipart/multipart-html.php.
2996
2997         * loader/cache/CachedResourceLoader.cpp:
2998         (WebCore::CachedResourceLoader::removeCachedResource):
2999
3000 2018-04-10  Zalan Bujtas  <zalan@apple.com>
3001
3002         Do not layout images when we only need the overflow information.
3003         https://bugs.webkit.org/show_bug.cgi?id=175331
3004
3005         Reviewed by Simon Fraser.
3006
3007         This improves MotionMark's Simple Leaves by ~10%. 
3008
3009         Covered by existing tests.
3010
3011         * rendering/RenderImage.cpp:
3012         (WebCore::RenderImage::layout):
3013
3014 2018-04-10  Zan Dobersek  <zdobersek@igalia.com>
3015
3016         [TexMap] TextureMapperLayer unnecessarily duplicates state in GraphicsLayerTransform
3017         https://bugs.webkit.org/show_bug.cgi?id=183868
3018
3019         Reviewed by Carlos Garcia Campos.
3020
3021         Drop the GraphicsLayerTransform member variable from TextureMapperLayer
3022         and instead compute all the required transform information in the
3023         computeTransformsRecursive() method. These computations are not too
3024         expensive, and in turn we can drop an object from this class' state that
3025         was only duplicating a bunch of state variables.
3026
3027         No new tests -- no change in functionality.
3028
3029         * platform/graphics/texmap/TextureMapperLayer.cpp:
3030         (WebCore::TextureMapperLayer::computeTransformsRecursive):
3031         (WebCore::TextureMapperLayer::paintSelf):
3032         (WebCore::TextureMapperLayer::paintSelfAndChildren):
3033         (WebCore::TextureMapperLayer::paintSelfAndChildrenWithReplica):
3034         (WebCore::TextureMapperLayer::replicaTransform):
3035         (WebCore::TextureMapperLayer::computeOverlapRegions):
3036         (WebCore::TextureMapperLayer::setPosition):
3037         (WebCore::TextureMapperLayer::setSize):
3038         (WebCore::TextureMapperLayer::setAnchorPoint):
3039         (WebCore::TextureMapperLayer::setPreserves3D):
3040         (WebCore::TextureMapperLayer::setTransform):
3041         (WebCore::TextureMapperLayer::setChildrenTransform):
3042         (WebCore::TextureMapperLayer::syncAnimations):
3043         (WebCore::TextureMapperLayer::setScrollPositionDeltaIfNeeded):
3044         * platform/graphics/texmap/TextureMapperLayer.h:
3045
3046 2018-04-09  Brent Fulgham  <bfulgham@apple.com>
3047
3048         Add ProcessPrivilege assertions to places that access NSApp
3049         https://bugs.webkit.org/show_bug.cgi?id=184322
3050         <rdar://problem/39194560>
3051
3052         Reviewed by Per Arne Vollan.
3053
3054         Add ProcessPrivilege assertions to places where we interact with NSApp so
3055         that we can prevent accidentally using them in the WebContent process.
3056
3057         * page/mac/EventHandlerMac.mm:
3058         (WebCore::lastEventIsMouseUp):
3059         (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
3060         * platform/mac/EventLoopMac.mm:
3061         (WebCore::EventLoop::cycle):
3062         * platform/mac/PasteboardMac.mm:
3063         (WebCore::Pasteboard::setDragImage):
3064
3065 2018-04-09  John Wilander  <wilander@apple.com>
3066
3067         Refactor Ignore HSTS code
3068         https://bugs.webkit.org/show_bug.cgi?id=184433
3069         <rdar://problem/39298238>
3070
3071         Reviewed by Darin Adler.
3072
3073         This patch refactors our ignore HSTS code. The convenience functions are moved
3074         out of CFNetwork SPI in PAL, and into where they are used. It also switches
3075         from performSelector: calls to straight function calls, after checking that
3076         there is a responder.
3077
3078         * platform/network/mac/WebCoreURLResponse.mm:
3079         (WebCore::schemeWasUpgradedDueToDynamicHSTS):
3080             Add convenience function here since it was moved out of
3081             CFNetworkSPI.h.
3082
3083 2018-04-09  Brady Eidson  <beidson@apple.com>
3084
3085         Expand WebCore policy concept of "shouldContinue" to allow for more than true/false
3086         https://bugs.webkit.org/show_bug.cgi?id=184424
3087
3088         Reviewed by Alex Christensen.
3089
3090         No new tests (No behavior change, refactor only)
3091
3092         Specifically this expands the "shouldContinue" bool to be an enum class with:
3093         -Yes
3094         -No
3095         -ForSuspension
3096
3097         * loader/DocumentLoader.cpp:
3098         (WebCore::DocumentLoader::willSendRequest):
3099         * loader/FrameLoader.cpp:
3100         (WebCore::FrameLoader::loadURL):
3101         (WebCore::FrameLoader::load):
3102         (WebCore::FrameLoader::loadWithDocumentLoader):
3103         (WebCore::FrameLoader::loadPostRequest):
3104         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
3105         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
3106         * loader/FrameLoader.h:
3107         * loader/PolicyChecker.cpp:
3108         (WebCore::PolicyChecker::checkNavigationPolicy):
3109         (WebCore::PolicyChecker::checkNewWindowPolicy):
3110         * loader/PolicyChecker.h:
3111
3112 2018-04-09  Sihui Liu  <sihui_liu@apple.com>
3113
3114         REGRESSION(r229929): localStorage is broken for WebInspector
3115         https://bugs.webkit.org/show_bug.cgi?id=184382
3116         <rdar://problem/39257355>
3117
3118         Reviewed by Chris Dumez.
3119
3120         Removed an if condition that caused false positive cases of database error. As per 
3121         https://www.sqlite.org/c3ref/errcode.html, return value of sqlite3_errcode() is undefined
3122         on successful API call, so we should not use the code to check if there is an error. We
3123         should only use it when there is an error.
3124         After moving this condition, LocalStorage might return empty string instead of NULL on
3125         sqlite3_column_blob() error.
3126
3127         Modified a test to cover this case: 
3128         TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm.
3129
3130         * platform/sql/SQLiteStatement.cpp:
3131         (WebCore::SQLiteStatement::getColumnBlobAsString):
3132
3133 2018-04-09  Brent Fulgham  <bfulgham@apple.com>
3134
3135         WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll is directly accessing NSScreen
3136         https://bugs.webkit.org/show_bug.cgi?id=184344
3137         <rdar://problem/39224969>
3138
3139         Reviewed by Per Arne Vollan.
3140
3141         The implementation of targetPositionInWindowForSelectionAutoscroll uses the display ID to get the
3142         screen boundaries of the current display. This causes a bunch of interaction with NSScreen that
3143         we do not want to allow in the WebContent process.
3144
3145         Instead, we should just use the cached screen information the WebContent process already possesses.
3146
3147         This patch makes the following changes:
3148         1. We now retrieve the screen rect of the page's display from the cache, rather than interacting with
3149            the WindowServer directly.
3150         2. Add a new 'toUserSpaceForPrimaryScreen' so we don't have to deal with a nil NSWindow when computing
3151            the user space version of the coordinates. A nil Window just means we want to get coordinates in
3152            terms of the primary display.
3153         3. Keep track of the primary display so we can refer to it later.
3154         4. Modify the IPC messages to include the primary display's ID so we can easily access it later.
3155         5. Modify the PlatformScreen methods to actually use the primary display when appropriate, rather
3156            than whichever screen happened to hash to the lowest value.
3157
3158         * page/mac/EventHandlerMac.mm:
3159         (WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll const): Use new methods that
3160         don't require WindowServer access.
3161         * platform/PlatformScreen.h:
3162         * platform/mac/PlatformScreenMac.mm:
3163         (WebCore::displayID): Assert if we hit this code in the WebContent process.
3164         (WebCore::firstScreen): Ditto.
3165         (WebCore::window): Ditto.
3166         (WebCore::screen): Ditto.
3167         (WebCore::primaryScreenID): Added.
3168         (WebCore::getScreenProperties): Modify to return a pair consisting of the primary display ID and
3169         the HashSet of screen settings.
3170         (WebCore::setScreenProperties): Update to also track the primary display ID.
3171         (WebCore::screenProperties): Update to use the primary display ID.
3172         (WebCore::screenHasInvertedColors): Ditto.
3173         (WebCore::toUserSpaceForPrimaryScreen): Added.
3174
3175 2018-04-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
3176
3177         Make InlineTextBox::createTextRun() take a const lvalue reference String
3178         https://bugs.webkit.org/show_bug.cgi?id=184182
3179
3180         Reviewed by Zalan Bujtas.
3181
3182         InlineTextBox::createTextRun() takes a non-const lvalue reference String.
3183         It is tempting to change the signature of this method to take a const lvalue 
3184         reference. But this was done intentionally. TextRun is effectively a StringView:
3185         it does not own the passed string. Having the argument a non-const lvalue
3186         reference makes the compiler prevent calls like createTextRun("abc").
3187
3188         To have a better way to express the lifetime of TextRun, this patch does
3189         the following:
3190
3191         -- It makes TextRun::m_text of type String instead of StringView.
3192         -- It adds a new constructor which takes const String&. This constructor
3193            will addRef the underlying StringImpl when assigning it to m_text.
3194         -- It keeps the constructor which takes a StringView. The caller of this
3195            constructor still has to make sure the underlying String outlives the
3196            TextRun. To avoid copying the underlying buffer of the StringView, we
3197            will not use  StringView::toString(). Instead we will use
3198            StringView::toStringWithoutCopying() which makes the returned String 
3199            accesses the same buffer the StringView uses. In this case, the returned
3200            String is effectively a StringView.
3201
3202         * page/DebugPageOverlays.cpp:
3203         (WebCore::drawRightAlignedText):
3204         * platform/graphics/TextRun.cpp:
3205         * platform/graphics/TextRun.h:
3206         (WebCore::TextRun::TextRun):
3207         (WebCore::TextRun::subRun const):
3208         (WebCore::TextRun::length const):
3209         (WebCore::TextRun::setText):
3210         (WebCore::TextRun::string const): Deleted.
3211         * rendering/InlineTextBox.cpp:
3212         (WebCore::InlineTextBox::localSelectionRect const):
3213         (WebCore::InlineTextBox::paint):
3214         (WebCore::InlineTextBox::paintPlatformDocumentMarker):
3215         (WebCore::InlineTextBox::paintMarkedTextBackground):
3216         (WebCore::InlineTextBox::paintMarkedTextForeground):
3217         (WebCore::InlineTextBox::paintMarkedTextDecoration):
3218         (WebCore::InlineTextBox::offsetForPosition const):
3219         (WebCore::InlineTextBox::positionForOffset const):
3220         (WebCore::InlineTextBox::createTextRun const):
3221         There is no need for this function to take a String argument anymore. The
3222         reason for passing the String was to guarantee its lifetime by keeping
3223         a copy of it in the caller side. Now there is no need for that. The TextRun
3224         itself will keep this copy.
3225
3226         * rendering/InlineTextBox.h:
3227         * rendering/RenderText.cpp:
3228         (WebCore::RenderText::computeCanUseSimplifiedTextMeasuring const):
3229         RenderText::text() returns StringImpl. The compiler wants us to be more
3230         explicit about which constructor of TextRun to call.
3231
3232         * rendering/SimpleLineLayout.cpp:
3233         (WebCore::SimpleLineLayout::canUseForFontAndText):
3234         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
3235         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
3236         RenderStyle::hyphenString() returns an AtomicString.
3237
3238 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3239
3240         Unreviewed, rolling out r230390.
3241
3242         Broke accelerated compositing
3243
3244         Reverted changeset:
3245
3246         "[GTK] WaylandCompositorDisplay leaks its wl_display"
3247         https://bugs.webkit.org/show_bug.cgi?id=184406
3248         https://trac.webkit.org/changeset/230390
3249
3250 2018-04-03  Sergio Villar Senin  <svillar@igalia.com>
3251
3252         [OpenVR][WebVR] Retrieve FrameData in WebVR's rAF
3253         https://bugs.webkit.org/show_bug.cgi?id=184265
3254
3255         Reviewed by Žan Doberšek.
3256
3257         VRFrameData contains all the required information to properly render a VR scene like view
3258         and projection matrices, pose data (position & orientation) and linear & angular velocity
3259         among others. The getFrameData() call must be issued inside a WebVR's own
3260         requestAnimationFrame.
3261
3262         * Modules/webvr/VRDisplay.cpp:
3263         (WebCore::VRDisplay::getFrameData const):
3264         (WebCore::VRDisplay::getPose const):
3265         (WebCore::VRDisplay::requestAnimationFrame):
3266         (WebCore::VRDisplay::cancelAnimationFrame):
3267         * Modules/webvr/VRDisplay.h:
3268         * Modules/webvr/VREyeParameters.h:
3269         (WebCore::VREyeParameters::rawOffset const): Required to compute view matrices.
3270         * Modules/webvr/VRFrameData.cpp:
3271         (WebCore::matrixToArray):
3272         (WebCore::VRFrameData::leftProjectionMatrix const):
3273         (WebCore::VRFrameData::leftViewMatrix const):
3274         (WebCore::VRFrameData::rightProjectionMatrix const):
3275         (WebCore::VRFrameData::rightViewMatrix const):
3276         (WebCore::projectionMatrixFromFieldOfView):
3277         (WebCore::rotationMatrixFromQuaternion):
3278         (WebCore::applyHeadToEyeTransform):
3279         (WebCore::VRFrameData::update):
3280         (WebCore::VRFrameData::timestamp const): Deleted.
3281         * Modules/webvr/VRFrameData.h:
3282         (WebCore::VRFrameData::timestamp const):
3283         * Modules/webvr/VRPose.cpp:
3284         (WebCore::optionalFloat3ToJSCArray):
3285         (WebCore::VRPose::position const):
3286         (WebCore::VRPose::linearVelocity const):
3287         (WebCore::VRPose::linearAcceleration const):
3288         (WebCore::VRPose::orientation const):
3289         (WebCore::VRPose::angularVelocity const):
3290         (WebCore::VRPose::angularAcceleration const):
3291         * Modules/webvr/VRPose.h:
3292         (WebCore::VRPose::create):
3293         (WebCore::VRPose::update):
3294         (WebCore::VRPose::VRPose):
3295         * platform/vr/VRPlatformDisplay.h:
3296         (WebCore::VRPlatformTrackingInfo::Quaternion::Quaternion):
3297         (WebCore::VRPlatformTrackingInfo::Quaternion::conjugate):
3298         (WebCore::VRPlatformTrackingInfo::Quaternion::operator*):
3299         (WebCore::VRPlatformTrackingInfo::Float3::Float3): Just a group of 3 floats used to store
3300         both velocity and acceleration in a format which is very convenient to later generate JSC
3301         arrays.
3302         (WebCore::VRPlatformTrackingInfo::clear):
3303         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
3304         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
3305         (WebCore::rotationMatrixToQuaternion):
3306         (WebCore::VRPlatformDisplayOpenVR::getTrackingInfo):
3307         * platform/vr/openvr/VRPlatformDisplayOpenVR.h:
3308
3309 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3310
3311         [GTK] WaylandCompositorDisplay leaks its wl_display
3312         https://bugs.webkit.org/show_bug.cgi?id=184406
3313
3314         Reviewed by Carlos Garcia Campos.
3315
3316         Remove the protected default constructor, for good measure.
3317
3318         * platform/graphics/wayland/PlatformDisplayWayland.h:
3319
3320 2018-04-08  Fujii Hironori  <Hironori.Fujii@sony.com>
3321
3322         [CMake] WebKit should link to WebCore as a PRIVATE library if WebCore is a static library
3323         https://bugs.webkit.org/show_bug.cgi?id=184127
3324
3325         Reviewed by Konstantin Tokarev.
3326
3327         No new tests (No behaviour changes).
3328
3329         * CMakeLists.txt: Added a interface library WebCoreHeaderInterface.
3330
3331 2018-04-08  Yusuke Suzuki  <utatane.tea@gmail.com>
3332
3333         Use alignas instead of compiler-specific attributes
3334         https://bugs.webkit.org/show_bug.cgi?id=183508
3335
3336         Reviewed by Mark Lam.
3337
3338         Use alignas instead of aligned.
3339
3340         * platform/graphics/cpu/arm/filters/FELightingNEON.cpp:
3341         * platform/graphics/cpu/arm/filters/FELightingNEON.h:
3342         (WebCore::FELighting::platformApplyNeon):
3343
3344 2018-04-08  Michael Catanzaro  <mcatanzaro@igalia.com>
3345
3346         [WPE][GTK] Remove applicationDirectoryPath() and sharedResourcePath()
3347         https://bugs.webkit.org/show_bug.cgi?id=184381
3348
3349         Reviewed by Carlos Garcia Campos.
3350
3351         These are unused.
3352
3353         * platform/FileSystem.h:
3354         * platform/glib/FileSystemGlib.cpp:
3355         (WebCore::FileSystem::applicationDirectoryPath): Deleted.
3356         (WebCore::FileSystem::sharedResourcesPath): Deleted.
3357
3358 2018-04-07  Daniel Bates  <dabates@apple.com>
3359
3360         Have WorkerScriptLoader::loadAsynchronously() take a FetchOptions
3361         https://bugs.webkit.org/show_bug.cgi?id=184385
3362
3363         Reviewed by Youenn Fablet.
3364
3365         Currently we pass various FetchOptions to WorkerScriptLoader::loadAsynchronously()
3366         so that it can build up a ThreadableLoaderOptions structure to pass to the loader.
3367         Each time we want to set another FetchOptions option we need to add a new parameter.
3368         Instead we should have WorkerScriptLoader::loadAsynchronously() take a FetchOptions.
3369         This will make it straightforward for a caller to set new loader options as needed.
3370         In particular, this will make it straightforward to support setting the request's
3371         destination flag (i.e. FetchOptions::destination) to support blocking scripts with
3372         a non-JavaScript MIME type in a subsequent commit.
3373
3374         No functionality changed. So, no new tests.
3375
3376         * loader/ResourceLoaderOptions.h:
3377         (WebCore::ResourceLoaderOptions::ResourceLoaderOptions): Modified to take a FetchOptions
3378         by value so as to support both move and copy semantics.
3379         * loader/ThreadableLoader.cpp:
3380         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):  Added helper constructor
3381         that takes a FetchOptions.
3382         * loader/ThreadableLoader.h:
3383         * workers/Worker.cpp:
3384         (WebCore::Worker::create): Instantiate and pass a FetchOptions to the loader for the mode,
3385         cache policy, and redirect policy.
3386         * workers/WorkerScriptLoader.cpp:
3387         (WebCore::WorkerScriptLoader::loadAsynchronously): Modified to take a FetchOptions and
3388         instantiate a ThreadableLoaderOptions from it.
3389         * workers/WorkerScriptLoader.h:
3390         * workers/WorkerScriptLoaderClient.h:
3391         (WebCore::WorkerScriptLoaderClient::isServiceWorkerClient const): Deleted. This function
3392         is no longer needed because the Service Worker client now passes the service worker mode
3393         directly to the loader.
3394         * workers/service/ServiceWorkerJob.cpp:
3395         (WebCore::ServiceWorkerJob::fetchScriptWithContext): Instantiate and pass a FetchOptions
3396         to the loader.
3397         * workers/service/ServiceWorkerJob.h:
3398
3399 2018-04-07  Timothy Hatcher  <timothy@apple.com>
3400
3401         Use the system's link color when system appearance is desired for a WebView.
3402
3403         https://bugs.webkit.org/show_bug.cgi?id=184353
3404         rdar://problem/9420053
3405
3406         Reviewed by Wenson Hsieh.
3407
3408         Have Document consult RenderTheme via StyleColor for the various link colors.
3409         This allows the system to have different colors than the standard hardcoded ones.
3410         This adds StyleColor::Options, to avoid multiple booleans being passed around,
3411         since the "for visited link" state is now needed in RenderTheme.
3412
3413         * WebCore.xcodeproj/project.pbxproj: Made StyleColor.h private, since RenderTheme.h includes it.
3414         * css/StyleColor.cpp:
3415         (WebCore::StyleColor::colorFromKeyword): Use options instead of a bool.
3416         (WebCore::StyleColor::isSystemColor): Consider CSSValueWebkitLink the start of system colors.
3417         * css/StyleColor.h:
3418         * css/StyleResolver.cpp:
3419         (WebCore::StyleResolver::colorFromPrimitiveValue const): Use StyleColor::Options.
3420         * css/parser/CSSParser.cpp:
3421         (WebCore::CSSParser::parseSystemColor): Use StyleColor::Options.
3422         * dom/Document.cpp:
3423         (WebCore::Document::resetLinkColor): Ask StyleColor for the link color instead of hardcoding it.
3424         (WebCore::Document::resetVisitedLinkColor): Ditto.
3425         (WebCore::Document::resetActiveLinkColor): Ditto.
3426         (WebCore::Document::styleColorOptions const): Added. Helper to get the options used.
3427         * dom/Document.h:
3428         * html/canvas/CanvasRenderingContext2D.cpp:
3429         (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal): Use StyleColor::Options.
3430         * rendering/RenderTheme.cpp:
3431         (WebCore::RenderTheme::systemColor const): Add default values here, moved from Document.
3432         (WebCore::RenderTheme::focusRingColor): Use StyleColor::Options.
3433         * rendering/RenderTheme.h:
3434         (WebCore::RenderTheme::platformFocusRingColor const): Use StyleColor::Options.
3435         * rendering/RenderThemeGtk.cpp:
3436         (WebCore::RenderThemeGtk::systemColor const): Use StyleColor::Options.
3437         * rendering/RenderThemeGtk.h:
3438         * rendering/RenderThemeIOS.h:
3439         * rendering/RenderThemeIOS.mm:
3440         (WebCore::RenderThemeIOS::systemColor const): Use StyleColor::Options.
3441         * rendering/RenderThemeMac.h:
3442         * rendering/RenderThemeMac.mm:
3443         (WebCore::RenderThemeMac::platformFocusRingColor const): Use StyleColor::Options.
3444         (WebCore::RenderThemeMac::platformColorsDidChange): Clear m_systemVisitedLinkColor.
3445         (WebCore::RenderThemeMac::systemColor const): Use StyleColor::Options.
3446         (WebCore::RenderThemeMac::adjustMenuListStyle const): Ditto.
3447         * rendering/RenderThemeWin.cpp:
3448         (WebCore::RenderThemeWin::systemColor const): Use StyleColor::Options.
3449         * rendering/RenderThemeWin.h:
3450         * rendering/TextPaintStyle.cpp:
3451         (WebCore::computeTextPaintStyle): Use StyleColor::Options.
3452
3453 2018-04-06  Youenn Fablet  <youenn@apple.com>
3454
3455         Response headers should be filtered when sent from NetworkProcess to WebProcess
3456         https://bugs.webkit.org/show_bug.cgi?id=184310
3457
3458         Reviewed by Ryosuke Niwa.
3459
3460         Did some refactoring to allow ResourceResponse to use header value parsing routines.
3461         We add sanitization levels for regular responses in case responses might be exposed to scripts or not.
3462         If not exposed to scripts, additional filtering is done.
3463
3464         Add internal API to get unfiltered response headers from a fetch response.
3465         Test: http/wpt/service-workers/header-filtering.https.html
3466
3467         * Modules/fetch/FetchResponse.h:
3468         * loader/CrossOriginPreflightResultCache.cpp:
3469         (WebCore::CrossOriginPreflightResultCacheItem::parse):
3470         * platform/network/HTTPParsers.h:
3471         (WebCore::addToAccessControlAllowList):
3472         (WebCore::parseAccessControlAllowList):
3473         * platform/network/ResourceResponseBase.cpp:
3474         (WebCore::isSafeToKeepRedirectionResponseHeader):
3475         (WebCore::isCrossOriginSafeToKeepResponseHeader):
3476         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFields):
3477         * platform/network/ResourceResponseBase.h:
3478         * testing/ServiceWorkerInternals.cpp:
3479         (WebCore::ServiceWorkerInternals::fetchResponseHeaderList):
3480         * testing/ServiceWorkerInternals.h:
3481         * testing/ServiceWorkerInternals.idl:
3482
3483 2018-04-06  Michael Catanzaro  <mcatanzaro@igalia.com>
3484
3485         Unreviewed, fix unused parameter warning when credential storage is disabled
3486
3487         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3488         (WebCore::NetworkStorageSession::getCredentialFromPersistentStorage):
3489
3490 2018-04-06  Eric Carlson  <eric.carlson@apple.com>
3491
3492         [Extra zoom mode] Block playback until fullscreen begins
3493         https://bugs.webkit.org/show_bug.cgi?id=184371
3494         <rdar://problem/39250891>
3495
3496         Reviewed by Youenn Fablet.
3497
3498         * html/HTMLMediaElement.cpp:
3499         (WebCore::HTMLMediaElement::updatePlayState): Return early when waiting to enter fullscreen.
3500         (WebCore::HTMLMediaElement::enterFullscreen): Set m_waitingToEnterFullscreen.
3501         (WebCore::HTMLMediaElement::exitFullscreen): Clear m_waitingToEnterFullscreen.
3502         (WebCore::HTMLMediaElement::didBecomeFullscreenElement): Ditto.
3503         * html/HTMLMediaElement.h:
3504
3505 2018-04-06  Brent Fulgham  <bfulgham@apple.com>
3506
3507         WebCore::screenSupportsExtendedColor improperly calls NSScreen functions in the WebContent process
3508         https://bugs.webkit.org/show_bug.cgi?id=184364
3509         <rdar://problem/39246314>
3510
3511         Reviewed by Per Arne Vollan.
3512
3513         The WebContent process is interacting directly with NSScreen to determine if the current screen
3514         has extended color support. This should be brokered from the UIProcess.
3515         
3516         Tested by fast/media/mq-color-gamut.html.
3517
3518         * platform/ScreenProperties.h:
3519         (WebCore::ScreenProperties::encode const): Add screenSupportsExtendedColor.
3520         (WebCore::ScreenProperties::decode): Ditto.
3521         * platform/mac/PlatformScreenMac.mm:
3522         (WebCore::getScreenProperties): Retrieve extended color support.
3523         (WebCore::screenSupportsExtendedColor): Retrieve cached version when in the WebContent
3524         process. Assert that NSScreen is not accessed in the WebContent process.
3525
3526 2018-04-06  Fujii Hironori  <Hironori.Fujii@sony.com>
3527
3528         [Win][WebCore] Expose a constant for scrollbar pixels per line (cScrollbarPixelsPerLine)
3529         https://bugs.webkit.org/show_bug.cgi?id=184296
3530
3531         Reviewed by Alex Christensen.
3532
3533         No new tests (No behavior changes).
3534
3535         * platform/PlatformWheelEvent.h: Placed cScrollbarPixelsPerLine definition.
3536         * platform/win/WheelEventWin.cpp:
3537         (WebCore::PlatformWheelEvent::PlatformWheelEvent): Removed cScrollbarPixelsPerLine definition.
3538
3539 2018-04-06  Brent Fulgham  <bfulgham@apple.com>
3540
3541         Unreviewed test fix after r230323
3542
3543         * platform/mac/PlatformScreenMac.mm:
3544         (WebCore::screenSupportsExtendedColor): Remove assertion hit during test runs.
3545
3546 2018-04-06  Brent Fulgham  <bfulgham@apple.com>
3547
3548         WebCore::screenColorSpace is retrieving CGColorSpace from NSScreen directly
3549         https://bugs.webkit.org/show_bug.cgi?id=184343
3550         <rdar://problem/39224881>
3551
3552         Reviewed by Per Arne Vollan.
3553
3554         Revise ScreenProperties to serialize the screen's color space, and later
3555         retrieve that in the WebContent process. This allows us to close off
3556         the CGSWindowServer connection.
3557
3558         * platform/ScreenProperties.h:
3559         (WebCore::ScreenProperties::encode const): Add CGColorSpaceRef support.
3560         (WebCore::ScreenProperties::decode): Ditto.
3561         * platform/mac/PlatformScreenMac.mm:
3562         (WebCore::displayID): Add assertion to prevent use in WebContent process.
3563         (WebCore::firstScreen): Ditto.
3564         (WebCore::getScreenProperties): Add support for CGColorSpaceRef.
3565         (WebCore::screenColorSpace): Retrieve cached version when in WebContent process.
3566         Assert that NSScreen is not accessed in WebContent process.
3567
3568 2018-04-06  Ms2ger  <Ms2ger@igalia.com>
3569
3570         Implement createImageBitmap(Blob)
3571         https://bugs.webkit.org/show_bug.cgi?id=183247
3572
3573         Reviewed by Dean Jackson.
3574
3575         Tests:
3576             - imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html
3577             - imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html
3578
3579         * fileapi/FileReaderLoader.h:
3580         (WebCore::FileReaderLoader::url): expose the Blob's URL.
3581         * html/ImageBitmap.cpp: implement createImageBitmap(Blob).
3582         * html/ImageBitmap.h: allow the BlobImageObserver class access to the creation function.
3583         * loader/cache/CachedImage.cpp: reuse extracted code.
3584         (WebCore::CachedImage::isPDFResource const):
3585         (WebCore::CachedImage::isPostScriptResource const):
3586         (WebCore::CachedImage::createImage):
3587         * platform/graphics/Image.cpp: extract some code from CachedImage to reuse.
3588         (WebCore::Image::create):
3589         (WebCore::Image::isPDFResource):
3590         (WebCore::Image::isPostScriptResource):
3591         * platform/graphics/Image.h: add declarations.
3592
3593 2018-04-06  Zalan Bujtas  <zalan@apple.com>
3594
3595         Flex child does not get repainted when it is inserted back to the render tree.
3596         https://bugs.webkit.org/show_bug.cgi?id=184361
3597         <rdar://problem/34528716>
3598
3599         Reviewed by Antti Koivisto.
3600
3601         As with any regular block children, we should issue full repaint for flexbox items on their
3602         first layout (see RenderBlockFlow::layoutBlockChild()).
3603
3604         Test: fast/flexbox/missing-repaint-when-flext-item-never-had-layout.html
3605
3606         * rendering/RenderFlexibleBox.cpp:
3607         (WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
3608
3609 2018-04-06  Ms2ger  <Ms2ger@igalia.com>
3610
3611         Support transferring ImageBitmap objects
3612         https://bugs.webkit.org/show_bug.cgi?id=183131
3613
3614         Reviewed by Dean Jackson.
3615
3616         Test: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-transfer.html
3617
3618         * bindings/js/SerializedScriptValue.cpp:
3619         (WebCore::CloneSerializer::serialize): thread through ImageBitmaps.
3620         (WebCore::CloneSerializer::CloneSerializer): thread through ImageBitmaps.
3621         (WebCore::CloneSerializer::fillTransferMap): don't require a mutable reference.
3622         (WebCore::CloneSerializer::dumpImageBitmap): add.
3623         (WebCore::CloneSerializer::dumpIfTerminal): check for ImageBitmap.
3624         (WebCore::CloneDeserializer::deserialize): thread through ImageBitmaps.
3625         (WebCore::CloneDeserializer::CloneDeserializer): thread through ImageBitmaps.
3626         (WebCore::CloneDeserializer::readImageBitmap): add.
3627         (WebCore::CloneDeserializer::readTerminal): check for ImageBitmap.
3628         (WebCore::SerializedScriptValue::SerializedScriptValue): thread through ImageBitmaps.
3629         (WebCore::SerializedScriptValue::create): thread through ImageBitmaps.
3630         (WebCore::containsDuplicates): add.
3631         (WebCore::SerializedScriptValue::deserialize): handle ImageBitmap arguments.
3632         * bindings/js/SerializedScriptValue.h: update signatures, add member.
3633         * html/ImageBitmap.cpp:
3634         (WebCore::ImageBitmap::create): add.
3635         (WebCore::ImageBitmap::detachBitmaps): add.
3636         * html/ImageBitmap.h: add signatures.
3637
3638 2018-04-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
3639
3640         When recording the drawing, the DisplayList should be initialized with the GraphicsContextState of the underlying GraphicsContext
3641         https://bugs.webkit.org/show_bug.cgi?id=184336
3642
3643         Reviewed by Antti Koivisto.
3644
3645         The state of the drawing context has to be transfered to the recording 
3646         DisplayList before recording. Many recording GraphicsContext functions 
3647         will behave wrongly if it gets the default state.
3648
3649         * html/canvas/CanvasRenderingContext2DBase.cpp:
3650         (WebCore::DisplayListDrawingContext::DisplayListDrawingContext):
3651         (WebCore::CanvasRenderingContext2DBase::drawingContext const):
3652         * platform/graphics/ca/GraphicsLayerCA.cpp:
3653         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
3654         * platform/graphics/displaylists/DisplayListRecorder.cpp:
3655         (WebCore::DisplayList::Recorder::Recorder):
3656         * platform/graphics/displaylists/DisplayListRecorder.h:
3657         (WebCore::DisplayList::Recorder::ContextState::ContextState):
3658         (WebCore::DisplayList::Recorder::ContextState::cloneForSave const):
3659         * platform/graphics/displaylists/DisplayListReplayer.cpp:
3660         (WebCore::DisplayList::Replayer::replay):
3661         * platform/graphics/displaylists/DisplayListReplayer.h:
3662         (WebCore::DisplayList::Replayer::replay): If we do not have a clipping
3663         rectangle and we want to record all the drawing, we need a default value
3664         for the clipping rectangle and we want no clipping to happen.
3665
3666 2018-04-06  Daniel Bates  <dabates@apple.com>
3667
3668         Emit a more informative message when a script is blocked due to "X-Content-Type: nosniff"
3669         https://bugs.webkit.org/show_bug.cgi?id=184359
3670
3671         Reviewed by Per Arne Vollan.
3672
3673         Emphasize in the message that the script was blocked from executing.
3674
3675         Test: http/tests/security/contentTypeOptions/nosniff-importScript-blocked.html
3676
3677         * dom/LoadableClassicScript.cpp:
3678         (WebCore::LoadableClassicScript::notifyFinished):
3679         * workers/WorkerScriptLoader.cpp:
3680         (WebCore::WorkerScriptLoader::didReceiveResponse):
3681
3682 2018-04-06  Daniel Bates  <dabates@apple.com>
3683
3684         importScripts() should throw exception with a reason when it fails to load a script from the network
3685         https://bugs.webkit.org/show_bug.cgi?id=184345
3686
3687         Reviewed by Alexey Proskuryakov.
3688
3689         Currently importScripts() throws a NetworkError exception without a reason when
3690         it fails to load a script from the network. It is ambiguous whether the load failed
3691         due to an access control failure or some other error. Instead we should include
3692         the reason the load failed in the thrown exception.
3693
3694         * workers/WorkerGlobalScope.cpp:
3695         (WebCore::WorkerGlobalScope::importScripts):
3696
3697 2018-04-06  Daniel Bates  <dabates@apple.com>
3698
3699         Attempt to fix the build after <https://trac.webkit.org/changeset/230338>
3700         (https://bugs.webkit.org/show_bug.cgi?id=184360)
3701
3702         Make lambdas mutable so that we can WTFMove() their captured arguments.
3703
3704         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3705         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed):
3706         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed):
3707         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed):
3708
3709 2018-04-06  Daniel Bates  <dabates@apple.com>
3710
3711         Have class Exception take String by value instead of a String&&
3712         https://bugs.webkit.org/show_bug.cgi?id=184360
3713
3714         Reviewed by Alexey Proskuryakov.
3715
3716         For convenience support instantiating an Exception with either an lvalue String or
3717         rvalue String.
3718
3719         Although it can be argued that having Exception take a String by value instead of String&&
3720         can lead to missed opportunities to WTFMove() a String object into Exception such mistakes
3721         are just that, missed opportunities. That is, correctness is not affected and we may perform
3722         an unnecessary ref/deref of the underlying StringImpl when instantiating an Exception. If
3723         such missed opportunities show up in profiles and such mistakes happen often then we can
3724         re-evaluate the decision to have Exception take a String by value.
3725
3726         * Modules/cache/DOMCache.cpp:
3727         (WebCore::DOMCache::put): Simplify code now that Exception takes a String by value.
3728         * Modules/fetch/FetchResponse.cpp:
3729         (WebCore::FetchResponse::BodyLoader::didFail): Ditto.
3730         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3731         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed): Move String into Exception to avoid an
3732         unnecessary ref/de-ref.
3733         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed): Ditto.
3734         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed): Ditto.
3735         * dom/Exception.h:
3736         (WebCore::Exception::Exception): Take String by value. Also use uniform initializer syntax.
3737
3738 2018-04-06  Antti Koivisto  <antti@apple.com>
3739
3740         Tighten ImageSource to have BitmapImage pointer instead of Image
3741         https://bugs.webkit.org/show_bug.cgi?id=184356
3742
3743         Reviewed by Said Abou-Hallawa.
3744
3745         ImageSource is an implementation detail of BitmapImage, not a generic type.
3746
3747         * loader/ImageLoader.cpp:
3748         (WebCore::ImageLoader::decode):
3749         * platform/graphics/BitmapImage.h:
3750         * platform/graphics/Image.h:
3751         (WebCore::Image::decode): Deleted.
3752         (WebCore::Image::imageFrameAvailableAtIndex): Deleted.
3753
3754         Also make some BitmapImage specific functions non-virtual and remove them from Image.
3755
3756         * platform/graphics/ImageSource.cpp:
3757         (WebCore::ImageSource::ImageSource):
3758         * platform/graphics/ImageSource.h:
3759         (WebCore::ImageSource::create):
3760
3761         Make constructors private.
3762
3763         * platform/graphics/cg/GraphicsContext3DCG.cpp:
3764         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
3765
3766 2018-04-06  Brent Fulgham  <bfulgham@apple.com>
3767
3768         Unreviewed test fix after r230323
3769
3770         * platform/mac/PlatformScreenMac.mm:
3771         (WebCore::screen): Remove assertion we still hit due to event handling code.
3772
3773 2018-04-05  Youenn Fablet  <youenn@apple.com>
3774
3775         REGRESSION (r230223): LayoutTest http/tests/contentextensions/css-display-none-overflows-rule-data-1.html is crashing
3776         https://bugs.webkit.org/show_bug.cgi?id=184306
3777
3778         Reviewed by Ryosuke Niwa.
3779
3780         Add an option to not compile CSS rules since they are not useful in NetworkProcess.
3781         Covered by tests no longer crashing in Debug WK2 bots.
3782
3783         * contentextensions/ContentExtension.cpp:
3784         (WebCore::ContentExtensions::ContentExtension::create):
3785         (WebCore::ContentExtensions::ContentExtension::ContentExtension):
3786         * contentextensions/ContentExtension.h:
3787         * contentextensions/ContentExtensionsBackend.cpp:
3788         (WebCore::ContentExtensions::ContentExtensionsBackend::addContentExtension):
3789         * contentextensions/ContentExtensionsBackend.h:
3790
3791 2018-04-05  Brent Fulgham  <bfulgham@apple.com>
3792
3793         WebContent process is calling CGDisplayUsesInvertedPolarity
3794         https://bugs.webkit.org/show_bug.cgi?id=184337
3795         <rdar://problem/39215702>
3796
3797         Reviewed by Zalan Bujtas.
3798
3799         The PlatformScreenMac code is still calling display-related routines directly, specifically
3800         CGDisplayUsesInvertedPolarity and CGDisplayUsesForceToGray. These should be brokered from
3801         the UIProcess.
3802         
3803         There's also no reason to avoid the brokering behavior on current WebKit builds. Remove
3804         the compile guards so all macOS builds use this behavior.
3805         
3806         Finally, add some ProcessPrivilege assertions to guard against accidentally calling these
3807         routines in the future.
3808
3809         Tested by existing regression tests.
3810
3811         * platform/PlatformScreen.h:
3812         * platform/ScreenProperties.h:
3813         (WebCore::ScreenProperties::encode const): Add new values.
3814         (WebCore::ScreenProperties::decode):
3815         * platform/mac/PlatformScreenMac.mm:
3816         (WebCore::displayID): Add assertion that this is not calling display-related routines in
3817         the WebContent process.
3818         (WebCore::firstScreen): Ditto.
3819         (WebCore::screenProperties): Moved higher in the file so it can be reused. Add calls to
3820         CGDisplayUsesInvertedPolarity and CGDisplayUsesForceToGray.
3821         (WebCore::getScreenProperties): Moved higher in the file so it can be reused. Stop
3822         double-hashing displayID.
3823         (WebCore::screenIsMonochrome): Use cached values in WebContent process. Assert if this
3824         code attempts a display-related routine in the WebContent process.
3825         (WebCore::screenHasInvertedColors): Ditto.
3826         (WebCore::screenDepth): Add assertion that this is not calling display-related routines in
3827         the WebContent process.
3828         (WebCore::screenDepthPerComponent): Ditto.
3829         (WebCore::screenRect): Ditto.
3830         (WebCore::screenAvailableRect): Ditto.
3831         (WebCore::screen): Ditto.
3832         (WebCore::screenColorSpace): Ditto.
3833         (WebCore::screenSupportsExtendedColor): Ditto.
3834
3835 2018-04-05  John Wilander  <wilander@apple.com>
3836
3837         Resource Load Statistics: Apply cookie blocking to setCookiesFromDOM()
3838         https://bugs.webkit.org/show_bug.cgi?id=184346
3839         <rdar://problem/39226036>
3840
3841         Reviewed by Brent Fulgham.
3842
3843         Since these cookies can't be seen and are not sent in requests, I
3844         can't write an automated test for them. This really should have been
3845         done as part of: https://bugs.webkit.org/show_bug.cgi?id=180682.
3846         That said, I have tested this manually.
3847
3848         * platform/network/mac/CookieJarMac.mm:
3849         (WebCore::setCookiesFromDOM):
3850
3851 2018-04-05  Zalan Bujtas  <zalan@apple.com>
3852
3853         Folding anonymous blocks should not result in deleting content.
3854         https://bugs.webkit.org/show_bug.cgi?id=184339
3855         <rdar://problem/37327428>
3856
3857         Reviewed by Antti Koivisto.
3858
3859         While folding multiple anonymous blocks (moving the children from next sibling over to previous sibling)
3860         we should ensure that the block we are about to destroy does not gain new descendants.
3861         In case of 4 sibling anonymous blocks (A B C D), while destroying B
3862         1. we move C's children to A and destroy C.
3863         2. While destroying C, we notice B and C as sibling anonymous blocks and we move
3864         D's children over to B (even though B is going to be destroyed as we climb back on the stack).
3865         
3866         In this patch, B is detached from the tree before we start moving renderers around so that a subsequent folding won't
3867         find B anymore as a candidate.
3868
3869         Test: fast/block/crash-while-folding-anonymous-blocks.html
3870
3871         * rendering/updating/RenderTreeBuilderBlock.cpp:
3872         (WebCore::RenderTreeBuilder::Block::detach):
3873
3874 2018-04-05  Andy Estes  <aestes@apple.com>
3875
3876         Mark Payment Request as "Supported" in features.json
3877         https://bugs.webkit.org/show_bug.cgi?id=184338
3878
3879         Reviewed by Anders Carlsson.
3880
3881         * features.json:
3882
3883 2018-04-05  Chris Dumez  <cdumez@apple.com>
3884
3885         Unreviewed, rolling out r230042.
3886
3887         It is no longer needed now that it is safe to construct a
3888         SecurityOrigin from an on-main thread
3889
3890         Reverted changeset:
3891
3892         "WebSocket::didReceiveMessage() may construct a SecurityOrigin
3893         object on a non-main thread"
3894         https://bugs.webkit.org/show_bug.cgi?id=184068
3895         https://trac.webkit.org/changeset/230042
3896
3897 2018-04-05  Yusuke Suzuki  <utatane.tea@gmail.com>
3898
3899         [WTF] Remove StaticLock
3900         https://bugs.webkit.org/show_bug.cgi?id=184332
3901
3902         Reviewed by Mark Lam.
3903
3904         No behavior change.
3905
3906         * Modules/webdatabase/Database.cpp:
3907         (WebCore::Database::Database):
3908         (WebCore::Database::performOpenAndVerify):
3909         (WebCore::Database::closeDatabase):
3910         (WebCore::Database::getCachedVersion const):
3911         (WebCore::Database::setCachedVersion):
3912         * Modules/webdatabase/DatabaseTracker.cpp:
3913         (WebCore::DatabaseTracker::openDatabaseMutex):
3914         * Modules/webdatabase/DatabaseTracker.h:
3915         * Modules/websockets/WebSocket.cpp:
3916         (WebCore::WebSocket::allActiveWebSocketsMutex):
3917         * Modules/websockets/WebSocket.h:
3918         * bridge/objc/WebScriptObject.mm:
3919         * crypto/CryptoAlgorithmRegistry.cpp:
3920         (WebCore::CryptoAlgorithmRegistry::identifier):
3921         (WebCore::CryptoAlgorithmRegistry::name):
3922         (WebCore::CryptoAlgorithmRegistry::create):
3923         (WebCore::CryptoAlgorithmRegistry::registerAlgorithm):
3924         * dom/Node.cpp:
3925         * platform/URL.cpp:
3926         * platform/graphics/FontCache.cpp:
3927         * platform/graphics/MediaPlayer.cpp:
3928         * platform/ios/QuickLook.mm:
3929         * platform/ios/WebSQLiteDatabaseTrackerClient.mm:
3930         * platform/ios/wak/WebCoreThread.mm:
3931         * platform/ios/wak/WebCoreThreadRun.cpp:
3932         * platform/network/cf/LoaderRunLoopCF.cpp:
3933         (WebCore::loaderRunLoop):
3934         * platform/network/curl/CurlContext.cpp:
3935         (WebCore::CurlShareHandle::mutexFor):
3936         * platform/network/curl/CurlContext.h:
3937         * platform/sql/SQLiteDatabaseTracker.cpp:
3938         (WebCore::SQLiteDatabaseTracker::incrementTransactionInProgressCount):
3939         (WebCore::SQLiteDatabaseTracker::decrementTransactionInProgressCount):
3940         * platform/text/TextEncodingRegistry.cpp:
3941         (WebCore::buildBaseTextCodecMaps):
3942         (WebCore::newTextCodec):
3943         (WebCore::atomicCanonicalTextEncodingName):
3944         * workers/WorkerThread.cpp:
3945         (WebCore::WorkerThread::workerThreadCount):
3946         (WebCore::WorkerThread::WorkerThread):
3947         (WebCore::WorkerThread::~WorkerThread):
3948         (WebCore::WorkerThread::releaseFastMallocFreeMemoryInAllThreads):
3949
3950 2018-04-04  Youenn Fablet  <youenn@apple.com>
3951
3952         WebRTC data channel only applications require capture permissions for direct connections
3953         https://bugs.webkit.org/show_bug.cgi?id=174500
3954         <rdar://problem/34134281>
3955
3956         Reviewed by Eric Carlson.
3957
3958         Test: webrtc/datachannel/mdns-ice-candidates.html
3959
3960         Add support at PeerConnectionBackend to obfuscate any gathered host candidate
3961         by replacing the IP address with an opaque name that can be resolved by MDNS.
3962         An opaque name is generated for each IP address and is scoped by the document owning the peer connection object.
3963
3964         Add support to resolve any such MDNS ICE candidate.
3965         A limit of 250 ms is fixed for the resolution to happen.
3966         After 250 ms, the candidate is discarded.
3967
3968         Add an experimental flag around this feature, off by default.
3969
3970         * Modules/mediastream/PeerConnectionBackend.cpp:
3971         (WebCore::extractIPAddres):
3972         (WebCore::PeerConnectionBackend::addIceCandidate):
3973         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
3974         (WebCore::PeerConnectionBackend::addIceCandidateFailed):
3975   &nbs