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