Another attempt to fix the Mac and iOS build following r230944
[WebKit.git] / Source / WebCore / ChangeLog
1 2018-04-24  Daniel Bates  <dabates@apple.com>
2
3         Another attempt to fix the Mac and iOS build following r230944
4         (https://bugs.webkit.org/show_bug.cgi?id=159464)
5
6         * platform/network/mac/CookieJarMac.mm:
7         (WebCore::policyProperties):
8
9 2018-04-24  Daniel Bates  <dabates@apple.com>
10
11         Attempt to fix the Mac and iOS build following r230944
12         (https://bugs.webkit.org/show_bug.cgi?id=159464)
13
14         * platform/network/mac/CookieJarMac.mm:
15         (WebCore::policyProperties):
16
17 2018-04-23  Daniel Bates  <dabates@apple.com>
18
19         Implement Same-Site cookies
20         https://bugs.webkit.org/show_bug.cgi?id=159464
21         <rdar://problem/27196358>
22
23         Reviewed by Brent Fulgham.
24
25         Implements support for Same-Site cookies as per <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00>.
26         The implementation is materially consistent with the spec. though implements the computation
27         for a document's "site for cookies" indirectly as part of loading its frame. This is done to
28         avoid traversing the frame tree on each subresource request initiated by the document or one
29         of its workers. We take advantage of the fact that Web Workers and Service Workers use their
30         host document's loader to load resources on their behalf to use the correct "site for cookies"
31         for requests (e.g. fetch()) initiating by them without the need to duplicate and store the
32         host document's "site for cookies" in the worker's script execution context.
33
34         The implementation differs from the spec. in the handling of about: URLs and the empty URL
35         and makes the implementation in WebKit match the behavior of Chrome and Firefox as well as
36         consistent with origin inheritance as described in <https://html.spec.whatwg.org/multipage/browsers.html#origin>
37         (16 April 2018). Specifically, requests to about:blank, about:srcdoc and the empty URL ("")
38         are treated as same-site because these URLs inherit their origin from their owner.
39
40         Tests: http/tests/cookies/same-site/fetch-after-navigating-iframe-in-cross-origin-page.html
41                http/tests/cookies/same-site/fetch-after-top-level-navigation-from-cross-origin-page.html
42                http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html
43                http/tests/cookies/same-site/fetch-cookies-set-in-about-blank-iframe.html
44                http/tests/cookies/same-site/fetch-in-about-blank-page.html
45                http/tests/cookies/same-site/fetch-in-cross-origin-iframe.html
46                http/tests/cookies/same-site/fetch-in-cross-origin-page.html
47                http/tests/cookies/same-site/fetch-in-cross-origin-service-worker.html
48                http/tests/cookies/same-site/fetch-in-cross-origin-worker.html
49                http/tests/cookies/same-site/fetch-in-same-origin-page.html
50                http/tests/cookies/same-site/fetch-in-same-origin-service-worker.html
51                http/tests/cookies/same-site/fetch-in-same-origin-srcdoc-iframe.html
52                http/tests/cookies/same-site/fetch-in-same-origin-worker.html
53                http/tests/cookies/same-site/popup-cross-site-post.html
54                http/tests/cookies/same-site/popup-cross-site.html
55                http/tests/cookies/same-site/popup-same-site-post.html
56                http/tests/cookies/same-site/popup-same-site-via-cross-site-redirect.html
57                http/tests/cookies/same-site/popup-same-site-via-same-site-redirect.html
58                http/tests/cookies/same-site/popup-same-site.html
59
60         * Sources.txt: Add source file SameSiteInfo.cpp.
61         * WebCore.xcodeproj/project.pbxproj: Add source files SameSiteInfo.{cpp, h}.
62         * dom/Document.cpp:
63         (WebCore::Document::initSecurityContext): Modified to call SecurityPolicy::shouldInheritSecurityOriginFromOwner().
64         (WebCore::Document::shouldInheritContentSecurityPolicyFromOwner const): Ditto.
65         (WebCore::shouldInheritSecurityOriginFromOwner): Deleted; moved to SecurityPolicy.
66         * dom/Document.h:
67         (WebCore::Document::firstPartyForSameSiteCookies const): Added.
68         (WebCore::Document::setFirstPartyForSameSiteCookies): Added.
69         * loader/CookieJar.cpp:
70         (WebCore::sameSiteInfo): Returns the same-site info for the request used to load the specified document.
71         (WebCore::cookies): Pass the same-site info down to the platform.
72         (WebCore::cookieRequestHeaderFieldProxy): Ditto.
73         (WebCore::setCookies): Ditto.
74         (WebCore::cookieRequestHeaderFieldValue): Ditto.
75         (WebCore::getRawCookies): Ditto.
76         * loader/DocumentLoader.cpp:
77         (WebCore::DocumentLoader::willSendRequest): Add same-site info to the request.
78         (WebCore::DocumentLoader::startLoadingMainResource): Update a FIXME comment to explain that
79         we can simplify ResourceRequestBase if we can remove the call to addExtraFieldsToMainResourceRequest()
80         here. Specifically, we would not need to differentiate between a request with an unspecified
81         same-site state (default state of a new request) from a request whose same-site state has
82         been explicitly set if we can assume that the same-site state of a request is set exactly
83         once. In absence of this guarantee we need an "unspecified" state to avoid overriding existing
84         same-site information computed with a null initiating document (the case of a new address bar
85         initiated load) from a load initiated by the document associated with this loader.
86         * loader/FrameLoader.cpp:
87         (WebCore::FrameLoader::setFirstPartyForCookies): Modified to also update the first party for
88         same-site cookies ("site for cookies").
89         (WebCore::FrameLoader::load): Add same-site info to the request.
90         (WebCore::FrameLoader::reload): Ditto.
91         (WebCore::FrameLoader::setOriginalURLForDownloadRequest): Ditto.
92         (WebCore::FrameLoader::addExtraFieldsToRequest): If the request does not already have
93         same-site info then compute it and add it to the request. Mark main frame main resource
94         requests as a "top-site".
95         (WebCore::FrameLoader::addSameSiteInfoToRequestIfNeeded): Implements the "'Same-site' and 'cross-site'
96         Requests" algorithm from <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-2.1>.
97         (WebCore::createWindow): Add same-site info to the request.
98         * loader/FrameLoader.h:
99         * loader/ResourceLoader.cpp:
100         (WebCore::ResourceLoader::init): Ditto.
101         * page/DOMWindow.cpp:
102         (WebCore::DOMWindow::createWindow): Ditto.
103         * page/SecurityPolicy.cpp:
104         (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): Moved from Document.cpp.
105         * page/SecurityPolicy.h:
106         * platform/CookiesStrategy.h:
107         * platform/network/CacheValidation.cpp:
108         (WebCore::headerValueForVary): Pass the same-site info down to the platform.
109         * platform/network/CookieRequestHeaderFieldProxy.h:
110         (WebCore::CookieRequestHeaderFieldProxy::encode const): Encode same-site bits.
111         (WebCore::CookieRequestHeaderFieldProxy::decode): Decode same-site bits.
112         * platform/network/PlatformCookieJar.h:
113         * platform/network/ResourceRequestBase.cpp:
114         (WebCore::ResourceRequestBase::setAsIsolatedCopy): Added.
115         (WebCore::ResourceRequestBase::isSameSite const): Added.
116         (WebCore::ResourceRequestBase::setIsSameSite): Added.
117         (WebCore::ResourceRequestBase::isTopSite const): Added.
118         (WebCore::ResourceRequestBase::setIsTopSite): Added.
119         (WebCore::equalIgnoringHeaderFields):
120         * platform/network/ResourceRequestBase.h:
121         (WebCore::ResourceRequestBase::isSameSiteUnspecified const): Added. See comment for DocumentLoader::startLoadingMainResource()
122         for more details.
123         (WebCore::registrableDomainsAreEqual): Added.
124         (WebCore::ResourceRequestBase::encodeBase const): Encode same-site bits.
125         (WebCore::ResourceRequestBase::decodeBase): Decode same-site bits.
126         * platform/network/SameSiteInfo.cpp: Added.
127         (WebCore::SameSiteInfo::create):
128         * platform/network/SameSiteInfo.h: Added.
129         (WebCore::SameSiteInfo::encode const):
130         (WebCore::SameSiteInfo::decode):
131         * platform/network/cf/CookieJarCFNet.cpp:
132         (WebCore::setCookiesFromDOM): Pass Same-Site info down.
133         (WebCore::cookiesForDOM): Ditto.
134         (WebCore::cookieRequestHeaderFieldValue): Ditto.
135         (WebCore::getRawCookies): Ditto.
136         * platform/network/cf/ResourceRequestCFNet.cpp:
137         (WebCore::siteForCookies): Added.
138         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
139         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
140         * platform/network/cocoa/ResourceRequestCocoa.mm:
141         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
142         (WebCore::siteForCookies): Added.
143         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
144         * platform/network/curl/CookieJarCurl.cpp:
145         (WebCore::cookiesForDOM): Pass Same-Site info down.
146         (WebCore::setCookiesFromDOM): Ditto.
147         (WebCore::cookieRequestHeaderFieldValue): Ditto.
148         (WebCore::getRawCookies): Ditto.
149         * platform/network/curl/CookieJarCurl.h:
150         * platform/network/curl/CookieJarCurlDatabase.cpp:
151         (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): Ditto.
152         (WebCore::CookieJarCurlDatabase::cookiesForDOM const): Ditto.
153         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): Ditto.
154         (WebCore::CookieJarCurlDatabase::getRawCookies const): Ditto.
155         * platform/network/curl/CookieJarCurlDatabase.h:
156         * platform/network/curl/ResourceHandleCurl.cpp:
157         (WebCore::ResourceHandle::createCurlRequest): Ditto.
158         * platform/network/mac/CookieJarMac.mm:
159         (WebCore::cookiesForURL): Added; shared function to return the cookies based on the specified criterion. 
160         (WebCore::setHTTPCookiesForURL): Moved from the bottom of the file to top to be closer to the other
161         CFNetwork helper functions. Modified to support fetching same-site cookies.
162         (WebCore::httpCookiesForURL): Moved to be under setHTTPCookiesForURL(). Modified to call cookiesForURL().
163         Note the SPI used in cookiesForURL() apply the same criterion for whether to fetch secure cookies as we
164         were computing here. That is, the CFNetwork SPI only returns secure cookies if the specified URL's scheme
165         case-insensitively matches "https".
166         (WebCore::cookiesInPartitionForURL): Wrote in terms of cookiesForURL().
167         (WebCore::cookiesForSession): Pass the Same-Site info.
168         (WebCore::cookiesForDOM): Ditto.
169         (WebCore::cookieRequestHeaderFieldValue): Ditto.
170         (WebCore::setCookiesFromDOM): Ditto.
171         (WebCore::getRawCookies): Ditto.
172         (WebCore::deleteCookie): Pass std::nullopt for the Same-Site info so that we do not consider the SameSite
173         attribute when fetching cookies to delete.
174         * platform/network/soup/CookieJarSoup.cpp:
175         (WebCore::setCookiesFromDOM): Pass the Same-Site info.
176         (WebCore::cookiesForDOM): Ditto.
177         (WebCore::cookieRequestHeaderFieldValue): Ditto.
178         (WebCore::getRawCookies): Ditto.
179         * workers/service/context/ServiceWorkerThreadProxy.cpp:
180         (WebCore::createPageForServiceWorker): Set the first party for same site cookies ("site for cookies") to
181         the script URL.
182         * xml/XSLTProcessor.cpp:
183         (WebCore::XSLTProcessor::createDocumentFromSource): Copy the first party for same-site cookies to the
184         new document.
185
186 2018-04-23  Youenn Fablet  <youenn@apple.com>
187
188         Make WebLoaderStrategy send to NetworkResourceLoader necessary parameters to handle full loads in NetworkProcess
189         https://bugs.webkit.org/show_bug.cgi?id=184763
190
191         Reviewed by Chris Dumez.
192
193         No change of behavior yet since we do not use these parameters in NetworkProcess yet.
194
195         Add PreflightPolicy and CSP response headers as ResourceLoaderOptions.
196         This allows passing them from DocumentThreadableLoader to WebLoaderStrategy.
197
198         Allow getting the original headers from a SubresourceLoader.
199         This allows passing them from DocumentThreadableLoader down to WebLoaderStrategy.
200
201         * Modules/fetch/FetchLoader.cpp:
202         (WebCore::FetchLoader::startLoadingBlobURL):
203         (WebCore::FetchLoader::start):
204         * loader/DocumentThreadableLoader.cpp:
205         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
206         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
207         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
208         * loader/ResourceLoaderOptions.h:
209         * loader/SubresourceLoader.cpp:
210         (WebCore::SubresourceLoader::originalHeaders const):
211         * loader/SubresourceLoader.h:
212         * loader/ThreadableLoader.cpp:
213         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):
214         (WebCore::ThreadableLoaderOptions::isolatedCopy const):
215         * loader/ThreadableLoader.h:
216         * page/EventSource.cpp:
217         (WebCore::EventSource::connect):
218         * xml/XMLHttpRequest.cpp:
219         (WebCore::XMLHttpRequest::createRequest):
220
221 2018-04-23  Michael Catanzaro  <mcatanzaro@igalia.com>
222
223         [WPE][GTK] Remove WlUniquePtr<wl_display> footgun
224         https://bugs.webkit.org/show_bug.cgi?id=184405
225
226         Reviewed by Carlos Garcia Campos.
227
228         WlUniquePtr<wl_display> is a pretty big footgun because there are two different destruction
229         functions -- wl_display_disconnect() and wl_display_destroy() -- and which one you need to
230         use depends on how the wl_display() was created, and WebKit uses both in different places.
231         So WlUniquePtr<wl_display> is pretty unsafe. See bug #176490 for an example of fun caused
232         by using it incorrectly.
233
234         Let's use std::unique_ptr with custom deleter functors instead.
235
236         * platform/graphics/wayland/WlUniquePtr.h:
237
238 2018-04-23  Antti Koivisto  <antti@apple.com>
239
240         REGRESSION (r220112): reCAPTCHA images render off screen on Twitch.tv app Log In or Sign Up
241         https://bugs.webkit.org/show_bug.cgi?id=182859
242         <rdar://problem/37595065>
243
244         Reviewed by Zalan Bujtas.
245
246         Roll out this change from the trunk as the issue it fixed no longer occurs.
247
248         * css/MediaQueryEvaluator.cpp:
249         (WebCore::orientationEvaluate):
250         (WebCore::aspectRatioEvaluate):
251         (WebCore::heightEvaluate):
252         (WebCore::widthEvaluate):
253         * page/FrameView.cpp:
254         (WebCore::FrameView::layoutSizeForMediaQuery const): Deleted.
255         * page/FrameView.h:
256         * page/LayoutContext.cpp:
257         (WebCore::LayoutContext::handleLayoutWithFrameFlatteningIfNeeded):
258
259 2018-04-23  Daniel Bates  <dabates@apple.com>
260
261         Another attempt to fix the Windows build following r230921
262         (https://bugs.webkit.org/show_bug.cgi?id=159464)
263
264         Pass dictionary key name using a string instead of a constant and pass CFURL* to
265         siteForCookies().
266
267         * platform/network/cf/ResourceRequestCFNet.cpp:
268         (WebCore::ResourceRequest::doUpdatePlatformRequest):
269         (WebCore::ResourceRequest::doUpdateResourceRequest):
270
271 2018-04-23  Zalan Bujtas  <zalan@apple.com>
272
273         [LayoutFormattingContext] Initial commit.
274         https://bugs.webkit.org/show_bug.cgi?id=184896
275
276         Reviewed by Antti Koivisto.
277
278         This is the initial commit of the new layout component -class definitions only (and mostly public functions).
279         See the header files (and Tools/LayoutReloaded project) for more information.
280
281         // Top level layout.
282         rootContainer = TreeBuilder::createLayoutTree(document);
283         rootDisplayBox = new Display::Box();
284         rootDisplayBox->setSize(viewportSize);
285         layoutContext = new LayoutContext(rootContainer, rootDisplayBox);
286         layoutContext->layout(rootContainer);
287
288         Driven by build time flag (currently off). Not testable yet.
289
290         * Configurations/FeatureDefines.xcconfig:
291         * Sources.txt:
292         * WebCore.xcodeproj/project.pbxproj:
293         * layout/BlockFormatting/BlockFormattingContext.cpp: Added.
294         * layout/BlockFormatting/BlockFormattingContext.h: Added.
295         * layout/BlockFormatting/BlockFormattingState.cpp: Added.
296         * layout/BlockFormatting/BlockFormattingState.h: Added.
297         * layout/BlockFormatting/BlockMarginCollapse.cpp: Added.
298         * layout/BlockFormatting/BlockMarginCollapse.h: Added.
299         * layout/DisplayTree/DisplayBox.cpp: Added.
300         * layout/DisplayTree/DisplayBox.h: Added.
301         * layout/FloatingContext.cpp: Added.
302         * layout/FloatingContext.h: Added.
303         * layout/FloatingState.cpp: Added.
304         * layout/FloatingState.h: Added.
305         * layout/FormattingContext.cpp: Added.
306         * layout/FormattingContext.h: Added.
307         * layout/FormattingState.cpp: Added.
308         * layout/FormattingState.h: Added.
309         * layout/InlineFormatting/InlineFormattingContext.cpp: Added.
310         * layout/InlineFormatting/InlineFormattingContext.h: Added.
311         * layout/InlineFormatting/InlineFormattingState.cpp: Added.
312         * layout/InlineFormatting/InlineFormattingState.h: Added.
313         * layout/LayoutCtx.cpp: Added.
314         * layout/LayoutCtx.h: Added.
315         * layout/LayoutTree/LayoutBlockContainer.cpp: Added.
316         * layout/LayoutTree/LayoutBlockContainer.h: Added.
317         * layout/LayoutTree/LayoutBox.cpp: Added.
318         * layout/LayoutTree/LayoutBox.h: Added.
319         * layout/LayoutTree/LayoutContainer.cpp: Added.
320         * layout/LayoutTree/LayoutContainer.h: Added.
321         * layout/LayoutTree/LayoutCtx.h: Added.
322         * layout/LayoutTree/LayoutInlineBox.cpp: Added.
323         * layout/LayoutTree/LayoutInlineBox.h: Added.
324         * layout/LayoutTree/LayoutInlineContainer.cpp: Added.
325         * layout/LayoutTree/LayoutInlineContainer.h: Added.
326
327 2018-04-23  Daniel Bates  <dabates@apple.com>
328
329         Attempt to fix the Mac and iOS build after r230921
330         (https://bugs.webkit.org/show_bug.cgi?id=159464)
331
332         Pass strings for the dictionary key names instead of using an extern constant as the
333         latter may not be available on all systems.
334
335         * platform/network/mac/CookieJarMac.mm:
336         (WebCore::setHTTPCookiesForURL):
337
338 2018-04-23  Daniel Bates  <dabates@apple.com>
339
340         Attempt to fix the build after r230921
341         (https://bugs.webkit.org/show_bug.cgi?id=159464)
342
343         Pass Same-Site info through.
344
345         * platform/network/cf/CookieJarCFNet.cpp:
346         (WebCore::cookieRequestHeaderFieldValue):
347         * platform/network/curl/CookieJarCurl.cpp:
348         (WebCore::cookieRequestHeaderFieldValue):
349         * platform/network/curl/CookieJarCurlDatabase.cpp:
350         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const):
351         * platform/network/soup/CookieJarSoup.cpp:
352         (WebCore::cookieRequestHeaderFieldValue):
353
354 2018-04-23  Ryan Haddad  <ryanhaddad@apple.com>
355
356         Unreviewed, speculative macOS build fix attempt.
357
358         * Modules/mediasource/SourceBuffer.cpp:
359         (WebCore::SourceBuffer::provideMediaData):
360
361 2018-04-23  Daniel Bates  <dabates@apple.com>
362
363         Implement Same-Site cookies
364         https://bugs.webkit.org/show_bug.cgi?id=159464
365         <rdar://problem/27196358>
366
367         Reviewed by Brent Fulgham.
368
369         Implements support for Same-Site cookies as per <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00>.
370         The implementation is materially consistent with the spec. though implements the computation
371         for a document's "site for cookies" indirectly as part of loading its frame. This is done to
372         avoid traversing the frame tree on each subresource request initiated by the document or one
373         of its workers. We take advantage of the fact that Web Workers and Service Workers use their
374         host document's loader to load resources on their behalf to use the correct "site for cookies"
375         for requests (e.g. fetch()) initiating by them without the need to duplicate and store the
376         host document's "site for cookies" in the worker's script execution context.
377
378         The implementation differs from the spec. in the handling of about: URLs and the empty URL
379         and makes the implementation in WebKit match the behavior of Chrome and Firefox as well as
380         consistent with origin inheritance as described in <https://html.spec.whatwg.org/multipage/browsers.html#origin>
381         (16 April 2018). Specifically, requests to about:blank, about:srcdoc and the empty URL ("")
382         are treated as same-site because these URLs inherit their origin from their owner.
383
384         Tests: http/tests/cookies/same-site/fetch-after-navigating-iframe-in-cross-origin-page.html
385                http/tests/cookies/same-site/fetch-after-top-level-navigation-from-cross-origin-page.html
386                http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html
387                http/tests/cookies/same-site/fetch-cookies-set-in-about-blank-iframe.html
388                http/tests/cookies/same-site/fetch-in-about-blank-page.html
389                http/tests/cookies/same-site/fetch-in-cross-origin-iframe.html
390                http/tests/cookies/same-site/fetch-in-cross-origin-page.html
391                http/tests/cookies/same-site/fetch-in-cross-origin-service-worker.html
392                http/tests/cookies/same-site/fetch-in-cross-origin-worker.html
393                http/tests/cookies/same-site/fetch-in-same-origin-page.html
394                http/tests/cookies/same-site/fetch-in-same-origin-service-worker.html
395                http/tests/cookies/same-site/fetch-in-same-origin-srcdoc-iframe.html
396                http/tests/cookies/same-site/fetch-in-same-origin-worker.html
397                http/tests/cookies/same-site/popup-cross-site-post.html
398                http/tests/cookies/same-site/popup-cross-site.html
399                http/tests/cookies/same-site/popup-same-site-post.html
400                http/tests/cookies/same-site/popup-same-site-via-cross-site-redirect.html
401                http/tests/cookies/same-site/popup-same-site-via-same-site-redirect.html
402                http/tests/cookies/same-site/popup-same-site.html
403
404         * Sources.txt: Add source file SameSiteInfo.cpp.
405         * WebCore.xcodeproj/project.pbxproj: Add source files SameSiteInfo.{cpp, h}.
406         * dom/Document.cpp:
407         (WebCore::Document::initSecurityContext): Modified to call SecurityPolicy::shouldInheritSecurityOriginFromOwner().
408         (WebCore::Document::shouldInheritContentSecurityPolicyFromOwner const): Ditto.
409         (WebCore::shouldInheritSecurityOriginFromOwner): Deleted; moved to SecurityPolicy.
410         * dom/Document.h:
411         (WebCore::Document::firstPartyForSameSiteCookies const): Added.
412         (WebCore::Document::setFirstPartyForSameSiteCookies): Added.
413         * loader/CookieJar.cpp:
414         (WebCore::sameSiteInfo): Returns the same-site info for the request used to load the specified document.
415         (WebCore::cookies): Pass the same-site info down to the platform.
416         (WebCore::cookieRequestHeaderFieldProxy): Ditto.
417         (WebCore::setCookies): Ditto.
418         (WebCore::cookieRequestHeaderFieldValue): Ditto.
419         (WebCore::getRawCookies): Ditto.
420         * loader/DocumentLoader.cpp:
421         (WebCore::DocumentLoader::willSendRequest): Add same-site info to the request.
422         (WebCore::DocumentLoader::startLoadingMainResource): Update a FIXME comment to explain that
423         we can simplify ResourceRequestBase if we can remove the call to addExtraFieldsToMainResourceRequest()
424         here. Specifically, we would not need to differentiate between a request with an unspecified
425         same-site state (default state of a new request) from a request whose same-site state has
426         been explicitly set if we can assume that the same-site state of a request is set exactly
427         once. In absence of this guarantee we need an "unspecified" state to avoid overriding existing
428         same-site information computed with a null initiating document (the case of a new address bar
429         initiated load) from a load initiated by the document associated with this loader.
430         * loader/FrameLoader.cpp:
431         (WebCore::FrameLoader::setFirstPartyForCookies): Modified to also update the first party for
432         same-site cookies ("site for cookies").
433         (WebCore::FrameLoader::load): Add same-site info to the request.
434         (WebCore::FrameLoader::reload): Ditto.
435         (WebCore::FrameLoader::setOriginalURLForDownloadRequest): Ditto.
436         (WebCore::FrameLoader::addExtraFieldsToRequest): If the request does not already have
437         same-site info then compute it and add it to the request. Mark main frame main resource
438         requests as a "top-site".
439         (WebCore::FrameLoader::addSameSiteInfoToRequestIfNeeded): Implements the "'Same-site' and 'cross-site'
440         Requests" algorithm from <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-2.1>.
441         (WebCore::createWindow): Add same-site info to the request.
442         * loader/FrameLoader.h:
443         * loader/ResourceLoader.cpp:
444         (WebCore::ResourceLoader::init): Ditto.
445         * page/DOMWindow.cpp:
446         (WebCore::DOMWindow::createWindow): Ditto.
447         * page/SecurityPolicy.cpp:
448         (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): Moved from Document.cpp.
449         * page/SecurityPolicy.h:
450         * platform/CookiesStrategy.h:
451         * platform/network/CacheValidation.cpp:
452         (WebCore::headerValueForVary): Pass the same-site info down to the platform.
453         * platform/network/CookieRequestHeaderFieldProxy.h:
454         (WebCore::CookieRequestHeaderFieldProxy::encode const): Encode same-site bits.
455         (WebCore::CookieRequestHeaderFieldProxy::decode): Decode same-site bits.
456         * platform/network/PlatformCookieJar.h:
457         * platform/network/ResourceRequestBase.cpp:
458         (WebCore::ResourceRequestBase::setAsIsolatedCopy): Added.
459         (WebCore::ResourceRequestBase::isSameSite const): Added.
460         (WebCore::ResourceRequestBase::setIsSameSite): Added.
461         (WebCore::ResourceRequestBase::isTopSite const): Added.
462         (WebCore::ResourceRequestBase::setIsTopSite): Added.
463         (WebCore::equalIgnoringHeaderFields):
464         * platform/network/ResourceRequestBase.h:
465         (WebCore::ResourceRequestBase::isSameSiteUnspecified const): Added. See comment for DocumentLoader::startLoadingMainResource()
466         for more details.
467         (WebCore::registrableDomainsAreEqual): Added.
468         (WebCore::ResourceRequestBase::encodeBase const): Encode same-site bits.
469         (WebCore::ResourceRequestBase::decodeBase): Decode same-site bits.
470         * platform/network/SameSiteInfo.cpp: Added.
471         (WebCore::SameSiteInfo::create):
472         * platform/network/SameSiteInfo.h: Added.
473         (WebCore::SameSiteInfo::encode const):
474         (WebCore::SameSiteInfo::decode):
475         * platform/network/cf/CookieJarCFNet.cpp:
476         (WebCore::setCookiesFromDOM): Pass Same-Site info down.
477         (WebCore::cookiesForDOM): Ditto.
478         (WebCore::cookieRequestHeaderFieldValue): Ditto.
479         (WebCore::getRawCookies): Ditto.
480         * platform/network/cf/ResourceRequestCFNet.cpp:
481         (WebCore::siteForCookies): Added.
482         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
483         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
484         * platform/network/cocoa/ResourceRequestCocoa.mm:
485         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
486         (WebCore::siteForCookies): Added.
487         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
488         * platform/network/curl/CookieJarCurl.cpp:
489         (WebCore::cookiesForDOM): Pass Same-Site info down.
490         (WebCore::setCookiesFromDOM): Ditto.
491         (WebCore::cookieRequestHeaderFieldValue): Ditto.
492         (WebCore::getRawCookies): Ditto.
493         * platform/network/curl/CookieJarCurl.h:
494         * platform/network/curl/CookieJarCurlDatabase.cpp:
495         (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): Ditto.
496         (WebCore::CookieJarCurlDatabase::cookiesForDOM const): Ditto.
497         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): Ditto.
498         (WebCore::CookieJarCurlDatabase::getRawCookies const): Ditto.
499         * platform/network/curl/CookieJarCurlDatabase.h:
500         * platform/network/curl/ResourceHandleCurl.cpp:
501         (WebCore::ResourceHandle::createCurlRequest): Ditto.
502         * platform/network/mac/CookieJarMac.mm:
503         (WebCore::cookiesForURL): Added; shared function to return the cookies based on the specified criterion.
504         (WebCore::setHTTPCookiesForURL): Moved from the bottom of the file to top to be closer to the other
505         CFNetwork helper functions. Modified to support fetching same-site cookies.
506         (WebCore::httpCookiesForURL): Moved to be under setHTTPCookiesForURL(). Modified to call cookiesForURL().
507         Note the SPI used in cookiesForURL() apply the same criterion for whether to fetch secure cookies as we
508         were computing here. That is, the CFNetwork SPI only returns secure cookies if the specified URL's scheme
509         case-insensitively matches "https".
510         (WebCore::cookiesInPartitionForURL): Wrote in terms of cookiesForURL().
511         (WebCore::cookiesForSession): Pass the Same-Site info.
512         (WebCore::cookiesForDOM): Ditto.
513         (WebCore::cookieRequestHeaderFieldValue): Ditto.
514         (WebCore::setCookiesFromDOM): Ditto.
515         (WebCore::getRawCookies): Ditto.
516         (WebCore::deleteCookie): Pass std::nullopt for the Same-Site info so that we do not consider the SameSite
517         attribute when fetching cookies to delete.
518         * platform/network/soup/CookieJarSoup.cpp:
519         (WebCore::setCookiesFromDOM): Pass the Same-Site info.
520         (WebCore::cookiesForDOM): Ditto.
521         (WebCore::cookieRequestHeaderFieldValue): Ditto.
522         (WebCore::getRawCookies): Ditto.
523         * workers/service/context/ServiceWorkerThreadProxy.cpp:
524         (WebCore::createPageForServiceWorker): Set the first party for same site cookies ("site for cookies") to
525         the script URL.
526         * xml/XSLTProcessor.cpp:
527         (WebCore::XSLTProcessor::createDocumentFromSource): Copy the first party for same-site cookies to the
528         new document.
529
530 2018-04-23  Chris Dumez  <cdumez@apple.com>
531
532         HTML String load cannot be prevented by responding 'Cancel' asynchronously in decidePolicyForNavigationAction
533         https://bugs.webkit.org/show_bug.cgi?id=184848
534         <rdar://problem/39145306>
535
536         Reviewed by Brady Eidson.
537
538         When calling loadHTMLString on a WebView, we end up doing a load for 'about:blank'
539         with substitute data. In such case, we want to do a regular asynchronous policy
540         delegate check, there is no reason we need it to be synchronous. Update our check
541         to make sure we only do a synchronous policy check for initial 'about:blank' loads
542         that do not have substitute data.
543
544         * loader/PolicyChecker.cpp:
545         (WebCore::PolicyChecker::checkNavigationPolicy):
546
547 2018-04-23  Wenson Hsieh  <wenson_hsieh@apple.com>
548
549         [Extra zoom mode] 100vw is roughly half of the viewport width in extra zoom mode
550         https://bugs.webkit.org/show_bug.cgi?id=184871
551         <rdar://problem/39477595>
552
553         Reviewed by Andy Estes.
554
555         Currently, when computing CSS viewport units, we use ViewportConfiguration::initialScaleIgnoringContentSize().
556         This method computes an initial scale from the layout width and height without relying on any information
557         derived from the current content size. This is done to ensure that the content size and viewport dimensions for
558         CSS viewport units should not be simultaneously dependent on each other.
559
560         Since shrink-to-fit heuristics depend on content size, we currently assume that shrink-to-fit is disabled when
561         computing initialScaleIgnoringContentSize, by always passing in `false` for `shouldIgnoreScalingConstraints`.
562         However, in extra zoom mode, the opposite is true: since we force both `m_canIgnoreScalingConstraints` and
563         `m_forceHorizontalShrinkToFit` to be `true` in this mode, we will always try to shrink-to-fit regardless of
564         content size.
565
566         Because of this shrink-to-fit disparity between `initialScale` and `initialScaleIgnoringContentSize`, viewport
567         units in extra zoom mode are currently computed assuming an initial scale set by the page, whereas the real
568         viewport is scaled to fit, which causes any lengths computed in terms of vw and vh to be incorrect. To fix this,
569         we introduce a version of shouldIgnoreScalingConstraints() that returns `true` iff scaling constraints are
570         always ignored, regardless of content size. We then use this in initialScaleIgnoringContentSize, instead of
571         always passing in `false` for `shouldIgnoreScalingConstraints`.
572
573         Test: fast/css/extrazoom/viewport-units-shrink-to-fit.html
574
575         * page/ViewportConfiguration.cpp:
576         (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const):
577         (WebCore::ViewportConfiguration::initialScaleIgnoringContentSize const):
578         * page/ViewportConfiguration.h:
579
580 2018-04-23  Zalan Bujtas  <zalan@apple.com>
581
582         [Simple line layout] Generate inline boxtree using simple line layout runs.
583         https://bugs.webkit.org/show_bug.cgi?id=184833
584
585         Reviewed by Antti Koivisto.
586
587         RenderBlockFlow::ensureLineBoxes triggers line layout on the block content to replace
588         the simple line layout runs with an inline boxtree. The runs generated by the fast path
589         should always match the inline tree boxes.
590         In this patch instead of triggering layout, we just convert the simple line runs to
591         inline boxes.
592         Currently, it works with only one, non-paginated text renderer, but we should be
593         able to extend it to all the simple line layout content.   
594
595         Covered by existing tests.
596
597         * rendering/InlineBox.h:
598         (WebCore::InlineBox::setHasHyphen):
599         (WebCore::InlineBox::setCanHaveLeadingExpansion):
600         (WebCore::InlineBox::setCanHaveTrailingExpansion):
601         (WebCore::InlineBox::setForceTrailingExpansion):
602         (WebCore::InlineBox::setForceLeadingExpansion):
603         (WebCore::InlineBox::hasHyphen const):
604         (WebCore::InlineBox::canHaveLeadingExpansion const):
605         (WebCore::InlineBox::canHaveTrailingExpansion const):
606         (WebCore::InlineBox::forceTrailingExpansion const):
607         * rendering/RenderBlockFlow.cpp:
608         (WebCore::RenderBlockFlow::ensureLineBoxes):
609         * rendering/RenderBlockFlow.h:
610         * rendering/SimpleLineLayoutFlowContents.h:
611         (WebCore::SimpleLineLayout::FlowContents::segmentForRun const):
612         * rendering/SimpleLineLayoutFunctions.cpp:
613         (WebCore::SimpleLineLayout::canUseForLineBoxTree):
614         (WebCore::SimpleLineLayout::initializeInlineBox):
615         (WebCore::SimpleLineLayout::generateLineBoxTree):
616         * rendering/SimpleLineLayoutFunctions.h:
617         * rendering/SimpleLineLayoutResolver.cpp:
618         (WebCore::SimpleLineLayout::RunResolver::rangeForLine const):
619         * rendering/SimpleLineLayoutResolver.h:
620
621 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
622
623         [CoordGraphics] Remove unused trajectory cruft in CoordinatedLayerTreeHost, CoordinatedGraphicsLayer
624         https://bugs.webkit.org/show_bug.cgi?id=184881
625
626         Reviewed by Michael Catanzaro.
627
628         Remove the redundant findFirstDescendantWithContentsRecursively() and
629         setVisibleContentRectTrajectoryVector() methods on the
630         CoordinatedGraphicsLayer class.
631
632         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
633         (WebCore::CoordinatedGraphicsLayer::findFirstDescendantWithContentsRecursively): Deleted.
634         (WebCore::CoordinatedGraphicsLayer::setVisibleContentRectTrajectoryVector): Deleted.
635         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
636
637 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
638
639         [CoordGraphics] TiledBackingStore unnecessarily tracks alpha support value
640         https://bugs.webkit.org/show_bug.cgi?id=184880
641
642         Reviewed by Michael Catanzaro.
643
644         Drop the m_supportsAlpha member from the TiledBackingStore class. The
645         member value was unused. TiledBackingStore::setSupportsAlpha() method
646         is removed.
647
648         TiledBackingStore::setSupportsAlpha() invalidated the backing store,
649         so CoordinatedGraphicsLayer::setContentsOpaque() now enforces the same
650         behavior by manually updating the m_needsDisplay struct. This means
651         that during the following layer flush the backing store is repainted
652         in its entirety.
653
654         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
655         (WebCore::CoordinatedGraphicsLayer::setContentsOpaque):
656         (WebCore::CoordinatedGraphicsLayer::createBackingStore):
657         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
658         (WebCore::TiledBackingStore::TiledBackingStore):
659         (WebCore::TiledBackingStore::setSupportsAlpha): Deleted.
660         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
661
662 2018-04-23  Thibault Saunier  <tsaunier@igalia.com>
663
664         [GStreamer] Start implementing Audio/VideoTrackPrivateGSTreamer::kind method
665         https://bugs.webkit.org/show_bug.cgi?id=184650
666
667         Reviewed by Philippe Normand.
668
669         In the playbin3 case we can assume that if the GstStream is selected by default,
670         it is the Main track of that kind.
671
672         No new tests are added as:
673             * It relies on playbin3 case which support might be compiled out
674             * we already have a few test that are currently disabled in the mediastream
675               testsuite. This patch is part of the work to enable them.
676
677         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
678         (WebCore::AudioTrackPrivateGStreamer::kind const):
679         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
680         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
681         (WebCore::VideoTrackPrivateGStreamer::kind const):
682         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
683
684 2018-04-23  Alicia Boya García  <aboya@igalia.com>
685
686         [MSE] Add allSamplesInTrackEnqueued event
687         https://bugs.webkit.org/show_bug.cgi?id=184737
688
689         MediaSource has a .endOfStream() method to signal when there are no more frames
690         after the ones currently buffered.
691
692         This bit of data is important for some multimedia frameworks. For instance, in
693         GStreamer a stream of frames being decoded should be terminated by a
694         'end-of-stream' (EOS) event that has a similar meaning. Some GStreamer elements
695         will expect this event in order to work properly under some circumstances.
696
697         Unfortunately currently WebKit provides no mechanism for this: an event of
698         sorts should be emitted after no more frames are going to be enqueued to signal
699         the end of the stream. The closest mechanism WebKit has for this is
700         `markEndOfStream()`, but it's not exactly the same: markEndOfStream() informs
701         that -- as far as network buffering is concerned -- we are done; but at that
702         point there may still be (and often are) many frames waiting in the
703         decodeQueue, so it would be wrong to signal the decoder that there are no more
704         frames.
705
706         This patch introduces a new optional method in SourceBufferPrivate,
707         `allSamplesInTrackEnqueued(const AtomicString& trackID)` that is called
708         whenever the MediaSource is in "ended" state (the user has called
709         `MediaSource.endOfStream()`) and the decodeQueue is empty. Media framework
710         implementations can use this method to send a EOS event to a decoder that needs
711         it.
712
713         Reviewed by Xabier Rodriguez-Calvar.
714
715         * Modules/mediasource/MediaSource.cpp:
716         (WebCore::MediaSource::streamEndedWithError):
717         * Modules/mediasource/SourceBuffer.cpp:
718         (WebCore::SourceBuffer::provideMediaData):
719         (WebCore::SourceBuffer::trySignalAllSamplesInTrackEnqueued):
720         (WebCore::SourceBuffer::trySignalAllSamplesEnqueued):
721         * Modules/mediasource/SourceBuffer.h:
722         * platform/graphics/SourceBufferPrivate.h:
723         (WebCore::SourceBufferPrivate::allSamplesInTrackEnqueued):
724         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
725         (WebCore::MediaSourceClientGStreamerMSE::allSamplesInTrackEnqueued):
726         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
727         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
728         (WebCore::PlaybackPipeline::allSamplesInTrackEnqueued):
729         * platform/graphics/gstreamer/mse/PlaybackPipeline.h:
730         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
731         (WebCore::SourceBufferPrivateGStreamer::allSamplesInTrackEnqueued):
732         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:
733
734 2018-04-23  Ms2ger  <Ms2ger@igalia.com>
735
736         Avoid uninitialized memory read.
737         https://bugs.webkit.org/show_bug.cgi?id=184505
738         <rdar://problem/39348325>
739
740         Reviewed by Dean Jackson.
741
742         Test: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-bounds.html
743
744         * html/ImageBitmap.cpp:
745         (WebCore::croppedSourceRectangleWithFormatting):
746
747 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
748
749         [TexMap] Drop RefCounted inheritance off of TextureMapperBackingStore
750         https://bugs.webkit.org/show_bug.cgi?id=184810
751
752         Reviewed by Carlos Garcia Campos.
753
754         Turn TextureMapperBackingStore into a simple interface that doesn't
755         inherit from RefCounted<>. Instead, push that inheritance off to the
756         classes that implement the TextureMapperBackingStore interface. This
757         narrows down the purpose of TextureMapperBackingStore towards a simple
758         interface that TextureMapper algorithms can work with.
759
760         TextureMapperLayer has its m_backingStore member variable turn into
761         a simple pointer instead of a RefPtr<>. Setter method and call sites of
762         that method are updated to reflect that.
763
764         TextureMapperTiledBackingStore now inherits from RefCounted<> directly,
765         instead of through TextureMapperBackingStore.
766
767         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
768         (WebCore::GraphicsLayerTextureMapper::commitLayerChanges):
769         (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
770         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
771         * platform/graphics/texmap/TextureMapperBackingStore.h:
772         * platform/graphics/texmap/TextureMapperLayer.cpp:
773         (WebCore::TextureMapperLayer::setBackingStore):
774         * platform/graphics/texmap/TextureMapperLayer.h:
775         * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
776
777 2018-04-22  Zan Dobersek  <zdobersek@igalia.com>
778
779         [AsyncScrolling] Add generic ScrollingThread implementation
780         https://bugs.webkit.org/show_bug.cgi?id=184809
781
782         Reviewed by Yusuke Suzuki.
783
784         Add a generic ScrollingThread implementation that internally uses
785         RunLoop facilities to run the scrolling thread and dispatch
786         callbacks on that thread.
787
788         ScrollingThread::initializeRunLoop() retrieves address of the
789         thread-specific RunLoop and signals the Condition object.
790         ScrollingThread::wakeUpRunLoop() uses RunLoop::dispatch() to schedule
791         callback dispatches on the scrolling thread.
792
793         ScrollingThread::createThreadIfNeeded() mimics Cocoa implementation and
794         waits for the RunLoop address to be retrieved before continuing.
795
796         * SourcesGTK.txt: Add to build.
797         * SourcesWPE.txt: Ditto.
798         * page/scrolling/ScrollingThread.cpp:
799         (WebCore::ScrollingThread::createThreadIfNeeded):
800         * page/scrolling/ScrollingThread.h:
801         * page/scrolling/generic/ScrollingThreadGeneric.cpp: Added.
802         (WebCore::ScrollingThread::initializeRunLoop):
803         (WebCore::ScrollingThread::wakeUpRunLoop):
804
805 2018-04-22  Zan Dobersek  <zdobersek@igalia.com>
806
807         [CoordinatedGraphics] Unused contentsSize, coveredRect attributes in CoordinatedGraphicsState
808         https://bugs.webkit.org/show_bug.cgi?id=184811
809
810         Reviewed by Carlos Garcia Campos.
811
812         Remove the unused contentsSize and coveredRect attributes on the
813         CoordinatedGraphicsState struct. CoordinatedGraphicsLayer::coverRect()
814         method is now unused and can also be removed.
815
816         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
817         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
818
819 2018-04-21  Daniel Bates  <dabates@apple.com>
820
821         Cleanup CookieRequestHeaderFieldProxy
822         https://bugs.webkit.org/show_bug.cgi?id=184868
823
824         Remove extraneous whitespace that I inadvertently added.
825
826         * platform/network/CookieRequestHeaderFieldProxy.h:
827         (WebCore::CookieRequestHeaderFieldProxy::decode):
828
829 2018-04-21  Daniel Bates  <dabates@apple.com>
830
831         Cleanup CookieRequestHeaderFieldProxy
832         https://bugs.webkit.org/show_bug.cgi?id=184868
833
834         Reviewed by Youenn Fablet.
835
836         Simplify the struct CookieRequestHeaderFieldProxy and make it consistent with other structs.
837         Among other changes, remove constructors for CookieRequestHeaderFieldProxy as they are
838         unnecessary as all supported compilers support non-static data member initializers (NSDMI)
839         for aggregates, remove prefix "m_" from the name of fields as this is struct exists for
840         convenience and offers no encapsulation and simplify decoding logic of this struct.
841
842         No functionality changed. So, no new tests.
843
844         * loader/CookieJar.cpp:
845         (WebCore::cookieRequestHeaderFieldProxy):
846         * platform/network/CookieRequestHeaderFieldProxy.h:
847         (WebCore::CookieRequestHeaderFieldProxy::encode const):
848         (WebCore::CookieRequestHeaderFieldProxy::decode):
849         (WebCore::CookieRequestHeaderFieldProxy::CookieRequestHeaderFieldProxy): Deleted.
850         * platform/network/SocketStreamHandleImpl.cpp:
851         (WebCore::cookieDataForHandshake):
852         * platform/network/cf/CookieJarCFNet.cpp:
853         (WebCore::cookieRequestHeaderFieldValue):
854         * platform/network/curl/CookieJarCurl.cpp:
855         (WebCore::cookieRequestHeaderFieldValue):
856         * platform/network/curl/CookieJarCurlDatabase.cpp:
857         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const):
858         * platform/network/mac/CookieJarMac.mm:
859         (WebCore::cookieRequestHeaderFieldValue):
860         * platform/network/soup/CookieJarSoup.cpp:
861         (WebCore::cookieRequestHeaderFieldValue):
862
863 2018-04-21  Antoine Quint  <graouts@apple.com>
864
865         [Modern Media Controls] Show a loading indicator after pressing the play button in compact mode
866         https://bugs.webkit.org/show_bug.cgi?id=184863
867         <rdar://problem/38939468>
868
869         Reviewed by Dean Jackson.
870
871         We now display a loading indicator after pressing the play button when in compact mode. We also update the
872         behavior to use assets provided through WebKitAdditions (see webkit.org/b/184862) for the play button and
873         the invalid icon. Additionally, we always show a 20% opaque black overlay in the background while any piece
874         of user interface is up.
875
876         * Modules/modern-media-controls/controls/compact-activity-indicator.css: Added.
877         (button.compact-activity-indicator > picture): The loading indicator asset is a sprite made of 23 frames, so
878         we specify the mask size (since all buttons are rendered via a mask) to be 23 * 100% the rendered size. The
879         display of the loading indicator is performed with a first intro animation which runs once through the first
880         8 frames and then a continuously looping animation going through the remaining frames. We use a frames()
881         timing function to achieve the frame-by-frame effect while using only from/to keyframe animations. When we
882         fade out, we use a simply opacity fade, which is combined with the spinning animation. We use CSS variables
883         to encode both animations so they can be used combined or one at a time without redefining the whole animation
884         property.
885         (button.compact-activity-indicator.spins > picture): Use the "spins" animation variable when spinning.
886         (button.compact-activity-indicator.spins.fades-out > picture): Combine the "spins" and "fades-out" animation
887         variables when fading out.
888         (@keyframes compact-activity-indicator-intro): Animation going through the first 8 frames of the loading indicator.
889         (@keyframes compact-activity-indicator-loop): Animation going through the remaining frames of the loading indicator.
890         (@keyframes compact-activity-indicator-fades-out): Animation fading opacity from 1 to 0.
891         * Modules/modern-media-controls/controls/compact-activity-indicator.js: Added.
892         (CompactActivityIndicator):
893         (CompactActivityIndicator.prototype.show): Add the "spins" CSS class to show the control spinning with the intro animation.
894         (CompactActivityIndicator.prototype.hide): Add the "fades-out" CSS class to hide the control, removing both this class and
895         the "spins" class when the fade-out animation completes.
896         * Modules/modern-media-controls/controls/compact-media-controls.css: Added.
897         (.media-controls.compact:before): Add a 20% black overlay over the video frame to provide contrast for controls.
898         (.media-controls.compact button): Ensure buttons are sized to use the entire video frame so that their hit region
899         comprises the whole video frame.
900         (.media-controls.compact button > picture): Override default blending styles for a simple solid white mask.
901         (.media-controls.compact button:active > picture): Turn off the scale down effect when pressing a button.
902         * Modules/modern-media-controls/controls/compact-media-controls.js: Expose a "state" property for the compact media controls,
903         which can be exlusively one of three: "paused", "pending" and "invalid".
904         (CompactMediaControls.):
905         (CompactMediaControls.prototype.get state):
906         (CompactMediaControls.prototype.set state):
907         (CompactMediaControls.prototype.layout): In the "paused" state, show the play button. In the "pending" state show
908         the loading indicator. In the "invalid" state show the invalid button.
909         (CompactMediaControls.prototype.get placard): Deleted.
910         (CompactMediaControls.prototype.set placard): Deleted.
911         * Modules/modern-media-controls/js-files:
912         * Modules/modern-media-controls/media/compact-media-controls-support.js: Added.
913         (CompactMediaControlsSupport.prototype.get mediaEvents):
914         (CompactMediaControlsSupport.prototype.handleEvent): Make the controls enter the "paused" state when receiving a "pause"
915         event. Make the controls enter the "invalid" state when receiving an "error" event. 
916         (CompactMediaControlsSupport.prototype.enable):
917         (CompactMediaControlsSupport.prototype.disable):
918         (CompactMediaControlsSupport.prototype.buttonWasPressed): Play the media when pressing the play button and make the controls
919         enter the "pending" state. When pressing the loading indicator, pause the media and make the controls enter the "paused" state.
920         (CompactMediaControlsSupport.prototype._buttons):
921         (CompactMediaControlsSupport):
922         * Modules/modern-media-controls/media/media-controller.js:
923         (MediaController.prototype._supportingObjectClasses): Only use CompactMediaControlsSupport as a media controller supporting object
924         in the compact mode.
925         * Modules/modern-media-controls/media/placard-support.js:
926         (PlacardSupport.prototype.get mediaEvents): This media controller support object no longer needs to deal with compact mode.
927         * Modules/modern-media-controls/media/playback-support.js:
928         (PlaybackSupport.prototype.syncControl): This media controller support object no longer needs to deal with compact mode.
929         (PlaybackSupport):
930
931 2018-04-21  Antoine Quint  <graouts@apple.com>
932
933         [Modern Media Controls] Obtain compact mode icons through WebKitAdditions
934         https://bugs.webkit.org/show_bug.cgi?id=184862
935         <rdar://problem/39621645>
936
937         Reviewed by Jon Lee.
938
939         * Modules/modern-media-controls/controls/button.js:
940         (Button.prototype._updateImageMetrics): Handle PDF assets where the image source's intrinsic size needs
941         to be adjusted for the device pixel density.
942         (Button):
943         * Modules/modern-media-controls/controls/icon-service.js: Expect three additional icons provided through
944         WebKitAdditions, including two in the PDF format, so we add support for this format.
945         * WebCore.xcodeproj/project.pbxproj: Copy additional assets from the WebKitAdditions build directory should
946         any be present.
947
948 2018-04-21  Dean Jackson  <dino@apple.com>
949
950         Expose whether you've build with the Apple Internal SDK
951         https://bugs.webkit.org/show_bug.cgi?id=184864
952
953         Reviewed by Wenson Hsieh.
954
955         Internals API to let a test know if it is running with the
956         Apple internal SDK.
957
958         * testing/Internals.cpp:
959         (WebCore::usingAppleInternalSDK const):
960         * testing/Internals.h:
961         * testing/Internals.idl:
962
963 2018-04-20  Nan Wang  <n_wang@apple.com>
964
965         AX: AOM does not work with DOM Level 1 events
966         https://bugs.webkit.org/show_bug.cgi?id=184847
967
968         Reviewed by Chris Fleizach.
969
970         Added the accessibility events to the HTML attribute names.
971
972         Test cases are added to the existing layout tests.
973
974         * html/HTMLAttributeNames.in:
975         * html/HTMLElement.cpp:
976         (WebCore::HTMLElement::createEventHandlerNameMap):
977
978 2018-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
979
980         REGRESSION(r228088): [SOUP] Check TLS errors for WebSockets on GTlsConnection::accept-certificate
981         https://bugs.webkit.org/show_bug.cgi?id=184804
982
983         Reviewed by Michael Catanzaro.
984
985         * platform/network/soup/SocketStreamHandleImpl.h: Add a public url getter.
986         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
987         (WebCore::acceptCertificateCallback): Call SoupNetworkSession::checkTLSErrors() to decide whether to accept the
988         certificate or not.
989         (WebCore::connectProgressCallback): Receive the SocketStreamHandle and pass it to acceptCertificateCallback callback.
990         (WebCore::socketClientEventCallback): Ditto.
991         (WebCore::SocketStreamHandleImpl::create): Always connect to network events.
992         (WebCore::wssConnectionAcceptCertificateCallback): Deleted.
993         (WebCore::wssSocketClientEventCallback): Deleted.
994
995 2018-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
996
997         [SOUP] Do TLS error checking on GTlsConnection::accept-certificate
998         https://bugs.webkit.org/show_bug.cgi?id=184480
999
1000         Reviewed by Michael Catanzaro.
1001
1002         * platform/network/soup/ResourceError.h: Change tlsError to recieve a failing URL instead of a SoupRequest,
1003         since the request was only used to get the failing URL.
1004         * platform/network/soup/ResourceErrorSoup.cpp:
1005         (WebCore::ResourceError::tlsError): Use the given failing URL.
1006         * platform/network/soup/SoupNetworkSession.cpp:
1007         (WebCore::SoupNetworkSession::SoupNetworkSession): Use ssl-strict when creating the SoupSession to handle the
1008         certificates ourselves by connecting to GTlsConnection::accept-certificate.
1009         (WebCore::SoupNetworkSession::checkTLSErrors): Updated to receive a URL, certificate and errors instead of
1010         receiving a SoupRequest and SoupMessage and extract the url, certirficate and errors from them. Also return the
1011         optional error directly instead of using a completion handler since the function is always synchronous.
1012         * platform/network/soup/SoupNetworkSession.h:
1013
1014 2018-04-20  Tim Horton  <timothy_horton@apple.com>
1015
1016         Adjust geolocation feature flag
1017         https://bugs.webkit.org/show_bug.cgi?id=184856
1018
1019         Reviewed by Wenson Hsieh.
1020
1021         * Configurations/FeatureDefines.xcconfig:
1022
1023 2018-04-20  Chris Dumez  <cdumez@apple.com>
1024
1025         Unreviewed attempt to fix Windows build after r230875.
1026
1027         * platform/network/cf/CookieJarCFNet.cpp:
1028         (WebCore::cookieRequestHeaderFieldValue):
1029         * platform/network/curl/CookieJarCurlDatabase.cpp:
1030
1031 2018-04-20  Chris Dumez  <cdumez@apple.com>
1032
1033         REGRESSION (r229828): web view doesn’t update or respond to resizing until client calls policy decision handler
1034         https://bugs.webkit.org/show_bug.cgi?id=184210
1035         <rdar://problem/39072354>
1036
1037         Reviewed by Wenson Hsieh.
1038
1039         r229828 tried to have some API tests happy on iOS by freezing the layer tree
1040         during the navigation policy decision. However, this is observable by the client
1041         application and a regression from when the policy delegate was synchronous.
1042
1043         To address the issue, this patch reverts r229828 and instead updates the iOS
1044         API tests to wait for the next presentation update after navigating
1045         before interacting with the view.
1046
1047         * loader/FrameLoaderClient.h:
1048         * loader/PolicyChecker.cpp:
1049         (WebCore::PolicyChecker::checkNavigationPolicy):
1050
1051 2018-04-20  Brent Fulgham  <bfulgham@apple.com>
1052
1053         Limit cookie header access to Network process
1054         https://bugs.webkit.org/show_bug.cgi?id=184764
1055         <rdar://problem/36785285>
1056
1057         Reviewed by Youenn Fablet.
1058
1059         Revise the handling of cookie request headers so that we don't interact with them in the
1060         WebContent process. They are only needed for interaction with the server and the network
1061         process, so we should limit their scope to just the Network process.
1062
1063         Instead, we should handle a token that represents the cookie headers in the WebContent
1064         process, which can be converted to the relevant cookie data in the network process when
1065         needed.
1066
1067         * Modules/websockets/WebSocketChannel.cpp:
1068         (WebCore::WebSocketChannel::didOpenSocketStream):
1069         * Modules/websockets/WebSocketHandshake.cpp:
1070         (WebCore::WebSocketHandshake::clientHandshakeMessage const):
1071         (WebCore::WebSocketHandshake::clientHandshakeRequest const):
1072         (WebCore::WebSocketHandshake::clientHandshakeCookieRequestHeaderFieldProxy const):
1073         (WebCore::WebSocketHandshake::clientHandshakeMessage): Deleted.
1074         (WebCore::WebSocketHandshake::clientHandshakeRequest): Deleted.
1075         * Modules/websockets/WebSocketHandshake.h:
1076         * WebCore.xcodeproj/project.pbxproj:
1077         * loader/CookieJar.cpp:
1078         (WebCore::cookieRequestHeaderFieldProxy):
1079         * loader/CookieJar.h:
1080         * platform/network/CookieRequestHeaderFieldProxy.h: Added.
1081         (WebCore::CookieRequestHeaderFieldProxy::CookieRequestHeaderFieldProxy):
1082         (WebCore::CookieRequestHeaderFieldProxy::isolatedCopy const):
1083         (WebCore::CookieRequestHeaderFieldProxy::encode const):
1084         (WebCore::CookieRequestHeaderFieldProxy::decode):
1085         * platform/network/PlatformCookieJar.h:
1086         * platform/network/SocketStreamHandle.cpp:
1087         (WebCore::SocketStreamHandle::sendHandshake):
1088         * platform/network/SocketStreamHandle.h:
1089         * platform/network/SocketStreamHandleImpl.cpp:
1090         (WebCore::SocketStreamHandleImpl::platformSendHandshake):
1091         * platform/network/cf/SocketStreamHandleImpl.h:
1092         * platform/network/curl/CookieJarCurl.cpp:
1093         (WebCore::cookieRequestHeaderFieldValue):
1094         * platform/network/curl/CookieJarCurl.h:
1095         * platform/network/curl/SocketStreamHandleImpl.h:
1096         * platform/network/mac/CookieJarMac.mm:
1097         (WebCore::cookieRequestHeaderFieldValue):
1098         * platform/network/soup/CookieJarSoup.cpp:
1099         (WebCore::cookieRequestHeaderFieldValue):
1100         * platform/network/soup/SocketStreamHandleImpl.h:
1101
1102 2018-04-20  Daniel Bates  <dabates@apple.com>
1103
1104         Hide Strong Password label when text field is too narrow
1105         https://bugs.webkit.org/show_bug.cgi?id=184785
1106         <rdar://problem/38183939>
1107
1108         Reviewed by Zalan Bujtas.
1109
1110         We accomplish this illusion by allowing the text field's decorations to wrap, specifying flex
1111         shrink factors, a flex basis and hiding overflow. Hiding overflow is accomplished by a
1112         combination of setting "overflow: hidden", "text-overflow: clip", and patching RenderTextControlSingleLine::layout()
1113         to ensure that the height of the container element is equal to the intrinsic height of the
1114         inner elements. Because the container is a flex box and we want to vertically center its
1115         contents we also need to fix up the y-position of the container element as it may have flexed
1116         as a result of forcing its height to match the intrinsic height of the inner elements.
1117
1118         * css/html.css:
1119         (input::-webkit-strong-password-auto-fill-button): Specify a flex-shrink factor and prevent
1120         wrapping of the "Strong Password" text when flexed.
1121         * html/shadow/TextControlInnerElements.cpp:
1122         (WebCore::TextControlInnerContainer::TextControlInnerContainer): Register for a custom style
1123         resolution callback so that we can style the container if it is a Strong Password or Strong
1124         Confirmation Password text field. Ideally we could accomplish this effect with a user agent-
1125         specific pseudo class together with a selector definition in the user agent style sheet,
1126         html.css. Unfortunately the style resolver does not seem to apply pseudo classes to
1127         shadow DOM pseudo elements (why?). Therefore we use a custom style resolution callback to
1128         achieve the same effect.
1129         (WebCore::isStrongPasswordTextField): Returns whether the specified DOM element is a Strong
1130         Password text field.
1131         (WebCore::TextControlInnerContainer::resolveCustomStyle): Conditionally apply CSS properties
1132         "flex-wrap: wrap" and overflow: hidden" if the shadow host of this container is a Strong
1133         Password text field.
1134         (WebCore::TextControlInnerElement::resolveCustomStyle): Conditionally style the inner text
1135         if the shadow host of this container is a Strong Password text field. We need to apply these
1136         styles here as opposed to in html.css for the same reason we need to apply the styles to
1137         the container in a custom style resolution callback. See the comments for TextControlInnerContainer()
1138         above for more details
1139         * html/shadow/TextControlInnerElements.h:
1140         * rendering/RenderTextControlSingleLine.cpp:
1141         (WebCore::resetOverriddenHeight): Added. Incorporates the logic from setNeedsLayoutOnAncestors().
1142         (WebCore::RenderTextControlSingleLine::layout): Override the height of the container element to
1143         match the height of the inner elements when this text field is a Strong Password field. We cache
1144         the container's logical top before adjusting its height so that we can restore it after performing
1145         a second layout of this renderer. This is needed because we vertically center the elements in this
1146         renderer and adjusting the height of the container may cause it to flex and re-position along its
1147         cross axis when the container's height is taller than the inner element's height (e.g. the "Strong
1148         Password" label wraps to the next line). This re-positioning causes a noticeable jitter when
1149         transitioning from a field that has a visible "Strong Password" label to one that does not. Caching
1150         and restoring the logical top of the container element avoids this jitter.
1151         (WebCore::setNeedsLayoutOnAncestors): Deleted. Moved its implementation into resetOverriddenHeight().
1152
1153 2018-04-20  Dean Jackson  <dino@apple.com>
1154
1155         Render a badge on system preview images
1156         https://bugs.webkit.org/show_bug.cgi?id=184854
1157         <rdar://problem/39615154>
1158
1159         Reviewed by Tim Horton.
1160
1161         At paint time, if a RenderImage is an image element
1162         which is identified as a system preview, then draw
1163         a little badge in the top right corner.
1164
1165         It is expected that platforms will override the
1166         default rendering with something that identifies
1167         how a system preview will operate. e.g. QuickLook
1168         on Apple systems.
1169
1170         Test: system-preview/badge.html
1171
1172         * rendering/RenderImage.cpp:
1173         (WebCore::RenderImage::paintIntoRect): If we are
1174         a system preview, call RenderTheme to draw a badge.
1175         * rendering/RenderTheme.cpp:
1176         (WebCore::RenderTheme::paintSystemPreviewBadge): A default
1177         implementation that draws a red circle.
1178         * rendering/RenderTheme.h:
1179
1180 2018-04-20  Brian Burg  <bburg@apple.com>
1181
1182         Web Inspector: remove some dead code in IdentifiersFactory
1183         https://bugs.webkit.org/show_bug.cgi?id=184839
1184
1185         Reviewed by Timothy Hatcher.
1186
1187         * inspector/InspectorController.cpp:
1188         (WebCore::InspectorController::setProcessId): Deleted.
1189         * inspector/InspectorController.h:
1190
1191 2018-04-20  Chris Dumez  <cdumez@apple.com>
1192
1193         Use WindowProxy in DOMWindow.idl
1194         https://bugs.webkit.org/show_bug.cgi?id=184820
1195
1196         Reviewed by Sam Weinig.
1197
1198         Use WindowProxy in DOMWindow.idl to match the specification more closely.
1199
1200         * bindings/js/JSWindowProxy.h:
1201         * bindings/js/WindowProxy.cpp:
1202         (WebCore::WindowProxy::window const):
1203         * bindings/js/WindowProxy.h:
1204         * bindings/scripts/CodeGeneratorJS.pm:
1205         (NativeToJSValueDOMConvertNeedsState):
1206         * dom/Document.cpp:
1207         * dom/Document.h:
1208         * dom/Document.idl:
1209         * page/DOMWindow.cpp:
1210         (WebCore::DOMWindow::focus):
1211         (WebCore::DOMWindow::self const):
1212         (WebCore::DOMWindow::opener const):
1213         (WebCore::DOMWindow::parent const):
1214         (WebCore::DOMWindow::top const):
1215         (WebCore::DOMWindow::open):
1216         * page/DOMWindow.h:
1217         * page/DOMWindow.idl:
1218         * testing/Internals.cpp:
1219         (WebCore::Internals::openDummyInspectorFrontend):
1220         * testing/Internals.h:
1221         * testing/Internals.idl:
1222
1223 2018-04-20  Chris Dumez  <cdumez@apple.com>
1224
1225         Update cross-origin SecurityError messages to not include the target origin
1226         https://bugs.webkit.org/show_bug.cgi?id=184803
1227         <rdar://problem/39547724>
1228
1229         Reviewed by Sam Weinig.
1230
1231         No new tests, rebaselined existing tests.
1232
1233         * bindings/js/JSDOMBindingSecurity.cpp:
1234         (WebCore::canAccessDocument):
1235         (WebCore::BindingSecurity::shouldAllowAccessToFrame):
1236         (WebCore::BindingSecurity::shouldAllowAccessToDOMWindow):
1237         * page/DOMWindow.cpp:
1238         (WebCore::DOMWindow::crossDomainAccessErrorMessage):
1239         (WebCore::DOMWindow::isInsecureScriptAccess):
1240         * page/DOMWindow.h:
1241         * page/Location.cpp:
1242         (WebCore::Location::reload):
1243
1244 2018-04-20  Chris Nardi  <cnardi@chromium.org>
1245
1246         Update HSL/HSLA parsing to match CSS Color 4
1247         https://bugs.webkit.org/show_bug.cgi?id=180528
1248         <rdar://problem/35926675>
1249
1250         CSS Color 4 specifies a comma optional syntax for HSL/HSLA, as well as allowing angle values for the
1251         hue and percent alpha values. Update our parsing to match this.
1252
1253         Reviewed by Simon Fraser.
1254
1255         This change also updates the import of WPT css-color to test the changes.
1256
1257         Tests: LayoutTests/imported/w3c/web-platform-tests/css/css-color/hsl{a}-{001-008}.html
1258
1259         * css/parser/CSSPropertyParserHelpers.cpp:
1260         (WebCore::CSSPropertyParserHelpers::parseHSLParameters):
1261         (WebCore::CSSPropertyParserHelpers::parseColorFunction):
1262         (WebCore::CSSPropertyParserHelpers::consumeColor):
1263         * platform/graphics/Color.cpp:
1264         (WebCore::calcHue):
1265         (WebCore::makeRGBAFromHSLA):
1266
1267 2018-04-20  Wenson Hsieh  <wenson_hsieh@apple.com>
1268
1269         [Extra zoom mode] Injected bundle form client should be notified when editing text fields
1270         https://bugs.webkit.org/show_bug.cgi?id=184822
1271         <rdar://problem/38807319>
1272
1273         Reviewed by Tim Horton.
1274
1275         Export the constructor and destructor of UserTypingGestureIndicator for use in WebKit (see WebPage.cpp).
1276
1277         Test: fast/forms/extrazoom/edit-text-field-calls-injected-bundle.html
1278
1279         * dom/UserTypingGestureIndicator.h:
1280
1281 2018-04-18  Jer Noble  <jer.noble@apple.com>
1282
1283         Don't put build products into WK_ALTERNATE_WEBKIT_SDK_PATH for engineering builds
1284         https://bugs.webkit.org/show_bug.cgi?id=184762
1285
1286         Reviewed by Dan Bernstein.
1287
1288         * Configurations/WebCore.xcconfig:
1289         * WebCore.xcodeproj/project.pbxproj:
1290
1291 2018-04-20  Daniel Bates  <dabates@apple.com>
1292
1293         Remove code for compilers that did not support NSDMI for aggregates
1294         https://bugs.webkit.org/show_bug.cgi?id=184599
1295
1296         Reviewed by Per Arne Vollan.
1297
1298         Remove workaround for earlier Visual Studio versions that did not support non-static data
1299         member initializers (NSDMI) for aggregates. We have since updated all the build.webkit.org
1300         and EWS bots to a newer version that supports this feature.
1301
1302         * Modules/cache/CacheQueryOptions.h:
1303         (WebCore::CacheQueryOptions::CacheQueryOptions): Deleted.
1304         * dom/Node.h:
1305         (WebCore::Node::InsertionType::InsertionType): Deleted.
1306         (WebCore::Node::RemovalType::RemovalType): Deleted.
1307         * html/canvas/CanvasStyle.h:
1308         (WebCore::CanvasStyle::CMYKAColor::CMYKAColor): Deleted.
1309         * page/EventHandler.h:
1310         (WebCore::EventHandler::DragTargetResponse::DragTargetResponse): Deleted.
1311         * page/animation/CSSAnimationController.h:
1312         (WebCore::AnimationUpdate::AnimationUpdate): Deleted.
1313         * platform/graphics/FontSelectionAlgorithm.h:
1314         (WebCore::FontSelectionRequest::tied const):
1315         (WebCore::FontSelectionRequest::FontSelectionRequest): Deleted.
1316         (WebCore::FontSelectionCapabilities::FontSelectionCapabilities): Deleted.
1317         * platform/mediastream/IceCandidate.h:
1318         (WebCore::IceCandidate::IceCandidate): Deleted.
1319         * platform/text/StringWithDirection.h:
1320         (WebCore::StringWithDirection::StringWithDirection): Deleted.
1321         * rendering/MarkedText.h:
1322         (WebCore::MarkedText::MarkedText): Deleted.
1323         * style/StyleUpdate.h:
1324         (WebCore::Style::ElementUpdate::ElementUpdate): Deleted.
1325         (WebCore::Style::ElementUpdates::ElementUpdates): Deleted.
1326         (WebCore::Style::TextUpdate::TextUpdate): Deleted.
1327
1328 2018-04-20  Youenn Fablet  <youenn@apple.com>
1329
1330         WebPage sometimes incorrectly rules out PDF as a mime type that can be showed
1331         https://bugs.webkit.org/show_bug.cgi?id=184369
1332
1333         Reviewed by Chris Dumez.
1334
1335         WebPage does need to check for plugins at reception of the response.
1336         In that case, the page URL is the URL from which we are navigating out.
1337         Add plugin API to check for plugin availability with an extra URL parameter to cover that case.
1338
1339         Covered by API test.
1340
1341         * plugins/PluginData.cpp:
1342         (WebCore::PluginData::supportsWebVisibleMimeTypeForURL const):
1343         (WebCore::PluginData::supportsWebVisibleMimeType const):
1344         * plugins/PluginData.h:
1345
1346 2018-04-20  Daniel Bates  <dabates@apple.com>
1347
1348         Remove Strong Password decoration when text field type changes
1349         https://bugs.webkit.org/show_bug.cgi?id=184795
1350         <rdar://problem/38325108>
1351
1352         Reviewed by Antti Koivisto.
1353
1354         Remove the Strong Password decoration when the text field's type changes to avoid interfering
1355         with web sites that allow a person to show/hide their password.
1356
1357         Test: fast/forms/auto-fill-button/hide-strong-password-when-field-type-changes.html
1358
1359         * html/HTMLInputElement.cpp:
1360         (WebCore::HTMLInputElement::updateType):
1361
1362 2018-04-20  Javier Fernandez  <jfernandez@igalia.com>
1363
1364         Update Alignment shorthands to the spec now that they are not ambiguous
1365         https://bugs.webkit.org/show_bug.cgi?id=184812
1366
1367         Reviewed by Antti Koivisto.
1368
1369         Now that the issue [1] about the syntax ambiguity has been resolved we
1370         don't need to use the custom syntax anymore. The Alignment shorthands
1371         use now the simple syntax, defined based on the longhands' syntax.
1372
1373         Since we allow all the values valid for each longhand, we'll update
1374         in this CL the corresponding web platform tests. Additionally, this CL
1375         updates also the shorthand serialization tests [2], which didn't
1376         consider the new value 'legacy' for justify-items (and place-items) due
1377         to the bug [3] Firefox still has pending to be fixed.
1378
1379         [1] https://github.com/w3c/csswg-drafts/issues/1001
1380         [2] css/css-align/default-alignment/shorthand-serialization-001.html
1381         [3] https://bugzilla.mozilla.org/show_bug.cgi?id=1363875
1382
1383         Tests: imported/w3c/web-platform-tests/css/css-align/default-alignment/shorthand-serialization-001.html
1384                imported/w3c/web-platform-tests/css/css-align/gaps/gap-normal-computed-001.html
1385                imported/w3c/web-platform-tests/css/css-align/gaps/gap-normal-used-001.html
1386                imported/w3c/web-platform-tests/css/css-align/gaps/gap-normal-used-002.html
1387
1388         * css/parser/CSSPropertyParser.cpp:
1389         (WebCore::CSSPropertyParser::consumePlaceContentShorthand): Using the justify-content and align-content parsing logic to parse the shorthand.
1390         (WebCore::CSSPropertyParser::consumePlaceItemsShorthand): Using the justify-items and align-items parsing logic to parse the shorthand.
1391         (WebCore::CSSPropertyParser::consumePlaceSelfShorthand): Using the justify-self and align-self parsing logic to parse the shorthand.
1392
1393 2018-04-20  Daniel Bates  <dabates@apple.com>
1394
1395         Unreviewed, rolling out r230117.
1396
1397         Broke find-in-page for PDFs
1398
1399         Reverted changeset:
1400
1401         "ASSERTION FAILED: ASSERT(!containsImage ||
1402         MIMETypeRegistry::isSupportedImageResourceMIMEType([resource
1403         MIMEType])) in -[NSPasteboard(WebExtras)
1404         _web_writePromisedRTFDFromArchive:containsImage:]"
1405         https://bugs.webkit.org/show_bug.cgi?id=184161
1406         https://trac.webkit.org/changeset/230117
1407
1408 2018-04-20  Eric Carlson  <eric.carlson@apple.com>
1409
1410         Pausing should clear m_waitingToEnterFullscreen
1411         https://bugs.webkit.org/show_bug.cgi?id=184831
1412         <rdar://problem/39602852>
1413
1414         Reviewed by Jer Noble.
1415
1416         * html/HTMLMediaElement.cpp:
1417         (WebCore::HTMLMediaElement::pause): Clear m_waitingToEnterFullscreen
1418
1419 2018-04-20  Eric Carlson  <eric.carlson@apple.com>
1420
1421         [Extra zoom mode] Disable CA transactions while setting up for fullscreen
1422         https://bugs.webkit.org/show_bug.cgi?id=184817
1423         <rdar://problem/39596075>
1424
1425         Reviewed by Jer Noble.
1426
1427         This was tested manually as it is not possible to write an automated test for this.
1428
1429         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1430         (VideoFullscreenInterfaceAVKit::doSetup): Move the call to disable CA transactions outside
1431         of the EXTRA_ZOOM_MODE check, the [CATransaction commit] was already unguarded.
1432
1433 2018-04-20  Youenn Fablet  <youenn@apple.com>
1434
1435         Make PluginData cache its web visible plugins
1436         https://bugs.webkit.org/show_bug.cgi?id=184421
1437
1438         Reviewed by Chris Dumez.
1439
1440         Buffer visible plugins until the page URL changes.
1441         For that purpose, we now cache the visible plugins and the URL it was computed from in PluginData.
1442
1443         Update plugin info provider API to pass the URL used to check for plugin visibility.
1444
1445         No observable change of behavior.
1446
1447         * loader/EmptyClients.cpp:
1448         * plugins/PluginData.cpp:
1449         (WebCore::PluginData::webVisiblePlugins const):
1450         (WebCore::PluginData::publiclyVisiblePlugins const):
1451         (WebCore::PluginData::supportsMimeType const):
1452         * plugins/PluginData.h:
1453         * plugins/PluginInfoProvider.h:
1454
1455 2018-04-20  Chris Dumez  <cdumez@apple.com>
1456
1457         Unreviewed build fix after r230840.
1458
1459         * bindings/js/JSWindowProxy.cpp:
1460         (WebCore::JSWindowProxy::attachDebugger):
1461
1462 2018-04-20  Chris Dumez  <cdumez@apple.com>
1463
1464         Unreviewed attempt to fix the Windows build after r230831.
1465
1466         * bindings/js/JSWindowProxy.cpp:
1467         (WebCore::JSWindowProxy::create):
1468         (WebCore::JSWindowProxy::attachDebugger):
1469
1470 2018-04-20  Chris Nardi  <cnardi@chromium.org>
1471
1472         Omit default value when serializing font-feature-settings
1473         https://bugs.webkit.org/show_bug.cgi?id=182382
1474
1475         Reviewed by Myles C. Maxfield.
1476
1477         According to the shortest-serialization principle [1], values should be omitted if their omission
1478         wouldn't change the value of reparsing. As "1"/"on" is the default value for font-feature-settings,
1479         omit this when serializing, matching the behavior of Firefox and Chrome.
1480
1481         [1]: https://github.com/w3c/csswg-drafts/issues/1564
1482
1483         Updated css3/font-feature-settings-parsing.html, fast/css/inherited-properties-rare-text.html,
1484         and fast/text/font-face-javascript.html.
1485
1486         * css/CSSFontFeatureValue.cpp:
1487         (WebCore::CSSFontFeatureValue::customCSSText const):
1488
1489 2018-04-19  Alexey Proskuryakov  <ap@apple.com>
1490
1491         More WK_ALTERNATE_FRAMEWORKS_DIR adoption in WebCore
1492         https://bugs.webkit.org/show_bug.cgi?id=184805
1493
1494         Reviewed by Dan Bernstein.
1495
1496         * Configurations/WebCoreTestShim.xcconfig:
1497         * Configurations/WebCoreTestSupport.xcconfig:
1498
1499 2018-04-19  Brady Eidson  <beidson@apple.com>
1500
1501         Make back forward cache work with process swapping.
1502         <rdar://problem/38676604> and https://bugs.webkit.org/show_bug.cgi?id=184793
1503
1504         Reviewed by Chris Dumez.
1505
1506         Covered by API tests.
1507
1508         * loader/FrameLoader.cpp:
1509         (WebCore::FrameLoader::loadWithNavigationAction):
1510         (WebCore::FrameLoader::load):
1511         (WebCore::FrameLoader::loadWithDocumentLoader):
1512         (WebCore::FrameLoader::reloadWithOverrideEncoding):
1513         (WebCore::FrameLoader::reload):
1514         (WebCore::FrameLoader::commitProvisionalLoad):
1515         (WebCore::FrameLoader::loadDifferentDocumentItem):
1516         * loader/FrameLoader.h:
1517
1518 2018-04-19  Chris Dumez  <cdumez@apple.com>
1519
1520         Rename JSDOMWindowProxy to JSWindowProxy
1521         https://bugs.webkit.org/show_bug.cgi?id=184797
1522
1523         Reviewed by Sam Weinig.
1524
1525         Rename JSDOMWindowProxy to JSWindowProxy for consistency with WindowProxy.
1526
1527         * Sources.txt:
1528         * WebCore.xcodeproj/project.pbxproj:
1529         * bindings/IDLTypes.h:
1530         * bindings/js/JSBindingsAllInOne.cpp:
1531         * bindings/js/JSDOMConvertWindowProxy.h:
1532         * bindings/js/JSDOMWindowBase.cpp:
1533         (WebCore::JSDOMWindowBase::JSDOMWindowBase):
1534         (WebCore::JSDOMWindowBase::finishCreation):
1535         (WebCore::JSDOMWindowBase::proxy const):
1536         (WebCore::toJSDOMWindow):
1537         * bindings/js/JSDOMWindowBase.h:
1538         * bindings/js/JSDOMWindowCustom.cpp:
1539         (WebCore::JSDOMWindow::toWrapped):
1540         * bindings/js/JSEventTargetCustom.cpp:
1541         (WebCore::JSEventTarget::toWrapped):
1542         * bindings/js/JSRemoteDOMWindowBase.cpp:
1543         (WebCore::JSRemoteDOMWindowBase::JSRemoteDOMWindowBase):
1544         (WebCore::toJSRemoteDOMWindow):
1545         * bindings/js/JSRemoteDOMWindowBase.h:
1546         * bindings/js/JSWindowProxy.cpp: Renamed from Source/WebCore/bindings/js/JSDOMWindowProxy.cpp.
1547         (WebCore::JSWindowProxy::JSWindowProxy):
1548         (WebCore::JSWindowProxy::finishCreation):
1549         (WebCore::JSWindowProxy::create):
1550         (WebCore::JSWindowProxy::destroy):
1551         (WebCore::JSWindowProxy::setWindow):
1552         (WebCore::JSWindowProxy::attachDebugger):
1553         (WebCore::JSWindowProxy::wrapped const):
1554         (WebCore::JSWindowProxy::toWrapped):
1555         (WebCore::toJS):
1556         (WebCore::toJSWindowProxy):
1557         * bindings/js/JSWindowProxy.h: Renamed from Source/WebCore/bindings/js/JSDOMWindowProxy.h.
1558         (WebCore::toJS):
1559         (WebCore::toJSWindowProxy):
1560         * bindings/js/ScriptController.cpp:
1561         (WebCore::ScriptController::initScriptForWindowProxy):
1562         * bindings/js/ScriptController.h:
1563         * bindings/js/WindowProxy.cpp:
1564         (WebCore::WindowProxy::createJSWindowProxy):
1565         (WebCore::WindowProxy::jsWindowProxiesAsVector const):
1566         (WebCore::WindowProxy::createJSWindowProxyWithInitializedScript):
1567         * bindings/js/WindowProxy.h:
1568         (WebCore::WindowProxy::jsWindowProxy):
1569         (WebCore::WindowProxy::existingJSWindowProxy const):
1570         * bindings/scripts/CodeGeneratorJS.pm:
1571         (AddToIncludesForIDLType):
1572         (GenerateHeader):
1573         (GenerateOverloadDispatcher):
1574         (GenerateImplementation):
1575         * bindings/scripts/test/JS/JSTestObj.cpp:
1576         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher):
1577         * page/Frame.cpp:
1578         * page/csp/ContentSecurityPolicy.cpp:
1579         (WebCore::ContentSecurityPolicy::didCreateWindowProxy const):
1580         * page/csp/ContentSecurityPolicy.h:
1581
1582 2018-04-19  Dirk Schulze  <krit@webbkit.org>
1583
1584         Introduce SVGGeometryElement interface
1585         https://bugs.webkit.org/show_bug.cgi?id=184768
1586
1587         Reviewed by Antti Koivisto.
1588
1589         Start implementing SVGGeometryElement interface from SVG2.
1590         https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement
1591
1592         Start with SVGPathElement only for now. Also, just inferface gets implemented
1593         by this patch. No new functionality like isPointInFill yet.
1594         Fix getPointAtLength and make it more restrictive. This follows the spec and
1595         all other implementations.
1596
1597         Added additional test scenarios to existing tests.
1598
1599         * CMakeLists.txt:
1600         * DerivedSources.make:
1601         * Sources.txt:
1602         * WebCore.xcodeproj/project.pbxproj:
1603         * bindings/scripts/CodeGeneratorJS.pm:
1604         (GetGnuVTableOffsetForType):
1605         * svg/SVGAllInOne.cpp:
1606         * svg/SVGGeometryElement.cpp: Added.
1607         (WebCore::SVGGeometryElement::SVGGeometryElement):
1608         (WebCore::SVGGeometryElement::isSupportedAttribute):
1609         (WebCore::SVGGeometryElement::parseAttribute):
1610         (WebCore::SVGGeometryElement::svgAttributeChanged):
1611         (WebCore::SVGGeometryElement::createElementRenderer):
1612         * svg/SVGGeometryElement.h: Added.
1613         * svg/SVGGeometryElement.idl: Added.
1614         * svg/SVGGradientElement.cpp:
1615         * svg/SVGPathElement.cpp:
1616         (WebCore::SVGPathElement::SVGPathElement):
1617         (WebCore::SVGPathElement::parseAttribute):
1618         (WebCore::SVGPathElement::svgAttributeChanged):
1619         (WebCore::SVGPathElement::insertedIntoAncestor):
1620         (WebCore::SVGPathElement::removedFromAncestor):
1621         * svg/SVGPathElement.h:
1622         * svg/SVGPathElement.idl:
1623
1624 2018-04-19  Tadeu Zagallo  <tzagallo@apple.com>
1625
1626         REGRESSION(r227340): ArrayBuffers were not being serialized when sent via MessagePorts
1627         https://bugs.webkit.org/show_bug.cgi?id=184254
1628         <rdar://problem/39140200>
1629
1630         Reviewed by Daniel Bates.
1631
1632         Add a new encoding method to SerializedScriptValue that includes ArrayBuffers.
1633
1634         Test: workers/message-port.html
1635
1636         * bindings/js/SerializedScriptValue.h:
1637         (WebCore::SerializedScriptValue::encode const):
1638         (WebCore::SerializedScriptValue::decode):
1639         * dom/messageports/MessageWithMessagePorts.h:
1640         (WebCore::MessageWithMessagePorts::encode const):
1641         (WebCore::MessageWithMessagePorts::decode):
1642
1643 2018-04-19  David Kilzer  <ddkilzer@apple.com>
1644
1645         Enable Objective-C weak references
1646         <https://webkit.org/b/184789>
1647         <rdar://problem/39571716>
1648
1649         Reviewed by Dan Bernstein.
1650
1651         * Configurations/Base.xcconfig:
1652         (CLANG_ENABLE_OBJC_WEAK): Enable.
1653
1654 2018-04-19  Antti Koivisto  <antti@apple.com>
1655
1656         Don't use RenderTreeBuilder::current() in RenderTreeUpdater
1657         https://bugs.webkit.org/show_bug.cgi?id=184794
1658
1659         Reviewed by Zalan Bujtas.
1660
1661         Pass the builder as a parameter where needed.
1662
1663         * rendering/updating/RenderTreeUpdater.cpp:
1664         (WebCore::RenderTreeUpdater::updateElementRenderer):
1665         (WebCore::RenderTreeUpdater::updateTextRenderer):
1666         (WebCore::RenderTreeUpdater::tearDownRenderers):
1667         (WebCore::RenderTreeUpdater::tearDownRenderer):
1668         (WebCore::RenderTreeUpdater::tearDownTextRenderer):
1669         (WebCore::RenderTreeUpdater::tearDownLeftoverPaginationRenderersIfNeeded):
1670         (WebCore::RenderTreeUpdater::tearDownLeftoverShadowHostChildren):
1671         * rendering/updating/RenderTreeUpdater.h:
1672         * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp:
1673         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
1674         (WebCore::RenderTreeUpdater::GeneratedContent::removeBeforePseudoElement):
1675         (WebCore::RenderTreeUpdater::GeneratedContent::removeAfterPseudoElement):
1676         * rendering/updating/RenderTreeUpdaterGeneratedContent.h:
1677
1678 2018-04-19  Eric Carlson  <eric.carlson@apple.com>
1679
1680         Runtime logging during GC can cause crash
1681         https://bugs.webkit.org/show_bug.cgi?id=184792
1682         <rdar://problem/39567927>
1683
1684         Reviewed by Jer Noble.
1685
1686         Test: media/destructor-logging-crash.html
1687
1688         * dom/Document.cpp:
1689         (WebCore::Document::~Document): Clear the logger observer immediately so anything logged
1690         as a side effect of the destructor won't cause a problem.
1691         (WebCore::Document::didLogMessage): Create the ConsoleMessage in a task.
1692         * dom/Document.h:
1693
1694 2018-04-19  Youenn Fablet  <youenn@apple.com>
1695
1696         Web Inspector backend should get headers & cookies from network process separately from resource requests
1697         https://bugs.webkit.org/show_bug.cgi?id=184396
1698         <rdar://problem/38877384>
1699
1700         Reviewed by Brian Burg.
1701
1702         Add two new loader strategies to get response and network metrics directly from
1703         NetworkProcess based on resource loader identifier.
1704         Use these methods in InspectorNetworkAgent when response/metrics might be filtered.
1705
1706         Covered by existing tests, in particular http/tests/inspector/network/fetch-network-data.html which would fail
1707         without this since we are now setting the sourceOrigin for NetworkResourceLoader, which is used to sanitize response headers.
1708
1709         * inspector/agents/InspectorNetworkAgent.cpp:
1710         (WebCore::InspectorNetworkAgent::didReceiveResponse):
1711         (WebCore::InspectorNetworkAgent::didFinishLoading):
1712         * loader/LoaderStrategy.cpp:
1713         (WebCore::LoaderStrategy::responseFromResourceLoaIdentifier):
1714         (WebCore::LoaderStrategy::networkMetricsFromResourceLoaIdentifier):
1715         * loader/LoaderStrategy.h:
1716
1717 2018-04-19  Wenson Hsieh  <wenson_hsieh@apple.com>
1718
1719         [Extra zoom mode] Add a mechanism to extend the height of the layout viewport in extra zoom mode
1720         https://bugs.webkit.org/show_bug.cgi?id=184782
1721         <rdar://problem/38346712>
1722
1723         Reviewed by Tim Horton.
1724
1725         Add a new helper on FrameView to compute an expanded layout viewport size, as well as a new setting for the
1726         height expansion factor when computing visual viewport dimensions. See WebKit/ChangeLog for more detail.
1727
1728         Test: fast/visual-viewport/extrazoom/layout-viewport-after-scrolling-and-resizing.html
1729
1730         * page/FrameView.cpp:
1731         (WebCore::FrameView::expandedLayoutViewportSize):
1732         * page/FrameView.h:
1733         * page/Settings.yaml:
1734
1735 2018-04-19  Chris Dumez  <cdumez@apple.com>
1736
1737         REGRESSION (r229133): decidePolicyForNavigationAction not called for loading an HTML string
1738         https://bugs.webkit.org/show_bug.cgi?id=184209
1739         <rdar://problem/39145306>
1740
1741         Reviewed by Ryosuke Niwa.
1742
1743         In r229133, we stopped doing navigation policy checks for about:blank because about:blank
1744         loads need to happen synchronously for Web-compatibility. However, this regressed loading
1745         an HTML string in a WebView because in such cases, the URL is also about:blank with
1746         substitute data.
1747
1748         In this patch, we take a more conservative approach and restore policy checking for
1749         'about:blank' but using synchronous IPC.
1750
1751         * loader/PolicyChecker.cpp:
1752         (WebCore::PolicyChecker::checkNavigationPolicy):
1753
1754 2018-04-19  Chris Nardi  <cnardi@chromium.org>
1755
1756         Support calc() in webkit-gradient and cross-fade
1757         https://bugs.webkit.org/show_bug.cgi?id=182225
1758
1759         Reviewed by Simon Fraser.
1760
1761         calc() was previously unsupported in webkit-gradient and webkit-cross-fade, but both should take calc() values.
1762         Update the code to support calc() values.
1763
1764         Tests: LayoutTests/css3/calc/cross-fade-calc.html
1765                LayoutTests/css3/calc/webkit-gradient-calc.html
1766
1767         * css/parser/CSSPropertyParserHelpers.cpp:
1768         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStop):
1769         (WebCore::CSSPropertyParserHelpers::consumeCrossFade):
1770
1771 2018-04-17  Filip Pizlo  <fpizlo@apple.com>
1772
1773         The InternalFunction hierarchy should be in IsoSubspaces
1774         https://bugs.webkit.org/show_bug.cgi?id=184721
1775
1776         Reviewed by Saam Barati.
1777
1778         No new tests because no new behavior.
1779
1780         * bindings/js/WebCoreJSClientData.cpp:
1781         (WebCore::JSVMClientData::JSVMClientData):
1782         * bindings/js/WebCoreJSClientData.h:
1783         (WebCore::JSVMClientData::runtimeMethodSpace):
1784         * bridge/runtime_method.cpp:
1785         (JSC::RuntimeMethod::subspaceForImpl):
1786         * bridge/runtime_method.h:
1787
1788 2018-04-19  Brady Eidson  <beidson@apple.com>
1789
1790         Add globally-unique HistoryItem identifiers (and have WebKit2 adopt them).
1791         <rdar://problem/39533949> and https://bugs.webkit.org/show_bug.cgi?id=184750
1792
1793         Reviewed by Ryosuke Niwa.
1794
1795         No new tests (Refactor, no behavior change).
1796
1797         In WebCore, we:
1798         - Add a process-unique "BackForwardItemIdentifier"
1799         - Make all HistoryItems have such an identifier as a member
1800
1801         * WebCore.xcodeproj/project.pbxproj:
1802
1803         * history/BackForwardItemIdentifier.h: Added.
1804         (WebCore::BackForwardItemIdentifier::logString const):
1805         (WebCore::operator==):
1806         (WebCore::BackForwardItemIdentifier::encode const):
1807         (WebCore::BackForwardItemIdentifier::decode):
1808         (WebCore::BackForwardItemIdentifier::hash const):
1809         (WTF::BackForwardItemIdentifierHash::hash):
1810         (WTF::BackForwardItemIdentifierHash::equal):
1811         (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::emptyValue):
1812         (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::constructDeletedValue):
1813         (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::isDeletedValue):
1814
1815         * history/HistoryItem.cpp:
1816         (WebCore::HistoryItem::generateSequenceNumber):
1817         (WebCore::HistoryItem::HistoryItem):
1818         (WebCore::generateSequenceNumber): Deleted.
1819
1820         * history/HistoryItem.h:
1821         (WebCore::HistoryItem::create):
1822         (WebCore::HistoryItem::identifier const):
1823
1824 2018-04-19  Nan Wang  <n_wang@apple.com>
1825
1826         AX: AOM: respect the accessibility setting for dispatching the accessible events
1827         https://bugs.webkit.org/show_bug.cgi?id=184619
1828
1829         Reviewed by Ryosuke Niwa.
1830
1831         Added accessibilityEventsEnabled as a setting on the page.
1832
1833         Test: accessibility/ios-simulator/accessibility-events-setting.html
1834
1835         * accessibility/AccessibilityObject.cpp:
1836         (WebCore::AccessibilityObject::shouldDispatchAccessibilityEvent const):
1837         * page/Settings.yaml:
1838         * testing/InternalSettings.cpp:
1839         (WebCore::InternalSettings::Backup::Backup):
1840         (WebCore::InternalSettings::Backup::restoreTo):
1841         (WebCore::InternalSettings::setAccessibilityEventsEnabled):
1842         * testing/InternalSettings.h:
1843         * testing/InternalSettings.idl:
1844
1845 2018-04-18  Jer Noble  <jer.noble@apple.com>
1846
1847         Fix build when WK_ALTERNATE_FRAMEWORKS_DIR is set to non-empty value
1848         https://bugs.webkit.org/show_bug.cgi?id=184693
1849         <rdar://problem/39491884>
1850
1851         Reviewed by Tim Horton.
1852
1853         * Configurations/WebCore.xcconfig:
1854
1855 2018-04-19  Eric Stobbart  <ericstobbart@gmail.com>
1856
1857         Change MediaSource WebCore to return NewObject for SourceBuffers
1858         https://bugs.webkit.org/show_bug.cgi?id=184642
1859
1860         Reviewed by Chris Dumez.
1861
1862         Minor change inline with IDL documentation
1863
1864         * Modules/mediasource/MediaSource.cpp:
1865         (WebCore::MediaSource::addSourceBuffer):
1866         (): Deleted.
1867         * Modules/mediasource/MediaSource.h:
1868         * Modules/mediasource/MediaSource.idl:
1869
1870 2018-04-19  Yusuke Suzuki  <utatane.tea@gmail.com>
1871
1872         Unreviewed, build fix for Ubuntu LTS GCC
1873         https://bugs.webkit.org/show_bug.cgi?id=184756
1874
1875         The variable name "windowProxy" (with auto&) conflicts with the function name "windowProxy".
1876
1877         * bindings/js/ScriptController.cpp:
1878         (WebCore::ScriptController::updateDocument):
1879         (WebCore::ScriptController::collectIsolatedContexts):
1880
1881 2018-04-19  Manuel Rego Casasnovas  <rego@igalia.com>
1882
1883         Caret rendered at incorrect location inside empty table cell
1884         https://bugs.webkit.org/show_bug.cgi?id=85385
1885
1886         Reviewed by Zalan Bujtas.
1887
1888         This is based on a previous patch by Shezan Baig <shezbaig.wk@gmail.com>.
1889
1890         This fixes the position of the caret in empty cells,
1891         that was painted lower than expected
1892         (and then modified when you start to edit the cell).
1893
1894         Ensures that editable table cells have at least one line when
1895         they are laid out. This ensures that the cell's intrinsic before/after
1896         padding is calculated correctly, which results in the caret location
1897         being calculated correctly.
1898
1899         Test: editing/caret/caret-in-empty-cell.html
1900
1901         * rendering/RenderTableCell.cpp:
1902         (WebCore::RenderTableCell::hasLineIfEmpty): Override method to consider
1903         that it has an an empty line if the table cell is editable.
1904         * rendering/RenderTableCell.h:
1905
1906 2018-04-18  Daniel Bates  <dabates@apple.com>
1907
1908         Cleanup TextControlInnerElements
1909         https://bugs.webkit.org/show_bug.cgi?id=184475
1910
1911         Reviewed by Antti Koivisto.
1912
1913         Clean up TextControlInnerElement::resolveCustomStyle(), move the implementation of
1914         TextControlPlaceholderElement::create() from the header to the cpp file, replace
1915         fancy comments to demarcate classes with MARK: so that they show up in Xcode's
1916         function menu.
1917
1918         * html/shadow/TextControlInnerElements.cpp:
1919         (WebCore::TextControlInnerElement::resolveCustomStyle):
1920         (WebCore::TextControlPlaceholderElement::TextControlPlaceholderElement):
1921         (WebCore::TextControlPlaceholderElement::create):
1922         * html/shadow/TextControlInnerElements.h:
1923
1924 2018-04-18  Chris Dumez  <cdumez@apple.com>
1925
1926         Rename WindowProxyController to WindowProxy
1927         https://bugs.webkit.org/show_bug.cgi?id=184756
1928
1929         Reviewed by Sam Weinig.
1930
1931         Rename WindowProxyController to WindowProxy for clarity. When the IDL uses WindowProxy, the implementation
1932         needed use WindowProxyController type, which was a bit confusing.
1933
1934         * Sources.txt:
1935         * WebCore.xcodeproj/project.pbxproj:
1936         * bindings/js/DOMWrapperWorld.cpp:
1937         (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
1938         (WebCore::DOMWrapperWorld::clearWrappers):
1939         * bindings/js/DOMWrapperWorld.h:
1940         (WebCore::DOMWrapperWorld::didCreateWindowProxy):
1941         (WebCore::DOMWrapperWorld::didDestroyWindowProxy):
1942         * bindings/js/JSBindingsAllInOne.cpp:
1943         * bindings/js/JSDOMWindowBase.cpp:
1944         (WebCore::toJS):
1945         * bindings/js/JSDOMWindowProxy.cpp:
1946         (WebCore::toJS):
1947         (WebCore::toJSDOMWindowProxy):
1948         * bindings/js/JSDOMWindowProxy.h:
1949         (WebCore::toJS):
1950         (WebCore::toJSDOMWindowProxy):
1951         * bindings/js/ScriptCachedFrameData.cpp:
1952         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
1953         (WebCore::ScriptCachedFrameData::restore):
1954         * bindings/js/ScriptController.cpp:
1955         (WebCore::ScriptController::evaluateInWorld):
1956         (WebCore::ScriptController::loadModuleScriptInWorld):
1957         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
1958         (WebCore::ScriptController::evaluateModule):
1959         (WebCore::ScriptController::setupModuleScriptHandlers):
1960         (WebCore::ScriptController::windowProxy):
1961         (WebCore::ScriptController::enableEval):
1962         (WebCore::ScriptController::enableWebAssembly):
1963         (WebCore::ScriptController::disableEval):
1964         (WebCore::ScriptController::disableWebAssembly):
1965         (WebCore::ScriptController::updateDocument):
1966         (WebCore::ScriptController::collectIsolatedContexts):
1967         (WebCore::ScriptController::windowScriptNPObject):
1968         (WebCore::ScriptController::executeIfJavaScriptURL):
1969         * bindings/js/ScriptController.h:
1970         (WebCore::ScriptController::globalObject):
1971         * bindings/js/ScriptControllerMac.mm:
1972         (WebCore::ScriptController::windowScriptObject):
1973         * bindings/js/ScriptState.cpp:
1974         (WebCore::mainWorldExecState):
1975         * bindings/js/WindowProxy.cpp: Renamed from Source/WebCore/bindings/js/WindowProxyController.cpp.
1976         (WebCore::WindowProxy::WindowProxy):
1977         (WebCore::WindowProxy::~WindowProxy):
1978         (WebCore::WindowProxy::destroyJSWindowProxy):
1979         (WebCore::WindowProxy::createJSWindowProxy):
1980         (WebCore::WindowProxy::jsWindowProxiesAsVector const):
1981         (WebCore::WindowProxy::createJSWindowProxyWithInitializedScript):
1982         (WebCore::WindowProxy::clearJSWindowProxiesNotMatchingDOMWindow):
1983         (WebCore::WindowProxy::setDOMWindow):
1984         (WebCore::WindowProxy::attachDebugger):
1985         * bindings/js/WindowProxy.h: Renamed from Source/WebCore/bindings/js/WindowProxyController.h.
1986         (WebCore::WindowProxy::jsWindowProxies const):
1987         (WebCore::WindowProxy::releaseJSWindowProxies):
1988         (WebCore::WindowProxy::setJSWindowProxies):
1989         (WebCore::WindowProxy::jsWindowProxy):
1990         (WebCore::WindowProxy::existingJSWindowProxy const):
1991         (WebCore::WindowProxy::globalObject):
1992         * loader/FrameLoader.cpp:
1993         (WebCore::FrameLoader::clear):
1994         (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
1995         * page/AbstractFrame.cpp:
1996         (WebCore::AbstractFrame::AbstractFrame):
1997         * page/AbstractFrame.h:
1998         (WebCore::AbstractFrame::windowProxy):
1999         (WebCore::AbstractFrame::windowProxy const):
2000         * page/Page.cpp:
2001         (WebCore::Page::setDebugger):
2002         * page/RemoteDOMWindow.cpp:
2003         (WebCore::RemoteDOMWindow::self const):
2004         (WebCore::RemoteDOMWindow::top const):
2005         (WebCore::RemoteDOMWindow::opener const):
2006         (WebCore::RemoteDOMWindow::parent const):
2007         * page/RemoteDOMWindow.h:
2008
2009 2018-04-18  Chris Dumez  <cdumez@apple.com>
2010
2011         Set RemoteDOMWindow's initial opener
2012         https://bugs.webkit.org/show_bug.cgi?id=184716
2013
2014         Reviewed by Sam Weinig.
2015
2016         Add support for WindowProxy type in the IDL. The implementation should
2017         return a WindowProxyController and toJS() will take care of converting
2018         this into a JSValue via JSDOMWindowProxy.
2019
2020         No new tests, rebaselined existing test.
2021
2022         * WebCore.xcodeproj/project.pbxproj:
2023         * bindings/IDLTypes.h:
2024         * bindings/js/JSDOMConvertWindowProxy.h: Added.
2025         (WebCore::JSConverter<IDLWindowProxy>::convert):
2026         * bindings/js/JSDOMWindowBase.cpp:
2027         (WebCore::toJS):
2028         * bindings/js/JSDOMWindowBase.h:
2029         (WebCore::toJS):
2030         * bindings/js/JSDOMWindowProxy.cpp:
2031         (WebCore::toJS):
2032         (WebCore::toJSDOMWindowProxy):
2033         * bindings/js/JSDOMWindowProxy.h:
2034         (WebCore::toJS):
2035         (WebCore::toJSDOMWindowProxy):
2036         * bindings/js/JSRemoteDOMWindowBase.cpp:
2037         * bindings/js/JSRemoteDOMWindowBase.h:
2038         * bindings/scripts/CodeGenerator.pm:
2039         (IsBuiltinType):
2040         * bindings/scripts/CodeGeneratorJS.pm:
2041         (AddToIncludesForIDLType):
2042         (GetBaseIDLType):
2043         * page/RemoteDOMWindow.cpp:
2044         (WebCore::RemoteDOMWindow::self const):
2045         (WebCore::RemoteDOMWindow::top const):
2046         (WebCore::RemoteDOMWindow::opener const):
2047         (WebCore::RemoteDOMWindow::parent const):
2048         * page/RemoteDOMWindow.h:
2049         * page/RemoteDOMWindow.idl:
2050         * page/RemoteFrame.h:
2051
2052 2018-04-18  Dean Jackson  <dino@apple.com>
2053
2054         Detect system preview links
2055         https://bugs.webkit.org/show_bug.cgi?id=184753
2056         <rdar://problem/39500514>
2057
2058         Reviewed by Antoine Quint.
2059
2060         Detect a special type of link anchor, which we're calling System Previews.
2061         Ultimately this will allow WebKit to present such links in a special
2062         way.
2063
2064         A System Preview link is an <a> element, with a rel attribute that
2065         includes "system-preview". It has a single element child, which is
2066         either an <img> or a <picture>.
2067
2068         Test: system-preview/detection.html
2069
2070         * html/HTMLAnchorElement.cpp:
2071         (WebCore::HTMLAnchorElement::relList): Add braces.
2072         (WebCore::HTMLAnchorElement::isSystemPreviewLink const): New
2073         function.
2074         * html/HTMLAnchorElement.h:
2075
2076         * html/HTMLImageElement.cpp:
2077         (WebCore::HTMLImageElement::isSystemPreviewImage const): Ask the
2078         parent if it is a system preview link.
2079         * html/HTMLImageElement.h:
2080         * html/HTMLPictureElement.cpp:
2081         (WebCore::HTMLPictureElement::isSystemPreviewImage const): Ditto.
2082         * html/HTMLPictureElement.h:
2083
2084         * testing/Internals.cpp: Testing helpers.
2085         (WebCore::Internals::systemPreviewRelType):
2086         (WebCore::Internals::isSystemPreviewLink const):
2087         (WebCore::Internals::isSystemPreviewImage const):
2088         * testing/Internals.h:
2089         * testing/Internals.idl:
2090
2091 2018-04-18  Antti Koivisto  <antti@apple.com>
2092
2093         :active pseudo class doesn't deactivate when using pressure sensitive trackpad
2094         https://bugs.webkit.org/show_bug.cgi?id=181680
2095
2096         Reviewed by Beth Dakin.
2097
2098         Trackpad sends a mouse force event with force of zero after mouse up event. This causes the element under cursor
2099         activate again.
2100
2101         Even a fake event test doesn't appear to be currently possible as TestRunner crashes if you try to send mouseForceChanged.
2102         All the tests using it are skipped.
2103
2104         * page/EventHandler.cpp:
2105         (WebCore::EventHandler::handleMouseForceEvent):
2106
2107         Don't add HitTestRequest::Active if the force of the force event is zero.
2108
2109 2018-04-18  Megan Gardner  <megan_gardner@apple.com>
2110
2111         Ensure correct screen sizes
2112         https://bugs.webkit.org/show_bug.cgi?id=184757
2113         
2114         Reviewed by Wenson Hsieh.
2115         
2116         Make sure that the screen sizes are actually correct.
2117
2118         Not currently testable, will add tests when it is.
2119
2120         * platform/ios/PlatformScreenIOS.mm:
2121
2122 2018-04-18  Nan Wang  <n_wang@apple.com>
2123
2124         AX: [macOS] WebKit hangs when triggering an alert from an AOM increment event
2125         https://bugs.webkit.org/show_bug.cgi?id=184742
2126
2127         Reviewed by Chris Fleizach.
2128
2129         Made increment and decrement actions on the macOS to be async. So that VoiceOver
2130         won't hang indefinitely if performing the actions causes an alert or other modal
2131         behaviors.
2132
2133         Test: accessibility/mac/async-increment-decrement-action.html
2134
2135         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2136         (-[WebAccessibilityObjectWrapper accessibilityPerformIncrementAction]):
2137         (-[WebAccessibilityObjectWrapper _accessibilityPerformIncrementAction]):
2138         (-[WebAccessibilityObjectWrapper accessibilityPerformDecrementAction]):
2139         (-[WebAccessibilityObjectWrapper _accessibilityPerformDecrementAction]):
2140         (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]):
2141
2142 2018-04-18  Youenn Fablet  <youenn@apple.com>
2143
2144         MediaResourceLoader should set its fetch destination
2145         https://bugs.webkit.org/show_bug.cgi?id=184746
2146
2147         Reviewed by Eric Carlson.
2148
2149         Covered by updated test.
2150
2151         * loader/MediaResourceLoader.cpp:
2152         (WebCore::MediaResourceLoader::requestResource):
2153
2154 2018-04-18  Jer Noble  <jer.noble@apple.com>
2155
2156         Fix runtime errors in simulator while playing media
2157         https://bugs.webkit.org/show_bug.cgi?id=184751
2158
2159         Reviewed by Eric Carlson.
2160
2161         AVURLAssetHTTPCookiesKey may not be present, and AVPlayer may not respond to certain methods.
2162
2163         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2164         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
2165         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
2166         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateDisableExternalPlayback):
2167         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep):
2168
2169 2018-04-18  Jer Noble  <jer.noble@apple.com>
2170
2171         Ignore ASSERT when setting AVAudioSessionCategory returns an error on simulator.
2172         https://bugs.webkit.org/show_bug.cgi?id=184698
2173
2174         Reviewed by Eric Carlson.
2175
2176         * platform/audio/ios/AudioSessionIOS.mm:
2177         * platform/audio/mac/AudioSessionMac.cpp:
2178
2179 2018-04-18  Sihui Liu  <sihui_liu@apple.com>
2180
2181         REGRESSION: Using the reload button while offline pushes identical pages onto the back/forward list
2182         https://bugs.webkit.org/show_bug.cgi?id=184570
2183         <rdar://problem/34807323>
2184
2185         Reviewed by Chris Dumez.
2186
2187         Set FrameLoadType properly when error occurs in reload.
2188
2189         tests: Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm
2190
2191         * loader/FrameLoader.cpp:
2192         (WebCore::FrameLoader::load):
2193
2194 2018-04-18  Chris Dumez  <cdumez@apple.com>
2195
2196         Add support for converting a local window to a remote window
2197         https://bugs.webkit.org/show_bug.cgi?id=184515
2198         <rdar://problem/39011318>
2199
2200         Reviewed by Ryosuke Niwa.
2201
2202         Add initial support for process-swapping when navigating cross-origin as a result
2203         of a window.open(). The window object returned by window.open() is initially same
2204         origin and is for about:blank. The navigation cross-origin then happens and the
2205         JS wrappers for the window then point to a cross-origin window which is remote (i.e.
2206         hosted in another WebProcess).
2207
2208         The RemoteDOMWindow exposed to JS looks like a regular cross-origin Window with a few
2209         exceptions due to our incomplete implementation (e.g. w.location returns null) and 
2210         most of its API is currently not functional. The RemoteDOMWindow API will be implemented
2211         in a follow-up by relying on IPC.
2212
2213         Test: http/tests/navigation/process-swap-window-open.html
2214
2215         * bindings/js/JSDOMGlobalObject.cpp:
2216         (WebCore::JSDOMGlobalObject::scriptExecutionContext const):
2217         * bindings/js/JSDOMPromiseDeferred.h:
2218         * bindings/js/JSDOMWindowProperties.cpp:
2219         (WebCore::JSDOMWindowProperties::getOwnPropertySlot):
2220         * bindings/js/JSDOMWindowProxy.cpp:
2221         (WebCore::JSDOMWindowProxy::finishCreation):
2222         (WebCore::JSDOMWindowProxy::create):
2223         * bindings/js/JSDOMWindowProxy.h:
2224         * bindings/js/JSDOMWrapper.cpp:
2225         (WebCore::JSDOMObject::JSDOMObject):
2226         * bindings/js/JSDOMWrapper.h:
2227         * bindings/js/WindowProxyController.cpp:
2228         (WebCore::WindowProxyController::createWindowProxy):
2229         (WebCore::WindowProxyController::setDOMWindowForWindowProxy):
2230         * bridge/objc/WebScriptObject.mm:
2231         (-[WebScriptObject _isSafeScript]):
2232         Teach more of our bindings code about RemoteDOMWindows.
2233
2234         * dom/Document.cpp:
2235         (WebCore::Document::createDOMWindow):
2236         * loader/FrameLoaderClient.h:
2237         Add FrameLoaderClient function to notify the client when a DOMWindow is constructed in
2238         the frame. This is needed for WebKit2 to link the old window to its new representation
2239         in the new WebProcess.
2240
2241 2018-04-17  Zan Dobersek  <zdobersek@igalia.com>
2242
2243         [CMake] Add and enable the ENABLE_CSS_ANIMATIONS_LEVEL_2 feature define
2244         https://bugs.webkit.org/show_bug.cgi?id=184681
2245
2246         Reviewed by Carlos Garcia Campos.
2247
2248         * Sources.txt: Include CSSAnimationTriggerScrollValue.cpp in the build.
2249         * WebCore.xcodeproj/project.pbxproj: Remove CSSAnimationTriggerScrollValue.cpp
2250         build target now that it's built via Sources.txt.
2251
2252 2018-04-17  Zan Dobersek  <zdobersek@igalia.com>
2253
2254         [CoordGraphics] CoordinatedImageBacking can simplify image drawing
2255         https://bugs.webkit.org/show_bug.cgi?id=183986
2256
2257         Reviewed by Michael Catanzaro.
2258
2259         In CoordinatedImageBacking::update(), when drawing the image into a
2260         freshly-created image backing, we can avoid save-and-restoring the
2261         painting context. We also don't have to clip it, since the clipping area
2262         is the same as the image (and buffer) bounds. Since the buffer is
2263         initialized to transparent color, we can use the CompositeCopy operator
2264         to just copy image data into the destination since there's nothing to
2265         paint the source over.
2266
2267         No new tests -- no change in functionality.
2268
2269         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
2270         (WebCore::CoordinatedImageBacking::update):
2271
2272 2018-04-17  Michael Catanzaro  <mcatanzaro@igalia.com>
2273
2274         [GTK] Webkit should spoof as Safari on a Mac for Outlook.com
2275         https://bugs.webkit.org/show_bug.cgi?id=184573
2276
2277         Reviewed by Carlos Alberto Lopez Perez.
2278
2279         Add quirk for outlook.live.com.
2280
2281         * platform/UserAgentQuirks.cpp:
2282         (WebCore::urlRequiresMacintoshPlatform):
2283
2284 2018-04-17  Mark Lam  <mark.lam@apple.com>
2285
2286         Templatize CodePtr/Refs/FunctionPtrs with PtrTags.
2287         https://bugs.webkit.org/show_bug.cgi?id=184702
2288         <rdar://problem/35391681>
2289
2290         Reviewed by Filip Pizlo and Saam Barati.
2291
2292         No new tests. This is covered by existing tests.
2293
2294         * WebCore.xcodeproj/project.pbxproj:
2295         * css/ElementRuleCollector.cpp:
2296         (WebCore::ElementRuleCollector::ruleMatches):
2297         * cssjit/CSSPtrTag.h: Added.
2298         * cssjit/CompiledSelector.h:
2299         * cssjit/FunctionCall.h:
2300         (WebCore::FunctionCall::FunctionCall):
2301         (WebCore::FunctionCall::setFunctionAddress):
2302         (WebCore::FunctionCall::prepareAndCall):
2303         * cssjit/SelectorCompiler.cpp:
2304         (WebCore::SelectorCompiler::compileSelector):
2305         (WebCore::SelectorCompiler::SelectorFragment::appendUnoptimizedPseudoClassWithContext):
2306         (WebCore::SelectorCompiler::addPseudoClassType):
2307         (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
2308         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeFunctionCallValueMatching):
2309         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementFunctionCallTest):
2310         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateContextFunctionCallTest):
2311         * cssjit/SelectorCompiler.h:
2312         (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction):
2313         (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction):
2314         (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext):
2315         (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext):
2316         * dom/SelectorQuery.cpp:
2317         (WebCore::SelectorDataList::executeCompiledSingleMultiSelectorData const):
2318         (WebCore::SelectorDataList::execute const):
2319         * dom/SelectorQuery.h:
2320
2321 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
2322
2323         Retain MessagePortChannel for transfer when disentangling ports
2324         https://bugs.webkit.org/show_bug.cgi?id=184502
2325         <rdar://problem/39372771>
2326
2327         Reviewed by Geoffrey Garen.
2328
2329         MessagePortChannels should be retained while ports are being transferred, but that was only
2330         happening when sending a port through another port, but not when sending it through a worker.
2331
2332         Test: workers/worker-to-worker.html
2333
2334         * dom/messageports/MessagePortChannel.cpp:
2335         (WebCore::MessagePortChannel::entanglePortWithProcess):
2336         (WebCore::MessagePortChannel::disentanglePort):
2337         (WebCore::MessagePortChannel::postMessageToRemote):
2338         (WebCore::MessagePortChannel::takeAllMessagesForPort):
2339
2340 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
2341
2342         References from CSSStyleDeclaration to CSSValues should be weak
2343         https://bugs.webkit.org/show_bug.cgi?id=180280
2344         <rdar://problem/35804869>
2345
2346         Reviewed by Geoffrey Garen.
2347
2348         No new tests - used the existing test to verify the leak
2349
2350         * css/DeprecatedCSSOMValue.h:
2351         (WebCore::DeprecatedCSSOMValue::weakPtrFactory):
2352         * css/PropertySetCSSStyleDeclaration.cpp:
2353         (WebCore::PropertySetCSSStyleDeclaration::wrapForDeprecatedCSSOM):
2354         * css/PropertySetCSSStyleDeclaration.h:
2355
2356 2018-04-17  Jonathan Bedard  <jbedard@apple.com>
2357
2358         Unreviewed rollout of r230632. Regression in memory usage.
2359
2360         That bug tracked in https://bugs.webkit.org/show_bug.cgi?id=184569.
2361
2362         Tests: animations/animation-internals-api-multiple-keyframes.html
2363                animations/animation-internals-api.html
2364                transitions/transition-drt-api-delay.html
2365                transitions/transition-drt-api.html
2366
2367         * page/RuntimeEnabledFeatures.h:
2368         * testing/Internals.cpp:
2369         (WebCore::Internals::pseudoElement): Deleted.
2370         * testing/Internals.h:
2371         * testing/Internals.idl:
2372
2373 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
2374
2375         Do not unregister MessagePorts on deallocation if it has been disentangled
2376         https://bugs.webkit.org/show_bug.cgi?id=184285
2377         <rdar://problem/39256714>
2378
2379         Reviewed by Darin Adler.
2380
2381         Test: workers/message-port-gc.html
2382
2383         * dom/MessagePort.cpp:
2384         (WebCore::MessagePort::deref const):
2385
2386 2018-04-17  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2387
2388         [Curl] Fix timing of reporting error to the client
2389         https://bugs.webkit.org/show_bug.cgi?id=184707
2390
2391         Before checking the result code, check the status of callback invocation and
2392         do the right thing.
2393
2394         Reviewed by Youenn Fablet.
2395
2396         No new tests because there's no new behavior.
2397
2398         * platform/network/curl/CurlRequest.cpp:
2399         (WebCore::CurlRequest::didCompleteTransfer):
2400         * platform/network/curl/CurlRequest.h:
2401         (WebCore::CurlRequest::needToInvokeDidReceiveResponse const):
2402
2403 2018-04-17  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2404
2405         [Curl] Export authentication information to be used by the client.
2406         https://bugs.webkit.org/show_bug.cgi?id=184709
2407
2408         Just added getters for username and password member variables.
2409
2410         Reviewed by Alex Christensen.
2411
2412         No new tests because there's no new behavior.
2413
2414         * platform/network/curl/CurlRequest.h:
2415         (WebCore::CurlRequest::user const):
2416         (WebCore::CurlRequest::password const):
2417
2418 2018-04-17  Chris Dumez  <cdumez@apple.com>
2419
2420         REGRESSION (r229831): CMD-clicking an iCloud web app link unexpectedly opens that link in a new tab and the current tab
2421         https://bugs.webkit.org/show_bug.cgi?id=184678
2422         <rdar://problem/39422122>
2423
2424         Reviewed by Alex Christensen.
2425
2426         Frament navigations need to happen synchronously for Web-compatibility. Because of this,
2427         r225657 added code to make sure that if the client does not make the navigation policy
2428         decision synchronously for frament navigations, then we'll stop waiting for the client
2429         and proceed with the navigation. However, r229831 make the navigation policy decision
2430         IPC decision, meaning that even if the client responds synchronously, it would be
2431         asynchronously from WebCore's point of view. As a result, we would always ignore the
2432         client's policy decision when doing a fragment navigation.
2433
2434         This is an issue on iclould.com because the web-app links are fragment URLs. When you
2435         CMD+click one of these link, we do the navigation policy check. As a result of this
2436         check, Safari responds IGNORE to the policy decision and instead decides to load the
2437         link in a new tab (because CMD key is pressed). Due to the bug mentioned above, we
2438         would not obey the IGNORE policy decision from Safari and load the link in the current
2439         tab, even though Safari would already be loading it in a new tab.
2440
2441         To address the issue, I reintroduced a synchronous code path for navigation policy
2442         decision making, backed by synchronous IPC. This synchronous code path is now used for
2443         fragment navigations to restore pre-r229831 behavior. If the client does not answer
2444         synchronously, we'll proceed with the navigation anyway, as was happening pre-r229831.
2445
2446         Test: http/tests/navigation/fragment-navigation-policy-ignore.html
2447
2448         * loader/EmptyClients.cpp:
2449         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2450         * loader/EmptyFrameLoaderClient.h:
2451         * loader/FrameLoader.cpp:
2452         (WebCore::FrameLoader::loadURL):
2453         (WebCore::FrameLoader::loadWithDocumentLoader):
2454         * loader/FrameLoaderClient.h:
2455         * loader/PolicyChecker.cpp:
2456         (WebCore::PolicyChecker::checkNavigationPolicy):
2457         * loader/PolicyChecker.h:
2458
2459 2018-04-17  Matt Lewis  <jlewis3@apple.com>
2460
2461         Unreviewed, rolling out r230713.
2462
2463         This caused internal build failures.
2464
2465         Reverted changeset:
2466
2467         "Implement checked cast for DDResultRef once
2468         DDResultGetTypeID() is available"
2469         https://bugs.webkit.org/show_bug.cgi?id=184554
2470         https://trac.webkit.org/changeset/230713
2471
2472 2018-04-17  Chris Dumez  <cdumez@apple.com>
2473
2474         Add bindings code for RemoteDOMWindow
2475         https://bugs.webkit.org/show_bug.cgi?id=184653
2476
2477         Reviewed by Ryosuke Niwa.
2478
2479         Add bindings code for RemoteDOMWindow. A RemoteDOMWindow behaves exactly like a cross-origin
2480         DOMWindow, which is backed by a RemoteDOMWindow object instead of a DOMWindow one. Since
2481         a RemoteDOMWindow is always cross origin, we do not need cross-origin checks and the bindings
2482         code is identical to the DOMWindow code paths from cross-origin handling.
2483
2484         No new tests, this code will be used and tested via Bug 184515.
2485
2486         * CMakeLists.txt:
2487         * DerivedSources.make:
2488         * Sources.txt:
2489         * WebCore.xcodeproj/project.pbxproj:
2490         * bindings/js/JSBindingsAllInOne.cpp:
2491         * bindings/js/JSDOMWindowCustom.cpp:
2492         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
2493         (WebCore::JSDOMWindow::getOwnPropertySlot):
2494         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
2495         (WebCore::addCrossOriginWindowOwnPropertyNames):
2496         * bindings/js/JSDOMWindowCustom.h:
2497
2498         * bindings/js/JSRemoteDOMWindowBase.cpp: Added.
2499         (WebCore::JSRemoteDOMWindowBase::JSRemoteDOMWindowBase):
2500         (WebCore::JSRemoteDOMWindowBase::destroy):
2501         (WebCore::JSRemoteDOMWindowBase::javaScriptRuntimeFlags):
2502         (WebCore::toJS):
2503         (WebCore::toJSRemoteDOMWindow):
2504         * bindings/js/JSRemoteDOMWindowBase.h: Added.
2505         JSRemoteDOMWindow unfortunately currently needs to be a global object because of:
2506         1. a JSProxy's target needs to be a JSGlobalObject currently
2507         2. The 'structure()->setGlobalObject(vm, &window);' call in
2508            JSDOMWindowProxy::setWindow(VM&, JSDOMGlobalObject&) which requires a JSGlobalObject.
2509         Ideally, this wouldn't be the case in the future but this would require some code refactoring.
2510         Our DOM global objects normally subclass JSDOMGlobalObject so I decided to subclass JSDOMGlobalObject,
2511         which brings some things our bindings code expect. However, subclassing JSDOMGlobalObject directly is
2512         problematic because it does not hold the m_wrapped implementation pointer. To address this issue, all
2513         our our DOM global objects have a JS*Base base class which subclasses JSDOMGlobalObject and stores the
2514         m_wrapped implementation pointer. I followed the same pattern here.
2515
2516         (WebCore::toJS):
2517         * bindings/js/JSRemoteDOMWindowCustom.cpp: Added.
2518         (WebCore::JSRemoteDOMWindow::getOwnPropertySlot):
2519         (WebCore::JSRemoteDOMWindow::getOwnPropertySlotByIndex):
2520         (WebCore::JSRemoteDOMWindow::put):
2521         (WebCore::JSRemoteDOMWindow::putByIndex):
2522         (WebCore::JSRemoteDOMWindow::deleteProperty):
2523         (WebCore::JSRemoteDOMWindow::deletePropertyByIndex):
2524         (WebCore::JSRemoteDOMWindow::getOwnPropertyNames):
2525         (WebCore::JSRemoteDOMWindow::defineOwnProperty):
2526         (WebCore::JSRemoteDOMWindow::getPrototype):
2527         (WebCore::JSRemoteDOMWindow::preventExtensions):
2528         (WebCore::JSRemoteDOMWindow::toStringName):
2529         * bindings/scripts/CodeGeneratorJS.pm:
2530         (IsDOMGlobalObject):
2531         (GenerateHeader):
2532         (GenerateOverloadDispatcher):
2533         (GenerateImplementation):
2534         * page/RemoteDOMWindow.idl: Added.
2535
2536 2018-04-17  David Kilzer  <ddkilzer@apple.com>
2537
2538         Implement checked cast for DDResultRef once DDResultGetTypeID() is available
2539         <https://webkit.org/b/184554>
2540         <rdar://problem/36241894>
2541
2542         Reviewed by Brent Fulgham.
2543
2544         * editing/cocoa/DataDetection.mm:
2545         (WebCore::detectItemAtPositionWithRange): Implement checked cast
2546         for DDResultRef.
2547
2548 2018-04-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
2549
2550         Animated GIF imagery with finite looping are falling one loop short
2551         https://bugs.webkit.org/show_bug.cgi?id=183153
2552
2553         Reviewed by Simon Fraser.
2554
2555         The Netscape Looping Application Extension is a block which may be added
2556         to a GIF file to tell the viewer to loop through the entire GIF frames.
2557         This is communicated through two bytes designated for the "loopCount" in
2558         this block.
2559
2560         The entire block may not be found in the GIF, in which case the GIF is 
2561         supposed to animate its entire frames only once.
2562
2563         If the block exists and loopCount = 0, this means the image has to loop
2564         through its frames indefinitely.
2565
2566         If the block exist and loopCount > 0, this should mean the image has to
2567         loop through its frames loopCount + 1 times. The extra loop seems to be
2568         the consensus among most of the GIF generators and viewers. For example,
2569         if the image designer wants the image to loop through its frames n times:
2570         -- The GIF generator (e.g. Adobe Photoshop and https://ezgif.com/maker) 
2571            will write n - 1 for loopCount. However http://gifmaker.me and 
2572            http://gifmaker.org write n for loopCount.
2573         -- The browser (e.g. Chrome 65.0.3325 181 and FireFox Quantum 59.0.2) will
2574            translate loopCount = n - 1 to: animate GIF once + loop n - 1, which 
2575            means loop the GIF n times.
2576
2577         Because the specs are not really clear about this, we are going to consider
2578         the agreed-upon behavior among most of the web browsers the specs here.
2579
2580         * platform/graphics/cg/ImageDecoderCG.cpp:
2581         (WebCore::ImageDecoderCG::repetitionCount const):
2582         * platform/image-decoders/gif/GIFImageDecoder.cpp:
2583         (WebCore::GIFImageDecoder::repetitionCount const):
2584
2585 2018-04-17  Saam Barati  <sbarati@apple.com>
2586
2587         Add system trace points for process launch and for initializeWebProcess
2588         https://bugs.webkit.org/show_bug.cgi?id=184669
2589
2590         Reviewed by Simon Fraser.
2591
2592         No testing needed because there is no new functionality here.
2593
2594         * loader/FrameLoader.cpp:
2595         (WebCore::FrameLoader::provisionalLoadStarted):
2596         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
2597         * loader/SubresourceLoader.cpp:
2598         (WebCore::SubresourceLoader::willSendRequestInternal):
2599         (WebCore::SubresourceLoader::didFinishLoading):
2600         (WebCore::SubresourceLoader::didFail):
2601         (WebCore::SubresourceLoader::didCancel):
2602
2603 2018-04-17  Eric Carlson  <eric.carlson@apple.com>
2604
2605         [iOS] AirPlay device name is sometimes wrong
2606         https://bugs.webkit.org/show_bug.cgi?id=184543
2607         <rdar://problem/39105498>
2608
2609         Reviewed by Jer Noble.
2610
2611         No new tests, this can only be tested with a specific hardware setup.
2612
2613         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2614         (WebCore::exernalDeviceDisplayNameForPlayer): Get the device name from the AVOutputContext
2615         when possible.
2616
2617 2018-04-17  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2618
2619         [GTK] Build fix after r230529 (WaylandCompositorDisplay leaks its wl_display)
2620         https://bugs.webkit.org/show_bug.cgi?id=184406
2621
2622         Rubber-stamped by Michael Catanzaro.
2623
2624         Fix build with clang 3.8
2625
2626         No new tests, it is a build fix.
2627
2628         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
2629         (WebCore::PlatformDisplayWayland::create):
2630
2631 2018-04-16  Antoine Quint  <graouts@apple.com>
2632
2633         Layout Test animations/needs-layout.html is a flaky Image Failure.
2634         https://bugs.webkit.org/show_bug.cgi?id=172397
2635
2636         Reviewed by Dean Jackson.
2637
2638         Animations that animate a transform and uses a relative value for either the x or y components
2639         require a layout before starting, which CSSAnimationController would perform in the call to
2640         CSSAnimationControllerPrivate::animationTimerFired() made immediately after a CSS animation was
2641         created.
2642
2643         We now perform a similar task where upon setting new blending keyframes we compute a flag indicating
2644         if the keyframe effect is animating a transform with relative x or y components. Then, when we perform
2645         the first invalidation task, which runs in the next run loop after a change to the timing model has
2646         been made, such as a call to play() on a CSSAnimation made in the TreeResolver::createAnimatedElementUpdate()
2647         where the CSSAnimation was created, we call forceLayout() on this element's FrameView. We also ensure
2648         we commit animations on the compositor immediately after that too, instead of waiting until the next
2649         DisplayRefreshMonitor callback.
2650
2651         * animation/DocumentTimeline.cpp:
2652         (WebCore::DocumentTimeline::performInvalidationTask):
2653         (WebCore::DocumentTimeline::updateAnimations):
2654         * animation/KeyframeEffectReadOnly.cpp:
2655         (WebCore::KeyframeEffectReadOnly::forceLayoutIfNeeded):
2656         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes):
2657         (WebCore::KeyframeEffectReadOnly::computedNeedsForcedLayout):
2658         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
2659         * animation/KeyframeEffectReadOnly.h:
2660
2661 2018-04-16  Pablo Saavedra  <psaavedra@igalia.com>
2662
2663         Inconsistent EGL defines in ImageBufferCairo
2664         https://bugs.webkit.org/show_bug.cgi?id=184661
2665
2666         Reviewed by Žan Doberšek.
2667
2668         On revision r219391 libepoxy is added. The headers in
2669         ImageBufferCairo.cpp become inconsistent when 2D canvas is enabled
2670         (-DENABLE_ACCELERATED_2D_CANVAS=ON) due to a redefinition error during
2671         the Webkit build:
2672
2673             ...
2674             /usr/include/GLES2/gl2.h:503:82: error: 'voi
2675             epoxy_glAttachShader(GLuint, GLuint)' redeclared as different kind
2676             of symbol
2677             GL_APICALL void         GL_APIENTRY glAttachShader (GLuint
2678             program, GLuint shader);
2679
2680         No new tests.
2681
2682         * platform/graphics/cairo/ImageBufferCairo.cpp:
2683
2684 2018-04-16  Filip Pizlo  <fpizlo@apple.com>
2685
2686         MutationObserver should be in an IsoHeap
2687         https://bugs.webkit.org/show_bug.cgi?id=184671
2688         <rdar://problem/36081981>
2689
2690         Reviewed by Sam Weinig.
2691
2692         No new tests because no new behavior.
2693
2694         * dom/MutationObserver.cpp:
2695         * dom/MutationObserver.h:
2696
2697 2018-04-16  Youenn Fablet  <youenn@apple.com>
2698
2699         Use NetworkLoadChecker to handle synchronous HTTP loads
2700         https://bugs.webkit.org/show_bug.cgi?id=184240
2701
2702         Reviewed by Chris Dumez.
2703
2704         Update LoaderStrategy::loadResourceSynchronously to pass FetchOptions directly.
2705         Update various call sites accordingly. This allows NetworkProcess to do all necessary checks.
2706         Add an option to disable security checks if NetworkProcess does it for WebProcess.
2707         This option will be also used for regular asynchronous loads in future patches.
2708
2709         Update DocumentThreadableLoader to bypass preflighting and response validation checks in case they are done in NetworkProcess.
2710
2711         Covered by existing and rebased tests.
2712
2713         * loader/CrossOriginPreflightChecker.cpp:
2714         (WebCore::CrossOriginPreflightChecker::doPreflight):
2715         * loader/DocumentThreadableLoader.cpp:
2716         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
2717         (WebCore::DocumentThreadableLoader::loadRequest):
2718         * loader/FrameLoader.cpp:
2719         (WebCore::FrameLoader::loadResourceSynchronously):
2720         * loader/FrameLoader.h:
2721         * loader/LoaderStrategy.h:
2722         * xml/XSLTProcessorLibxslt.cpp:
2723         (WebCore::docLoaderFunc):
2724         * xml/parser/XMLDocumentParserLibxml2.cpp:
2725         (WebCore::openFunc):
2726
2727 2018-04-16  Christopher Reid  <chris.reid@sony.com>
2728
2729         [WinCairo] Media elements should be enabled by default
2730         https://bugs.webkit.org/show_bug.cgi?id=184597
2731
2732         Reviewed by Per Arne Vollan.
2733
2734         Enabling media elements by default with media foundation.
2735
2736         * page/SettingsDefaultValues.h:
2737
2738 2018-04-16  Christopher Reid  <chris.reid@sony.com>
2739
2740         [Curl] Add the Accept-Language field to curl request headers
2741         https://bugs.webkit.org/show_bug.cgi?id=184605
2742
2743         Reviewed by Alex Christensen.
2744
2745         Add Accept-Language field to curl request headers
2746
2747         * platform/network/curl/CurlRequest.cpp:
2748         * platform/network/curl/CurlRequest.h:
2749
2750 2018-04-16  Chris Dumez  <cdumez@apple.com>
2751
2752         Move more WindowProxy-related logic from ScriptController to WindowProxyController
2753         https://bugs.webkit.org/show_bug.cgi?id=184640
2754
2755         Reviewed by Ryosuke Niwa.
2756
2757         Move more WindowProxy-related logic from ScriptController to WindowProxyController,
2758         for clarity.
2759
2760         * bindings/js/JSDOMWindowProxy.cpp:
2761         (WebCore::JSDOMWindowProxy::attachDebugger):
2762         * bindings/js/JSDOMWindowProxy.h:
2763         * bindings/js/ScriptCachedFrameData.cpp:
2764         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
2765         (WebCore::ScriptCachedFrameData::restore):
2766         * bindings/js/ScriptController.cpp:
2767         (WebCore::ScriptController::~ScriptController):
2768         (WebCore::ScriptController::initScriptForWindowProxy):
2769         * bindings/js/ScriptController.h:
2770         (WebCore::ScriptController::existingCacheableBindingRootObject const):
2771         * bindings/js/WindowProxyController.cpp:
2772         (WebCore::collectGarbageAfterWindowProxyDestruction):
2773         (WebCore::WindowProxyController::~WindowProxyController):
2774         (WebCore::WindowProxyController::clearWindowProxiesNotMatchingDOMWindow):
2775         (WebCore::WindowProxyController::setDOMWindowForWindowProxy):
2776         (WebCore::WindowProxyController::attachDebugger):
2777         * bindings/js/WindowProxyController.h:
2778         * loader/FrameLoader.cpp:
2779         (WebCore::FrameLoader::clear):
2780         * page/Page.cpp:
2781         (WebCore::Page::setDebugger):
2782
2783 2018-04-16  Thibault Saunier  <tsaunier@igalia.com>
2784
2785         [GStreamer] Set *TrackPrivateGStreamer::active based on GstStream default select in constructor
2786         https://bugs.webkit.org/show_bug.cgi?id=184652
2787
2788         Reviewed by Philippe Normand.
2789
2790         In the constructor we should mark selected streams based on the default values from GstStream,
2791         if the user changes them, they will be updated as required later on.
2792
2793         No new tests are added as we already have a few ones that are currently disabled in
2794         the mediastream testsuite. This patch is part of the work to enable them.
2795
2796         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
2797         (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
2798         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
2799         (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
2800
2801 2018-04-16  Thibault Saunier  <tsaunier@igalia.com>
2802
2803         [GStreamer] Set TrackPrivateBaseGStreamer metadata information even if no client is avalaible
2804         https://bugs.webkit.org/show_bug.cgi?id=184651
2805
2806         Reviewed by Philippe Normand.
2807
2808         We can't notify the client if none is connected, but still we need to fill our metadatas from
2809         the provided GstTagList, especially in the case of playbin3 where the client is not set yet
2810         at construct time but the metadata might already be preset (and won't be updated later on).
2811
2812         No new tests are added as we already have a few ones that are currently disabled in
2813         the mediastream testsuite. This patch is part of the work to enable them.
2814
2815         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
2816         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged):
2817
2818 2018-04-16  Antoine Quint  <graouts@apple.com>
2819
2820         [Web Animations] Ensure we never return -0 through the API
2821         https://bugs.webkit.org/show_bug.cgi?id=184644
2822
2823         Reviewed by Dean Jackson.
2824
2825         We could sometimes return -0 instead of 0, which is surprising and leads to an error in WPT tests.
2826         This would happen when playbackRate < 0.
2827
2828         * animation/WebAnimationUtilities.h:
2829         (WebCore::secondsToWebAnimationsAPITime):
2830
2831 2018-04-15  Antoine Quint  <graouts@apple.com>
2832
2833         [Web Animations] Animations do not naturally get a finish event
2834         https://bugs.webkit.org/show_bug.cgi?id=184639
2835         <rdar://problem/39397649>
2836
2837         Reviewed by Jon Lee.
2838
2839         We must call updateFinishedState() when an animation gets sampled as it means its timeline's time has progressed
2840         and it may have crossed to a finished state. Calling updateFinishedState() when sampling means that we'll correctly
2841         set the animation's hold time to its end value, which means that currentTime() will now always be clamped to return
2842         the end time once its has reached it, so we must not schedule animations to resolve immediately anymore since otherwise
2843         they will keep being scheduled in a loop.
2844
2845         * animation/WebAnimation.cpp:
2846         (WebCore::WebAnimation::timeToNextRequiredTick const):
2847         (WebCore::WebAnimation::resolve):
2848
2849 2018-04-15  Chris Dumez  <cdumez@apple.com>
2850
2851         Change Event's returnValue so it doesn't expose a new primitive
2852         https://bugs.webkit.org/show_bug.cgi?id=184415
2853
2854         Reviewed by Darin Adler.
2855
2856         Update Event.returnValue setter to match the latest DOM specification after:
2857         - https://github.com/whatwg/dom/pull/626
2858
2859         In particular, the returnValue setter is now a no-op if the new flag value
2860         is true. If the input flag value is false, it only sets the 'canceled' flag
2861         if the event is cancelable and the event’s in passive listener flag is unset.
2862
2863         Test: imported/w3c/web-platform-tests/dom/events/Event-returnValue.html
2864
2865         * dom/Event.cpp:
2866         (WebCore::Event::setLegacyReturnValue):
2867         (WebCore::Event::setCanceledFlagIfPossible):
2868         (WebCore::Event::preventDefault):
2869         * dom/Event.h:
2870
2871 2018-04-14  Thibault Saunier  <tsaunier@igalia.com>
2872
2873         [GStreamer] Expose a method to retrieve the GstStream from a TrackPrivateBaseGStreamer
2874         https://bugs.webkit.org/show_bug.cgi?id=184620
2875
2876         Reviewed by Philippe Normand.
2877
2878         This is a minor change, a dedicated test doesn't really make sense here.
2879
2880         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
2881         (WebCore::TrackPrivateBaseGStreamer::stream):
2882
2883 2018-04-13  Ryosuke Niwa  <rniwa@webkit.org>
2884
2885         WebKit crashes when libwebrtc.dylib is missing
2886         https://bugs.webkit.org/show_bug.cgi?id=184607
2887
2888         Rubber-stamped by Jer Noble.
2889
2890         Don't call LibWebRTC related code when libwebrtc is not available.
2891
2892         * dom/Document.cpp:
2893         (WebCore::Document::prepareForDestruction):
2894         (WebCore::Document::suspend):
2895
2896 2018-04-13  Chris Dumez  <cdumez@apple.com>
2897
2898         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame
2899         https://bugs.webkit.org/show_bug.cgi?id=184591
2900
2901         Reviewed by Sam Weinig.
2902
2903         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame.
2904         RemoteFrames do not need a ScriptController but do need to maintain WindowProxies.
2905         This is work towards fixing Bug 184515.
2906
2907         * Sources.txt:
2908         * WebCore.xcodeproj/project.pbxproj:
2909         * bindings/js/DOMWrapperWorld.cpp:
2910         (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
2911         (WebCore::DOMWrapperWorld::clearWrappers):
2912         * bindings/js/DOMWrapperWorld.h:
2913         (WebCore::DOMWrapperWorld::didCreateWindowProxy):
2914         (WebCore::DOMWrapperWorld::didDestroyWindowProxy):
2915         * bindings/js/JSBindingsAllInOne.cpp:
2916         * bindings/js/JSDOMWindowBase.cpp:
2917         (WebCore::toJSDOMWindow):
2918         * bindings/js/JSDOMWindowProxy.cpp:
2919         (WebCore::toJS):
2920         (WebCore::toJSDOMWindowProxy):
2921         * bindings/js/ScriptCachedFrameData.cpp:
2922         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
2923         (WebCore::ScriptCachedFrameData::restore):
2924         * bindings/js/ScriptController.cpp:
2925         (WebCore::ScriptController::~ScriptController):
2926         (WebCore::ScriptController::evaluateInWorld):
2927         (WebCore::ScriptController::loadModuleScriptInWorld):
2928         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
2929         (WebCore::ScriptController::evaluateModule):
2930         (WebCore::ScriptController::clearWindowProxiesNotMatchingDOMWindow):
2931         (WebCore::ScriptController::setDOMWindowForWindowProxy):
2932         (WebCore::ScriptController::initScriptForWindowProxy):
2933         (WebCore::ScriptController::setupModuleScriptHandlers):
2934         (WebCore::ScriptController::windowProxyController):
2935         (WebCore::ScriptController::enableEval):
2936         (WebCore::ScriptController::enableWebAssembly):
2937         (WebCore::ScriptController::disableEval):
2938         (WebCore::ScriptController::disableWebAssembly):
2939         (WebCore::ScriptController::attachDebugger):
2940         (WebCore::ScriptController::updateDocument):
2941         (WebCore::ScriptController::collectIsolatedContexts):
2942         (WebCore::ScriptController::windowScriptNPObject):
2943         (WebCore::ScriptController::executeIfJavaScriptURL):
2944         * bindings/js/ScriptController.h:
2945         (WebCore::ScriptController::globalObject):
2946         * bindings/js/ScriptControllerMac.mm:
2947         (WebCore::ScriptController::windowScriptObject):
2948         * bindings/js/ScriptState.cpp:
2949         (WebCore::mainWorldExecState):
2950         * bindings/js/WindowProxyController.cpp: Added.
2951         (WebCore::WindowProxyController::WindowProxyController):
2952         (WebCore::WindowProxyController::destroyWindowProxy):
2953         (WebCore::WindowProxyController::createWindowProxy):
2954         (WebCore::WindowProxyController::windowProxies):
2955         (WebCore::WindowProxyController::createWindowProxyWithInitializedScript):
2956         * bindings/js/WindowProxyController.h: Added.
2957         (WebCore::WindowProxyController::releaseWindowProxies):
2958         (WebCore::WindowProxyController::setWindowProxies):
2959         (WebCore::WindowProxyController::windowProxy):
2960         (WebCore::WindowProxyController::existingWindowProxy const):
2961         (WebCore::WindowProxyController::globalObject):
2962         * loader/FrameLoader.cpp:
2963         (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
2964         * page/AbstractFrame.cpp:
2965         (WebCore::AbstractFrame::AbstractFrame):
2966         * page/AbstractFrame.h:
2967         (WebCore::AbstractFrame::windowProxyController):
2968         (WebCore::AbstractFrame::windowProxyController const):
2969
2970 2018-04-13  Brady Eidson  <beidson@apple.com>
2971
2972         Introduce SuspendedPageProxy to keep old web processes around after their WebPageProxy has been swapped to a new one.
2973         https://bugs.webkit.org/show_bug.cgi?id=184559
2974
2975         Reviewed by Alex Christensen.
2976
2977         Covered by new API test.
2978
2979         WebCore changes rework the meaning of a "ForSuspension" policy to simply navigate the page to about:blank.
2980
2981         * loader/DocumentLoader.cpp:
2982         (WebCore::DocumentLoader::redirectReceived):
2983         (WebCore::DocumentLoader::willSendRequest):
2984         (WebCore::DocumentLoader::startLoadingMainResource):
2985         * loader/DocumentLoader.h:
2986
2987         * loader/FrameLoader.cpp:
2988         (WebCore::FrameLoader::init):
2989         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
2990
2991 2018-04-13  Chris Dumez  <cdumez@apple.com>
2992
2993         input.webkitEntries does not work as expected when folder contains accented chars
2994         https://bugs.webkit.org/show_bug.cgi?id=184517
2995         <rdar://problem/39265537>
2996
2997         Reviewed by Alex Christensen.
2998
2999         Use String::fromUTF8() to construct a WTF String from the char* returned by
3000         dirname() in FileSystem::directoryName(). Previously, we were just calling
3001         the String constructor, which would treat the input as latin 1 instead of
3002         UTF-8.
3003
3004         Change is covered by an API test rather than a layout test due to file versioning
3005         limitations.
3006
3007         * platform/posix/FileSystemPOSIX.cpp:
3008         (WebCore::FileSystem::directoryName):
3009
3010 2018-04-13  Yusuke Suzuki  <utatane.tea@gmail.com>
3011
3012         [WebCore] Use @getByIdDirectPrivate / @putByIdDirectPrivate in WebCore JS
3013         https://bugs.webkit.org/show_bug.cgi?id=184401
3014
3015         Rubber stamped by Saam Barati.
3016
3017         Apply bug 183970 changes to WebCore JS too. This offers solid type checking
3018         with @getByIdDirectPrivate().
3019
3020         * Modules/mediastream/RTCPeerConnection.js:
3021         (initializeRTCPeerConnection):
3022         (getLocalStreams):
3023         (getStreamById):
3024         (addStream):
3025         * Modules/mediastream/RTCPeerConnectionInternals.js:
3026         (isRTCPeerConnection):
3027         * Modules/streams/ReadableByteStreamController.js:
3028         (enqueue):
3029         (error):
3030         (close):
3031         (getter.byobRequest):
3032         * Modules/streams/ReadableByteStreamInternals.js:
3033         (privateInitializeReadableStreamBYOBReader):
3034         (privateInitializeReadableByteStreamController):
3035         (privateInitializeReadableStreamBYOBRequest):
3036         (isReadableByteStreamController):
3037         (isReadableStreamBYOBRequest):
3038         (isReadableStreamBYOBReader):
3039         (readableByteStreamControllerCancel):
3040         (readableByteStreamControllerError):
3041         (readableByteStreamControllerClose):
3042         (readableByteStreamControllerClearPendingPullIntos):
3043         (readableByteStreamControllerGetDesiredSize):
3044         (readableStreamHasBYOBReader):
3045         (readableStreamHasDefaultReader):
3046         (readableByteStreamControllerHandleQueueDrain):
3047         (readableByteStreamControllerPull):
3048         (readableByteStreamControllerShouldCallPull):
3049         (readableByteStreamControllerCallPullIfNeeded):
3050         (readableByteStreamControllerEnqueue):
3051         (readableByteStreamControllerEnqueueChunk):
3052         (readableByteStreamControllerRespondWithNewView):
3053         (readableByteStreamControllerRespond):
3054         (readableByteStreamControllerRespondInternal):
3055         (readableByteStreamControllerRespondInReadableState):
3056         (readableByteStreamControllerRespondInClosedState):
3057         (readableByteStreamControllerProcessPullDescriptors):
3058         (readableByteStreamControllerFillDescriptorFromQueue):
3059         (readableByteStreamControllerShiftPendingDescriptor):
3060         (readableByteStreamControllerInvalidateBYOBRequest):
3061         (readableByteStreamControllerCommitDescriptor):
3062         (readableStreamFulfillReadIntoRequest):
3063         (readableByteStreamControllerPullInto):
3064         (readableStreamAddReadIntoRequest):
3065         * Modules/streams/ReadableStream.js:
3066         (initializeReadableStream):
3067         (pipeThrough):
3068         * Modules/streams/ReadableStreamBYOBReader.js:
3069         (cancel):
3070         (read):
3071         (releaseLock):
3072         (getter.closed):
3073         * Modules/streams/ReadableStreamBYOBRequest.js:
3074         (respond):
3075         (respondWithNewView):
3076         (getter.view):
3077         * Modules/streams/ReadableStreamDefaultController.js:
3078         (error):
3079         * Modules/streams/ReadableStreamDefaultReader.js:
3080         (cancel):
3081         (read):
3082         (releaseLock):
3083         (getter.closed):
3084         * Modules/streams/ReadableStreamInternals.js:
3085         (privateInitializeReadableStreamDefaultReader):
3086         (readableStreamReaderGenericInitialize):
3087         (readableStreamDefaultControllerError):
3088         (readableStreamPipeTo):
3089         (readableStreamTee):
3090         (isReadableStream):
3091         (isReadableStreamDefaultReader):
3092         (isReadableStreamDefaultController):
3093         (readableStreamError):
3094         (readableStreamDefaultControllerCallPullIfNeeded):
3095         (readableStreamDefaultControllerGetDesiredSize):
3096         (readableStreamReaderGenericCancel):
3097         (readableStreamCancel):
3098         (readableStreamDefaultControllerCancel):
3099         (readableStreamDefaultControllerPull):
3100         (readableStreamDefaultControllerClose):
3101         (readableStreamClose):
3102         (readableStreamFulfillReadRequest):
3103         (readableStreamDefaultReaderRead):
3104         (readableStreamAddReadRequest):
3105         (isReadableStreamDisturbed):
3106         (readableStreamReaderGenericRelease):
3107         (readableStreamDefaultControllerCanCloseOrEnqueue):
3108         (privateInitializeReadableStreamDefaultController): Deleted.
3109         * Modules/streams/StreamInternals.js:
3110         (validateAndNormalizeQueuingStrategy):
3111         * Modules/streams/WritableStream.js:
3112         (initializeWritableStream):
3113         (abort):
3114         (close):
3115         (write):
3116         (getter.closed):
3117         (getter.ready):
3118         (getter.state):
3119         * Modules/streams/WritableStreamInternals.js:
3120         (isWritableStream):
3121         (syncWritableStreamStateWithQueue):
3122         (errorWritableStream):
3123         (callOrScheduleWritableStreamAdvanceQueue):
3124         * bindings/js/JSDOMBindingInternals.js:
3125         (mapLikeForEach):
3126
3127 2018-04-12  Antoine Quint  <graouts@apple.com>
3128
3129         [Web Animations] Turn CSS Animations and CSS Transitions as Web Animations on by default
3130         https://bugs.webkit.org/show_bug.cgi?id=184569
3131         <rdar://problem/38671301>
3132
3133         Reviewed by Jon Lee.
3134
3135         We now set the CSS Animations and CSS Transitions as Web Animations flag on by default. To ensure that some remaining
3136         tests pass with this flag on, we expose a way to get to a PseudoElement via a new internals.pseudoElement() method. This
3137         allows tests that used internals.pauseAnimationAtTimeOnPseudoElement() and internals.pauseTransitionAtTimeOnPseudoElement()
3138         to now work with the Web Animations API.
3139
3140         * page/RuntimeEnabledFeatures.h:
3141         * testing/Internals.cpp:
3142         (WebCore::Internals::pseudoElement):
3143         * testing/Internals.h:
3144         * testing/Internals.idl:
3145
3146 2018-04-13  Sergio Villar Senin  <svillar@igalia.com>
3147
3148         [WebVR][OpenVR] Implement requestPresent()/exitPresent() and getLayers()
3149         https://bugs.webkit.org/show_bug.cgi?id=184530
3150
3151         Reviewed by Žan Doberšek.
3152
3153         WebVR apps should invoke requestPresent() to start presenting contents of a VRLayerInit
3154         (right now a HTML canvas with a WebGL context) on the VRDisplay. This request might fail for
3155         a variety of reasons and can be eventually cancelled with exitPresent(). Once we are
3156         presenting we could access the presenting layers (right now just one) with getLayers().
3157
3158         Note that we are not presenting anything to the HMD yet, that will be done later in a follow
3159         up patch.
3160
3161         I took the chance to correct a mistak in the VRDisplayCapabilities object which has a method
3162         that should be called maxLayers instead of maxLayer.
3163
3164         * Modules/webvr/VRDisplay.cpp:
3165         (WebCore::VRDisplay::requestPresent):
3166         (WebCore::VRDisplay::stopPresenting):
3167         (WebCore::VRDisplay::exitPresent):
3168         (WebCore::VRDisplay::getLayers const):
3169         (WebCore::VRDisplay::isPresenting const): Deleted. Implemented in the header file.
3170         * Modules/webvr/VRDisplay.h:
3171         (WebCore::VRDisplay::isPresenting const):
3172         * Modules/webvr/VRDisplayCapabilities.h:
3173         (WebCore::VRDisplayCapabilities::maxLayers const): Renamed from maxLayer().
3174         (WebCore::VRDisplayCapabilities::maxLayer const): Deleted.
3175         * Modules/webvr/VRDisplayCapabilities.idl:
3176
3177 2018-04-13  Miguel Gomez  <magomez@igalia.com>
3178
3179         REGRESSION(r230627): [GTK][WPE] Possible deadlock when destroying the player in non AC mode
3180         https://bugs.webkit.org/show_bug.cgi?id=184583
3181
3182         Reviewed by Carlos Garcia Campos.
3183
3184         In non AC mode, ensure that a deadlock can't happen when destroying MediaPlayerPrivateGStreamerBase.
3185
3186         Covered by existent tests.
3187
3188         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3189         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
3190         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
3191         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
3192         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3193
3194 2018-04-13  Miguel Gomez  <magomez@igalia.com>
3195
3196         [GTK] [gstreamer] video won't unpause when built with -DUSE_GSTREAMER_GL=OFF
3197         https://bugs.webkit.org/show_bug.cgi?id=183362
3198
3199         Reviewed by Carlos Garcia Campos.
3200
3201         Remove the drawCancelled flag and use a new one to indicate that the player is being destroyed.
3202         That new flag is only enabled on destruction and it's not modified by cancelRepaint(), which
3203         can be used to handle the pause event without avoiding future renderings. Also cancelRepaint()
3204         has only effect when not in AC mode.
3205
3206         Covered by existent tests.
3207
3208         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3209         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
3210         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
3211         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
3212         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3213
3214 2018-04-13  Xabier Rodriguez Calvar  <calvaris@igalia.com>
3215
3216         [GStreamer] Convert GStreamerUtilities in GStreamerCommon and include the GStreamer smart pointer traits
3217         https://bugs.webkit.org/show_bug.cgi?id=184533
3218
3219         Reviewed by Philippe Normand.
3220
3221         Renamed GStreamerUtilities* files into GStreamerCommon* and
3222         modified files including them accordingly. Include
3223         GRefPtrGStreamer.h and GUniquePtrGStreamer.h in GStreamerCommon.h
3224         to avoid problems destroying objects when those files are
3225         forgotten to be included.
3226
3227         * Modules/webaudio/AudioContext.cpp:
3228         * platform/GStreamer.cmake:
3229         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
3230         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
3231         * platform/graphics/gstreamer/GStreamerCommon.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp.
3232         * platform/graphics/gstreamer/GStreamerCommon.h: Renamed from Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h.
3233         * platform/graphics/gstreamer/ImageGStreamer.h:
3234         * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
3235         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
3236         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
3237         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3238         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
3239         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3240         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3241         * platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
3242         * platform/graphics/gstreamer/MediaSampleGStreamer.h:
3243         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
3244         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
3245         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
3246         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
3247         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
3248         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3249         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp:
3250         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
3251         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
3252         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
3253         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
3254         * platform/graphics/gstreamer/mse/AppendPipeline.h:
3255         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp:
3256         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.h:
3257         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3258         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
3259         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
3260         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
3261         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
3262         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
3263         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h:
3264
3265 2018-04-12  Christopher Reid  <chris.reid@sony.com>
3266
3267         [Curl] Fix clang build error in CurlContext.cpp
3268         https://bugs.webkit.org/show_bug.cgi?id=184561
3269
3270         Reviewed by Darin Adler.
3271
3272         MSVC allows explicit template specialization in classes but gcc/clang do not.
3273
3274         * platform/network/curl/CurlContext.cpp:
3275
3276 2018-04-12  Christopher Reid  <chris.reid@sony.com>
3277
3278         [Curl] Cookie Database on memory path should be :memory:
3279         https://bugs.webkit.org/show_bug.cgi?id=184572
3280
3281         Reviewed by Alex Christensen.
3282
3283         CookieJarDB::isOnMemory is comparing the database path with :onmemory: but it should be using :memory:
3284         For reference, see: https://www.sqlite.org/inmemorydb.html
3285
3286         * platform/network/curl/CookieJarDB.h:
3287
3288 2018-04-12  Daniel Bates  <dabates@apple.com>
3289
3290         Attmept to fix the Windows build following <https://trac.webkit.org/changeset/230602/>
3291         (https://bugs.webkit.org/show_bug.cgi?id=184386)
3292
3293         Visual Studio cannot prove that all cases in the switch are covered :(
3294         So, add an ASSERT_NOT_REACHED() and a return a value outside of the switch block. 
3295
3296         * loader/cache/CachedResourceLoader.cpp:
3297         (WebCore::destinationForType):
3298
3299 2018-04-12  Chris Dumez  <cdumez@apple.com>
3300
3301         Introduce remote variants of Frame / DOMWindow classes
3302         https://bugs.webkit.org/show_bug.cgi?id=184467
3303         <rdar://problem/39011267>
3304
3305         Reviewed by Ryosuke Niwa.
3306
3307         Introduce remote variants of Frame / DOMWindow classes, for when these frames / windows
3308         are hosted on another WebProcess. Those will be used in a follow-up patch.
3309
3310         The hierarchy is as follows (class naming will be improved in a follow-up patch to minimise
3311         patch size):
3312         - AbstractFrame: A frame that can be either local or remote (hosted on another WebProcess)
3313             - Frame: A local frame
3314             - RemoteFrame: A frame hosted on another WebProcess. A RemoteFrame's window is also remote.
3315         - AbstractDOMWindow: A window that be either local or remote (hosted on another WebProcess)
3316             - DOMWindow: A local DOMWindow
3317             - RemoteDOMWindow: A window hosted on another WebProcess. A RemoteDOMWindow's frame is also
3318               remote. A RemoteDOMWindow is always cross-origin.
3319
3320         This patch introduces global identifiers (unique across all WebProcesses) for both Frames and
3321         Windows. This is useful as we need to know which Frame / DOMWindow a particular RemoteFrame /
3322         RemoteDOMWindow is pointing to.
3323
3324         Follow-up patch will add support for converting a local DOMWindow / Frame into a remote ones,
3325         when a newly opened window (via window.open) is navigated cross-origin (Bug 184515).
3326
3327         Other things we'll need to implement in follow-ups:
3328         - RemoteDOMWindow will need to know about its opener in order to support the window.opener
3329           API. Internally, the opener will be stored as a RemoteFrame so that window.opener always
3330           returns the current window in the opener frame (which changes upon navigation).
3331         - Nullify a RemoteDOMWindow's frame whenever the window it is pointing to becomes frameless.
3332           A frameless window behaves very differently (e.g. very little API is exposed to the Web).
3333           This happens when either the newly opened window is either closed or navigated.
3334
3335         * Sources.txt:
3336         * WebCore.xcodeproj/project.pbxproj:
3337         * loader/ContentFilter.cpp:
3338         (WebCore::ContentFilter::didDecide):
3339         * page/AbstractDOMWindow.cpp: Added.
3340         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
3341         (WebCore::AbstractDOMWindow::~AbstractDOMWindow):
3342         * page/AbstractDOMWindow.h: Added.
3343         (WebCore::AbstractDOMWindow::identifier const):
3344         * page/AbstractFrame.cpp: Added.
3345         (WebCore::AbstractFrame::AbstractFrame):
3346         (WebCore::AbstractFrame::~AbstractFrame):
3347         * page/AbstractFrame.h: Added.
3348         (WebCore::AbstractFrame::window const):
3349         * page/DOMWindow.cpp:
3350         (WebCore::DOMWindow::DOMWindow):
3351         * page/DOMWindow.h:
3352         (isType):
3353         * page/Frame.cpp:
3354         (WebCore::Frame::window const):
3355         (WebCore::Frame::virtualWindow const):
3356         * page/Frame.h:
3357         (isType):
3358         * page/GlobalFrameIdentifier.h: Added.
3359         (WebCore::GlobalFrameIdentifier::encode const):
3360         (WebCore::GlobalFrameIdentifier::decode):
3361         * page/GlobalWindowIdentifier.h: Added.
3362         (WebCore::operator==):
3363         (WebCore::GlobalWindowIdentifier::hash const):
3364         (WebCore::GlobalWindowIdentifier::encode const):
3365         (WebCore::GlobalWindowIdentifier::decode):
3366         (WTF::GlobalWindowIdentifierHash::hash):
3367         (WTF::GlobalWindowIdentifierHash::equal):
3368         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::emptyValue):
3369         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::constructDeletedValue):
3370         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::isDeletedValue):
3371
3372         * page/RemoteDOMWindow.cpp: Added.
3373         (WebCore::RemoteDOMWindow::RemoteDOMWindow):
3374         (WebCore::RemoteDOMWindow::~RemoteDOMWindow):
3375         (WebCore::RemoteDOMWindow::self const):
3376         (WebCore::RemoteDOMWindow::location const):
3377         (WebCore::RemoteDOMWindow::close):
3378         (WebCore::RemoteDOMWindow::closed const):
3379         (WebCore::RemoteDOMWindow::focus):
3380         (WebCore::RemoteDOMWindow::blur):
3381         (WebCore::RemoteDOMWindow::length const):
3382         (WebCore::RemoteDOMWindow::top const):
3383         (WebCore::RemoteDOMWindow::opener const):
3384         (WebCore::RemoteDOMWindow::parent const):
3385         (WebCore::RemoteDOMWindow::postMessage):
3386         The DOM API exposed on RemoteDOMWindow is only the subset of the DOMWindow API that is exposed cross origin,
3387         since remote DOMWindow are always from a different origin. The short-term plan is to implement these in a
3388         follow-up by relying on IPC (synchronous when necessary) to fetch the information from the real window in
3389         the WebProcess where it lives. Longer term, we should probably keep RemoteDOMWindow members in sync with the
3390         DOMWindow they're pointing to, so we do not have to rely on synchronous IPC.
3391
3392         * page/RemoteDOMWindow.h: Added.
3393         (isType):
3394         * page/RemoteFrame.cpp: Added.
3395         (WebCore::RemoteFrame::RemoteFrame):
3396         (WebCore::RemoteFrame::~RemoteFrame):
3397         (WebCore::RemoteFrame::virtualWindow const):
3398         * page/RemoteFrame.h: Added.
3399         (isType):
3400
3401 2018-04-12  Daniel Bates  <dabates@apple.com>
3402
3403         Content-Type not enforced for <script> allows for XSS
3404         https://bugs.webkit.org/show_bug.cgi?id=184386
3405         <rdar://problem/39112268>
3406
3407         Reviewed by Brady Eidson.
3408
3409         As per the Fetch standard, <https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-mime-type?> (16 March 2018),
3410         we should block JavaScript scripts that are served with MIME type text/csv, or a MIME type
3411         that begins with "audio/", "image/" or "video/".
3412
3413         As a side benefit of this change we now set the destination property [1] on preload requests.
3414
3415         [1] <https://fetch.spec.whatwg.org/#concept-request-destination>
3416
3417         Tests: http/tests/security/script-with-banned-mimetype.html
3418                http/tests/workers/worker-importScripts-banned-mimetype.html
3419
3420         * Sources.txt: Add file FetchIdioms.cpp.
3421         * WebCore.xcodeproj/project.pbxproj: Add files FetchIdioms.{cpp, h}.
3422         * dom/LoadableClassicScript.cpp:
3423         (WebCore::LoadableClassicScript::notifyFinished): Check the MIME type of the response and
3424         block the script if applicable.
3425         * dom/LoadableScript.h: Add error type MIMEType.
3426         * loader/FetchIdioms.cpp: Added.
3427         (WebCore::shouldBlockResponseDueToMIMEType): Implements the "Should response to request be blocked
3428         due to its MIME type?" algorithm from the Fetch standard.
3429         * loader/FetchIdioms.h: Added.
3430         * loader/FetchOptions.h:
3431         (WebCore::isScriptLikeDestination): Implements the definition of "script like" as per <https://fetch.spec.whatwg.org/#request-destination-script-like>.
3432         * loader/cache/CachedResourceLoader.cpp:
3433         (WebCore::CachedResourceLoader::requestImage): Removed logic to set the destination property as
3434         CachedResourceLoader::requestResource() is now responsible for doing this.
3435         (WebCore::CachedResourceLoader::requestFont): Ditto.
3436         (WebCore::CachedResourceLoader::requestTextTrack): Ditto.
3437         (WebCore::CachedResourceLoader::requestCSSStyleSheet): Ditto.
3438         (WebCore::CachedResourceLoader::requestScript): Ditto.
3439         (WebCore::CachedResourceLoader::requestXSLStyleSheet): Ditto.
3440         (WebCore::CachedResourceLoader::requestMedia): Update comment to express that we should assert
3441         that the destination property is either video or audio.
3442         (WebCore::CachedResourceLoader::requestIcon): Remove logic to set the destination property as
3443         CachedResourceLoader::requestResource() is now responsible for doing this.
3444         (WebCore::CachedResourceLoader::requestRawResource): Removed assertion as this function is used to
3445         load many kinds of requests that have different destination properties. The caller is responsible
3446         for setting the appropriate destintion property.
3447         (WebCore::CachedResourceLoader::requestMainResource): Remove logic to set the destination property
3448         as CachedResourceLoader::requestResource() is now responsible for doing this.
3449         (WebCore::destinationForType): Helper function that maps CachedResource::Type to FetchOptions::Destination.
3450         (WebCore::CachedResourceLoader::requestResource): Set the destination property on the request if not
3451         already set.
3452         * loader/cache/CachedResourceLoader.h: Segregate requestRawResource() from the other request functions