[iOS] Remove soft linking of MobileCoreServices.framework
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-09-06  David Kilzer  <ddkilzer@apple.com>
2
3         [iOS] Remove soft linking of MobileCoreServices.framework
4         <https://webkit.org/b/161641>
5         <rdar://problem/10420118>
6
7         Reviewed by Darin Adler.
8
9         * Configurations/WebCore.xcconfig: Add hard link to
10         MobileCoreServices.framework.
11
12         * editing/ios/EditorIOS.mm: Change #include to #import.
13         * platform/graphics/cg/ImageSourceCGMac.mm:
14         * platform/graphics/mac/ImageMac.mm:
15         * platform/ios/PasteboardIOS.mm:
16         * platform/ios/PlatformPasteboardIOS.mm:
17         * platform/network/ios/WebCoreURLResponseIOS.mm:
18         * platform/network/mac/UTIUtilities.mm:
19         - Rearrange import statements as needed.
20         - Remove soft link to MobileCoreServices.framework.
21         - Add import of <MobileCoreServices/MobileCoreServices.h> as
22           needed.
23
24         * rendering/RenderThemeIOS.mm: Remove unused soft link to
25         MobileCoreServices.framework.
26
27 2016-09-06  Chris Dumez  <cdumez@apple.com>
28
29         Align srcset attribute parsing with the HTML specification
30         https://bugs.webkit.org/show_bug.cgi?id=161636
31
32         Reviewed by Darin Adler.
33
34         Align srcset attribute parsing with the HTML specification:
35         - https://html.spec.whatwg.org/#parse-a-srcset-attribute
36
37         The new behavior is also consistent with Firefox and Chrome
38         as all 3 browsers now pass 100% of the checks at:
39         - http://w3c-test.org/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html
40
41         No new tests, rebaselined existing tests.
42
43         * html/parser/HTMLParserIdioms.cpp:
44         (WebCore::parseValidHTMLNonNegativeIntegerInternal):
45         (WebCore::parseValidHTMLNonNegativeInteger):
46         (WebCore::parseValidHTMLFloatingPointNumberInternal):
47         (WebCore::parseValidHTMLFloatingPointNumber):
48         * html/parser/HTMLParserIdioms.h:
49         Add convenience for parsing *valid* HTML non-negative integers and
50         *valid* floating point number values.
51
52         * html/parser/HTMLSrcsetParser.cpp:
53         (WebCore::parseDescriptors):
54         - Use parseValidHTMLFloatingPointNumber() to parse density so that the value
55           is parsed as a valid HTML floating point number value, as per the spec.
56         - Use parseValidHTMLNonNegativeInteger() to parse width and height so that
57           the value is parsed as a valid HTML non-negative integer value, as per the
58           spec.
59         - Return false if descriptor does not have a h, w and x at the end as per:
60           https://html.spec.whatwg.org/#parse-a-srcset-attribute (step 13: Anything else)
61         - Return false if height is set but not width, as per:
62           https://html.spec.whatwg.org/#parse-a-srcset-attribute (step 14)
63
64         (WebCore::parseImageCandidatesFromSrcsetAttribute):
65         - Skip whitespace if URL does not end with a comma instead of assuming there is
66           a single space character, as per:
67           https://html.spec.whatwg.org/#parse-a-srcset-attribute (step 8. Otherwise 1.)
68
69 2016-09-06  Fujii Hironori  <Hironori.Fujii@sony.com>
70
71         [CMake] Decouple generating bindings of WebCore and WebCoreTestSupport
72         https://bugs.webkit.org/show_bug.cgi?id=161474
73
74         Generating bindings of WebCore and WebCoreTestSupport shares a
75         single supplementalDependencyFile.  But, nothing supplements any
76         IDL of WebCoreTestSupport.  This introduces unnecessary
77         dependencies.
78
79         Reviewed by Alex Christensen.
80
81         * CMakeLists.txt: Do not input any IDL of WebCoreTestSupport to
82         preprocess-idls.pl.  Do not use supplementalDependencyFile to
83         generate bindings of WebCoreTestSupport.  Add SettingsMacros.h as
84         a source file of WebCoreDerivedSources to ensure make_settings.pl
85         is finished before compiling WebCoreDerivedSources.
86
87 2016-09-06  Zalan Bujtas  <zalan@apple.com>
88
89         ASSERTION FAILED: !paintInfo.overlapTestRequests->contains(this) in WebCore::RenderWidget::paintContents
90         https://bugs.webkit.org/show_bug.cgi?id=135602
91         <rdar://problem/27701733>
92
93         Reviewed by Simon Fraser.
94
95         ASSERT is updated to support multiple fragments painting. We just have to ensure that the FrameView's rect
96         has not changed between the 2 paintContents calls.  
97
98         Test: fast/layers/assert-on-overlap-testing-with-frames-inside-columns.html
99
100         * rendering/RenderWidget.cpp:
101         (WebCore::RenderWidget::paintContents):
102
103 2016-09-06  Commit Queue  <commit-queue@webkit.org>
104
105         Unreviewed, rolling out r205504.
106         https://bugs.webkit.org/show_bug.cgi?id=161645
107
108         Broke the iOS device build (Requested by ryanhaddad on
109         #webkit).
110
111         Reverted changeset:
112
113         "Make JSMap and JSSet faster"
114         https://bugs.webkit.org/show_bug.cgi?id=160989
115         http://trac.webkit.org/changeset/205504
116
117 2016-09-06  Zalan Bujtas  <zalan@apple.com>
118
119         Remove unused overlap checking functions from FrameView.
120         https://bugs.webkit.org/show_bug.cgi?id=161635
121
122         Reviewed by Simon Fraser.
123
124         No change in functionality.
125
126         * page/FrameView.cpp:
127         (WebCore::FrameView::isOverlappedIncludingAncestors): Deleted.
128         * page/FrameView.h:
129
130 2016-09-06  Simon Fraser  <simon.fraser@apple.com>
131
132         Align element.scroll() / scrollTo() / scrollBy() with the CSSOM specification
133         https://bugs.webkit.org/show_bug.cgi?id=161610
134
135         Reviewed by Darin Adler, Chris Dumez.
136
137         Implement Element.scroll(), scrollBy() and scrollTo() with x,y and ScrollToOptions
138         on Element, according to <https://drafts.csswg.org/cssom-view/#element-scrolling-members>
139
140         WebKit's behavior of treating scrolls on the body element in both quirks and strict mode
141         is preserved.
142
143         Tests: fast/dom/Element/scrolling-funtions-on-body-quirks.html
144                fast/dom/Element/scrolling-funtions-on-body.html
145                fast/dom/Element/scrolling-funtions-on-element.html
146
147         * dom/Element.cpp:
148         (WebCore::Element::scrollBy):
149         (WebCore::normalizeNonFiniteValue):
150         (WebCore::Element::scrollTo):
151         * dom/Element.h:
152         * dom/Element.idl:
153         * html/HTMLBodyElement.cpp:
154         (WebCore::HTMLBodyElement::scrollTo):
155         * html/HTMLBodyElement.h:
156
157 2016-09-06  Saam Barati  <sbarati@apple.com>
158
159         Make JSMap and JSSet faster
160         https://bugs.webkit.org/show_bug.cgi?id=160989
161
162         Reviewed by Filip Pizlo.
163
164         * ForwardingHeaders/runtime/HashMapImpl.h: Added.
165         * ForwardingHeaders/runtime/MapBase.h: Added.
166         * bindings/js/SerializedScriptValue.cpp:
167         (WebCore::CloneSerializer::serialize):
168         (WebCore::CloneDeserializer::deserialize):
169
170 2016-09-05  Alex Christensen  <achristensen@webkit.org>
171
172         Implement relative file urls and begin implementing character encoding in URLParser
173         https://bugs.webkit.org/show_bug.cgi?id=161618
174
175         Reviewed by Tim Horton.
176
177         Covered by new API tests.
178         Also, this is a significant step towards passing the URL web platform tests when using the URLParser,
179         which is still off by default.
180
181         * platform/URLParser.cpp:
182         (WebCore::isInSimpleEncodeSet):
183         (WebCore::isInDefaultEncodeSet):
184         (WebCore::isInUserInfoEncodeSet):
185         (WebCore::isInvalidDomainCharacter):
186         (WebCore::shouldCopyFileURL):
187         (WebCore::percentEncode):
188         (WebCore::utf8PercentEncode):
189         (WebCore::encodeQuery):
190         (WebCore::isDefaultPort):
191         (WebCore::isPercentEncodedDot):
192         (WebCore::URLParser::parse):
193         (WebCore::percentDecode):
194         (WebCore::domainToASCII):
195         (WebCore::hasInvalidDomainCharacter):
196         (WebCore::URLParser::parsePort):
197         (WebCore::URLParser::parseHost):
198         (WebCore::isTabOrNewline): Deleted.
199         * platform/URLParser.h:
200
201 2016-09-06  Daniel Bates  <dabates@apple.com>
202
203         Fix the Apple-internal build following <https://trac.webkit.org/changeset/205488>
204         (https://bugs.webkit.org/show_bug.cgi?id=161090)
205
206         Use the default linkage for QuartzCore constants to match the linkage used for such constants
207         in the Apple-internal SDK.
208
209         * platform/spi/cocoa/QuartzCoreSPI.h:
210
211 2016-09-06  Daniel Bates  <dabates@apple.com>
212
213         <table> inside <div align="right"> with large content inside = no scrollbar
214         https://bugs.webkit.org/show_bug.cgi?id=3352
215
216         Reviewed by Brent Fulgham.
217
218         Respect "right" text-alignment only if the width of the child does not overflow the
219         width of its containing block. This makes our margin computation more closely conform
220         to section "Block-level, non-replaced elements in normal flow" of the CSS 2.1
221         spec., <http://www.w3.org/TR/CSS21/>, and to the behavior observed in Firefox, Chrome,
222         IE version 9 or later and Microsoft Edge.
223
224         Test: fast/block/align-overflow-child.html
225
226         * rendering/RenderBox.cpp:
227         (WebCore::RenderBox::computeInlineDirectionMargins):
228
229 2016-09-06  Daniel Bates  <dabates@apple.com>
230
231         Remove EXTERN_C from WTF
232         https://bugs.webkit.org/show_bug.cgi?id=161090
233
234         Reviewed by Brent Fulgham.
235
236         Guard external C declarations in WTF_EXTERN_C_BEGIN, WTF_EXTERN_C_END.
237
238         * platform/spi/cf/CFLocaleSPI.h:
239         * platform/spi/cf/CFNetworkConnectionCacheSPI.h:
240         * platform/spi/cf/CFNetworkSPI.h: Additionally, remove the workaround for <rdar://problem/18337182>
241         as this bug was fixed in El Capitan.
242         * platform/spi/cf/CFUtilitiesSPI.h:
243         * platform/spi/cocoa/CoreTextSPI.h:
244         * platform/spi/cocoa/DataDetectorsCoreSPI.h:
245         * platform/spi/cocoa/IOPMLibSPI.h:
246         * platform/spi/cocoa/MachVMSPI.h:
247         * platform/spi/cocoa/QuartzCoreSPI.h:
248         * platform/spi/ios/MobileGestaltSPI.h:
249         * platform/spi/ios/QuickLookSPI.h:
250         * platform/spi/win/CoreTextSPIWin.cpp:
251         * platform/spi/win/CoreTextSPIWin.h:
252
253 2016-09-06  Ryan Haddad  <ryanhaddad@apple.com>
254
255         Unreviewed, rolling out r205407.
256
257         Not the correct way to implement this functionality
258
259         Reverted changeset:
260
261         "Consult with the FrameLoaderClient about whether or not
262         content extensions should be enabled when loading this URL."
263         https://bugs.webkit.org/show_bug.cgi?id=161441
264         http://trac.webkit.org/changeset/205407
265
266 2016-09-06  Youenn Fablet  <youenn@apple.com>
267
268         http/tests/security/contentSecurityPolicy/worker-csp-blocks-xhr-redirect-cross-origin.html is flaky
269         https://bugs.webkit.org/show_bug.cgi?id=161627
270
271         Reviewed by Darin Adler.
272
273         Covered by changed expectation.
274
275         * loader/DocumentThreadableLoader.cpp:
276         (WebCore::DocumentThreadableLoader::redirectReceived): Clearing the resource in lieu of clearing the request. This will stop the resource load.
277         * loader/SubresourceLoader.cpp:
278         (WebCore::SubresourceLoader::didReceiveResponse): Adding an ASSERT to ensure that no valid redirect responses is mistakenly processed here.
279
280 2016-09-06  Zalan Bujtas  <zalan@apple.com>
281
282         ASSERTION FAILED: !currBox->needsLayout() in WebCore::RenderBlock::checkPositionedObjectsNeedLayout
283         https://bugs.webkit.org/show_bug.cgi?id=120291
284         <rdar://problem/27683456>
285
286         Reviewed by David Hyatt.
287
288         This patch ensures that we always set the 'positioned child needs layout' bit on the containing block
289         when a new positioned descendant gets inserted. It fixes cases for simplified layout when
290         we ended up not laying out the descendant element. 
291
292         Test: fast/block/positioning/assert-when-positioned-descendant-is-not-getting-laid-out.html
293
294         * rendering/RenderBlock.cpp:
295         (WebCore::RenderBlock::insertPositionedObject):
296
297 2016-09-06  Youenn Fablet  <youenn@apple.com>
298
299         CachedResourceLoader is not taking into account fetch options to use or not cached resources
300         https://bugs.webkit.org/show_bug.cgi?id=161389
301
302         Reviewed by Darin Adler.
303
304         Tests: http/tests/fetch/fetching-same-resource-with-diffferent-options.html
305                http/tests/security/cross-origin-cached-resource-parallel.html
306                http/tests/security/cross-origin-cached-resource.html
307                http/tests/security/load-image-after-redirection-2.html
308                http/tests/security/shape-outside-and-cached-resources.html
309
310         Adding CORS checks for the response in case of CORS fetch mode, in SubresourceLoader.
311         Removing the CORS checks in Image and DocumentThreadableLoader.
312
313         The direction of this patch is to make CachedResource origin-specific/fetch mode specific.
314
315         This will remove the need for CachedResource clients to do CORS checks when receiving the notifyFinished call.
316         This will also make the computation of whether a resource is clean or not much easier since the CachedResource knowd its origin and its response tainting.
317
318         Removing the CORS checks at ImageLoader creates the risk of using some cached resources loaded from previously no-cors mode without doing the actual CORS check.
319         Note that the risk was already there in case of a resource loaded through redirections.
320         Reusing a cached resource for a load with different options also leads to bad computation of the resource tainting.
321
322         As a first step, improvements are done but only for CachedImage resources.
323
324         This patch limits the direct reuse of cached resources as follow:
325         - If the request and existing resources have different origins.
326         - If the fetch mode is different between request and existing resource.
327
328         In those cases, a new CachedResource is created with the correct options and origin.
329         The data and response of the CachedResource found in the cache are copied efficiently in the new CachedResource, if the matching CachedResource finished loading (CachedImage specific).
330
331         If the matching CachedResource is still loading, we trigger a reload (with caching=false to not disturb the being loaded resource).
332         This should be made more efficient at some point, especially if the matching CachedResource already has its response set.
333
334         This triggers a change of behavior: previously, the CORS checks were done by the ImageLoader when the resource was finished loading.
335         The CORS checks were controlled by the crossOrigin attribute, which may be set or unset between the load start and the load end.
336
337         Now the crossOrigin attribute is checked at load start. If it is set, the CORS checks will happen even if the attribute is unset before the end of the load.
338         This is more consistent as the actual request was built with CORS enabled.
339
340         * loader/CrossOriginPreflightChecker.cpp:
341         (WebCore::CrossOriginPreflightChecker::startPreflight): Setting correctly the preflight options as per fetch spec.
342         * loader/DocumentThreadableLoader.cpp:
343         (WebCore::DocumentThreadableLoader::didReceiveResponse): Removing CORS check.
344         (WebCore::DocumentThreadableLoader::loadRequest): Adding CORS check in sync mode.
345         * loader/ImageLoader.cpp:
346         (WebCore::ImageLoader::updateFromElement):
347         (WebCore::ImageLoader::notifyFinished):
348         * loader/SubresourceLoader.cpp:
349         (WebCore::SubresourceLoader::didReceiveResponse): Adding CORS checks to the response
350         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl): Helper routine to do CORS checks
351         * loader/SubresourceLoader.h:
352         * loader/cache/CachedImage.cpp:
353         (WebCore::CachedImage::cloneData): Responsible to set image content from another CachedImage.
354         * loader/cache/CachedImage.h:
355         * loader/cache/CachedResource.cpp:
356         (WebCore::CachedResource::computeOrigin): Helper routine to set the origin and whether the resource is cross-origin or not.
357         (WebCore::CachedResource::load): Using computeOrigin.
358         (WebCore::CachedResource::loadFrom): Loading from a CachedResource from the same type and which finished loading.
359         * loader/cache/CachedResource.h:
360         (WebCore::CachedResource::cloneData):
361         * loader/cache/CachedResourceLoader.cpp:
362         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Helper routine responsible to adapt the CachedResource
363         that can be reused to the origin and options of a new request.
364         (WebCore::CachedResourceLoader::requestResource): Calling updateCachedResourceWithCurrentRequest before actually returning the resource.
365         (WebCore::CachedResourceLoader::determineRevalidationPolicy): Space clean-up.
366         * loader/cache/CachedResourceLoader.h:
367         * loader/cache/CachedResourceRequest.h:
368         (WebCore::CachedResourceRequest::setCachingPolicy):
369         * style/StylePendingResources.cpp:
370         (WebCore::Style::loadPendingImage): Allowing data URLs for ShapeOutside data.
371
372 2016-09-05  Darin Adler  <darin@apple.com>
373
374         More bindings improvements, particularly things not needed for JavaScript bindings
375         https://bugs.webkit.org/show_bug.cgi?id=161572
376
377         Reviewed by Sam Weinig.
378
379         * WebCore.xcodeproj/project.pbxproj: Export a couple of files needed for legacy bindings.
380
381         * bindings/js/JSDOMWindowCustom.cpp:
382         (WebCore::addCrossOriginWindowPropertyNames): Mark array const.
383         * bindings/js/JSLocationCustom.cpp:
384         (WebCore::addCrossOriginLocationPropertyNames): Ditto.
385
386         * dom/DOMImplementation.cpp:
387         (WebCore::addString): Deleted.
388         (WebCore::isSupportedSVG10Feature): Deleted.
389         (WebCore::isSupportedSVG11Feature): Deleted.
390         (WebCore::DOMImplementation::hasFeature): Deleted.
391
392         * dom/DOMImplementation.h: Changed hasFeature to take no arguments and to always
393         return true, as specified in the DOM spec.
394
395         * dom/DOMImplementation.idl: Removed the arguments to hasFeature.
396
397         * dom/Document.cpp:
398         (WebCore::Document::defaultCharsetForLegacyBindings): Renamed from
399         defaultCharsetForBindings, because this function is used only by the
400         non-JavaScript bindings.
401         * dom/Document.h: Updated for the above.
402
403         * dom/DocumentType.h: Removed entitiesForBindings,
404         notationsForBindings, and internalSubsetForBindings, all of which were
405         empty functions. The empty implementations are now in the legacy bindings.
406
407         * dom/Element.cpp:
408         (WebCore::Element::dispatchSimulatedClickForBindings): Deleted.
409         This code is now at the single call site, in HTMLElement.
410         * dom/Element.h: Updated for the above change.
411
412         * dom/Node.cpp:
413         (WebCore::Node::isSupportedForBindings): Deleted. This is only used in the
414         legacy bindings, and since it only returns a value other than "true" for
415         SVG features, it is now in the SVGTests class.
416         * dom/Node.h: Updated for the above change.
417
418         * html/HTMLElement.cpp:
419         (WebCore::HTMLElement::click): Call simulateClick with the appropriate
420         arguments rather than calling dispatchSimulatedClickForBindings.
421
422         * svg/SVGTests.cpp:
423         (WebCore::supportedSVGFeatures): Added. Moved here from DOMImplementation,
424         but also refactored.
425         (WebCore::SVGTests::isValid): Changed to use the function above, rather than
426         calling DOMImplementation::hasFeature. This change fixes a bug where feature names
427         that do not look like valid SVG feature names, names such as "xxx", were returning
428         true claiming that the feature was supported. This behavior was helpful in the
429         general DOMImplementation function, but harmful here. This bug was causing test
430         failures in some of our SVG tests.
431         (WebCore::SVGTests::hasFeatureForLegacyBindings): Added. Uses the set above to
432         implement the legacy behavior of hasFeature. It's better to have this in parallel
433         with the SVGTests::isValid function rather than having either depend on the other.
434
435         * svg/SVGTests.h: Added exported SVGTests::isValid function.
436
437 2016-09-05  Commit Queue  <commit-queue@webkit.org>
438
439         Unreviewed, rolling out r205450.
440         https://bugs.webkit.org/show_bug.cgi?id=161614
441
442         Made tests flaky, causing false positives on EWS (Requested by
443         ap on #webkit).
444
445         Reverted changeset:
446
447         "CachedResourceLoader is not taking into account fetch options
448         to use or not cached resources"
449         https://bugs.webkit.org/show_bug.cgi?id=161389
450         http://trac.webkit.org/changeset/205450
451
452 2016-08-31  Filip Pizlo  <fpizlo@apple.com>
453
454         Butterflies should be allocated in Auxiliary MarkedSpace instead of CopiedSpace and we should rewrite as much of the GC as needed to make this not a regression
455         https://bugs.webkit.org/show_bug.cgi?id=160125
456
457         Reviewed by Geoffrey Garen and Keith Miller.
458
459         No new tests because no new WebCore behavior.
460         
461         Just rewiring #includes.
462
463         * ForwardingHeaders/heap/HeapInlines.h: Added.
464         * ForwardingHeaders/interpreter/Interpreter.h: Removed.
465         * ForwardingHeaders/runtime/AuxiliaryBarrierInlines.h: Added.
466         * Modules/indexeddb/IDBCursorWithValue.cpp:
467         * Modules/indexeddb/client/TransactionOperation.cpp:
468         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
469         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
470         * bindings/js/JSApplePayPaymentAuthorizedEventCustom.cpp:
471         * bindings/js/JSApplePayPaymentMethodSelectedEventCustom.cpp:
472         * bindings/js/JSApplePayShippingContactSelectedEventCustom.cpp:
473         * bindings/js/JSApplePayShippingMethodSelectedEventCustom.cpp:
474         * bindings/js/JSClientRectCustom.cpp:
475         * bindings/js/JSDOMBinding.cpp:
476         * bindings/js/JSDOMBinding.h:
477         * bindings/js/JSDeviceMotionEventCustom.cpp:
478         * bindings/js/JSDeviceOrientationEventCustom.cpp:
479         * bindings/js/JSErrorEventCustom.cpp:
480         * bindings/js/JSIDBCursorWithValueCustom.cpp:
481         * bindings/js/JSIDBIndexCustom.cpp:
482         * bindings/js/JSPopStateEventCustom.cpp:
483         * bindings/js/JSWebGL2RenderingContextCustom.cpp:
484         * bindings/js/JSWorkerGlobalScopeCustom.cpp:
485         * bindings/js/WorkerScriptController.cpp:
486         * contentextensions/ContentExtensionParser.cpp:
487         * dom/ErrorEvent.cpp:
488         * html/HTMLCanvasElement.cpp:
489         * html/MediaDocument.cpp:
490         * inspector/CommandLineAPIModule.cpp:
491         * loader/EmptyClients.cpp:
492         * page/CaptionUserPreferences.cpp:
493         * page/Frame.cpp:
494         * page/PageGroup.cpp:
495         * page/UserContentController.cpp:
496         * platform/mock/mediasource/MockBox.cpp:
497         * testing/GCObservation.cpp:
498
499 2016-09-05  Fujii Hironori  <Hironori.Fujii@sony.com>
500
501         run-bindings-tests fails since r205422
502         https://bugs.webkit.org/show_bug.cgi?id=161595
503
504         Reviewed by Darin Adler.
505
506         Rebaseline binding tests after r205422.
507
508         * bindings/scripts/test/JS/JSInterfaceName.cpp:
509         * bindings/scripts/test/JS/JSInterfaceName.h:
510         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
511         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
512         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
513         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
514         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
515         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
516         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
517         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
518         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
519         * bindings/scripts/test/JS/JSTestEventConstructor.h:
520         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
521         * bindings/scripts/test/JS/JSTestEventTarget.h:
522         * bindings/scripts/test/JS/JSTestException.cpp:
523         * bindings/scripts/test/JS/JSTestException.h:
524         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
525         * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
526         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
527         * bindings/scripts/test/JS/JSTestGlobalObject.h:
528         * bindings/scripts/test/JS/JSTestInterface.cpp:
529         * bindings/scripts/test/JS/JSTestInterface.h:
530         * bindings/scripts/test/JS/JSTestIterable.cpp:
531         * bindings/scripts/test/JS/JSTestIterable.h:
532         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
533         * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
534         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
535         * bindings/scripts/test/JS/JSTestNamedConstructor.h:
536         * bindings/scripts/test/JS/JSTestNode.cpp:
537         * bindings/scripts/test/JS/JSTestNode.h:
538         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
539         * bindings/scripts/test/JS/JSTestNondeterministic.h:
540         * bindings/scripts/test/JS/JSTestObj.cpp:
541         * bindings/scripts/test/JS/JSTestObj.h:
542         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
543         * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
544         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
545         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
546         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
547         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
548         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
549         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
550         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
551         * bindings/scripts/test/JS/JSTestTypedefs.h:
552         * bindings/scripts/test/JS/JSattribute.cpp:
553         * bindings/scripts/test/JS/JSattribute.h:
554         * bindings/scripts/test/JS/JSreadonly.cpp:
555         * bindings/scripts/test/JS/JSreadonly.h:
556
557 2016-09-05  Fujii Hironori  <Hironori.Fujii@sony.com>
558
559         [CMake] Duplicated IDL files in WebCore_IDL_FILES
560         https://bugs.webkit.org/show_bug.cgi?id=161592
561
562         Reviewed by Darin Adler.
563
564         * CMakeLists.txt: Removed duplicated IDL files.
565         * DerivedSources.cpp: Added #if ENABLE(USER_MESSAGE_HANDLERS)
566
567 2016-09-05  Joseph Pecoraro  <pecoraro@apple.com>
568
569         [Mac] Static Analyzer warnings about unused values in CDMSessionAVStreamSession.mm
570         https://bugs.webkit.org/show_bug.cgi?id=161598
571
572         Reviewed by Darin Adler.
573
574         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
575         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
576         (WebCore::CDMSessionAVStreamSession::generateKeyReleaseMessage):
577         Make this parameter a reference again, accidentally lost in r195410.
578         Now assignments to the parameter make sense.
579
580 2016-09-05  Youenn Fablet  <youenn@apple.com>
581
582         Clean CSS stylesheets should be accessible from JavaScript
583         https://bugs.webkit.org/show_bug.cgi?id=158728
584
585         Reviewed by Darin Adler.
586
587         Covered by updated tests.
588
589         Making use of the resource response type to evaluate whether to make the CSS stylesheets visible
590         for stylesheet link elements and for stylesheet processing instructions.
591         Ideally, the origin flag should be a boolean.
592
593         To keep behavior consistent in cors-check-unaware cases, the flag might remain unset.
594         In that case, the behavior remains the same (checking of the stylesheet URL).
595         The origin flag is set to true or false only in case of fetch mode being set to cors using the crossorigin attribute.
596
597         Updated CSSStyleSheet::create to take a Node reference. Updated callers accordingly.
598
599         * contentextensions/ContentExtensionStyleSheet.cpp:
600         (WebCore::ContentExtensions::ContentExtensionStyleSheet::ContentExtensionStyleSheet): Updated to pass a Node reference and not pointer.
601         * css/CSSStyleSheet.cpp:
602         (WebCore::CSSStyleSheet::create): Makes origin flag undefined if boolean parameter is not passed.
603         Otherwise origin flag is set according given boolean value.
604         (WebCore::CSSStyleSheet::createInline): Makes origin flag set to true.
605         (WebCore::CSSStyleSheet::CSSStyleSheet): Adding origin flag initialization.
606         (WebCore::CSSStyleSheet::canAccessRules): Returning according the origin flag if set.
607         Returning as before in case the flag is not set.
608         * css/CSSStyleSheet.h: Adding origin clean flag.
609         * dom/ExtensionStyleSheets.cpp:
610         (WebCore::ExtensionStyleSheets::addUserStyleSheet):
611         (WebCore::ExtensionStyleSheets::addAuthorStyleSheetForTesting):
612         (WebCore::ExtensionStyleSheets::maybeAddContentExtensionSheet):
613         * html/HTMLLinkElement.cpp:
614         (WebCore::HTMLLinkElement::initializeStyleSheet): Helper routine used in setCSSStyleSheet.
615         Sets origin clean flag if the resource is clean.
616         (WebCore::HTMLLinkElement::setCSSStyleSheet): Making use of initializeStyleSheet.
617         * html/HTMLLinkElement.h:
618
619 2016-09-05  Youenn Fablet  <youenn@apple.com>
620
621         CachedResourceLoader is not taking into account fetch options to use or not cached resources
622         https://bugs.webkit.org/show_bug.cgi?id=161389
623
624         Reviewed by Darin Adler.
625
626         Tests: http/tests/fetch/fetching-same-resource-with-diffferent-options.html
627                http/tests/security/cross-origin-cached-resource-parallel.html
628                http/tests/security/cross-origin-cached-resource.html
629                http/tests/security/load-image-after-redirection-2.html
630                http/tests/security/shape-outside-and-cached-resources.html
631
632         Adding CORS checks for the response in case of CORS fetch mode, in SubresourceLoader.
633         Removing the CORS checks in Image and DocumentThreadableLoader.
634
635         The direction of this patch is to make CachedResource origin-specific/fetch mode specific.
636
637         This will remove the need for CachedResource clients to do CORS checks when receiving the notifyFinished call.
638         This will also make the computation of whether a resource is clean or not much easier since the CachedResource knowd its origin and its response tainting.
639
640         Removing the CORS checks at ImageLoader creates the risk of using some cached resources loaded from previously no-cors mode without doing the actual CORS check.
641         Note that the risk was already there in case of a resource loaded through redirections.
642         Reusing a cached resource for a load with different options also leads to bad computation of the resource tainting.
643
644         As a first step, improvements are done but only for CachedImage resources.
645
646         This patch limits the direct reuse of cached resources as follow:
647         - If the request and existing resources have different origins.
648         - If the fetch mode is different between request and existing resource.
649
650         In those cases, a new CachedResource is created with the correct options and origin.
651         The data and response of the CachedResource found in the cache are copied efficiently in the new CachedResource, if the matching CachedResource finished loading (CachedImage specific).
652
653         If the matching CachedResource is still loading, we trigger a reload (with caching=false to not disturb the being loaded resource).
654         This should be made more efficient at some point, especially if the matching CachedResource already has its response set.
655
656         This triggers a change of behavior: previously, the CORS checks were done by the ImageLoader when the resource was finished loading.
657         The CORS checks were controlled by the crossOrigin attribute, which may be set or unset between the load start and the load end.
658
659         Now the crossOrigin attribute is checked at load start. If it is set, the CORS checks will happen even if the attribute is unset before the end of the load.
660         This is more consistent as the actual request was built with CORS enabled.
661
662         * loader/CrossOriginPreflightChecker.cpp:
663         (WebCore::CrossOriginPreflightChecker::startPreflight): Setting correctly the preflight options as per fetch spec.
664         * loader/DocumentThreadableLoader.cpp:
665         (WebCore::DocumentThreadableLoader::didReceiveResponse): Removing CORS check.
666         (WebCore::DocumentThreadableLoader::loadRequest): Adding CORS check in sync mode.
667         * loader/ImageLoader.cpp:
668         (WebCore::ImageLoader::updateFromElement):
669         (WebCore::ImageLoader::notifyFinished):
670         * loader/SubresourceLoader.cpp:
671         (WebCore::SubresourceLoader::didReceiveResponse): Adding CORS checks to the response
672         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl): Helper routine to do CORS checks
673         * loader/SubresourceLoader.h:
674         * loader/cache/CachedImage.cpp:
675         (WebCore::CachedImage::cloneData): Responsible to set image content from another CachedImage.
676         * loader/cache/CachedImage.h:
677         * loader/cache/CachedResource.cpp:
678         (WebCore::CachedResource::computeOrigin): Helper routine to set the origin and whether the resource is cross-origin or not.
679         (WebCore::CachedResource::load): Using computeOrigin.
680         (WebCore::CachedResource::loadFrom): Loading from a CachedResource from the same type and which finished loading.
681         * loader/cache/CachedResource.h:
682         (WebCore::CachedResource::cloneData):
683         * loader/cache/CachedResourceLoader.cpp:
684         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Helper routine responsible to adapt the CachedResource
685         that can be reused to the origin and options of a new request.
686         (WebCore::CachedResourceLoader::requestResource): Calling updateCachedResourceWithCurrentRequest before actually returning the resource.
687         (WebCore::CachedResourceLoader::determineRevalidationPolicy): Space clean-up.
688         * loader/cache/CachedResourceLoader.h:
689         * loader/cache/CachedResourceRequest.h:
690         (WebCore::CachedResourceRequest::setCachingPolicy):
691         * style/StylePendingResources.cpp:
692         (WebCore::Style::loadPendingImage): Allowing data URLs for ShapeOutside data.
693
694 2016-09-05  Frederic Wang  <fwang@igalia.com>
695
696         More refactoring of RenderMathMLScripts
697         https://bugs.webkit.org/show_bug.cgi?id=161371
698
699         Reviewed by Darin Adler.
700
701         This is a follow-up of bug 161084. The function getScriptMetricsAndLayoutIfNeeded was quite
702         complicated and it was not obvious that we have to call it twice with the same reference
703         to a struture holding vertical metrics. We extract the part retrieving layout parameters
704         into verticalParameters and move its layoutIfNeeded calls into layoutBlock. Then it can
705         be reduced to a simple function that retrieve the vertical metrics in one call.
706         We also improve getBaseAndScripts to make clear that it is performing validation. It returns
707         a ReferenceChildren structure encapsulating pointers to important children so that we no
708         longer pass these pointers as function parameters. We continue to need them to browse the
709         list of prescripts & postscripts but we refactor a bit the loop to avoid explicit mention
710         of RenderBox*.
711
712         No new tests, already covered by existing tests.
713
714         * rendering/mathml/RenderMathMLScripts.cpp:
715         (WebCore::RenderMathMLScripts::validateAndGetReferenceChildren): We now store the pointers to
716         the base, firstPostScript and firstPreScript children in the ReferenceChildren structure. We
717         also add a pointer to the prescriptDelimiter for convenience.
718         (WebCore::RenderMathMLScripts::italicCorrection): Use the ReferenceChildren structure so that
719         we are sure the base has been validated before calling this function.
720         (WebCore::RenderMathMLScripts::computePreferredLogicalWidths): Retrieve the reference
721         children with validateAndGetReferenceChildren instead of calling getBaseAndScripts and use
722         ReferenceChildren to handle these children and to call italicCorrection. The loops for
723         SubSup, UnderOver, Multiscripts are also rewritten a bit to avoid declaring a null RenderBox*
724         outside of them and hence allow to use auto.
725         (WebCore::RenderMathMLScripts::verticalParameters): This part to extract the layout
726         parameters is extracted from getScriptMetricsAndLayoutIfNeeded. The parameters are returned
727         as a VerticalParameters struct.
728         (WebCore::RenderMathMLScripts::verticalMetrics): This is the remaining part of
729         getScriptMetricsAndLayoutIfNeeded It used to call layoutIfNeeded on children and to
730         calculate maximum vertical metrics. For Multiscripts it was called twice: We did a first
731         call to handle the prescripts and then pass the result again in the second call to handle
732         the postscripts. We modify a bit the loop so that all the scripts are handled in one call and
733         hence we can directly return a VerticalMetrics. Again, the reference children are now handled
734         using the ReferenceChildren structure passed as a parameter.
735         (WebCore::RenderMathMLScripts::layoutBlock): We retrieve the reference children with
736         validateAndGetReferenceChildren instead of calling getBaseAndScripts and use
737         ReferenceChildren to handle these children and to call italicCorrection. We layout all the
738         children if needed in one loop at the beginning instead of doing that when their vertical
739         metrics are needed. We can now also retrieve vertical metrics with a single call.
740         (WebCore::RenderMathMLScripts::getBaseAndScripts): Renamed validateAndGetReferenceChildren.
741         (WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded): Deleted. Split into
742         verticalParameters and verticalMetrics.
743         * rendering/mathml/RenderMathMLScripts.h: New structure to handle the pointers to reference
744         children. Update the signature of getBaseAndScripts to use this struture and give a clearer
745         name. Update the signature of italicCorrection to use this structure too. Add a new structure
746         VerticalParameters and declare the helper function to retrieve them. Rename ScriptMetrics
747         to VerticalMetrics and update the signature of the function needed to retrieve it.
748
749 2016-09-05  Zan Dobersek  <zdobersek@igalia.com>
750
751         MediaPlayerPrivateGStreamerBase: improve build guards in nativeImageForCurrentTime()
752         https://bugs.webkit.org/show_bug.cgi?id=161594
753
754         Reviewed by Philippe Normand.
755
756         Guard the uses of cairo-gl API in nativeImageForCurrentTime() with the
757         USE(CAIRO) && ENABLE(ACCELERATED_2D_CANVAS) pair of build guards. This
758         API is only made available when the ACCELERATED_2D_CANVAS option is
759         enabled. Placing the guards this way thus avoids compilation errors
760         when compiling USE_GSTREAMER_GL code without the accelerated 2D canvas
761         support enabled.
762
763         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
764         (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
765
766 2016-09-04  Sam Weinig  <sam@webkit.org>
767
768         Remove the CREATE_DOM_WRAPPER macro
769         https://bugs.webkit.org/show_bug.cgi?id=161580
770
771         Reviewed by Dan Bernstein.
772
773         The CREATE_DOM_WRAPPER has irritated me for too long! Replace it
774         with direct calls to createWrapper<ImplementationType>, which has
775         been upgraded to not require specifying both the implementation type
776         and the wrapper type by way of the new JSDOMWrapperConverterTraits
777         struct which provides mapping from ImplementationType -> JSWrapper.
778         createWrapper<ImplementationType> has also been upgraded to have a
779         specialization for when the object being passed in needs to be casted.
780
781         * bindings/js/JSAnimationTimelineCustom.cpp:
782         (WebCore::toJSNewlyCreated):
783         * bindings/js/JSBlobCustom.cpp:
784         (WebCore::toJSNewlyCreated):
785         (WebCore::constructJSBlob):
786         * bindings/js/JSCSSRuleCustom.cpp:
787         (WebCore::toJSNewlyCreated):
788         * bindings/js/JSCSSValueCustom.cpp:
789         (WebCore::toJSNewlyCreated):
790         * bindings/js/JSDataCueCustom.cpp:
791         (WebCore::constructJSDataCue):
792         * bindings/js/JSDocumentCustom.cpp:
793         (WebCore::createNewDocumentWrapper):
794         * bindings/js/JSDocumentFragmentCustom.cpp:
795         (WebCore::toJSNewlyCreated):
796         * bindings/js/JSElementCustom.cpp:
797         (WebCore::createNewElementWrapper):
798         * bindings/js/JSEventCustom.cpp:
799         (WebCore::toJSNewlyCreated):
800         * bindings/js/JSFileCustom.cpp:
801         (WebCore::constructJSFile):
802         * bindings/js/JSHTMLCollectionCustom.cpp:
803         (WebCore::toJSNewlyCreated):
804         * bindings/js/JSHTMLDocumentCustom.cpp:
805         (WebCore::toJSNewlyCreated):
806         * bindings/js/JSIDBCursorCustom.cpp:
807         (WebCore::toJSNewlyCreated):
808         * bindings/js/JSImageDataCustom.cpp:
809         (WebCore::toJSNewlyCreated):
810         * bindings/js/JSNodeCustom.cpp:
811         (WebCore::createWrapperInline):
812         * bindings/js/JSNodeListCustom.cpp:
813         (WebCore::createWrapper):
814         * bindings/js/JSPerformanceEntryCustom.cpp:
815         (WebCore::toJSNewlyCreated):
816         * bindings/js/JSSVGPathSegCustom.cpp:
817         (WebCore::toJSNewlyCreated):
818         * bindings/js/JSStyleSheetCustom.cpp:
819         (WebCore::toJSNewlyCreated):
820         * bindings/js/JSTextCustom.cpp:
821         (WebCore::toJSNewlyCreated):
822         * bindings/js/JSTextTrackCueCustom.cpp:
823         (WebCore::toJSNewlyCreated):
824         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
825         (WebCore::toJSNewlyCreated):
826         * bindings/js/JSXMLDocumentCustom.cpp:
827         (WebCore::toJSNewlyCreated):
828         * dom/make_names.pl:
829         (printWrapperFunctions):
830         (printWrapperFactoryCppFile):
831         Replace CREATE_DOM_WRAPPER with direct calls to createWrapper.
832
833         * bindings/js/JSWorkerGlobalScopeBase.h:
834         Add #include of JSDOMWrapper.h to allow generated subclasses to use 
835         JSDOMWrapperConverterTraits.
836
837         * bindings/js/JSDOMBinding.h:
838         (WebCore::castDOMObjectForWrapperCreation): Deleted.
839         Remove CREATE_DOM_WRAPPER and castDOMObjectForWrapperCreation and 
840         specialize createWrapper.
841
842         * bindings/js/JSDOMWrapper.h:
843         Forward declare JSDOMWrapperConverterTraits.
844
845         * bindings/scripts/CodeGeneratorJS.pm:
846         (GenerateHeader):
847         Add specialization of JSDOMWrapperConverterTraits for each header.
848
849         (GenerateImplementation):
850         (GenerateConstructorDefinition):
851         Replace CREATE_DOM_WRAPPER with direct calls to createWrapper.
852
853 2016-09-04  Antti Koivisto  <antti@apple.com>
854
855         Remove Style::PendingResources
856         https://bugs.webkit.org/show_bug.cgi?id=161574
857
858         Reviewed by Andreas Kling.
859
860         RenderStyle contains all the information needed to initialize resource loads. There is no need for this side structure.
861
862         * css/CSSFilterImageValue.cpp:
863         (WebCore::CSSFilterImageValue::loadSubimages):
864
865             Load external SVG resources along with any image resources.
866
867         * css/CSSToStyleMap.cpp:
868         (WebCore::CSSToStyleMap::styleImage):
869         (WebCore::CSSToStyleMap::mapFillImage):
870         (WebCore::CSSToStyleMap::mapNinePieceImage):
871         * css/CSSToStyleMap.h:
872         * css/StyleBuilderConverter.h:
873         (WebCore::StyleBuilderConverter::convertStyleImage):
874         (WebCore::StyleBuilderConverter::convertShapeValue):
875         * css/StyleBuilderCustom.h:
876         (WebCore::StyleBuilderCustom::applyValueCursor):
877         (WebCore::StyleBuilderCustom::applyValueContent):
878         * css/StyleResolver.cpp:
879         (WebCore::StyleResolver::State::clear):
880         (WebCore::StyleResolver::styleImage):
881         (WebCore::StyleResolver::createFilterOperations):
882         (WebCore::StyleResolver::loadPendingResources):
883         (WebCore::StyleResolver::State::ensurePendingResources): Deleted.
884         (WebCore::StyleResolver::styleCachedImageFromValue): Deleted.
885         (WebCore::StyleResolver::styleGeneratedImageFromValue): Deleted.
886         * css/StyleResolver.h:
887         (WebCore::StyleResolver::State::takePendingResources): Deleted.
888         * platform/graphics/filters/FilterOperation.cpp:
889         (WebCore::ReferenceFilterOperation::loadExternalDocumentIfNeeded):
890         (WebCore::ReferenceFilterOperation::getOrCreateCachedSVGDocumentReference): Deleted.
891         * platform/graphics/filters/FilterOperation.h:
892         (WebCore::ReferenceFilterOperation::cachedSVGDocumentReference):
893         * rendering/style/StyleCachedImage.cpp:
894         (WebCore::StyleCachedImage::StyleCachedImage):
895         * style/StylePendingResources.cpp:
896         (WebCore::Style::loadPendingResources):
897
898             Trigger resource loads by checking pending resources in RenderStyle unconditionally. Keeping track of them
899             separately wasn't necessary or a meaningful optimization.
900
901         (WebCore::Style::loadPendingImages): Deleted.
902         (WebCore::Style::loadPendingSVGFilters): Deleted.
903         * style/StylePendingResources.h:
904
905 2016-09-04  Antti Koivisto  <antti@apple.com>
906
907         Reverse ownership relation of StyleCachedImage and CSSImageValue
908         https://bugs.webkit.org/show_bug.cgi?id=161447
909
910         Reviewed by Andreas Kling.
911
912         Currently StyleCachedImage (which represents an image in RenderStyle) has a weak ref to the
913         underlying CSSImageValue/CSSImageSetValue which actually owns it. This is awkwards especially since
914         StyleGeneratedImage, the other StyleImage subclass has reversed relationship where it refs
915         the underlying CSSImageGeneratorValue.
916
917         This patch makes StyleCachedImage similar to StyleGeneratedImage. StyleCachedImage now refs the
918         underlying CSSImageValue/CSSImageSetValue. CSSImageValues no longer need to know about StyleCachedImage.
919         Instead they reference CachedImages (memory cache objects) directly. StyleCachedImage instances are now
920         conceptually unique to RenderStyle instances. Actual resources are shared as before by sharing CachedImages.
921
922         * css/CSSCursorImageValue.cpp:
923         (WebCore::CSSCursorImageValue::loadImage):
924         (WebCore::CSSCursorImageValue::cachedImage):
925         (WebCore::CSSCursorImageValue::styleImage): Deleted.
926         * css/CSSCursorImageValue.h:
927         * css/CSSImageGeneratorValue.cpp:
928         (WebCore::CSSImageGeneratorValue::cachedImageForCSSValue):
929         * css/CSSImageSetValue.cpp:
930         (WebCore::CSSImageSetValue::~CSSImageSetValue):
931         (WebCore::CSSImageSetValue::loadBestFitImage):
932         (WebCore::CSSImageSetValue::traverseSubresources):
933         (WebCore::CSSImageSetValue::styleImage): Deleted.
934         * css/CSSImageSetValue.h:
935         * css/CSSImageValue.cpp:
936         (WebCore::CSSImageValue::CSSImageValue):
937         (WebCore::CSSImageValue::~CSSImageValue):
938         (WebCore::CSSImageValue::isPending):
939         (WebCore::CSSImageValue::loadImage):
940         (WebCore::CSSImageValue::traverseSubresources):
941         (WebCore::CSSImageValue::knownToBeOpaque):
942         (WebCore::CSSImageValue::styleImage): Deleted.
943         * css/CSSImageValue.h:
944         * css/StyleBuilderCustom.h:
945         (WebCore::StyleBuilderCustom::applyValueContent):
946         * css/StyleResolver.cpp:
947         (WebCore::StyleResolver::styleImage):
948         (WebCore::StyleResolver::styleCachedImageFromValue):
949         (WebCore::StyleResolver::styleGeneratedImageFromValue):
950         (WebCore::StyleResolver::cachedOrPendingFromValue): Deleted.
951         (WebCore::StyleResolver::generatedOrPendingFromValue): Deleted.
952         (WebCore::StyleResolver::setOrPendingFromValue): Deleted.
953         (WebCore::StyleResolver::cursorOrPendingFromValue): Deleted.
954         * css/StyleResolver.h:
955         * editing/TextIterator.cpp:
956         (WebCore::fullyClipsContents):
957         * page/PageSerializer.cpp:
958         (WebCore::PageSerializer::retrieveResourcesForProperties):
959         * rendering/style/FillLayer.cpp:
960         (WebCore::FillLayer::imagesIdentical):
961
962             Compare data equality instead of pointer equality for StyleImages (since StyleImages are no longer shared).
963
964         (WebCore::layerImagesIdentical): Deleted.
965         * rendering/style/StyleCachedImage.cpp:
966         (WebCore::StyleCachedImage::StyleCachedImage):
967         (WebCore::StyleCachedImage::~StyleCachedImage):
968         (WebCore::StyleCachedImage::cachedImage):
969         (WebCore::StyleCachedImage::cssValue):
970         (WebCore::StyleCachedImage::canRender):
971         (WebCore::StyleCachedImage::isPending):
972         (WebCore::StyleCachedImage::isLoaded):
973         (WebCore::StyleCachedImage::errorOccurred):
974         (WebCore::StyleCachedImage::imageSize):
975         (WebCore::StyleCachedImage::imageHasRelativeWidth):
976         (WebCore::StyleCachedImage::imageHasRelativeHeight):
977         (WebCore::StyleCachedImage::computeIntrinsicDimensions):
978         (WebCore::StyleCachedImage::usesImageContainerSize):
979         (WebCore::StyleCachedImage::setContainerSizeForRenderer):
980         (WebCore::StyleCachedImage::addClient):
981         (WebCore::StyleCachedImage::removeClient):
982         (WebCore::StyleCachedImage::image):
983         (WebCore::StyleCachedImage::knownToBeOpaque):
984         (WebCore::StyleCachedImage::setCachedImage): Deleted.
985         * rendering/style/StyleCachedImage.h:
986
987 2016-09-03  Wenson Hsieh  <wenson_hsieh@apple.com>
988
989         Media controls behave strangely when videos mute from within a playing handler
990         https://bugs.webkit.org/show_bug.cgi?id=161559
991         <rdar://problem/28018438>
992
993         Reviewed by Darin Adler.
994
995         Defer showing media controls until after the media element has fired its onplaying handler. This handles cases
996         where videos that autoplay may initially meet the criteria for main content, but once the video begins to play,
997         the page may change the media in some way (e.g. muting) that makes the video no longer main content. This causes
998         media controls to flicker in and out.
999
1000         These changes are covered by existing unit tests, which have been refactored to check media controller state
1001         after all autoplaying videos have begun playing. Also adds an additional unit test.
1002
1003         * html/HTMLMediaElement.cpp:
1004         (WebCore::HTMLMediaElement::notifyAboutPlaying):
1005         (WebCore::HTMLMediaElement::hasEverNotifiedAboutPlaying):
1006         * html/HTMLMediaElement.h:
1007         * html/MediaElementSession.cpp:
1008         (WebCore::MediaElementSession::canShowControlsManager):
1009
1010 2016-09-03  Ryosuke Niwa  <rniwa@webkit.org>
1011
1012         Update the semantics of defined-ness of custom elements per spec changes
1013         https://bugs.webkit.org/show_bug.cgi?id=161570
1014
1015         Reviewed by Darin Adler.
1016
1017         This patch adds the notion of a custom element that failed to construct or upgrade so that :defined
1018         doesn't apply to such an element. We also set the defined flag inside the HTMLElement constructor in
1019         the case of synchronous construction instead of waiting for the custom element constructor to finish.
1020         https://dom.spec.whatwg.org/#concept-create-element
1021
1022         Conceptually, there are four distinct states for an element:
1023         1. The element is a built-in element
1024         2. The element is a custom element yet to be defined (an upgrade candidate).
1025         3. The element is a well-defined custom element (constructed or upgraded).
1026         4. The element has failed to construct or upgrade as a custom element (because the custom element
1027         constructor threw an exception or returned an unexpected object).
1028
1029         In the latest DOM/HTML specifications, these states are called as 1. "uncustomized", 2. "undefined",
1030         3. "custom", and 4. "failed": https://dom.spec.whatwg.org/#concept-element-defined
1031
1032         This patch refactors Node flags to introduce these distinct states as the following:
1033         1. Neither IsCustomElement nor IsEditingTextOrUnresolvedCustomElementFlag is set.
1034         2. IsCustomElement and IsEditingTextOrUnresolvedCustomElementFlag are set.
1035         isCustomElementUpgradeCandidate() and isUndefinedCustomElement() return true.
1036         3. IsCustomElement is set and IsEditingTextOrUnresolvedCustomElementFlag is unset.
1037         isDefinedCustomElement() returns true.
1038         4. IsCustomElement is unset and IsEditingTextOrUnresolvedCustomElementFlag is set.
1039         isFailedCustomElement() and isUndefinedCustomElement() return true.
1040
1041         Per a spec change, this patch also makes :defined applied to a synchronously constructed custom element
1042         immediately after super() call in the constructor. When the constructor throws an exception or fails to
1043         return the right element, the HTML parser marks the fallback element with setIsUndefinedCustomElement.
1044
1045         Tests: fast/custom-elements/defined-pseudo-class.html
1046                fast/custom-elements/defined-rule.html
1047                fast/custom-elements/upgrading/Node-cloneNode.html
1048
1049         * bindings/js/JSCustomElementInterface.cpp:
1050         (WebCore::JSCustomElementInterface::constructElement): Don't set :defined flag here since that's done
1051         in the HTMLElement constructor now.
1052         (WebCore::JSCustomElementInterface::upgradeElement): Mark the element as failed-to-upgrade as needed.
1053         * bindings/js/JSElementCustom.cpp:
1054         (WebCore::toJSNewlyCreated):
1055         * bindings/js/JSHTMLElementCustom.cpp:
1056         (WebCore::constructJSHTMLElement):
1057         * css/SelectorCheckerTestFunctions.h:
1058         (WebCore::isDefinedElement):
1059         * dom/CustomElementReactionQueue.cpp:
1060         (WebCore::CustomElementReactionQueue::enqueueElementUpgradeIfDefined): Enqueue custom element reactions
1061         only if the element is well defined (successfully constructed or upgraded).
1062         (WebCore::CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded): Ditto.
1063         (WebCore::CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded): Ditto.
1064         (WebCore::CustomElementReactionQueue::enqueueAdoptedCallbackIfNeeded): Ditto.
1065         (WebCore::CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded): Ditto.
1066         * dom/CustomElementRegistry.cpp:
1067         (WebCore::enqueueUpgradeInShadowIncludingTreeOrder):
1068         * dom/Document.cpp:
1069         (WebCore::createUpgradeCandidateElement):
1070         (WebCore::createFallbackHTMLElement):
1071         * dom/Element.cpp:
1072         (WebCore::Element::attributeChanged):
1073         (WebCore::Element::didMoveToNewDocument):
1074         (WebCore::Element::insertedInto):
1075         (WebCore::Element::removedFrom):
1076         (WebCore::Element::setCustomElementIsResolved): Deleted.
1077         (WebCore::Element::setIsDefinedCustomElement): Renamed from setCustomElementIsResolved.
1078         (WebCore::Element::setIsFailedCustomElement): Added.
1079         (WebCore::Element::setIsCustomElementUpgradeCandidate): Added.
1080         (WebCore::Element::customElementInterface):
1081         * dom/Element.h:
1082         * dom/Node.h:
1083         (WebCore::Node::setIsCustomElement): Deleted.
1084         (WebCore::Node::isUndefinedCustomElement): Renamed from isUnresolvedCustomElement.
1085         (WebCore::Node::setIsUnresolvedCustomElement): Deleted.
1086         (WebCore::Node::isCustomElementUpgradeCandidate): Added.
1087         (WebCore::Node::isDefinedCustomElement): Renamed from isCustomElement.
1088         (WebCore::Node::isFailedCustomElement): Added.
1089         * dom/make_names.pl:
1090         (printWrapperFactoryCppFile): Use the HTMLElement wrapper on upgrade candidates. When a custom element
1091         failed to upgrade, the HTMLElement constructor would have created the wrapper so we never run this code.
1092         * html/parser/HTMLConstructionSite.cpp:
1093         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface): 
1094         * html/parser/HTMLDocumentParser.cpp:
1095         (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder): Mark the HTMLUnknownElement created when
1096         the custom element constructor failed to run successfully as a failed custom element so that :define
1097         wouldn't apply to this element.
1098
1099 2016-09-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1100
1101         Refactor the heuristic for showing media controls to take all media sessions into account
1102         https://bugs.webkit.org/show_bug.cgi?id=161503
1103         <rdar://problem/28033783>
1104
1105         Reviewed by Darin Adler.
1106
1107         Currently, when selecting a media session to show playback controls for, we grab the first media session that
1108         passes our heuristic. Using this method, we are unable to take additional factors into account, such as whether
1109         another media session's element is scrolled in view, or if another media session has been interacted with more
1110         recently. To address this, we make the following changes:
1111
1112             1.  Consider the list of all MediaElementSessions.
1113
1114             2.  Select only the MediaElementSessions capable of showing media controls and sort the list by a special
1115                 heuristic that takes visibility and time of last user interaction into account. The first element on
1116                 this list is the strongest candidate for main content.
1117
1118             3.  If this strongest candidate is visible in the viewport, or it is playing with audio, we return this
1119                 as the chosen candidate. Otherwise, we return this session only if no other non-candidate video could be
1120                 confused as the main content (i.e. the non-candidate video is not only visible in the viewport, but also
1121                 large enough to be considered main content).
1122
1123         Using this new method of determining the video to show controls for, we retain previous behavior for pages with
1124         a single video. On pages with multiple videos, the above logic ensures that if the current controlled video is
1125         paused, scrolled out of view, and then a new video is scrolled into view, we will either hide media controls to
1126         avoid confusion if that video could be confused for main content (using the mechanism in step 3), or we
1127         hook up the media controls to the new video if it satisfies main content (using the mechanism in step 2).
1128
1129         This patch also adds 6 new TestWebKitAPI unit tests.
1130
1131         * html/HTMLMediaElement.cpp:
1132         (WebCore::mediaElementSessionInfoForSession):
1133         (WebCore::preferMediaControlsForCandidateSessionOverOtherCandidateSession):
1134         (WebCore::mediaSessionMayBeConfusedWithMainContent):
1135         (WebCore::bestMediaSessionForShowingPlaybackControlsManager):
1136         (WebCore::HTMLMediaElement::didAttachRenderers):
1137         (WebCore::HTMLMediaElement::layoutSizeChanged):
1138         (WebCore::HTMLMediaElement::isVisibleInViewportChanged):
1139         (WebCore::HTMLMediaElement::resetPlaybackSessionState):
1140         (WebCore::HTMLMediaElement::isVisibleInViewport):
1141         (WebCore::HTMLMediaElement::updatePlaybackControlsManager):
1142         * html/HTMLMediaElement.h:
1143         * html/MediaElementSession.cpp:
1144         (WebCore::MediaElementSession::removeBehaviorRestriction):
1145         (WebCore::MediaElementSession::canShowControlsManager):
1146         (WebCore::MediaElementSession::isLargeEnoughForMainContent):
1147         (WebCore::MediaElementSession::mostRecentUserInteractionTime):
1148         (WebCore::MediaElementSession::wantsToObserveViewportVisibilityForMediaControls):
1149         (WebCore::MediaElementSession::wantsToObserveViewportVisibilityForAutoplay):
1150         (WebCore::MediaElementSession::resetPlaybackSessionState):
1151         (WebCore::MediaElementSession::canControlControlsManager): Deleted.
1152         * html/MediaElementSession.h:
1153         * platform/audio/PlatformMediaSession.h:
1154         (WebCore::PlatformMediaSession::resetPlaybackSessionState):
1155         (WebCore::PlatformMediaSession::canControlControlsManager): Deleted.
1156         * platform/audio/PlatformMediaSessionManager.cpp:
1157         (WebCore::PlatformMediaSessionManager::currentSessionsMatching):
1158         (WebCore::PlatformMediaSessionManager::currentSessionMatching): Deleted.
1159         * platform/audio/PlatformMediaSessionManager.h:
1160         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
1161         (WebPlaybackSessionModelMediaElement::setMediaElement):
1162
1163 2016-09-03  Darin Adler  <darin@apple.com>
1164
1165         Streamline DOMImplementation, and move it to our new DOM exception system
1166         https://bugs.webkit.org/show_bug.cgi?id=161295
1167
1168         Reviewed by Ryosuke Niwa.
1169
1170         * WebCore.xcodeproj/project.pbxproj: Added new headers to project.
1171
1172         * bindings/js/JSDOMBinding.h:
1173         (WebCore::toJS): Added an overload for ExceptionOr<>; this handles the
1174         exception case here so it doesn't need to be handled in generated code
1175         for the binding. Implemented here so that ExceptionOr.h does not know
1176         about bindings. But since this is a template, it will only compile when
1177         instantiated and there is no need to include ExceptionOr.h and indirectly
1178         the Variant.h header in this header.
1179         (WebCore::toJSNewlyCreated): Ditto.
1180
1181         * bindings/scripts/CodeGeneratorJS.pm:
1182         (GenerateCallbackImplementation): Refer to JSC::Exception with explicit
1183         namespace to avoid ambiguity with WebCore::Exception.
1184
1185         * dom/DOMImplementation.cpp:
1186         (WebCore::DOMImplementation::createDocumentType): Changed to return
1187         ExceptionOr.
1188         (WebCore::createXMLDocument): Added. Helper used in createDocument.
1189         (WebCore::DOMImplementation::getInterface): Deleted. This was unused.
1190         (WebCore::DOMImplementation::createDocument): Changed to return
1191         ExceptionOr.
1192         (WebCore::DOMImplementation::createCSSStyleSheet): Removed the unused
1193         ExceptionCode out argument.
1194         (WebCore::isValidXMLMIMETypeChar): Deleted. Moved to MIMETypeRegistry.
1195         (WebCore::DOMImplementation::isXMLMIMEType): Ditto.
1196         (WebCore::DOMImplementation::isTextMIMEType): Ditto.
1197
1198         * dom/DOMImplementation.h: Changed functions as described above to
1199         return ExceptionOr values. Also removed unused getInterface function,
1200         and isXMLMIMEType and isTextMIMEType, which both moved to the
1201         MIMETypeRegistry class alongside all the other similar MIME type
1202         functions.
1203
1204         * dom/DOMImplementation.idl: Reorganized this to match the IDL files
1205         in the specifications a little better. Also removed [RaisesException]
1206         since that is only needed for the old legacy ExceptionCode& style.
1207
1208         * dom/Document.cpp:
1209         (WebCore::Document::setXMLVersion): Removed call to the
1210         DOMImplementation::hasFeature function since the values passed in
1211         unconditionally result in the return value "true". This is left over
1212         either from specification language, or from an ancient version of this
1213         code that worked in a "no XML supported" mode.
1214         (WebCore::Document::setXMLStandalone): Ditto.
1215
1216         * dom/Document.h: Removed the ExceptionCode& out argument from setXMLStandalone.
1217         * dom/Document.idl: Removed [SetterRaisesException] from xmlStandalone.
1218
1219         * dom/Exception.h: Added.
1220         * dom/ExceptionOr.h: Added.
1221
1222         * html/HTMLTemplateElement.cpp: Removed unneeded include of DOMImplementation.h.
1223
1224         * inspector/InspectorPageAgent.cpp:
1225         (WebCore::createXHRTextDecoder): Use isXMLMIMEType in its new location in
1226         MIMETypeRegistry.
1227         * inspector/NetworkResourcesData.cpp:
1228         (WebCore::createOtherResourceTextDecoder): Ditto.
1229
1230         * loader/FrameLoader.cpp: Removed unneeded include of DOMImplementation.h.
1231
1232         * loader/TextResourceDecoder.cpp:
1233         (WebCore::TextResourceDecoder::determineContentType): Use isXMLMIMEType in its
1234         new location in MIMETypeRegistry.
1235
1236         * platform/MIMETypeRegistry.cpp:
1237         (WebCore::MIMETypeRegistry::isTextMIMEType): Added. Moved here from
1238         DOMImplementation.
1239         (WebCore::isValidXMLMIMETypeChar): Ditto.
1240         (WebCore::MIMETypeRegistry::isXMLMIMEType): Ditto.
1241
1242         * platform/MIMETypeRegistry.h: Added isXMLMIMEType and isTextMIMEType.
1243         Made isUnsupportedTextMIMEType private.
1244
1245         * svg/SVGElement.cpp:
1246         (WebCore::SVGElement::isSupported): Deleted. This function was never called.
1247         * svg/SVGElement.h: Updated for the above change.
1248
1249         * xml/XMLHttpRequest.cpp:
1250         (WebCore::XMLHttpRequest::responseIsXML): Use isXMLMIMEType in its new
1251         location in MIMETypeRegistry.
1252
1253         * xml/parser/XMLDocumentParserLibxml2.cpp:
1254         (WebCore::XMLDocumentParser::startDocument): Updated since setXMLStandalone
1255         no longer can raise an exception.
1256
1257 2016-09-03  Ryosuke Niwa  <rniwa@webkit.org>
1258
1259         Unbreak customElements.whenDefined after r205383 with a crash fix
1260         https://bugs.webkit.org/show_bug.cgi?id=161562
1261
1262         Reviewed by Darin Adler.
1263
1264         The crash was caused by DeferredWrapper::contextDestroyed not calling ContextDestructionObserver::contextDestroyed.
1265
1266         This caused m_scriptExecutionContext to not being set to nullptr when the Document was destroyed before DOMWindow
1267         during a single GC sweeping, and resulted in a use-after-free in ContextDestructionObserver's destructor.
1268
1269         Fixed the crash and reverted r205383.
1270
1271         Tests: fast/custom-elements/CustomElementRegistry.html
1272
1273         * bindings/js/JSCustomElementRegistryCustom.cpp:
1274         (WebCore::whenDefinedPromise):
1275         * bindings/js/JSDOMPromise.cpp:
1276         (WebCore::DeferredWrapper::contextDestroyed): Fixed the crash.
1277         * dom/CustomElementRegistry.cpp:
1278         (WebCore::CustomElementRegistry::addElementDefinition):
1279         * dom/CustomElementRegistry.h:
1280         (WebCore::CustomElementRegistry::promiseMap):
1281
1282 2016-09-03  Chris Dumez  <cdumez@apple.com>
1283
1284         Align cross-Origin Object.getOwnPropertyNames() with the HTML specification
1285         https://bugs.webkit.org/show_bug.cgi?id=161457
1286
1287         Reviewed by Darin Adler.
1288
1289         Align cross-Origin Object.getOwnPropertyNames() with the HTML specification:
1290         - https://html.spec.whatwg.org/#windowproxy-ownpropertykeys
1291         - https://html.spec.whatwg.org/#location-ownpropertykeys
1292         - https://html.spec.whatwg.org/#crossoriginproperties-(-o-)
1293
1294         We should list cross origin properties.
1295
1296         Firefox complies with the specification. However, WebKit was returning an
1297         empty array and logs a security error message.
1298
1299         No new tests, updated existing test.
1300
1301         * bindings/js/JSDOMWindowCustom.cpp:
1302         (WebCore::addCrossOriginPropertyNames):
1303         (WebCore::JSDOMWindow::getOwnPropertyNames):
1304         * bindings/js/JSLocationCustom.cpp:
1305         (WebCore::addCrossOriginPropertyNames):
1306         (WebCore::JSLocation::getOwnPropertyNames):
1307
1308 2016-09-03  Frédéric Wang  <fwang@igalia.com>
1309
1310         Constructors of MathML renderers should only accept MathMLPresentationElement-derived classes
1311         https://bugs.webkit.org/show_bug.cgi?id=161378
1312
1313         Reviewed by Darin Adler.
1314
1315         We update constructors of RenderMathMLBlock, to only accept MathMLPresentationElement
1316         instances as a parameter. Similarly, we make the constructor of RenderMathMLToken only
1317         accept MathMLTokenElement instances.
1318
1319         No new tests, behavior is unchanged.
1320
1321         * rendering/mathml/RenderMathMLBlock.cpp:
1322         (WebCore::RenderMathMLBlock::RenderMathMLBlock):
1323         * rendering/mathml/RenderMathMLBlock.h:
1324         * rendering/mathml/RenderMathMLToken.cpp:
1325         (WebCore::RenderMathMLToken::RenderMathMLToken):
1326         * rendering/mathml/RenderMathMLToken.h:
1327
1328 2016-09-03  Brian Weinstein  <bweinstein@apple.com>
1329
1330         Consult with the FrameLoaderClient about whether or not content extensions should be enabled when loading this URL.
1331         https://bugs.webkit.org/show_bug.cgi?id=161441
1332
1333         Reviewed by Darin Adler.
1334
1335         * loader/DocumentLoader.cpp:
1336         (WebCore::DocumentLoader::startLoadingMainResource): If content extensions aren't already disabled, consult with the
1337         FrameLoaderClient about whether or not we should use content extensions for this URL.
1338         * loader/FrameLoaderClient.h: Add the FrameLoaderClient call to determine if we should use content extensions for a given
1339         URL...
1340         * loader/EmptyClients.h: ... And add a stub implementation.
1341
1342 2016-09-03  Michael Catanzaro  <mcatanzaro@igalia.com>
1343
1344         Silence -Wparentheses warning triggered by r205266
1345
1346         Unreviewed
1347
1348         * platform/URL.cpp:
1349         (WebCore::URL::URL):
1350
1351 2016-09-03  Joseph Pecoraro  <pecoraro@apple.com>
1352
1353         Use ASCIILiteral in some more places
1354         https://bugs.webkit.org/show_bug.cgi?id=161557
1355
1356         Reviewed by Darin Adler.
1357
1358         * Modules/indexeddb/IDBDatabaseException.cpp:
1359         (WebCore::IDBDatabaseException::getErrorName):
1360         (WebCore::IDBDatabaseException::getErrorDescription):
1361         * Modules/websockets/WebSocket.cpp:
1362         (WebCore::WebSocket::binaryType):
1363         * css/FontFace.cpp:
1364         (WebCore::FontFace::stretch):
1365         (WebCore::FontFace::unicodeRange):
1366         (WebCore::FontFace::featureSettings):
1367         * html/canvas/WebGLRenderingContextBase.cpp:
1368         * html/parser/HTMLPreloadScanner.cpp:
1369         (WebCore::TokenPreloadScanner::initiatorFor):
1370         * loader/FormSubmission.cpp:
1371         (WebCore::FormSubmission::Attributes::parseEncodingType):
1372         * page/SecurityOrigin.cpp:
1373         (WebCore::SecurityOrigin::toRawString):
1374         * platform/graphics/cg/ImageBufferCG.cpp:
1375         (WebCore::CGImageToDataURL):
1376         (WebCore::ImageBuffer::toDataURL):
1377         (WebCore::ImageDataToDataURL):
1378         * svg/graphics/SVGImage.cpp:
1379         (WebCore::SVGImage::filenameExtension):
1380
1381 2016-09-03  Chris Dumez  <cdumez@apple.com>
1382
1383         Object.preventExtensions(window) should throw a TypeError
1384         https://bugs.webkit.org/show_bug.cgi?id=161554
1385
1386         Reviewed by Darin Adler.
1387
1388         Object.preventExtensions(window) should throw a TypeError.
1389
1390         [[PreventExtensions]] should return false for Window:
1391         - https://html.spec.whatwg.org/#windowproxy-preventextensions
1392
1393         EcmaScript says that Object.preventExtensions() should throw a TypeError
1394         if [[PreventExtension]] returns false:
1395         - https://tc39.github.io/ecma262/#sec-object.preventextensions
1396
1397         No new tests, updated existing test.
1398
1399         * bindings/js/JSDOMWindowCustom.cpp:
1400         (WebCore::JSDOMWindow::preventExtensions):
1401
1402 2016-09-03  Chris Dumez  <cdumez@apple.com>
1403
1404         Align meta element http-equiv="refresh" parsing with the HTML specification
1405         https://bugs.webkit.org/show_bug.cgi?id=161543
1406
1407         Reviewed by Darin Adler.
1408
1409         Align meta element http-equiv="refresh" parsing with the HTML specification:
1410         - https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-refresh
1411
1412         Tests: imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html
1413
1414         * dom/Document.cpp:
1415         (WebCore::Document::processHttpEquiv):
1416         * html/parser/HTMLParserIdioms.cpp:
1417         (WebCore::parseHTTPRefreshInternal):
1418         (WebCore::parseMetaHTTPEquivRefresh):
1419         * html/parser/HTMLParserIdioms.h:
1420         * loader/FrameLoader.cpp:
1421         (WebCore::FrameLoader::receivedFirstData):
1422         * platform/network/HTTPParsers.cpp:
1423         (WebCore::skipWhiteSpace):
1424         (WebCore::skipEquals):
1425         (WebCore::parseHTTPRefresh):
1426         (WebCore::parseXSSProtectionHeader):
1427         (WebCore::skipValue): Deleted.
1428         * platform/network/HTTPParsers.h:
1429
1430 2016-09-02  Myles C. Maxfield  <mmaxfield@apple.com>
1431
1432         [Cocoa] Distinguish between paint advances and base advances
1433         https://bugs.webkit.org/show_bug.cgi?id=160892
1434
1435         Reviewed by Simon Fraser.
1436
1437         This patch introduces the concept of a layout (or "base") advance which is distinct
1438         from a painting advance. In extremely complicated scripts such as Urdu, it is common
1439         for a glyph advance to be negative in the horizontal direction, and have large advances
1440         in the vertical direction. In particular, in cursive scripts, the glyph placement is
1441         only indirectly related to where the actual characters lie. Conceptually, these glyph
1442         locations are correct for painting, but are not correct when performing width
1443         measurements.
1444
1445         In many text engines, glyph shaping actually can be split into two phases: adjusting
1446         advances, and then placing glyphs relative to those advances. The secondary glyph
1447         placement step is much more context-sensitive than the first step. In addition, when
1448         multiple glyphs combine to form a character, it is common for one glyph to own the
1449         full base advance for the character, and for the other glyphs in the character to
1450         have zero base advances. (Then, in the glyph placement phase, the other glyphs get
1451         placed all around.)
1452
1453         Because of the context-insensitivity of the base advances, it is valuable to use
1454         these for text measurement. Then, when we want to paint, we should add in the extra
1455         origins. This dramatically improves the layout of complex fonts like Noto Nastaliq.
1456
1457         This patch migrates WebKit to use this two-phase shaping.
1458
1459         No new tests just yet, because I have to create a font which exercises the
1460         advanced glyph placement support.
1461
1462         * platform/graphics/GlyphBuffer.h:
1463         (WebCore::GlyphBufferAdvance::setHeight):
1464         (WebCore::GlyphBufferAdvance::setWidth): Deleted.
1465         * platform/graphics/TextRun.h:
1466         (WebCore::TextRun::TextRun):
1467         (WebCore::TextRun::shouldDisableLayoutSpecificAdvances):
1468         (WebCore::TextRun::setShouldDisableLayoutSpecificAdvances):
1469         (WebCore::TextRun::spacingDisabled): Deleted.
1470         (WebCore::TextRun::setCharacterScanForCodePath): Deleted.
1471         * platform/graphics/cocoa/FontCascadeCocoa.mm:
1472         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
1473         * platform/graphics/mac/ComplexTextController.cpp:
1474         (WebCore::ComplexTextController::ComplexTextController):
1475         (WebCore::ComplexTextController::offsetForPosition):
1476         (WebCore::ComplexTextController::collectComplexTextRuns):
1477         (WebCore::ComplexTextController::ComplexTextRun::setIsNonMonotonic):
1478         (WebCore::ComplexTextController::runWidthSoFarFraction):
1479         (WebCore::ComplexTextController::advance):
1480         (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
1481         * platform/graphics/mac/ComplexTextController.h:
1482         (WebCore::ComplexTextController::ComplexTextRun::create):
1483         (WebCore::ComplexTextController::ComplexTextRun::baseAdvances):
1484         (WebCore::ComplexTextController::ComplexTextRun::glyphOrigins):
1485         (WebCore::ComplexTextController::useLayoutSpecificAdvances):
1486         (WebCore::ComplexTextController::finalRoundingWidth): Deleted.
1487         (WebCore::ComplexTextController::ComplexTextRun::advances): Deleted.
1488         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
1489         (SOFT_LINK):
1490         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
1491         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
1492         * platform/spi/cocoa/CoreTextSPI.h:
1493
1494 2016-09-02  Zalan Bujtas  <zalan@apple.com>
1495
1496         Should never be reached failure in WebCore::floatValueForLength
1497         https://bugs.webkit.org/show_bug.cgi?id=139397
1498         <rdar://problem/27704376>
1499
1500         Reviewed by Simon Fraser.
1501
1502         floatValueForLength can't resolve unspecified Length types. Filter them out and return 0 as if they were auto.
1503
1504         Test: svg/css/assert-on-non-resolvable-dimension.html
1505
1506         * svg/SVGLengthContext.cpp:
1507         (WebCore::SVGLengthContext::valueForLength):
1508
1509 2016-09-02  Joseph Pecoraro  <pecoraro@apple.com>
1510
1511         [Mac] Remove unnecessary RetainPtr in NeverDestroyed value
1512         https://bugs.webkit.org/show_bug.cgi?id=161553
1513
1514         Reviewed by Daniel Bates.
1515
1516         * platform/ios/WebCoreMotionManager.mm:
1517         (+[WebCoreMotionManager sharedManager]):
1518
1519 2016-09-02  Alex Christensen  <achristensen@webkit.org>
1520
1521         URLParser should parse file URLs
1522         https://bugs.webkit.org/show_bug.cgi?id=161556
1523
1524         Reviewed by Tim Horton.
1525
1526         Added new API tests.
1527
1528         * platform/URLParser.cpp:
1529         (WebCore::isWindowsDriveLetter):
1530         (WebCore::shouldCopyFileURL):
1531         (WebCore::URLParser::parse):
1532         (WebCore::URLParser::parseHost):
1533         * platform/URLParser.h:
1534
1535 2016-09-02  Ryosuke Niwa  <rniwa@webkit.org>
1536
1537         Add validations for a synchronously constructed custom element
1538         https://bugs.webkit.org/show_bug.cgi?id=161528
1539
1540         Reviewed by Yusuke Suzuki.
1541
1542         The latest DOM specification has sanity checks when creating an element with the synchronous custom elements flag set
1543         in 6.1.3 through 10:
1544         3. If result does not implement the HTMLElement interface, throw a TypeError.
1545         4. If result's attribute list is not empty, then throw a NotSupportedError.
1546         5. If result has children, then throw a NotSupportedError.
1547         6. If result's parent is not null, then throw a NotSupportedError.
1548         7. If result's node document is not document, then throw a NotSupportedError.
1549         8. If result's namespace is not the HTML namespace, then throw a NotSupportedError.
1550         9. If result's local name is not equal to localName, then throw a NotSupportedError.
1551
1552         Add all these checks to JSCustomElementInterface::constructElement.
1553
1554         Tests: fast/custom-elements/Document-createElement.html
1555
1556         * bindings/js/JSCustomElementInterface.cpp:
1557         (WebCore::JSCustomElementInterface::constructElement): Report the exception thrown during parsing instead of just
1558         clearing and ignoring it.
1559         (WebCore::constructCustomElementSynchronously): Extracted out of constructElement so that we can also catch TypeError
1560         and NotSupportedError we throw in constructElement for the parser.
1561
1562 2016-09-02  Zalan Bujtas  <zalan@apple.com>
1563
1564         ASSERT_NOT_REACHED() is touched in WebCore::valueForLength
1565         https://bugs.webkit.org/show_bug.cgi?id=123337
1566         <rdar://problem/27684121>
1567
1568         Reviewed by Simon Fraser.
1569
1570         Do not try to use unspecified height value while resolving logical height for table row.
1571
1572         Test: fast/table/assert-on-non-resolvable-row-dimension.html
1573
1574         * rendering/RenderTableCell.h:
1575         (WebCore::RenderTableCell::logicalHeightForRowSizing):
1576
1577 2016-09-02  Ryosuke Niwa  <rniwa@webkit.org>
1578
1579         Temporarily break customElements.whenDefined to remove flaky crashes
1580         https://bugs.webkit.org/show_bug.cgi?id=161555
1581
1582         Reviewed by Chris Dumez.
1583
1584         Remove HashMap of DeferredWrapper which causes a crash during destruction.
1585         This breaks the semantics of "whenDefined" for now.
1586
1587         * bindings/js/JSCustomElementRegistryCustom.cpp:
1588         (WebCore::whenDefinedPromise):
1589         * dom/CustomElementRegistry.cpp:
1590         (WebCore::CustomElementRegistry::addElementDefinition):
1591         * dom/CustomElementRegistry.h:
1592         (WebCore::CustomElementRegistry::promiseMap): Deleted.
1593
1594 2016-09-02  Ryan Haddad  <ryanhaddad@apple.com>
1595         Unreviewed, rolling out r205373.
1596
1597         This change causes LayoutTest crashes under GuardMalloc
1598
1599         Reverted changeset:
1600
1601         "[Cocoa] Distinguish between paint advances and base advances"
1602         https://bugs.webkit.org/show_bug.cgi?id=160892
1603         http://trac.webkit.org/changeset/205373
1604
1605 2016-09-02  Beth Dakin  <bdakin@apple.com>
1606
1607         Need to updateEditorState if an element change edit-ability without changing 
1608         selection
1609         https://bugs.webkit.org/show_bug.cgi?id=161546
1610         -and corresponding-
1611         rdar://problem/27806012
1612
1613         Reviewed by Ryosuke Niwa.
1614
1615         Call into the client in case edited state needs to be updated. 
1616         * editing/FrameSelection.cpp:
1617         (WebCore::FrameSelection::updateAppearanceAfterLayout):
1618         * loader/EmptyClients.h:
1619         * page/EditorClient.h:
1620
1621 2016-09-02  Zalan Bujtas  <zalan@apple.com>
1622
1623         ASSERTION FAILED: !m_committedWidth in WebCore::LineWidth::fitBelowFloats
1624         https://bugs.webkit.org/show_bug.cgi?id=149462
1625         <rdar://problem/27710841>
1626
1627         Reviewed by David Hyatt.
1628
1629         In certain cases (multiple spans on the same line with negativ marings), the LineWidth::m_committedWidth > 0
1630         check is not sufficient to decide if some content has already been committed to the current line.
1631         This patch adds a flag to indicate if we ever committed to the current line. 
1632
1633         Test: fast/text/assert-when-text-with-negative-margin-sibling-does-not-fit.html
1634
1635         * rendering/line/BreakingContext.h:
1636         (WebCore::BreakingContext::handleText):
1637         * rendering/line/LineWidth.h:
1638         (WebCore::LineWidth::hasCommitted):
1639
1640 2016-09-02  Myles C. Maxfield  <mmaxfield@apple.com>
1641
1642         [Cocoa] Distinguish between paint advances and base advances
1643         https://bugs.webkit.org/show_bug.cgi?id=160892
1644
1645         Reviewed by Simon Fraser.
1646
1647         This patch introduces the concept of a layout (or "base") advance which is distinct
1648         from a painting advance. In extremely complicated scripts such as Urdu, it is common
1649         for a glyph advance to be negative in the horizontal direction, and have large advances
1650         in the vertical direction. In particular, in cursive scripts, the glyph placement is
1651         only indirectly related to where the actual characters lie. Conceptually, these glyph
1652         locations are correct for painting, but are not correct when performing width
1653         measurements.
1654
1655         In many text engines, glyph shaping actually can be split into two phases: adjusting
1656         advances, and then placing glyphs relative to those advances. The secondary glyph
1657         placement step is much more context-sensitive than the first step. In addition, when
1658         multiple glyphs combine to form a character, it is common for one glyph to own the
1659         full base advance for the character, and for the other glyphs in the character to
1660         have zero base advances. (Then, in the glyph placement phase, the other glyphs get
1661         placed all around.)
1662
1663         Because of the context-insensitivity of the base advances, it is valuable to use
1664         these for text measurement. Then, when we want to paint, we should add in the extra
1665         origins. This dramatically improves the layout of complex fonts like Noto Nastaliq.
1666
1667         This patch migrates WebKit to use this two-phase shaping.
1668
1669         No new tests just yet, because I have to create a font which exercises the
1670         advanced glyph placement support.
1671
1672         * platform/graphics/GlyphBuffer.h:
1673         (WebCore::GlyphBufferAdvance::setHeight):
1674         (WebCore::GlyphBufferAdvance::setWidth): Deleted.
1675         * platform/graphics/TextRun.h:
1676         (WebCore::TextRun::TextRun):
1677         (WebCore::TextRun::shouldDisableLayoutSpecificAdvances):
1678         (WebCore::TextRun::setShouldDisableLayoutSpecificAdvances):
1679         (WebCore::TextRun::spacingDisabled): Deleted.
1680         (WebCore::TextRun::setCharacterScanForCodePath): Deleted.
1681         * platform/graphics/cocoa/FontCascadeCocoa.mm:
1682         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
1683         * platform/graphics/mac/ComplexTextController.cpp:
1684         (WebCore::ComplexTextController::ComplexTextController):
1685         (WebCore::ComplexTextController::offsetForPosition):
1686         (WebCore::ComplexTextController::collectComplexTextRuns):
1687         (WebCore::ComplexTextController::ComplexTextRun::setIsNonMonotonic):
1688         (WebCore::ComplexTextController::runWidthSoFarFraction):
1689         (WebCore::ComplexTextController::advance):
1690         (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
1691         * platform/graphics/mac/ComplexTextController.h:
1692         (WebCore::ComplexTextController::ComplexTextRun::create):
1693         (WebCore::ComplexTextController::ComplexTextRun::baseAdvances):
1694         (WebCore::ComplexTextController::ComplexTextRun::glyphOrigins):
1695         (WebCore::ComplexTextController::useLayoutSpecificAdvances):
1696         (WebCore::ComplexTextController::finalRoundingWidth): Deleted.
1697         (WebCore::ComplexTextController::ComplexTextRun::advances): Deleted.
1698         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
1699         (SOFT_LINK):
1700         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
1701         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
1702         * platform/spi/cocoa/CoreTextSPI.h:
1703
1704 2016-09-02  Chris Dumez  <cdumez@apple.com>
1705
1706         Unreviewed, roll out r205354 because it caused JSC test failures
1707
1708         * bindings/js/JSDOMWindowBase.cpp:
1709         (WebCore::shouldAllowAccessFrom):
1710         * bindings/js/JSDOMWindowCustom.cpp:
1711         (WebCore::JSDOMWindow::preventExtensions): Deleted.
1712         (WebCore::JSDOMWindow::setLocation): Deleted.
1713         * bindings/js/JSLocationCustom.cpp:
1714         (WebCore::JSLocation::preventExtensions): Deleted.
1715         (WebCore::JSLocationPrototype::putDelegate): Deleted.
1716         (WebCore::JSLocationPrototype::defineOwnProperty): Deleted.
1717         * bindings/js/JSWorkerGlobalScopeBase.cpp:
1718         (WebCore::JSWorkerGlobalScopeBase::allowsAccessFrom):
1719         * bindings/js/JSWorkerGlobalScopeBase.h:
1720         * bindings/scripts/CodeGeneratorJS.pm:
1721         (GenerateHeader):
1722         * bindings/scripts/IDLAttributes.txt:
1723         * page/DOMWindow.idl:
1724         * page/Location.idl:
1725
1726 2016-09-02  Joseph Pecoraro  <pecoraro@apple.com>
1727
1728         Web Inspector: Provide a way to open an inspector frontend for a remote target
1729         https://bugs.webkit.org/show_bug.cgi?id=161515
1730         <rdar://problem/13182127>
1731
1732         Reviewed by Brian Burg.
1733
1734         Previously WebKit inspector frontend clients could only
1735         create a frontend for a web page with the latest protocol.
1736         Now it may create a frontend for a "javascript" or "web"
1737         debuggable that may be current or an older protocol.
1738
1739         The frontend already supports these configurations by
1740         checking and calling InspectorFrontendHost methods
1741         that may or may not have existed previously:
1742
1743         - debuggableType was always "web" but frontend supports "javascript"
1744         - inspectorBackendCommandsURLs was absent so the frontend used the most current
1745             - rename this to backendCommandsURL
1746         
1747         Formalize the methods and have them delegate to the
1748         frontend client opening the frontend.
1749
1750         * inspector/InspectorFrontendClient.h:
1751         (WebCore::InspectorFrontendClient::backendCommandsURL):
1752         (WebCore::InspectorFrontendClient::debuggableType):
1753         * inspector/InspectorFrontendHost.cpp:
1754         (WebCore::InspectorFrontendHost::localizedStringsURL):
1755         (WebCore::InspectorFrontendHost::backendCommandsURL):
1756         (WebCore::InspectorFrontendHost::debuggableType):
1757         * inspector/InspectorFrontendHost.h:
1758         * inspector/InspectorFrontendHost.idl:
1759         Formalize and give default values to InspectorFrontentHost methods.
1760
1761 2016-09-02  Dave Hyatt  <hyatt@apple.com>
1762
1763         Add support for media query parsing using new CSS Parser
1764         https://bugs.webkit.org/show_bug.cgi?id=161537
1765
1766         Reviewed by Dean Jackson.
1767
1768         * CMakeLists.txt:
1769         * WebCore.xcodeproj/project.pbxproj:
1770         * css/MediaQueryExp.cpp:
1771         (WebCore::featureWithValidIdent):
1772         (WebCore::featureWithValidDensity):
1773         (WebCore::featureWithValidPositiveLength):
1774         (WebCore::featureWithPositiveInteger):
1775         (WebCore::featureWithPositiveNumber):
1776         (WebCore::featureWithZeroOrOne):
1777         (WebCore::isFeatureValidWithIdentifier):
1778         (WebCore::MediaQueryExpression::MediaQueryExpression):
1779         * css/MediaQueryExp.h:
1780         * css/parser/CSSParserIdioms.cpp: Added.
1781         (WebCore::convertToASCIILowercaseInPlace):
1782         * css/parser/CSSParserIdioms.h:
1783         * css/parser/CSSParserToken.cpp:
1784         (WebCore::convertToASCIILowercaseInPlace):
1785         * css/parser/MediaQueryBlockWatcher.cpp: Added.
1786         (WebCore::MediaQueryBlockWatcher::MediaQueryBlockWatcher):
1787         (WebCore::MediaQueryBlockWatcher::handleToken):
1788         * css/parser/MediaQueryBlockWatcher.h: Added.
1789         (WebCore::MediaQueryBlockWatcher::blockLevel):
1790         * css/parser/MediaQueryParser.cpp: Added.
1791         (WebCore::MediaQueryParser::parseMediaQuerySet):
1792         (WebCore::MediaQueryParser::parseMediaCondition):
1793         (WebCore::MediaQueryParser::MediaQueryParser):
1794         (WebCore::MediaQueryParser::~MediaQueryParser):
1795         (WebCore::MediaQueryParser::setStateAndRestrict):
1796         (WebCore::MediaQueryParser::readRestrictor):
1797         (WebCore::MediaQueryParser::readMediaNot):
1798         (WebCore::isRestrictorOrLogicalOperator):
1799         (WebCore::MediaQueryParser::readMediaType):
1800         (WebCore::MediaQueryParser::commitMediaQuery):
1801         (WebCore::MediaQueryParser::readAnd):
1802         (WebCore::MediaQueryParser::readFeatureStart):
1803         (WebCore::MediaQueryParser::readFeature):
1804         (WebCore::MediaQueryParser::readFeatureColon):
1805         (WebCore::MediaQueryParser::readFeatureValue):
1806         (WebCore::MediaQueryParser::readFeatureEnd):
1807         (WebCore::MediaQueryParser::skipUntilComma):
1808         (WebCore::MediaQueryParser::skipUntilBlockEnd):
1809         (WebCore::MediaQueryParser::done):
1810         (WebCore::MediaQueryParser::handleBlocks):
1811         (WebCore::MediaQueryParser::processToken):
1812         (WebCore::MediaQueryParser::parseInternal):
1813         (WebCore::MediaQueryData::MediaQueryData):
1814         (WebCore::MediaQueryData::clear):
1815         (WebCore::MediaQueryData::addExpression):
1816         (WebCore::MediaQueryData::tryAddParserToken):
1817         (WebCore::MediaQueryData::setMediaType):
1818         * css/parser/MediaQueryParser.h: Added.
1819         (WebCore::MediaQueryData::restrictor):
1820         (WebCore::MediaQueryData::expressions):
1821         (WebCore::MediaQueryData::mediaType):
1822         (WebCore::MediaQueryData::currentMediaQueryChanged):
1823         (WebCore::MediaQueryData::setRestrictor):
1824         (WebCore::MediaQueryData::setMediaFeature):
1825
1826 2016-07-08  Jer Noble  <jer.noble@apple.com>
1827
1828         Refactor WebPlaybackSessionModelMediaElement to be client based.
1829         https://bugs.webkit.org/show_bug.cgi?id=159580
1830
1831         Reviewed by Eric Carlson.
1832
1833         Add client callback interfaces to both WebPlaybackSessionModel and WebVideoFullscreenModel, where each object
1834         can have multiple clients, and so the object will both store current values and also notify those clients
1835         when the values change. After this change, there is no need to have the models know about their associated
1836         interfaces explicitly.
1837
1838         * platform/cocoa/WebPlaybackSessionInterface.h:
1839         * platform/cocoa/WebPlaybackSessionModel.h:
1840         (WebCore::WebPlaybackSessionModelClient::~WebPlaybackSessionModelClient):
1841         (WebCore::WebPlaybackSessionModelClient::durationChanged):
1842         (WebCore::WebPlaybackSessionModelClient::currentTimeChanged):
1843         (WebCore::WebPlaybackSessionModelClient::bufferedTimeChanged):
1844         (WebCore::WebPlaybackSessionModelClient::rateChanged):
1845         (WebCore::WebPlaybackSessionModelClient::seekableRangesChanged):
1846         (WebCore::WebPlaybackSessionModelClient::canPlayFastReverseChanged):
1847         (WebCore::WebPlaybackSessionModelClient::audioMediaSelectionOptionsChanged):
1848         (WebCore::WebPlaybackSessionModelClient::legibleMediaSelectionOptionsChanged):
1849         (WebCore::WebPlaybackSessionModelClient::externalPlaybackChanged):
1850         (WebCore::WebPlaybackSessionModelClient::wirelessVideoPlaybackDisabledChanged):
1851         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
1852         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
1853         (WebPlaybackSessionModelMediaElement::setMediaElement):
1854         (WebPlaybackSessionModelMediaElement::updateForEventName):
1855         (WebPlaybackSessionModelMediaElement::addClient):
1856         (WebPlaybackSessionModelMediaElement::removeClient):
1857         (WebPlaybackSessionModelMediaElement::updateLegibleOptions):
1858         (WebPlaybackSessionModelMediaElement::observedEventNames):
1859         (WebPlaybackSessionModelMediaElement::eventNameAll):
1860         (WebPlaybackSessionModelMediaElement::audioMediaSelectionOptions):
1861         (WebPlaybackSessionModelMediaElement::audioMediaSelectedIndex):
1862         (WebPlaybackSessionModelMediaElement::legibleMediaSelectedIndex):
1863         (WebPlaybackSessionModelMediaElement::externalPlaybackEnabled):
1864         (WebPlaybackSessionModelMediaElement::externalPlaybackTargetType):
1865         (WebPlaybackSessionModelMediaElement::externalPlaybackLocalizedDeviceName):
1866         (WebPlaybackSessionModelMediaElement::wirelessVideoPlaybackDisabled):
1867         (WebPlaybackSessionModelMediaElement::setWebPlaybackSessionInterface): Deleted.
1868         * platform/cocoa/WebVideoFullscreenInterface.h:
1869         * platform/cocoa/WebVideoFullscreenModel.h:
1870         (WebCore::WebVideoFullscreenModelClient::~WebVideoFullscreenModelClient):
1871         * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
1872         (WebCore::WebVideoFullscreenModelVideoElement::create):
1873         (WebCore::WebVideoFullscreenModelVideoElement::playbackSessionModel): Deleted.
1874         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
1875         (WebVideoFullscreenModelVideoElement::WebVideoFullscreenModelVideoElement):
1876         (WebVideoFullscreenModelVideoElement::setVideoElement):
1877         (WebVideoFullscreenModelVideoElement::updateForEventName):
1878         (WebVideoFullscreenModelVideoElement::addClient):
1879         (WebVideoFullscreenModelVideoElement::removeClient):
1880         (WebVideoFullscreenModelVideoElement::setHasVideo):
1881         (WebVideoFullscreenModelVideoElement::setVideoDimensions):
1882         (WebVideoFullscreenModelVideoElement::setWebVideoFullscreenInterface): Deleted.
1883         * platform/ios/WebAVPlayerController.h:
1884         * platform/ios/WebAVPlayerController.mm:
1885         (-[WebAVPlayerController resetState]): Deleted.
1886         * platform/ios/WebPlaybackSessionInterfaceAVKit.h:
1887         (WebCore::WebPlaybackSessionInterfaceAVKitClient::~WebPlaybackSessionInterfaceAVKitClient): Deleted.
1888         * platform/ios/WebPlaybackSessionInterfaceAVKit.mm:
1889         (WebCore::WebPlaybackSessionInterfaceAVKit::WebPlaybackSessionInterfaceAVKit):
1890         (WebCore::WebPlaybackSessionInterfaceAVKit::~WebPlaybackSessionInterfaceAVKit):
1891         (WebCore::WebPlaybackSessionInterfaceAVKit::resetMediaState):
1892         (WebCore::WebPlaybackSessionInterfaceAVKit::durationChanged):
1893         (WebCore::WebPlaybackSessionInterfaceAVKit::currentTimeChanged):
1894         (WebCore::WebPlaybackSessionInterfaceAVKit::bufferedTimeChanged):
1895         (WebCore::WebPlaybackSessionInterfaceAVKit::rateChanged):
1896         (WebCore::WebPlaybackSessionInterfaceAVKit::seekableRangesChanged):
1897         (WebCore::WebPlaybackSessionInterfaceAVKit::canPlayFastReverseChanged):
1898         (WebCore::WebPlaybackSessionInterfaceAVKit::audioMediaSelectionOptionsChanged):
1899         (WebCore::WebPlaybackSessionInterfaceAVKit::legibleMediaSelectionOptionsChanged):
1900         (WebCore::WebPlaybackSessionInterfaceAVKit::externalPlaybackChanged):
1901         (WebCore::WebPlaybackSessionInterfaceAVKit::wirelessVideoPlaybackDisabledChanged):
1902         (WebCore::WebPlaybackSessionInterfaceAVKit::invalidate):
1903         (WebCore::WebPlaybackSessionInterfaceAVKit::setWebPlaybackSessionModel): Deleted.
1904         (WebCore::WebPlaybackSessionInterfaceAVKit::setDuration): Deleted.
1905         (WebCore::WebPlaybackSessionInterfaceAVKit::setCurrentTime): Deleted.
1906         (WebCore::WebPlaybackSessionInterfaceAVKit::setBufferedTime): Deleted.
1907         (WebCore::WebPlaybackSessionInterfaceAVKit::setRate): Deleted.
1908         (WebCore::WebPlaybackSessionInterfaceAVKit::setSeekableRanges): Deleted.
1909         (WebCore::WebPlaybackSessionInterfaceAVKit::setCanPlayFastReverse): Deleted.
1910         (WebCore::WebPlaybackSessionInterfaceAVKit::setAudioMediaSelectionOptions): Deleted.
1911         (WebCore::WebPlaybackSessionInterfaceAVKit::setLegibleMediaSelectionOptions): Deleted.
1912         (WebCore::WebPlaybackSessionInterfaceAVKit::setExternalPlayback): Deleted.
1913         (WebCore::WebPlaybackSessionInterfaceAVKit::setWirelessVideoPlaybackDisabled): Deleted.
1914         (WebCore::WebPlaybackSessionInterfaceAVKit::wirelessVideoPlaybackDisabled): Deleted.
1915         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1916         (WebVideoFullscreenControllerContext::didSetupFullscreen):
1917         (WebVideoFullscreenControllerContext::didExitFullscreen):
1918         (WebVideoFullscreenControllerContext::didCleanupFullscreen):
1919         (WebVideoFullscreenControllerContext::durationChanged):
1920         (WebVideoFullscreenControllerContext::currentTimeChanged):
1921         (WebVideoFullscreenControllerContext::bufferedTimeChanged):
1922         (WebVideoFullscreenControllerContext::rateChanged):
1923         (WebVideoFullscreenControllerContext::hasVideoChanged):
1924         (WebVideoFullscreenControllerContext::videoDimensionsChanged):
1925         (WebVideoFullscreenControllerContext::seekableRangesChanged):
1926         (WebVideoFullscreenControllerContext::canPlayFastReverseChanged):
1927         (WebVideoFullscreenControllerContext::audioMediaSelectionOptionsChanged):
1928         (WebVideoFullscreenControllerContext::legibleMediaSelectionOptionsChanged):
1929         (WebVideoFullscreenControllerContext::externalPlaybackChanged):
1930         (WebVideoFullscreenControllerContext::wirelessVideoPlaybackDisabledChanged):
1931         (WebVideoFullscreenControllerContext::addClient):
1932         (WebVideoFullscreenControllerContext::removeClient):
1933         (WebVideoFullscreenControllerContext::requestFullscreenMode):
1934         (WebVideoFullscreenControllerContext::setVideoLayerFrame):
1935         (WebVideoFullscreenControllerContext::setVideoLayerGravity):
1936         (WebVideoFullscreenControllerContext::fullscreenModeChanged):
1937         (WebVideoFullscreenControllerContext::isVisible):
1938         (WebVideoFullscreenControllerContext::hasVideo):
1939         (WebVideoFullscreenControllerContext::videoDimensions):
1940         (WebVideoFullscreenControllerContext::play):
1941         (WebVideoFullscreenControllerContext::pause):
1942         (WebVideoFullscreenControllerContext::togglePlayState):
1943         (WebVideoFullscreenControllerContext::beginScrubbing):
1944         (WebVideoFullscreenControllerContext::endScrubbing):
1945         (WebVideoFullscreenControllerContext::seekToTime):
1946         (WebVideoFullscreenControllerContext::fastSeek):
1947         (WebVideoFullscreenControllerContext::beginScanningForward):
1948         (WebVideoFullscreenControllerContext::beginScanningBackward):
1949         (WebVideoFullscreenControllerContext::endScanning):
1950         (WebVideoFullscreenControllerContext::selectAudioMediaOption):
1951         (WebVideoFullscreenControllerContext::selectLegibleMediaOption):
1952         (WebVideoFullscreenControllerContext::duration):
1953         (WebVideoFullscreenControllerContext::currentTime):
1954         (WebVideoFullscreenControllerContext::bufferedTime):
1955         (WebVideoFullscreenControllerContext::isPlaying):
1956         (WebVideoFullscreenControllerContext::playbackRate):
1957         (WebVideoFullscreenControllerContext::seekableRanges):
1958         (WebVideoFullscreenControllerContext::canPlayFastReverse):
1959         (WebVideoFullscreenControllerContext::audioMediaSelectionOptions):
1960         (WebVideoFullscreenControllerContext::audioMediaSelectedIndex):
1961         (WebVideoFullscreenControllerContext::legibleMediaSelectionOptions):
1962         (WebVideoFullscreenControllerContext::legibleMediaSelectedIndex):
1963         (WebVideoFullscreenControllerContext::externalPlaybackEnabled):
1964         (WebVideoFullscreenControllerContext::externalPlaybackTargetType):
1965         (WebVideoFullscreenControllerContext::externalPlaybackLocalizedDeviceName):
1966         (WebVideoFullscreenControllerContext::wirelessVideoPlaybackDisabled):
1967         (WebVideoFullscreenControllerContext::setUpFullscreen):
1968         (WebVideoFullscreenControllerContext::exitFullscreen):
1969         (WebVideoFullscreenControllerContext::requestHideAndExitFullscreen):
1970         (WebVideoFullscreenControllerContext::resetMediaState): Deleted.
1971         (WebVideoFullscreenControllerContext::setDuration): Deleted.
1972         (WebVideoFullscreenControllerContext::setCurrentTime): Deleted.
1973         (WebVideoFullscreenControllerContext::setBufferedTime): Deleted.
1974         (WebVideoFullscreenControllerContext::setRate): Deleted.
1975         (WebVideoFullscreenControllerContext::setVideoDimensions): Deleted.
1976         (WebVideoFullscreenControllerContext::setSeekableRanges): Deleted.
1977         (WebVideoFullscreenControllerContext::setCanPlayFastReverse): Deleted.
1978         (WebVideoFullscreenControllerContext::setAudioMediaSelectionOptions): Deleted.
1979         (WebVideoFullscreenControllerContext::setLegibleMediaSelectionOptions): Deleted.
1980         (WebVideoFullscreenControllerContext::setExternalPlayback): Deleted.
1981         (WebVideoFullscreenControllerContext::setWirelessVideoPlaybackDisabled): Deleted.
1982         (WebVideoFullscreenSessionModel::play): Deleted.
1983         (WebVideoFullscreenSessionModel::pause): Deleted.
1984         (WebVideoFullscreenSessionModel::togglePlayState): Deleted.
1985         (WebVideoFullscreenSessionModel::beginScrubbing): Deleted.
1986         (WebVideoFullscreenSessionModel::endScrubbing): Deleted.
1987         (WebVideoFullscreenSessionModel::seekToTime): Deleted.
1988         (WebVideoFullscreenSessionModel::fastSeek): Deleted.
1989         (WebVideoFullscreenSessionModel::beginScanningForward): Deleted.
1990         (WebVideoFullscreenSessionModel::beginScanningBackward): Deleted.
1991         (WebVideoFullscreenSessionModel::endScanning): Deleted.
1992         (WebVideoFullscreenSessionModel::selectAudioMediaOption): Deleted.
1993         (WebVideoFullscreenSessionModel::selectLegibleMediaOption): Deleted.
1994         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
1995         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1996         (WebVideoFullscreenInterfaceAVKit::~WebVideoFullscreenInterfaceAVKit):
1997         (WebVideoFullscreenInterfaceAVKit::setWebVideoFullscreenModel):
1998         (WebVideoFullscreenInterfaceAVKit::setWebVideoFullscreenChangeObserver):
1999         (WebVideoFullscreenInterfaceAVKit::hasVideoChanged):
2000         (WebVideoFullscreenInterfaceAVKit::videoDimensionsChanged):
2001         (WebVideoFullscreenInterfaceAVKit::externalPlaybackChanged):
2002         (WebVideoFullscreenInterfaceAVKit::resetMediaState): Deleted.
2003         (WebVideoFullscreenInterfaceAVKit::setDuration): Deleted.
2004         (WebVideoFullscreenInterfaceAVKit::setCurrentTime): Deleted.
2005         (WebVideoFullscreenInterfaceAVKit::setBufferedTime): Deleted.
2006         (WebVideoFullscreenInterfaceAVKit::setRate): Deleted.
2007         (WebVideoFullscreenInterfaceAVKit::setVideoDimensions): Deleted.
2008         (WebVideoFullscreenInterfaceAVKit::setSeekableRanges): Deleted.
2009         (WebVideoFullscreenInterfaceAVKit::setCanPlayFastReverse): Deleted.
2010         (WebVideoFullscreenInterfaceAVKit::setAudioMediaSelectionOptions): Deleted.
2011         (WebVideoFullscreenInterfaceAVKit::setLegibleMediaSelectionOptions): Deleted.
2012         (WebVideoFullscreenInterfaceAVKit::setExternalPlayback): Deleted.
2013         (WebVideoFullscreenInterfaceAVKit::externalPlaybackEnabledChanged): Deleted.
2014         (WebVideoFullscreenInterfaceAVKit::setWirelessVideoPlaybackDisabled): Deleted.
2015         (WebVideoFullscreenInterfaceAVKit::wirelessVideoPlaybackDisabled): Deleted.
2016         * platform/mac/WebPlaybackSessionInterfaceMac.h:
2017         (WebCore::WebPlaybackSessionInterfaceMacClient::~WebPlaybackSessionInterfaceMacClient): Deleted.
2018         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
2019         (WebCore::WebPlaybackSessionInterfaceMac::create):
2020         (WebCore::WebPlaybackSessionInterfaceMac::WebPlaybackSessionInterfaceMac):
2021         (WebCore::WebPlaybackSessionInterfaceMac::~WebPlaybackSessionInterfaceMac):
2022         (WebCore::WebPlaybackSessionInterfaceMac::durationChanged):
2023         (WebCore::WebPlaybackSessionInterfaceMac::currentTimeChanged):
2024         (WebCore::WebPlaybackSessionInterfaceMac::rateChanged):
2025         (WebCore::WebPlaybackSessionInterfaceMac::seekableRangesChanged):
2026         (WebCore::WebPlaybackSessionInterfaceMac::audioMediaSelectionOptionsChanged):
2027         (WebCore::WebPlaybackSessionInterfaceMac::legibleMediaSelectionOptionsChanged):
2028         (WebCore::WebPlaybackSessionInterfaceMac::invalidate):
2029         (WebCore::WebPlaybackSessionInterfaceMac::setWebPlaybackSessionModel): Deleted.
2030         (WebCore::WebPlaybackSessionInterfaceMac::setClient): Deleted.
2031         (WebCore::WebPlaybackSessionInterfaceMac::setDuration): Deleted.
2032         (WebCore::WebPlaybackSessionInterfaceMac::setCurrentTime): Deleted.
2033         (WebCore::WebPlaybackSessionInterfaceMac::setRate): Deleted.
2034         (WebCore::WebPlaybackSessionInterfaceMac::setSeekableRanges): Deleted.
2035         (WebCore::WebPlaybackSessionInterfaceMac::setAudioMediaSelectionOptions): Deleted.
2036         (WebCore::WebPlaybackSessionInterfaceMac::setLegibleMediaSelectionOptions): Deleted.
2037         * platform/mac/WebVideoFullscreenInterfaceMac.h:
2038         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
2039         (WebCore::WebVideoFullscreenInterfaceMac::WebVideoFullscreenInterfaceMac):
2040         (WebCore::WebVideoFullscreenInterfaceMac::~WebVideoFullscreenInterfaceMac):
2041         (WebCore::WebVideoFullscreenInterfaceMac::setWebVideoFullscreenModel):
2042         (WebCore::WebVideoFullscreenInterfaceMac::externalPlaybackChanged):
2043         (WebCore::WebVideoFullscreenInterfaceMac::hasVideoChanged):
2044         (WebCore::WebVideoFullscreenInterfaceMac::videoDimensionsChanged):
2045         (WebCore::WebVideoFullscreenInterfaceMac::setDuration): Deleted.
2046         (WebCore::WebVideoFullscreenInterfaceMac::setCurrentTime): Deleted.
2047         (WebCore::WebVideoFullscreenInterfaceMac::setRate): Deleted.
2048         (WebCore::WebVideoFullscreenInterfaceMac::setSeekableRanges): Deleted.
2049         (WebCore::WebVideoFullscreenInterfaceMac::setAudioMediaSelectionOptions): Deleted.
2050         (WebCore::WebVideoFullscreenInterfaceMac::setLegibleMediaSelectionOptions): Deleted.
2051         (WebCore::WebVideoFullscreenInterfaceMac::setExternalPlayback): Deleted.
2052         (WebCore::WebVideoFullscreenInterfaceMac::setVideoDimensions): Deleted.
2053
2054 2016-09-02  Chris Dumez  <cdumez@apple.com>
2055
2056         REGRESSION (r204839): [mac-wk1] LayoutTest webgl/max-active-contexts-webglcontextlost-prevent-default.html is a flaky timeout
2057         https://bugs.webkit.org/show_bug.cgi?id=161205
2058
2059         Reviewed by Geoffrey Garen.
2060
2061         Fixes several issues:
2062         - Add missing isReachableFromOpaqueRoots() implementation for JSWebGLRenderingContextBase.
2063           It used to rely on the one from its JSCanvasRenderingContext base. However, that base
2064           was dropped in r204839.
2065         - Update JSWebGLRenderingContextBase::visitAdditionalChildren() to add its canvas
2066           object as opaque root as well. This used to be taken care of by
2067           JSCanvasRenderingContext::visitAdditionalChildren() but it got dropped in r204839.
2068
2069         This also refactors the code a bit for clarity.
2070
2071         No new tests, unskipped existing test.
2072
2073         * WebCore.xcodeproj/project.pbxproj:
2074         * bindings/js/JSCanvasRenderingContext.h: Removed.
2075         * bindings/js/JSDocumentCustom.cpp:
2076         (WebCore::JSDocument::getCSSCanvasContext):
2077         * bindings/js/JSHTMLCanvasElementCustom.cpp:
2078         (WebCore::JSHTMLCanvasElement::getContext):
2079         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
2080         (WebCore::toJSNewlyCreated):
2081         (WebCore::toJS):
2082         (WebCore::JSWebGLRenderingContextBaseOwner::isReachableFromOpaqueRoots):
2083         (WebCore::JSWebGLRenderingContextBase::visitAdditionalChildren):
2084         * html/canvas/CanvasRenderingContext.h:
2085         (WebCore::CanvasRenderingContext::is3d):
2086         * html/canvas/WebGLRenderingContextBase.h:
2087         * html/canvas/WebGLRenderingContextBase.idl:
2088
2089 2016-09-02  Chris Dumez  <cdumez@apple.com>
2090
2091         Object.preventExtensions() should throw cross-origin
2092         https://bugs.webkit.org/show_bug.cgi?id=161486
2093
2094         Reviewed by Geoffrey Garen.
2095
2096         Object.preventExtensions() should throw cross-origin:
2097         - https://html.spec.whatwg.org/#windowproxy-preventextensions
2098         - https://html.spec.whatwg.org/#location-preventextensions
2099         - http://www.ecma-international.org/ecma-262/6.0/#sec-object.preventextensions
2100
2101         Firefox and Chrome both throw in the cross-origin case. Firefox also throws
2102         a TypeError in the same-origin case for Window, as per the specification.
2103         However, Firefox does not seem to throw yet in the same-origin case for
2104         Location yet.
2105
2106         Test: http/tests/security/preventExtensions-window-location.html
2107
2108         * bindings/js/JSDOMWindowCustom.cpp:
2109         (WebCore::JSDOMWindow::preventExtensions):
2110         * bindings/js/JSLocationCustom.cpp:
2111         (WebCore::JSLocation::preventExtensions):
2112         * bindings/scripts/CodeGeneratorJS.pm:
2113         (GenerateHeader):
2114         * bindings/scripts/IDLAttributes.txt:
2115         * page/DOMWindow.idl:
2116         * page/Location.idl:
2117
2118 2016-09-02  Chris Dumez  <cdumez@apple.com>
2119
2120         Object.defineProperty() should throw cross-origin
2121         https://bugs.webkit.org/show_bug.cgi?id=161460
2122
2123         Reviewed by Geoffrey Garen.
2124
2125         Object.defineProperty() should throw cross-origin to match Firefox and
2126         Chrome.
2127
2128         The specification is in the process of being updated to match the
2129         behavior of browsers.
2130
2131         Test: http/tests/security/window-defineProperty-crossOrigin.html
2132
2133         * bindings/js/JSDOMWindowCustom.cpp:
2134         (WebCore::JSDOMWindow::defineOwnProperty):
2135         * bindings/js/JSLocationCustom.cpp:
2136         (WebCore::JSLocation::defineOwnProperty):
2137
2138 2016-09-02  Brady Eidson  <beidson@apple.com>
2139
2140         Weak link the GameController.framework on macOS but differently than before.
2141
2142         Reviewed by Dan Bernstein.
2143         
2144         * Configurations/WebCore.xcconfig:
2145
2146 2016-09-02  Chris Dumez  <cdumez@apple.com>
2147
2148         Align proto getter / setter behavior with other browsers
2149         https://bugs.webkit.org/show_bug.cgi?id=161455
2150
2151         Reviewed by Mark Lam.
2152
2153         Align cross-origin __proto__ getter / setter behavior with other
2154         browsers and the specification:
2155
2156         [[SetPrototypeOf]] should throw a TypeError:
2157         - https://html.spec.whatwg.org/#windowproxy-setprototypeof
2158         - https://html.spec.whatwg.org/#location-setprototypeof
2159         - https://tc39.github.io/ecma262/#sec-object.setprototypeof (step 5)
2160
2161         [[GetPrototypeOf]] should return null cross-origin:
2162         - https://html.spec.whatwg.org/#windowproxy-getprototypeof
2163         - https://html.spec.whatwg.org/#location-getprototypeof
2164
2165         Test: js/dom/setPrototypeOf-location-window.html
2166
2167         * bindings/js/JSDOMWindowBase.cpp:
2168         (WebCore::JSDOMWindowBase::JSDOMWindowBase): Deleted.
2169         * bindings/js/JSDOMWindowCustom.cpp:
2170         (WebCore::JSDOMWindow::setPrototype):
2171         (WebCore::JSDOMWindow::getPrototype):
2172         * bindings/js/JSLocationCustom.cpp:
2173         (WebCore::JSLocation::setPrototype):
2174         (WebCore::JSLocation::getPrototype):
2175         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2176         (WebCore::JSWorkerGlobalScopeBase::supportsRichSourceInfo): Deleted.
2177         * bindings/js/JSWorkerGlobalScopeBase.h:
2178         * bindings/scripts/CodeGeneratorJS.pm:
2179         (GenerateHeader):
2180         * bindings/scripts/IDLAttributes.txt:
2181         * page/DOMWindow.idl:
2182         * page/Location.idl:
2183
2184 2016-09-02  Eric Carlson  <eric.carlson@apple.com>
2185
2186         [MediaStream] applyConstraints pt. 1 - mandatory constraints
2187         https://bugs.webkit.org/show_bug.cgi?id=161469
2188         <rdar://problem/28109325>
2189
2190         Reviewed by Jer Noble.
2191
2192         Tests: fast/mediastream/apply-constraints-audio.html
2193                fast/mediastream/apply-constraints-video.html
2194
2195         * Modules/mediastream/MediaStreamTrack.cpp:
2196         (WebCore::MediaStreamTrack::MediaStreamTrack): Initialize the weak pointer factory.
2197         (WebCore::MediaStreamTrack::applyConstraints): Make it work.
2198         * Modules/mediastream/MediaStreamTrack.h:
2199         * Modules/mediastream/MediaStreamTrack.idl:
2200
2201         * WebCore.xcodeproj/project.pbxproj: Add JSMediaDevicesCustom.h.
2202
2203         * bindings/js/JSMediaDevicesCustom.cpp:
2204         (WebCore::createStringConstraint): Add name parameter.
2205         (WebCore::createBooleanConstraint): Ditto.
2206         (WebCore::createDoubleConstraint): Ditto.
2207         (WebCore::createIntConstraint): Ditto.
2208         (WebCore::parseMediaTrackConstraintSetForKey): Drop type parameter because we don't need to
2209           filter by source media type.
2210         (WebCore::parseAdvancedConstraints): Ditto.
2211         (WebCore::parseMediaConstraintsDictionary): Renamed from parseConstraints.
2212         (WebCore::JSMediaDevices::getUserMedia): Don't throw exceptions, always return a promise.
2213         (WebCore::parseConstraints): Deleted.
2214         * bindings/js/JSMediaDevicesCustom.h: Added.
2215
2216         * bindings/js/JSMediaStreamTrackCustom.cpp:
2217         (WebCore::JSMediaStreamTrack::getSettings): Don't include aspect ratio if the value is 0.
2218         (WebCore::capabilityValue): asULong -> asInt.
2219         (WebCore::JSMediaStreamTrack::applyConstraints): New.
2220         (WebCore::JSMediaStreamTrack::getConstraints): New.
2221
2222         * bindings/js/WebCoreBuiltinNames.h: Add "mediaStreamTrackConstraints".
2223
2224         * html/HTMLMediaElement.cpp:
2225         (WebCore::HTMLMediaElement::setSrcObject): Drive by fix: don't call DOMURL::createPublicURL(null).
2226
2227         * platform/mediastream/MediaConstraints.cpp:
2228         (WebCore::MediaConstraint::create): Pass name to constructors.
2229         (WebCore::StringConstraint::find): New.
2230         * platform/mediastream/MediaConstraints.h:
2231
2232         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2233         (WebCore::MediaStreamTrackPrivate::applyConstraints): Add callback parameters.
2234         * platform/mediastream/MediaStreamTrackPrivate.h:
2235
2236         * platform/mediastream/RealtimeMediaSource.cpp:
2237         (WebCore::RealtimeMediaSource::RealtimeMediaSource): Initialize weak pointer factory.
2238         (WebCore::RealtimeMediaSource::settingsDidChange): Don't call observers immediately so we can
2239          coalesce multiple changes in the same runloop cycle.
2240         (WebCore::RealtimeMediaSource::supportsConstraint): New.
2241         (WebCore::value): Return the most appropriate value from a numeric constraint.
2242         (WebCore::RealtimeMediaSource::applyConstraint): New, apply one constraint.
2243         (WebCore::RealtimeMediaSource::applyConstraints): New, validate and apply constraints.
2244         (WebCore::RealtimeMediaSource::setWidth): New.
2245         (WebCore::RealtimeMediaSource::setHeight): New.
2246         (WebCore::RealtimeMediaSource::setFrameRate): New.
2247         (WebCore::RealtimeMediaSource::setAspectRatio): New.
2248         (WebCore::RealtimeMediaSource::setFacingMode): New.
2249         (WebCore::RealtimeMediaSource::setVolume): New.
2250         (WebCore::RealtimeMediaSource::setSampleRate): New.
2251         (WebCore::RealtimeMediaSource::setSampleSize): New.
2252         (WebCore::RealtimeMediaSource::setEchoCancellation) New.:
2253         (WebCore::RealtimeMediaSource::scheduleDeferredTask): New.
2254         * platform/mediastream/RealtimeMediaSource.h:
2255
2256         * platform/mediastream/RealtimeMediaSourceCapabilities.h:
2257         (WebCore::CapabilityValueOrRange::CapabilityValueOrRange): "unsigned long" -> "int"
2258
2259         * platform/mediastream/RealtimeMediaSourceSettings.cpp:
2260         (WebCore::userFacing): New.
2261         (WebCore::environmentFacing): New.
2262         (WebCore::leftFacing): New.
2263         (WebCore::rightFacing): New.
2264         (WebCore::RealtimeMediaSourceSettings::facingMode):
2265         (WebCore::RealtimeMediaSourceSettings::videoFacingModeEnum):
2266         * platform/mediastream/RealtimeMediaSourceSettings.h:
2267
2268         * platform/mediastream/mac/AVAudioCaptureSource.mm:
2269         (WebCore::AVAudioCaptureSource::initializeCapabilities): Volume range is 0.0 .. 1.0.
2270
2271         * platform/mediastream/mac/AVMediaCaptureSource.h:
2272         (WebCore::AVMediaCaptureSource::createWeakPtr): Deleted.
2273         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2274         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource): Don't need the weak ptr factory, it is
2275           in the base class.
2276         (WebCore::AVMediaCaptureSource::scheduleDeferredTask): Deleted.
2277
2278         * platform/mediastream/mac/AVVideoCaptureSource.h:
2279         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2280         (WebCore::AVVideoCaptureSource::applySize): New.
2281         (WebCore::AVVideoCaptureSource::applyFrameRate): New.
2282         (WebCore::AVVideoCaptureSource::setupCaptureSession):
2283         (WebCore::AVVideoCaptureSource::setFrameRateConstraint): Deleted.
2284         (WebCore::AVVideoCaptureSource::applyConstraints): Deleted.
2285
2286         * platform/mock/MockRealtimeAudioSource.cpp:
2287         (WebCore::MockRealtimeAudioSource::updateSettings): Set volume and echoCancellation to the
2288           current values.
2289         (WebCore::MockRealtimeAudioSource::initializeCapabilities): Volume takes a float, not an int.
2290         * platform/mock/MockRealtimeAudioSource.h:
2291
2292         * platform/mock/MockRealtimeMediaSource.cpp: Minor cleanup.
2293         * platform/mock/MockRealtimeMediaSource.h:
2294
2295         * platform/mock/MockRealtimeVideoSource.cpp:
2296         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource): Initialize frame rate.
2297         (WebCore::MockRealtimeVideoSource::startProducingData): m_size -> size().
2298         (WebCore::MockRealtimeVideoSource::updateSettings): Use accessors because instance variables
2299           have been moved to the base class.
2300         (WebCore::MockRealtimeVideoSource::initializeCapabilities): Ditto.
2301         (WebCore::MockRealtimeVideoSource::applyFrameRate): New.
2302         (WebCore::MockRealtimeVideoSource::applySize):
2303         (WebCore::MockRealtimeVideoSource::drawAnimation):
2304         (WebCore::MockRealtimeVideoSource::drawBoxes):
2305         (WebCore::MockRealtimeVideoSource::drawText):
2306         (WebCore::MockRealtimeVideoSource::generateFrame):
2307         (WebCore::MockRealtimeVideoSource::imageBuffer):
2308         (WebCore::MockRealtimeVideoSource::setFrameRate): Deleted.
2309         (WebCore::MockRealtimeVideoSource::setSize): Deleted.
2310         * platform/mock/MockRealtimeVideoSource.h:
2311         (WebCore::MockRealtimeVideoSource::size): Deleted.
2312
2313 2016-09-02  Brady Eidson  <beidson@apple.com>
2314
2315         Weak link the GameController.framework on macOS.
2316
2317         Reviewed by Tim Horton.
2318         
2319         * Configurations/WebCore.xcconfig:
2320
2321 2016-09-02  Commit Queue  <commit-queue@webkit.org>
2322
2323         Unreviewed, rolling out r205344.
2324         https://bugs.webkit.org/show_bug.cgi?id=161533
2325
2326         Hitting assertions under CachedResource::removeClient in a few
2327         tests (Requested by anttik on #webkit).
2328
2329         Reverted changeset:
2330
2331         "Reverse ownership relation of StyleCachedImage and
2332         CSSImageValue"
2333         https://bugs.webkit.org/show_bug.cgi?id=161447
2334         http://trac.webkit.org/changeset/205344
2335
2336 2016-09-02  Antti Koivisto  <antti@apple.com>
2337
2338         Reverse ownership relation of StyleCachedImage and CSSImageValue
2339         https://bugs.webkit.org/show_bug.cgi?id=161447
2340
2341         Reviewed by Andreas Kling.
2342
2343         Currently StyleCachedImage (which represents an image in RenderStyle) has a weak ref to the
2344         underlying CSSImageValue/CSSImageSetValue which actually owns it. This is awkwards especially since
2345         StyleGeneratedImage, the other StyleImage subclass has reversed relationship where it refs
2346         the underlying CSSImageGeneratorValue.
2347
2348         This patch makes StyleCachedImage similar to StyleGeneratedImage. StyleCachedImage now refs the
2349         underlying CSSImageValue/CSSImageSetValue. CSSImageValues no longer need to know about StyleCachedImage.
2350         Instead they reference CachedImages (memory cache objects) directly. StyleCachedImage instances are now
2351         conceptually unique to RenderStyle instances. Actual resources are shared as before by sharing CachedImages.
2352
2353         * css/CSSCursorImageValue.cpp:
2354         (WebCore::CSSCursorImageValue::loadImage):
2355         (WebCore::CSSCursorImageValue::cachedImage):
2356         (WebCore::CSSCursorImageValue::styleImage): Deleted.
2357         * css/CSSCursorImageValue.h:
2358         * css/CSSImageGeneratorValue.cpp:
2359         (WebCore::CSSImageGeneratorValue::cachedImageForCSSValue):
2360         * css/CSSImageSetValue.cpp:
2361         (WebCore::CSSImageSetValue::~CSSImageSetValue):
2362         (WebCore::CSSImageSetValue::loadBestFitImage):
2363         (WebCore::CSSImageSetValue::traverseSubresources):
2364         (WebCore::CSSImageSetValue::styleImage): Deleted.
2365         * css/CSSImageSetValue.h:
2366         * css/CSSImageValue.cpp:
2367         (WebCore::CSSImageValue::CSSImageValue):
2368         (WebCore::CSSImageValue::~CSSImageValue):
2369         (WebCore::CSSImageValue::isPending):
2370         (WebCore::CSSImageValue::loadImage):
2371         (WebCore::CSSImageValue::traverseSubresources):
2372         (WebCore::CSSImageValue::knownToBeOpaque):
2373         (WebCore::CSSImageValue::styleImage): Deleted.
2374         * css/CSSImageValue.h:
2375         * css/StyleBuilderCustom.h:
2376         (WebCore::StyleBuilderCustom::applyValueContent):
2377         * css/StyleResolver.cpp:
2378         (WebCore::StyleResolver::styleImage):
2379         (WebCore::StyleResolver::styleCachedImageFromValue):
2380         (WebCore::StyleResolver::styleGeneratedImageFromValue):
2381         (WebCore::StyleResolver::cachedOrPendingFromValue): Deleted.
2382         (WebCore::StyleResolver::generatedOrPendingFromValue): Deleted.
2383         (WebCore::StyleResolver::setOrPendingFromValue): Deleted.
2384         (WebCore::StyleResolver::cursorOrPendingFromValue): Deleted.
2385         * css/StyleResolver.h:
2386         * editing/TextIterator.cpp:
2387         (WebCore::fullyClipsContents):
2388         * page/PageSerializer.cpp:
2389         (WebCore::PageSerializer::retrieveResourcesForProperties):
2390         * rendering/style/FillLayer.cpp:
2391         (WebCore::FillLayer::imagesIdentical):
2392
2393             Compare data equality instead of pointer equality for StyleImages (since StyleImages are no longer shared).
2394
2395         (WebCore::layerImagesIdentical): Deleted.
2396         * rendering/style/StyleCachedImage.cpp:
2397         (WebCore::StyleCachedImage::StyleCachedImage):
2398         (WebCore::StyleCachedImage::~StyleCachedImage):
2399         (WebCore::StyleCachedImage::cachedImage):
2400         (WebCore::StyleCachedImage::cssValue):
2401         (WebCore::StyleCachedImage::canRender):
2402         (WebCore::StyleCachedImage::isPending):
2403         (WebCore::StyleCachedImage::isLoaded):
2404         (WebCore::StyleCachedImage::errorOccurred):
2405         (WebCore::StyleCachedImage::imageSize):
2406         (WebCore::StyleCachedImage::imageHasRelativeWidth):
2407         (WebCore::StyleCachedImage::imageHasRelativeHeight):
2408         (WebCore::StyleCachedImage::computeIntrinsicDimensions):
2409         (WebCore::StyleCachedImage::usesImageContainerSize):
2410         (WebCore::StyleCachedImage::setContainerSizeForRenderer):
2411         (WebCore::StyleCachedImage::addClient):
2412         (WebCore::StyleCachedImage::removeClient):
2413         (WebCore::StyleCachedImage::image):
2414         (WebCore::StyleCachedImage::knownToBeOpaque):
2415         (WebCore::StyleCachedImage::setCachedImage): Deleted.
2416         * rendering/style/StyleCachedImage.h:
2417
2418 2016-09-01  Ryosuke Niwa  <rniwa@webkit.org>
2419
2420         Only update connected custom elements
2421         https://bugs.webkit.org/show_bug.cgi?id=161480
2422
2423         Reviewed by Yusuke Suzuki.
2424
2425         In the latest specs, creating an element only upgrades an element if the custom element had already been defined:
2426         https://dom.spec.whatwg.org/#concept-create-element
2427
2428         Otherwise, an element remains unresolved until it gets connected to the document associated with the global object:
2429         https://dom.spec.whatwg.org/#concept-node-insert
2430
2431         This patch removes the upgrade candidate map in CustomElementRegistry, and traverses the entire document associated
2432         with global object (DOMWindow) in addElementDefinition: https://html.spec.whatwg.org/#dom-customelementregistry-define
2433
2434         The traversal is done in the shadow-including tree order (different from depth-first preorder traversal of flat tree)
2435         since it doesn't enter slots and children of shadow hosts are always visited even if they are not assigned to a slot:
2436         https://dom.spec.whatwg.org/#concept-shadow-including-tree-order
2437
2438         Test: fast/custom-elements/enqueue-custom-element-upgrade-reaction.html
2439
2440         * bindings/js/JSCustomElementInterface.cpp:
2441         (WebCore::JSCustomElementInterface::upgradeElement): Assert that the element being upgraded as the same qualified name
2442         as the custom element interface.
2443         * bindings/js/JSCustomElementRegistryCustom.cpp:
2444         (WebCore::JSCustomElementRegistry::define): Moved the code to resolve the promise from here to addElementDefinition.
2445         Also cleaned up the code to extract callbacks a little.
2446         * dom/CustomElementReactionQueue.cpp:
2447         (WebCore::CustomElementReactionQueue::enqueueElementUpgrade): Added an assertion.
2448         (WebCore::CustomElementReactionQueue::enqueueElementUpgradeIfDefined): Added. Upgrade an element if the custom element
2449         had already been defined.
2450         * dom/CustomElementReactionQueue.h:
2451         * dom/CustomElementRegistry.cpp:
2452         (WebCore::CustomElementRegistry::create): Stores the reference to DOMWindow to find its document in addElementDefinition.
2453         (WebCore::CustomElementRegistry::CustomElementRegistry): Ditto.
2454         (WebCore::enqueueUpgradeInShadowIncludingTreeOrder): Added. Enqueue upgrade reactions in shadow-including tree order.
2455         (WebCore::CustomElementRegistry::addElementDefinition): Upgrade all unresolved elements that matches this definition and
2456         resolve the the promise returned by "whenDefined" if there is any.
2457         (WebCore::CustomElementRegistry::addUpgradeCandidate): Deleted.
2458         (WebCore::CustomElementRegistry::findInterface): Added a new variant that takes an element.
2459         * dom/CustomElementRegistry.h:
2460         * dom/Document.cpp:
2461         (WebCore::createUpgradeCandidateElement): No longer takes DOMWindow since we don't upgrade synchronously here. It's also
2462         wrong not to mark the element as unresolved custom element in a document without a browsing context per new semantics.
2463         (WebCore::createHTMLElementWithNameValidation): Ditto.
2464         (WebCore::createFallbackHTMLElement): Ditto.
2465         * dom/Element.cpp:
2466         (WebCore::Element::insertedInto): Enqueue an upgrade reaction if this is an unsolved custom element and there is now
2467         a definition for it (the latter condition is checked in enqueueElementUpgradeIfDefined).
2468         * html/parser/HTMLConstructionSite.cpp:
2469         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface): Don't upgrade this element until it gets
2470         connected to a document in Element::insertedInto.
2471         * page/DOMWindow.cpp:
2472         (WebCore::DOMWindow::ensureCustomElementRegistry):
2473
2474 2016-09-01  Yusuke Suzuki  <utatane.tea@gmail.com>
2475
2476         Add toJS for JSC::PrivateName
2477         https://bugs.webkit.org/show_bug.cgi?id=161522
2478
2479         Reviewed by Ryosuke Niwa.
2480
2481         JSC::PrivateName is the wrapper to create and hold the ES6 Symbol instance.
2482         This patch adds toJS support for JSC::PrivateName.
2483         Later, the module integration patch will use this feature to call
2484         DeferredWrapper::{resolve,reject} with JSC::PrivateName.
2485
2486         * bindings/js/JSDOMBinding.h:
2487         (WebCore::toJS):
2488
2489 2016-09-01  Dan Bernstein  <mitz@apple.com>
2490
2491         Build fix.
2492
2493         * Configurations/FeatureDefines.xcconfig:
2494         * Configurations/WebCore.xcconfig:
2495         * WebCore.xcodeproj/project.pbxproj:
2496
2497 2016-09-01  Ricky Mondello  <rmondello@apple.com>
2498
2499         YouTube Flash plug-in replacement facility should not insert showinfo=0 into iframe URLs
2500         https://bugs.webkit.org/show_bug.cgi?id=161478
2501         <rdar://problem/28050847>
2502
2503         Reviewed by Eric Carlson.
2504
2505         * Modules/plugins/YouTubePluginReplacement.cpp:
2506         (WebCore::YouTubePluginReplacement::youTubeURLFromAbsoluteURL): Stop adding the query parameter.
2507
2508 2016-09-01  Mark Lam  <mark.lam@apple.com>
2509
2510         Move some JSObject and JSArray inline functions to their respective Inlines.h files.
2511         https://bugs.webkit.org/show_bug.cgi?id=161499
2512
2513         Reviewed by Saam Barati.
2514
2515         No new tests because there is no behavior change.
2516
2517         * ForwardingHeaders/runtime/JSObjectInlines.h: Added.
2518         * bindings/js/JSDOMBinding.h:
2519         * bindings/js/JSSQLTransactionCustom.cpp:
2520         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
2521         * contentextensions/ContentExtensionParser.cpp:
2522
2523 2016-09-01  Michael Catanzaro  <mcatanzaro@igalia.com>
2524
2525         Fix ENABLE(CSS_GRID_LAYOUT) guards harder after r205102/r205292
2526
2527         Unreviewed. Silence unused function warning.
2528
2529         * css/CSSComputedStyleDeclaration.cpp:
2530
2531 2016-09-01  Alex Christensen  <achristensen@webkit.org>
2532
2533         Avoid unneeded string copy when parsing URL hosts
2534         https://bugs.webkit.org/show_bug.cgi?id=161511
2535
2536         Reviewed by Tim Horton.
2537
2538         No change in behavior.  Covered by existing API tests.
2539
2540         * platform/URLParser.cpp:
2541         (WebCore::URLParser::parse):
2542         (WebCore::URLParser::parseAuthority):
2543         (WebCore::URLParser::parseHost):
2544         (WebCore::URLParser::authorityEndReached): Deleted.
2545         (WebCore::URLParser::hostEndReached): Deleted.
2546         * platform/URLParser.h:
2547
2548 2016-09-01  Ryosuke Niwa  <rniwa@webkit.org>
2549
2550         Add "whenDefined" to CustomElementRegistry
2551         https://bugs.webkit.org/show_bug.cgi?id=161425
2552
2553         Reviewed by Yusuke Suzuki.
2554
2555         Add the support for "whenDefined" method on CustomElementRegistry: 
2556         https://html.spec.whatwg.org/#dom-customelementregistry-whendefined
2557
2558         Because it needs to store the newly created promise when the queried custom element has not been defined yet,
2559         we need to write custom binding code instead of relying on the binding generator.
2560
2561         Tests: fast/custom-elements/CustomElementRegistry.html
2562
2563         * bindings/js/JSCustomElementRegistryCustom.cpp:
2564         (WebCore::validateCustomElementNameAndThrowIfNeeded): Extracted out of JSCustomElementRegistry::define.
2565         (WebCore::JSCustomElementRegistry::define): Fulfill the "whenDefined" promise when the definition succeeds.
2566         (WebCore::whenDefinedPromise): Added. Return an existing promise if there is one, or create a new promise.
2567         We cache the created promise only if the custom element had not been defined yet since we'll indefinitely
2568         retain the resolved promise otherwise.
2569         (WebCore::JSCustomElementRegistry::whenDefined): Added. Calls whenDefinedPromise and returns a rejected
2570         promise when there was an exception.
2571         * dom/CustomElementRegistry.cpp:
2572         * dom/CustomElementRegistry.h:
2573         (WebCore::CustomElementRegistry::promiseMap): Added.
2574         * dom/CustomElementRegistry.idl:
2575
2576 2016-09-01  Alex Christensen  <achristensen@webkit.org>
2577
2578         URLParser should handle . and .. in URL paths
2579         https://bugs.webkit.org/show_bug.cgi?id=161443
2580
2581         Reviewed by Brady Eidson.
2582
2583         Covered by new API tests.
2584
2585         * platform/URLParser.cpp:
2586         (WebCore::isSingleDotPathSegment):
2587         (WebCore::isDoubleDotPathSegment):
2588         (WebCore::consumeSingleDotPathSegment):
2589         (WebCore::consumeDoubleDotPathSegment):
2590         (WebCore::URLParser::parse):
2591         (WebCore::URLParser::copyURLPartsUntil): Deleted.
2592
2593 2016-09-01  Alex Christensen  <achristensen@webkit.org>
2594
2595         Fix Mac CMake build.
2596
2597         * PlatformMac.cmake:
2598
2599 2016-09-01  Ricky Mondello  <rmondello@apple.com>
2600
2601         YouTube Flash plug-in replacement facility should more gracefully handle malformed queries
2602         https://bugs.webkit.org/show_bug.cgi?id=161476
2603         <rdar://problem/28050847>
2604
2605         Reviewed by Eric Carlson.
2606
2607         Some YouTube Flash embeds use '&' instead of '?' to start the query portion of the URL. Before this patch,
2608         our implementation discards all parts of the path after the '&', which could drop important query information
2609         like the start time for the video. This patch treats anything after that '&' as a "malformed query" and uses
2610         it as the query to restore to the transformed URL if there was no actual query in the original URL.
2611
2612         * Modules/plugins/YouTubePluginReplacement.cpp:
2613         (WebCore::processAndCreateYouTubeURL): Add an out-parameter for the path after the first ampersand.
2614         (WebCore::YouTubePluginReplacement::youTubeURLFromAbsoluteURL): If the input URL had no query, append
2615             the possibly malformed one found after the first ampersand to the replacement URL.
2616
2617 2016-09-01  Alex Christensen  <achristensen@webkit.org>
2618
2619         Fix Mac CMake build after r205266.
2620
2621         * PlatformMac.cmake:
2622         * platform/cocoa/URLParserCocoa.mm: Removed.
2623
2624 2016-09-01  Javier Fernandez  <jfernandez@igalia.com>
2625
2626         Unreviewed build fix after r205102.
2627
2628         The change made in r205102 caused compilation failures on
2629         builds with the CSS_GRID_LAYOUT compilation flag disabled.
2630
2631         * css/CSSComputedStyleDeclaration.cpp:
2632         (WebCore::ComputedStyleExtractor::propertyValue):
2633         (WebCore::resolveJustifySelfAuto): Deleted.
2634         * css/CSSPropertyNames.in:
2635         * css/parser/CSSParser.cpp:
2636         (WebCore::isKeywordPropertyID):
2637         (WebCore::CSSParser::parseValue):
2638
2639 2016-09-01  Fujii Hironori  <Hironori.Fujii@sony.com>
2640
2641         Fix the Mac cmake clean build issue
2642         https://bugs.webkit.org/show_bug.cgi?id=157261
2643
2644         Reviewed by Michael Catanzaro.
2645
2646         Building WebCoreDerivedSources target failed due to the race
2647         condition with building ForwardingHeaders of JavaScriptCore.
2648
2649         * CMakeLists.txt: Make WebCoreDerivedSources depends on JavaScriptCore.
2650
2651 2016-09-01  Andreas Kling  <akling@apple.com>
2652
2653         FocusController should pass KeyboardEvent around by reference.
2654         <https://webkit.org/b/161461>
2655
2656         Reviewed by Sam Weinig.
2657
2658         Clean up FocusController to pass KeyboardEvent& around internally.
2659
2660         Also make FocusController::setInitialFocus() synthesize a dummy KeyboardEvent
2661         if one isn't provided, just like nextFocusableElement()/previousFocusableElement() does.
2662         This way we can feel confident about dereferencing the formerly KeyboardEvent* everywhere.
2663
2664         * page/EventHandler.cpp:
2665         (WebCore::EventHandler::defaultArrowEventHandler):
2666         (WebCore::EventHandler::defaultTabEventHandler):
2667         * page/FocusController.cpp:
2668         (WebCore::isFocusableElementOrScopeOwner):
2669         (WebCore::isNonFocusableScopeOwner):
2670         (WebCore::isFocusableScopeOwner):
2671         (WebCore::shadowAdjustedTabIndex):
2672         (WebCore::FocusController::findFocusableElementDescendingDownIntoFrameDocument):
2673         (WebCore::FocusController::setInitialFocus):
2674         (WebCore::FocusController::advanceFocus):
2675         (WebCore::FocusController::advanceFocusInDocumentOrder):
2676         (WebCore::FocusController::findFocusableElementAcrossFocusScope):
2677         (WebCore::FocusController::findFocusableElementWithinScope):
2678         (WebCore::FocusController::nextFocusableElementWithinScope):
2679         (WebCore::FocusController::previousFocusableElementWithinScope):
2680         (WebCore::FocusController::findFocusableElementOrScopeOwner):
2681         (WebCore::FocusController::findElementWithExactTabIndex):
2682         (WebCore::nextElementWithGreaterTabIndex):
2683         (WebCore::previousElementWithLowerTabIndex):
2684         (WebCore::FocusController::nextFocusableElement):
2685         (WebCore::FocusController::previousFocusableElement):
2686         (WebCore::FocusController::nextFocusableElementOrScopeOwner):
2687         (WebCore::FocusController::previousFocusableElementOrScopeOwner):
2688         (WebCore::FocusController::findFocusCandidateInContainer):
2689         (WebCore::FocusController::advanceFocusDirectionallyInContainer):
2690         (WebCore::FocusController::advanceFocusDirectionally):
2691         * page/FocusController.h:
2692
2693 2016-09-01  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2694
2695         [Streams API] Align internal structure of ReadableStream with spec
2696         https://bugs.webkit.org/show_bug.cgi?id=160299
2697
2698         Reviewed by Xabier Rodriguez-Calvar.
2699
2700         Aligned internal structure of ReadableStream with spec. Various
2701         internal properties have been moved to ReadableStreamDefaultController.
2702         In addition, various behaviors had to be updated. Several other changes
2703         will have to be performed in order to align with spec, e.g. changing
2704         functions names. This patch does not change them in order to make the
2705         structural changes easier to follow.
2706
2707         No change in functionality except support for 1 specific case where
2708         an error was not thrown while it should have been. Changed corresponding
2709         test expectation (now PASS instead of FAIL).
2710         Modified test expectation: web-platform-tests/streams/readable-streams/general.https-expected.txt
2711
2712         * Modules/fetch/FetchResponse.js:
2713         (initializeFetchResponse): Replaced reference to underlyingSource as no
2714         more a property of readableStream (use readableStreamController instead,
2715         as defined by spec).
2716         * Modules/streams/ReadableStream.js:
2717         (initializeReadableStream): Removed various properties now hanlded by
2718         ReadableStreamDefaultController.
2719         * Modules/streams/ReadableStreamDefaultController.js:
2720         (enqueue): Updated based on new properties repartition between reader and controller. 
2721         (error): Updated based on new properties repartition between reader and controller. 
2722         (close): Updated based on new properties repartition between reader and controller. 
2723         (desiredSize): Updated based on new properties repartition between reader and controller. 
2724         * Modules/streams/ReadableStreamInternals.js:
2725         (privateInitializeReadableStreamDefaultController): Added various properties now handled by
2726         ReadableStreamDefaultController, as well as an internal pull function defined by spec.
2727         (readableStreamDefaultControllerError): Added based on spec (error handling at controller level).
2728         (teeReadableStream): Fixed typo and use readableStreamDefaultControllerError instead of errorReadableStream.
2729         (doStructuredClone): Added "use strict";.
2730         (teeReadableStreamPullFunction): Use readableStreamDefaultControllerClose instead of closeReadableStream.
2731         (isReadableStream): Replaced check of underlyingSource by check that object is actually an instance of
2732         ReadableStream (spec requires checking that readableStreamController slot is present, but this cannot
2733         be checked).
2734         (isReadableStreamDefaultReader): Replaced check of ownerReadableStream presence by check of readRequests,
2735         in line with spec.
2736         (isReadableStreamDefaultController): Replaced check of controlledReadableStream presence by check of unerlyingSource,
2737         in line with spec.
2738         (errorReadableStream): Updated based on new properties repartition between reader and controller.
2739         (requestReadableStreamPull): Updated based on new properties repartition between reader and controller.
2740         (readableStreamDefaultControllerGetDesiredSize): Replaces getReadableStreamDesiredSize (size now depends
2741         on controller; new function name aligned with spec).
2742         (cancelReadableStream): Updated based on new properties repartition between reader and controller. 
2743         (readableStreamDefaultControllerClose): Added based on spec (closing controller).
2744         (closeReadableStream): Updated based on new properties repartition between reader and controller. 
2745         (enqueueInReadableStream): Updated based on new properties repartition between reader and controller. 
2746         (readFromReadableStreamDefaultReader): Updated based on new properties repartition between reader and controller. 
2747         * bindings/js/WebCoreBuiltinNames.h: Added pull (internal function of ReadableStreamDefaultController)
2748         and readableStreamController (defined by spec)
2749
2750 2016-09-01  Csaba Osztrogonác  <ossy@webkit.org>
2751
2752         Unreviewed, fix the !ENABLE(SVG_FONTS) and !ENABLE(XSLT) build after r205269.
2753
2754         * loader/LinkLoader.cpp:
2755         (WebCore::createLinkPreloadResourceClient):
2756
2757 2016-09-01  Csaba Osztrogonác  <ossy@webkit.org>
2758
2759         URTBF after r205161 to fix !ENABLE(WEB_TIMING) build.
2760
2761         * bindings/js/JSPerformanceTimingCustom.cpp:
2762
2763 2016-09-01  Myles C. Maxfield  <mmaxfield@apple.com>
2764
2765         Clean up TextRun-related code
2766         https://bugs.webkit.org/show_bug.cgi?id=161473
2767
2768         Reviewed by Simon Fraser.
2769
2770         Some assorted cleanup, including:
2771         - Renaming "AllowTrailingExpansion | ForbidLeadingExpansion" to "DefaultExpansion"
2772         - Migrating from pointers to references
2773         - Migrating from ints to unsigneds
2774         - Using proper character names from CharacterNames.h
2775         - Simplifying CoreTextSPI.h
2776
2777         No new tests because there is no behavior change.
2778
2779         * platform/graphics/TextRun.h:
2780         (WebCore::TextRun::TextRun):
2781         * platform/graphics/mac/ComplexTextController.cpp:
2782         (WebCore::TextLayout::isNeeded):
2783         (WebCore::TextLayout::constructTextRun):
2784         * platform/spi/cocoa/CoreTextSPI.h:
2785         * platform/text/TextFlags.h:
2786         * rendering/RenderBlock.cpp:
2787         (WebCore::RenderBlock::constructTextRun):
2788         * rendering/RenderBlock.h:
2789         * rendering/RenderListMarker.cpp:
2790         (WebCore::RenderListMarker::computePreferredLogicalWidths):
2791         (WebCore::RenderListMarker::getRelativeMarkerRect):
2792         * rendering/RenderMenuList.cpp:
2793         (RenderMenuList::updateOptionsWidth):
2794         * rendering/RenderText.cpp:
2795         (WebCore::RenderText::widthFromCache):
2796         (WebCore::RenderText::trimmedPrefWidths):
2797         (WebCore::hyphenWidth):
2798         (WebCore::maxWordFragmentWidth):
2799         (WebCore::RenderText::computePreferredLogicalWidths):
2800         (WebCore::RenderText::width):
2801         * rendering/RenderText.h:
2802         * rendering/RenderThemeIOS.mm:
2803         * rendering/line/BreakingContext.h:
2804         (WebCore::textWidth):
2805         (WebCore::tryHyphenating):
2806         * rendering/svg/SVGInlineTextBox.cpp:
2807         (WebCore::SVGInlineTextBox::offsetForPositionInFragment):
2808         (WebCore::SVGInlineTextBox::selectionRectForTextFragment):
2809         (WebCore::SVGInlineTextBox::localSelectionRect):
2810         (WebCore::SVGInlineTextBox::paintSelectionBackground):
2811         (WebCore::SVGInlineTextBox::paint):
2812         (WebCore::SVGInlineTextBox::acquirePaintingResource):
2813         (WebCore::SVGInlineTextBox::prepareGraphicsContextForTextPainting):
2814         (WebCore::SVGInlineTextBox::constructTextRun):
2815         (WebCore::SVGInlineTextBox::paintDecorationWithStyle):
2816         (WebCore::SVGInlineTextBox::paintTextWithShadows):
2817         (WebCore::SVGInlineTextBox::paintText):
2818         * rendering/svg/SVGInlineTextBox.h:
2819
2820 2016-08-31  Carlos Garcia Campos  <cgarcia@igalia.com>
2821
2822         [GTK] Move GObject DOM bindings to WebKit2 layer and stop auto generating them
2823         https://bugs.webkit.org/show_bug.cgi?id=161438
2824
2825         Reviewed by Michael Catanzaro.
2826
2827         Remove the scripts to generate GObject DOM bindings and the tests. Also remove all GObject ifdefs from the idl files.
2828
2829         * PlatformGTK.cmake:
2830         * bindings/gobject: Removed.
2831         * bindings/scripts/CodeGeneratorGObject.pm: Removed.
2832         * bindings/scripts/test/GObject: Removed.
2833         * css/CSSStyleSheet.idl:
2834         * css/RGBColor.idl:
2835         * dom/DOMCoreException.idl:
2836         * dom/DOMImplementation.idl:
2837         * dom/Document.idl:
2838         * dom/DocumentType.idl:
2839         * dom/Element.idl:
2840         * dom/Event.idl:
2841         * dom/EventTarget.idl:
2842         * dom/KeyboardEvent.idl:
2843         * dom/MessageEvent.idl:
2844         * dom/MessagePort.idl:
2845         * dom/MouseEvent.idl:
2846         * dom/NamedNodeMap.idl:
2847         * dom/Node.idl:
2848         * dom/Range.idl:
2849         * dom/Slotable.idl:
2850         * dom/WheelEvent.idl:
2851         * fileapi/FileException.idl:
2852         * html/HTMLAppletElement.idl:
2853         * html/HTMLCanvasElement.idl:
2854         * html/HTMLCollection.idl:
2855         * html/HTMLDocument.idl:
2856         * html/HTMLElement.idl:
2857         * html/HTMLEmbedElement.idl:
2858         * html/HTMLFieldSetElement.idl:
2859         * html/HTMLFormElement.idl:
2860         * html/HTMLIFrameElement.idl:
2861         * html/HTMLInputElement.idl:
2862         * html/HTMLMediaElement.idl:
2863         * html/HTMLOptionElement.idl:
2864         * html/HTMLOptionsCollection.idl:
2865         * html/HTMLSelectElement.idl:
2866         * html/HTMLTableCellElement.idl:
2867         * html/HTMLTableColElement.idl:
2868         * html/HTMLTextAreaElement.idl:
2869         * html/HTMLVideoElement.idl:
2870         * html/ImageData.idl:
2871         * html/URLUtils.idl:
2872         * html/track/TextTrack.idl:
2873         * page/DOMSelection.idl:
2874         * page/DOMWindow.idl:
2875         * svg/SVGDocument.idl:
2876         * svg/SVGElement.idl:
2877         * svg/SVGException.idl:
2878         * workers/DedicatedWorkerGlobalScope.idl:
2879         * workers/Worker.idl:
2880         * workers/WorkerGlobalScope.idl:
2881         * xml/XPathException.idl:
2882
2883 2016-08-31  Yusuke Suzuki  <utatane.tea@gmail.com>
2884
2885         [JSC] Add initiator parameter to module pipeline
2886         https://bugs.webkit.org/show_bug.cgi?id=161470
2887
2888         Reviewed by Saam Barati.
2889
2890         No user-observable behavior change.
2891
2892         We rename JSModuleLoader to ScriptModuleLoader.
2893         The name "JSModuleLoader" is misleading since it seems like this is a JS object.
2894         "ModuleLoader" is not good since there is CSS modules.
2895
2896         * CMakeLists.txt:
2897         * WebCore.xcodeproj/project.pbxproj:
2898         * bindings/js/JSBindingsAllInOne.cpp:
2899         * bindings/js/JSDOMWindowBase.cpp:
2900         (WebCore::JSDOMWindowBase::moduleLoaderResolve):
2901         (WebCore::JSDOMWindowBase::moduleLoaderFetch):
2902         (WebCore::JSDOMWindowBase::moduleLoaderEvaluate):
2903         * bindings/js/JSDOMWindowBase.h:
2904         * bindings/js/JSMainThreadExecState.h:
2905         (WebCore::JSMainThreadExecState::loadModule):
2906         (WebCore::JSMainThreadExecState::linkAndEvaluateModule):
2907         * bindings/js/JSModuleLoader.cpp:
2908         (WebCore::JSModuleLoader::JSModuleLoader): Deleted.
2909         (WebCore::JSModuleLoader::resolve): Deleted.
2910         (WebCore::JSModuleLoader::fetch): Deleted.
2911         (WebCore::JSModuleLoader::evaluate): Deleted.
2912         * bindings/js/JSModuleLoader.h:
2913         (WebCore::JSModuleLoader::document): Deleted.
2914         * bindings/js/ScriptModuleLoader.cpp: Renamed from Source/WebCore/bindings/js/JSModuleLoader.cpp.
2915         (WebCore::ScriptModuleLoader::ScriptModuleLoader):
2916         (WebCore::ScriptModuleLoader::resolve):
2917         (WebCore::ScriptModuleLoader::fetch):
2918         (WebCore::ScriptModuleLoader::evaluate):
2919         * bindings/js/ScriptModuleLoader.h: Renamed from Source/WebCore/bindings/js/JSModuleLoader.h.
2920         (WebCore::ScriptModuleLoader::document):
2921         * dom/Document.cpp:
2922         (WebCore::Document::Document):
2923         * dom/Document.h:
2924         (WebCore::Document::moduleLoader):
2925
2926 2016-08-31  Zalan Bujtas  <zalan@apple.com>
2927
2928         ASSERTION FAILED: !flow->layer() && !flow->isInlineElementContinuation() in WebCore::RenderBlock::addContinuationWithOutline
2929         https://bugs.webkit.org/show_bug.cgi?id=151022
2930         <rdar://problem/27710993>
2931
2932         Reviewed by Simon Fraser.
2933
2934         Certain CSS properties like opacity, mask etc (graphical group members) require the layer to be a non-normal flow,
2935         self painting layer so that we can manage painting properly. However in addition to those CSS properties, some of the will-change
2936         values (again, graphical group members) also require the layer to be non-normal flow, self painting.
2937         This patch ensures that when deciding whether a layer should be a normal flow layer, we take the will-change values into account as well.
2938
2939         Tests: compositing/layer-creation/assert-on-inline-element-with-will-change.html
2940                compositing/layer-creation/will-change-on-normal-flow-content.html
2941
2942         * rendering/RenderLayer.cpp:
2943         (WebCore::RenderLayer::calculateClipRects):
2944         * rendering/style/WillChangeData.cpp:
2945         (WebCore::propertyCreatesGraphicalGroup):
2946         (WebCore::WillChangeData::addFeature):
2947         * rendering/style/WillChangeData.h:
2948         (WebCore::WillChangeData::canCreateGraphicalGroup):
2949         (WebCore::WillChangeData::canTriggerCompositingOnInline): Deleted.
2950
2951 2016-08-31  Keith Rollin  <krollin@apple.com>
2952
2953         WebKit should set a subsystem for os_log so it's easier to filter for WebKit log messages
2954         https://bugs.webkit.org/show_bug.cgi?id=160969
2955         <rdar://problem/26068734>
2956
2957         Reviewed by Simon Fraser.
2958
2959         - Specify a channel when using RELEASE_LOG macros
2960         - Add a new channel so that we have something to pass to the
2961           RELEASE_LOG macros (Layers).
2962         - Enable subsystem- and channel-related data and functions when using
2963           RELEASE_LOG macros.
2964         - Use the DECLARE_LOG_CHANNEL, DEFINE_LOG_CHANNEL, and
2965           LOG_CHANNEL_ADDRESS macros that are now defined in WTF.
2966
2967         No new tests. There are no tests for logging.
2968
2969         * loader/FrameLoader.cpp:
2970         * platform/LogInitialization.h:
2971         * platform/LogMacros.h:
2972         * platform/Logging.cpp:
2973         * platform/Logging.h:
2974         * platform/MemoryPressureHandler.cpp:
2975         (WebCore::MemoryPressureHandler::ReliefLogger::logMemoryUsageChange):
2976         * platform/graphics/cg/GraphicsContextCG.cpp:
2977         (WebCore::GraphicsContext::drawNativeImage):
2978         * platform/graphics/cocoa/IOSurface.mm:
2979         (WebCore::IOSurface::IOSurface):
2980         * platform/mac/LoggingMac.mm:
2981         * platform/unix/LoggingUnix.cpp:
2982         * platform/win/LoggingWin.cpp:
2983         * testing/js/WebCoreTestSupport.cpp:
2984         (WebCoreTestSupport::initializeLogChannelsIfNecessary):
2985
2986 2016-08-31  Ricky Mondello  <rmondello@apple.com>
2987
2988         Enable the YouTube Flash plug-in replacement behavior on all Cocoa ports
2989         https://bugs.webkit.org/show_bug.cgi?id=161453
2990         <rdar://problem/28050847>
2991
2992         Reviewed by Eric Carlson.
2993
2994         Now that we have some tests for the URL transformation logic (r205212) and the ability to enable the YouTube
2995         Flash plug-in replacement behavior independently from the QuickTime plug-in replacement behavior (r205214 and
2996         r205271), enable the YouTube Flash plug-in replacement behavior for Cocoa ports. We can and will continue to
2997         improve it.
2998
2999         * page/Settings.cpp: Enable the feature for PLATFORM(COCOA), rather than just PLATFORM(IOS).
3000
3001 2016-08-31  Alex Christensen  <achristensen@webkit.org>
3002
3003         Implement IPv6 parsing in URLParser
3004         https://bugs.webkit.org/show_bug.cgi?id=161390
3005
3006         Reviewed by Darin Adler.
3007
3008         Covered by new API tests.
3009
3010         * platform/URLParser.cpp:
3011         (WebCore::zeroSequenceLength):
3012         (WebCore::findLongestZeroSequence):
3013         (WebCore::nibbleToHex):
3014         (WebCore::serializeIPv6Piece):
3015         (WebCore::serializeIPv6):
3016         (WebCore::parseIPv6Host):
3017         (WebCore::URLParser::hostEndReached):
3018
3019 2016-08-31  Ricky Mondello  <rmondello@apple.com>
3020
3021         Break pluginReplacementEnabled into youTubeFlashPluginReplacementEnabled and quickTimePluginReplacementEnabled
3022         https://bugs.webkit.org/show_bug.cgi?id=161424
3023         <rdar://problem/28050847>
3024
3025         Reviewed by Dean Jackson.
3026
3027         Replace the single pluginReplacementEnabled setting with individual settings for the YouTube Flash plug-in
3028         behavior and the QuickTime plug-in behavior. Unless otherwise noted, this change copies the existing plumbing
3029         for pluginReplacementEnabled and renames it twice. The default values for these settings remain the same.
3030
3031         * Modules/plugins/PluginReplacement.h:
3032         (WebCore::ReplacementPlugin::ReplacementPlugin): Augment the constructor.
3033         (WebCore::ReplacementPlugin::isEnabledBySettings): Added.
3034         * Modules/plugins/QuickTimePluginReplacement.h: Declare a static member function.
3035         * Modules/plugins/QuickTimePluginReplacement.mm:
3036         (WebCore::QuickTimePluginReplacement::registerPluginReplacement): Properly create a ReplacementPlugin instance.
3037         (WebCore::QuickTimePluginReplacement::isEnabledBySettings): Added.
3038         * Modules/plugins/YouTubePluginReplacement.cpp:
3039         (WebCore::YouTubePluginReplacement::registerPluginReplacement): Properly create a ReplacementPlugin instance.
3040         (WebCore::YouTubePluginReplacement::isEnabledBySettings): Added.
3041         * Modules/plugins/YouTubePluginReplacement.h: Declare a static member function.
3042         * html/HTMLPlugInElement.cpp:
3043         (WebCore::HTMLPlugInElement::requestObject): Ask the ReplacementPlugin whether it's enabled, rather than assume
3044             all plug-in replacement is guarded by a single run-time setting.
3045         * page/Settings.cpp: Declare values for defaults for both settings.
3046         * page/Settings.in: Declare two settings.
3047         * testing/InternalSettings.cpp:
3048         (WebCore::InternalSettings::Backup::Backup): Handle both settings.
3049         (WebCore::InternalSettings::Backup::restoreTo): Ditto.
3050         (WebCore::InternalSettings::setQuickTimePluginReplacementEnabled): Added.
3051         (WebCore::InternalSettings::setYouTubeFlashPluginReplacementEnabled): Added.
3052         (WebCore::InternalSettings::setPluginReplacementEnabled): Deleted.
3053         * testing/InternalSettings.h: Duplicate and rename.
3054         * testing/InternalSettings.idl: Ditto.
3055
3056 2016-08-31  Yoav Weiss  <yoav@yoav.ws>
3057
3058         Add event support for link preload.
3059         https://bugs.webkit.org/show_bug.cgi?id=158466
3060
3061         Reviewed by Alex Christensen.
3062
3063         Add onload/onerror support for link rel preload to align it with the spec
3064         and enable various resource loading use-cases.
3065         This patch also fixes XHR matching issues by replacing LinkPreload with RawResource.
3066
3067         Tests: http/tests/misc/script_onload_delays_window_onload.html
3068                http/tests/preload/delaying_onload_link_preload_after_discovery.html
3069                http/tests/preload/delaying_onload_link_preload_after_discovery_image.html
3070                http/tests/preload/not_delaying_window_onload_before_discovery.html
3071                http/tests/preload/onerror_event.html
3072                http/tests/preload/onload_event.html
3073
3074         * CMakeLists.txt: Add LinkPreloadResourceClients.{h,cpp}
3075         * WebCore.xcodeproj/project.pbxproj: Add LinkPreloadResourceClients.{h,cpp}.
3076         * html/HTMlLinkElement.cpp:
3077         (WebCore::linkErrorEventSender): Add an eventSender for the error event.
3078         (WebCore::HTMLLinkElement::HTMLLinkElement): s/m_loadedSheet/m_loadedResource/
3079         (WebCore::HTMLLinkElement::~HTMLLinkElement): Cancel the error event when the element gets destructed.
3080         (WebCore::HTMLLinkElement::linkLoaded): dispatch the event in an async manner.
3081         (WebCore::HTMLLinkElement::linkLoadingErrored): dispatch the event in an async manner.
3082         (WebCore::HTMLLinkElement::dispatchPendingEvent): Call dispatchEvent directly.
3083         (WebCore::HTMLLinkElement::notifyLoadedSheetAndAllCriticalSubresources): s/m_loadedSheet/m_loadedResource/
3084         * html/HTMLLinkElement.h: s/m_loadedSheet/m_loadedResource/
3085         * html/parser/HTMLResourcePreloader.cpp:
3086         (WebCore::HTMLResourcePreloader::preload): Call preload as ImplicitPreload, to distinguish it from declarative preload.
3087         * loader/LinkLoader.cpp:
3088         (WebCore::LinkLoader::LinkLoader): Get rid of unnecessary event timers and add a weakPtrFactory.
3089         (WebCore::LinkLoader::triggerEvents): Add a triggerEvents function that can be called from notifyFinished as well as the
3090         LinkPreloadResourceClients.
3091         (WebCore::LinkLoader::notifyFinished): Call the triggerEvents function.
3092         (WebCore::LinkLoader::resourceTypeFromAsAttribute): Replace LinkPreload with RawResource to avoid XHR resource matching issues.
3093         (WebCore::createLinkPreloadResourceClient): Create a resource client for link preload.
3094         (WebCore::LinkLoader::preloadIfNeeded): Trigger an error when `as` is unknown. Make sure that preload resources don't delay window.onload
3095         before discovery. Get the resource back from calling preload and create a client for that resource.
3096         (WebCore::LinkLoader::linkLoadTimerFired): Deleted.
3097         (WebCore::LinkLoader::linkLoadingErrorTimerFired): Deleted.
3098         (WebCore::preloadIfNeeded): Deleted.
3099         * loader/LinkLoader.h:
3100         (WebCore::LinkLoader::createWeakPtr):
3101         * loader/LinkPreloadResourceClients.cpp: Added.
3102         (WebCore::LinkPreloadResourceClient::LinkPreloadResourceClient): Create a LinkPreloadResourceClient and assign with with a weakPtr of
3103         LinkLoader.
3104         (WebCore::LinkPreloadResourceClient::triggerEvents): Call LinkLoader's triggerEvents.
3105         * loader/LinkPreloadResourceClients.h: Added.
3106         (WebCore::LinkPreloadResourceClient::~LinkPreloadResourceClient):
3107         (WebCore::LinkPreloadResourceClient::addResource): Add as resource's client.
3108         (WebCore::LinkPreloadResourceClient::clearResource): Remove as resource's client and clear ref to resource.
3109         (WebCore::LinkPreloadResourceClient::ownedResource): Return ref to resource.
3110         * loader/ResourceLoadInfo.cpp:
3111         (WebCore::toResourceType): Removed LinkPreload.
3112         * loader/SubresourceLoader.cpp:
3113         (WebCore::logResourceLoaded): Removed LinkPreload.
3114         * loader/cache/CachedResource.cpp:
3115         (WebCore::CachedResource::defaultPriorityForResourceType): Removed LinkPreload.
3116         * loader/cache/CachedResource.h: Removed LinkPreload.
3117         (WebCore::CachedResource::ignoreForRequestCount): Don't delay window.onload for requests that opted out of that.
3118         * loader/cache/CachedResourceLoader.cpp:
3119         (WebCore::CachedResourceLoader::checkInsecureContent): Removed LinkPreload.
3120         (WebCore::CachedResourceLoader::requestResource): Make sure that discovered preload resources do block window.onload.
3121         (WebCore::CachedResourceLoader::preload): Make sure that explicitly preloaded subresources can be fetched even if there are parser
3122         blocking resources still in flight. Return the preloaded resource.
3123         (WebCore::CachedResourceLoader::requestPreload): Make sure that preloaded fonts get requested. Return preloaded resource.
3124         (WebCore::createResource): Removed LinkPreload.
3125         (WebCore::contentTypeFromResourceType): Removed LinkPreload.
3126         (WebCore::CachedResourceLoader::canRequest): Removed LinkPreload.
3127         * loader/cache/CachedResourceLoader.h:
3128         * platform/network/ResourceRequestBase.h:
3129         (WebCore::ResourceRequestBase::ignoreForRequestCount): Get the flag saying if a resource should block window.onload.
3130         (WebCore::ResourceRequestBase::setIgnoreForRequestCount): Set the flag saying if a resource should block window.onload.
3131
3132 2016-08-31  Joseph Pecoraro  <pecoraro@apple.com>
3133
3134         Web Inspector: XHR with text but responseType = "blob" shows blank content
3135         https://bugs.webkit.org/show_bug.cgi?id=161422
3136         <rdar://problem/28066869>
3137
3138         Reviewed by Brian Burg.
3139
3140         Test: inspector/network/xhr-json-blob-has-content.html
3141
3142         When an XMLHttpRequest finished loading it was always setting the Inspector's
3143         content for that load at the end. However, if the XHR was loading binary data
3144         then it was passing an empty string to the inspector and overwriting the
3145         data the inspector already had for the resource. Avoid this overwriting.
3146
3147         * xml/XMLHttpRequest.cpp:
3148         (WebCore::XMLHttpRequest::didFinishLoading):
3149         When loading binary content we have no decoded text to send to the inspector.
3150
3151         * inspector/InspectorInstrumentation.cpp:
3152         (WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl):
3153         * inspector/InspectorInstrumentation.h:
3154         (WebCore::InspectorInstrumentation::didFinishXHRLoading):
3155         Switch to an Optional string, and if it is not available don't
3156         call through to the NetworkAgent expecting decoded text.
3157
3158         * inspector/InspectorNetworkAgent.cpp:
3159         (WebCore::InspectorNetworkAgent::didFinishXHRLoading):
3160         * inspector/InspectorNetworkAgent.h:
3161         Improve variable name.
3162
3163 2016-08-31  Alex Christensen  <achristensen@webkit.org>
3164
3165         Add runtime flag for using URLParser
3166         https://bugs.webkit.org/show_bug.cgi?id=161363
3167
3168         Reviewed by Sam Weinig.
3169
3170         No new tests.  No change in default behavior.
3171
3172         * PlatformMac.cmake:
3173         * platform/URL.cpp:
3174         (WebCore::URL::URL):
3175         (WebCore::URL::init):
3176         (WebCore::URL::setProtocol):
3177         (WebCore::URL::setHost):
3178         (WebCore::URL::removePort):
3179         (WebCore::URL::setPort):
3180         (WebCore::URL::setHostAndPort):
3181         (WebCore::URL::setUser):
3182         (WebCore::URL::setPass):
3183         (WebCore::URL::setFragmentIdentifier):
3184         (WebCore::URL::removeFragmentIdentifier):
3185         (WebCore::URL::setQuery):
3186         (WebCore::URL::setPath):
3187         (WebCore::URL::parse):
3188         * platform/URLParser.cpp:
3189         (WebCore::URLParser::parse):
3190         (WebCore::URLParser::setEnabled):
3191         (WebCore::URLParser::enabled):
3192         * platform/URLParser.h:
3193         * platform/cf/URLCF.cpp:
3194         (WebCore::URL::URL):
3195         * platform/cocoa/URLParserCocoa.mm: Added.
3196         (WebCore::URLParser::URLParserEnabled):
3197         * platform/mac/URLMac.mm:
3198         (WebCore::URL::URL):
3199
3200 2016-08-31  Youenn Fablet  <youenn@apple.com>
3201
3202         [Fetch API] Fetch API should be able to load data URL in Same Origin mode
3203         https://bugs.webkit.org/show_bug.cgi?id=161434
3204
3205         Reviewed by Sam Weinig.
3206
3207         Tests: imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl-worker.html
3208                imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl.html
3209         Covered also by added sub-test.
3210
3211         Moving SameDataURLOrigin option from ThreadableLoaderOptions to ResourceLoaderOptions.
3212         This allows doing some of the checks in CachedResourceLoader/CachedResource.
3213         This also allows setting this options in CachedResourceLoader clients, ImageLoader in that case.
3214
3215         * Modules/fetch/FetchLoader.cpp:
3216         (WebCore::FetchLoader::start): Setting sameOriginDataURL as ResourceLoader option.
3217         * loader/ImageLoader.cpp:
3218         (WebCore::ImageLoader::updateFromElement): Setting sameOriginDataURL as specificied in
3219         https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element.
3220         * loader/ResourceLoaderOptions.h: Adding sameOriginDataURL as ResourceLoader option.
3221         * loader/ThreadableLoader.cpp:
3222         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions): Removing sameOriginDataURL option.
3223         * loader/ThreadableLoader.h:
3224         * loader/WorkerThreadableLoader.cpp: Setting sameOriginDataURL as ResourceLoader option.
3225         (WebCore::LoaderTaskOptions::LoaderTaskOptions):
3226         * loader/cache/CachedResource.cpp:
3227         (WebCore::CachedResource::load): If resource URL is a data url, we previously marked the resource as same origin.
3228         We only do that now if the sameOriginDataURL flag is set as per fetch specification.
3229         See https://fetch.spec.whatwg.org/#main-fetch.
3230         * loader/cache/CachedResourceLoader.cpp:
3231         (WebCore::isSameOriginDataURL): Helper function.
3232         (WebCore::CachedResourceLoader::canRequest): Allowing same origin loads of data URLs if flag is set and no redirection happens.
3233         See https://fetch.spec.whatwg.org/#http-redirect-fetch for why we check redirection.
3234
3235 2016-08-31  Ryosuke Niwa  <rniwa@webkit.org>
3236
3237         HTML constructor must throw when newTarget is itself
3238         https://bugs.webkit.org/show_bug.cgi?id=161430
3239
3240         Reviewed by Antti Koivisto.
3241
3242         Per https://github.com/w3c/webcomponents/issues/541, we must throw a TypeError when the HTMLElement constructor
3243         is called with new.target set to itself (i.e. new HTMLElement after registering it with a custom element).
3244
3245         Note that we can't check this at the time of customElements.define because it could be a Proxy object.
3246
3247         Also see: https://html.spec.whatwg.org/#html-element-constructors
3248
3249         Tests: fast/custom-elements/CustomElementRegistry.html
3250                fast/custom-elements/HTMLElement-constructor.html
3251
3252         * bindings/js/JSHTMLElementCustom.cpp:
3253         (WebCore::constructJSHTMLElement): Throw a TypeError when NewTarget is HTMLElement constructor itself.
3254
3255 2016-08-31  Ryosuke Niwa  <rniwa@webkit.org>
3256
3257         Rebaseline binding tests after r205257.
3258
3259         * bindings/scripts/test/JS/JSTestObj.cpp:
3260         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionPromise):
3261         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
3262         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise):
3263         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise):
3264         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
3265         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
3266         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise):
3267         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise):
3268
3269 2016-08-31  Ryosuke Niwa  <rniwa@webkit.org>
3270
3271         Add the check for reentrancy to CustomElementRegistry
3272         https://bugs.webkit.org/show_bug.cgi?id=161423
3273
3274         Reviewed by Antti Koivisto.
3275
3276         Added the "element definition is running" flag to JSCustomElementRegistry:
3277         https://html.spec.whatwg.org/multipage/scripting.html#element-definition-is-running
3278
3279         And added an exception for when this flag is set during JSCustomElementRegistry::define:
3280         https://html.spec.whatwg.org/multipage/scripting.html#dom-customelementregistry-define
3281
3282         Tests: fast/custom-elements/CustomElementRegistry.html
3283
3284         * bindings/js/JSCustomElementRegistryCustom.cpp:
3285         (WebCore::JSCustomElementRegistry::define): Throw NotSupportedError when m_elementDefinitionIsRunning is true.
3286         * dom/CustomElementRegistry.h:
3287         (WebCore::CustomElementRegistry::elementDefinitionIsRunning): Added.
3288
3289 2016-08-30  Ryosuke Niwa  <rniwa@webkit.org>
3290
3291         Avoid using strong reference in JSDOMPromise’s DeferredWrapper
3292         https://bugs.webkit.org/show_bug.cgi?id=161426
3293         <rdar://problem/28091123>
3294
3295         Reviewed by Geoffrey Garen.
3296
3297         Replace JSC::Strong in DeferredWrapper by JSC::Weak, and make the global object own JSPromiseDeferred.
3298
3299         DeferredWrapper adds itself to JSDOMGlobalObject's newly added HashSet when it's created and clears itself
3300         from the HashSet inside its destructor as well as when the promise is resolved or rejected.
3301         This is so that JSDOMGlobalObject's visitChildren can visit every live DeferredWrapper.
3302
3303         Because this operation is rather expense, this patch turns DeferredWrapper into a RefCounted object to avoid
3304         HashMap churns. Most of code changes in this patch is due to this type change, and the fact lambda cannot
3305         capture Ref<DeferredWrapper> since its copy constructor doesn't exist.
3306
3307         We also create a write barrier from the global object to JSPromiseDeferred so that they won't be collected
3308         during an eden collection when it happens before JSDOMGlobalObject's visitChildren is invoked.
3309
3310         Note that it's possible for the entire DOM wrapper world of the promise to go away before the promise is
3311         resolved or rejected by a ref-counted C++ object. In this case, m_deferred and m_globalObject become dead.
3312         Various member resolve* and reject functions of DeferredWrapper have been modified to check this condition.
3313
3314         Because JSDOMGlobalObject can be finalized before DeferredWrapper is finalized. DeferredWrapper's destructor,
3315         which calls DeferredWrapper::clear, should only remove itself from m_globalObject when m_globalObject is alive.
3316
3317         Finally, this patch makes DeferredWrapper inherit from ActiveDOMCallback so that it won't try to execute scripts
3318         when the active DOM objects have been suspended; e.g. after a page navigation.
3319
3320         No new tests since there should be no author/user visible behavioral change.
3321
3322         * Modules/applepay/ApplePaySession.cpp:
3323         (WebCore::ApplePaySession::canMakePaymentsWithActiveCard):
3324         * Modules/applepay/ApplePaySession.h:
3325         * Modules/fetch/DOMWindowFetch.cpp:
3326         (WebCore::DOMWindowFetch::fetch):
3327         * Modules/fetch/DOMWindowFetch.h:
3328         * Modules/fetch/FetchBody.cpp:
3329         (WebCore::FetchBody::arrayBuffer):
3330         (WebCore::FetchBody::blob):
3331         (WebCore::FetchBody::json):
3332         (WebCore::FetchBody::text):
3333         (WebCore::FetchBody::consume):
3334         (WebCore::FetchBody::consumeArrayBuffer):
3335         (WebCore::FetchBody::consumeArrayBufferView):
3336         (WebCore::FetchBody::consumeText):
3337         (WebCore::FetchBody::consumeBlob):
3338         (WebCore::FetchBody::loadingFailed):
3339         (WebCore::FetchBody::loadingSucceeded):
3340         * Modules/fetch/FetchBody.h:
3341         (WebCore::FetchBody::formData):
3342         (WebCore::FetchBody::cleanConsumePromise):
3343         (WebCore::FetchBody): Use RefPtr<DeferredWrapper> instead of Optional<DeferredWrapper> now that DeferredWrapper
3344         is ref counted. Perhaps we could use Optional<Ref<DeferredWrapper>> here but that seemed rather verbose.
3345