TextTrackLoader should use FetchOptions::mode according its crossOrigin attribute
[WebKit.git] / Source / WebCore / ChangeLog
1 2016-09-09  Youenn Fablet  <youenn@apple.com>
2
3         TextTrackLoader should use FetchOptions::mode according its crossOrigin attribute
4         https://bugs.webkit.org/show_bug.cgi?id=161792
5
6         Reviewed by Eric Carlson.
7
8         Covered by existing and updated tests.
9
10         Updating text track loader to use fetch mode according crossOrigin value.
11
12         Removed the check done in the case the crossOrigin value is not set.
13         Previously cross-origin loads were forbidden, now this is authorized.
14         This change allows aligning with the spec.
15         Also, this check could be bypassed in the case of a same-origin URL redirecting to a cross-origin one.
16
17         * loader/TextTrackLoader.cpp:
18         (WebCore::TextTrackLoader::notifyFinished): Checking resource error in lieu of doing CORS checks on its own.
19         (WebCore::TextTrackLoader::load): Using CachedResourceRequest::setAsPotentiallyCrossOrigin
20         * loader/TextTrackLoader.h:
21         * loader/cache/CachedResource.cpp:
22         (WebCore::CachedResource::loadFrom): Setting loading and status values as would be done when load is finished.
23         (WebCore::CachedResource::setBodyDataFrom): Default implementation is to copy the shared buffer.
24         * loader/cache/CachedResource.h:
25         * loader/cache/CachedResourceLoader.cpp:
26         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Enabling resource update when mode or origin is different for TextTrack resources.
27
28 2016-09-09  Alex Christensen  <achristensen@webkit.org>
29
30         URLParser should parse URLs with non-special schemes
31         https://bugs.webkit.org/show_bug.cgi?id=161786
32
33         Reviewed by Andy Estes.
34
35         Covered by new API tests.
36
37         * platform/URLParser.cpp:
38         (WebCore::URLParser::parse):
39         There's no reason for a SchemeEndCheckForSlashes state now that we can copy iterators.
40         It's not in the spec and not needed.
41         Also, move things around a little so parsing special or non-special schemes
42         followed by one or two slashes works correctly.
43
44 2016-09-09  Chris Dumez  <cdumez@apple.com>
45
46         Regression(r186020): Null dereference in getStartDate()
47         https://bugs.webkit.org/show_bug.cgi?id=161733
48
49         Reviewed by Eric Carlson.
50
51         Update HTMLMediaElement::getStartDate() to return NaN if m_player is null,
52         instead of crashing.
53
54         Test: fast/media/getStartDate-NaN.html
55
56         * bindings/js/IDBBindingUtilities.cpp:
57         (WebCore::toJS):
58         Add a FIXME comment as this code is using jsDateOrNull() but should
59         probably be using jsDate() as per:
60         - http://w3c.github.io/IndexedDB/#request-convert-a-key-to-a-value
61
62         * bindings/js/JSDOMBinding.cpp:
63         (WebCore::jsDate):
64         (WebCore::jsDateOrNull):
65         * bindings/js/JSDOMBinding.h:
66         - Rename jsDateOrNaN() to jsDate() as this is the default behavior. Also,
67           return new Date(NaN) instead of NaN if the implementation returns NaN.
68           The IDL says we should return a Date, not a number.
69         - Update jsDateOrNull() to only return jsNull() if the native value is
70           NaN, instead of doing so for every value that is not finite. Our
71           convention is to use NaN as special value to represent null in JS.
72
73         * bindings/scripts/CodeGeneratorJS.pm:
74         (NativeToJSValue):
75         When converting a native value (double) into a Date, rely on the fact
76         that the type is nullable when deciding if we should call jsDate() or
77         jsDateOrNull() to convert. This way, we no longe need a WebKit specific
78         [TreatReturnedDateAs=Null|NaN] IDL extended attribute.
79
80         * bindings/scripts/IDLAttributes.txt:
81         * html/HTMLInputElement.idl:
82         Mark valueAsDate attribute as nullable, as per the specification:
83         - https://html.spec.whatwg.org/#htmlinputelement
84
85         * html/HTMLMediaElement.cpp:
86         (WebCore::HTMLMediaElement::getStartDate):
87         Return NaN if m_player is null instead of crashing. The reason I decided
88         to return NaN is because the specification [1] says to return a new Date
89         object representing the current timeline offset. The spec of timeline
90         offset [2] says that the initial timeline offset value is NaN.
91         [1] https://html.spec.whatwg.org/#dom-media-getstartdate
92         [2] https://html.spec.whatwg.org/#timeline-offset
93
94         * bindings/scripts/IDLAttributes.txt:
95         * html/HTMLMediaElement.idl:
96         Drop [TreatReturnedDateAs] attribute as it is no longer supported.
97
98 2016-09-09  Youenn Fablet  <youenn@apple.com>
99
100         ASSERTION FAILED: promise.inherits(JSPromise::info())
101         https://bugs.webkit.org/show_bug.cgi?id=161632
102         <rdar://problem/28184743>
103
104         Reviewed by Mark Lam.
105
106         Test: fetch/fetch-worker-crash.html
107
108         * bindings/js/JSDOMPromise.h:
109         (WebCore::callPromiseFunction): Returning early if created promise is null.
110         Passing directly a DeferredWrapper to the generated code.
111         * bindings/scripts/CodeGeneratorJS.pm: Updated to take a DeferredWrapper.
112         (GenerateImplementation):
113         (GenerateReturnParameters):
114         * bindings/scripts/test/JS/JSTestObj.cpp: Rebasing expectations.
115         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionPromise):
116         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
117         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise):
118         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise):
119         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
120         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
121         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise):
122         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise):
123
124 2016-09-09  Myles C. Maxfield  <mmaxfield@apple.com>
125
126         [Cocoa] Improve performance of glyph advance metrics gathering
127         https://bugs.webkit.org/show_bug.cgi?id=161119
128
129         Reviewed by Simon Fraser.
130
131         Most of the glyphs in a GlyphPage are never read from. Therefore, we can get a performance boost
132         by not populating as many items in the GlyphPage. Because of the performance characteristics of
133         CTFontGetGlyphsForCharacters(), a better size for a GlyphPage is 16 items. This, coupled with
134         using CTFontGetUnsummedAdvancesForGlyphsAndStyle(), causes between a 0.01%-0.5% speedup on PLT.
135
136         No new tests because there is no behavior change.
137
138         * platform/graphics/Font.cpp:
139         (WebCore::Font::initCharWidths):
140         (WebCore::Font::platformGlyphInit):
141         (WebCore::createAndFillGlyphPage):
142         * platform/graphics/Font.h:
143         (WebCore::Font::widthForGlyph):
144         * platform/graphics/GlyphMetricsMap.h:
145         * platform/graphics/GlyphPage.h:
146         * platform/graphics/cocoa/FontCocoa.mm:
147         * platform/spi/cocoa/CoreTextSPI.h:
148         (WebCore::Font::platformWidthForGlyph):
149         (WebCore::canUseFastGlyphAdvanceGetter): Deleted.
150
151 2016-09-09  Antti Koivisto  <antti@apple.com>
152
153         v3: WebContent crash due to RELEASE_ASSERT in WebCore: WebCore::StyleResolver::styleForElement
154         https://bugs.webkit.org/show_bug.cgi?id=161689
155
156         Reviewed by Andreas Kling.
157
158         These crashes happen because synchronously triggered resource loads generate callbacks that may end up
159         deleting the resource loader.
160
161         Stop triggering resource loads from StyleResolver. Instead trigger them when applying style to render tree.
162
163         * css/StyleResolver.cpp:
164         (WebCore::StyleResolver::~StyleResolver):
165
166             Replace the RELEASE_ASSERT against deletion during resource loads by a general isDeleted assert.
167
168         (WebCore::StyleResolver::styleForElement):
169         (WebCore::StyleResolver::styleForKeyframe):
170         (WebCore::StyleResolver::pseudoStyleForElement):
171         (WebCore::StyleResolver::styleForPage):
172         (WebCore::StyleResolver::applyMatchedProperties):
173         (WebCore::StyleResolver::loadPendingResources): Deleted.
174         * css/StyleResolver.h:
175         * page/animation/KeyframeAnimation.cpp:
176         (WebCore::KeyframeAnimation::KeyframeAnimation):
177         (WebCore::KeyframeAnimation::resolveKeyframeStyles):
178
179             Ensure resource load for all animation frames.
180
181         * page/animation/KeyframeAnimation.h:
182         * rendering/RenderElement.cpp:
183         (WebCore::RenderElement::createFor):
184         (WebCore::RenderElement::initializeStyle):
185
186             Load resources when renderer initializes a style.
187
188         (WebCore::RenderElement::setStyle):
189         (WebCore::RenderElement::getUncachedPseudoStyle):
190
191             Load resources for pseudo styles.
192
193         * rendering/RenderImage.cpp:
194         (WebCore::RenderImage::RenderImage):
195         (WebCore::RenderImage::styleWillChange):
196
197             Shuffle image resource initialization out from constructor so initializeStyle gets called before.
198
199         * rendering/RenderImage.h:
200         * rendering/style/StyleCachedImage.cpp:
201         (WebCore::StyleCachedImage::StyleCachedImage):
202
203             Track pending status with a bit instead of implicitly by the existence of CachedResource.
204             This is useful for asserts.
205
206         (WebCore::StyleCachedImage::load):
207         (WebCore::StyleCachedImage::isPending):
208         (WebCore::StyleCachedImage::addClient):
209         (WebCore::StyleCachedImage::removeClient):
210         (WebCore::StyleCachedImage::image):
211         * rendering/style/StyleCachedImage.h:
212
213 2016-09-08  Yusuke Suzuki  <utatane.tea@gmail.com>
214
215         ScriptRunner should be driven by PendingScript rather than ScriptElement
216         https://bugs.webkit.org/show_bug.cgi?id=161726
217
218         Reviewed by Ryosuke Niwa.
219
220         Tests: js/dom/document-write-in-error-event.html
221                js/dom/document-write-in-load-event.html
222
223         ScriptRunner is driven by ScriptElement::notifyFinished. While ScriptRunner is driven by this,
224         HTMLScriptRunner does not use it. Instead, HTMLScriptRunner uses PendingScriptClient. As a result,
225         ScriptElement::notifyFinished is used only when the script is annotated with "defer" or "async"
226         while all the external script will load the LoadableScript. It is confusing.
227         This patch removes ScriptElement::notifyFinished and use PendingScript's observability
228         in ScriptRunner instead.
229
230         This patch also fixes the behavior about ignore-destructive-writes counter[1]. When dispatching
231         the load and error events, this ignore-destructive-writes counter should not be incremeneted by
232         this execution. The added tests ensure this behavior.
233
234         [1]: https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block
235
236         * dom/ScriptElement.cpp: Drop LoadableScriptClient interface.
237         (WebCore::ScriptElement::prepareScript): Do not use addClient. ScriptRunner use PendingScript::{setClient,clearClient} instead.
238         (WebCore::ScriptElement::executeScriptForScriptRunner): IgnoreDestructiveWriteCountIncrementer will be done in ScriptElement::executeScript.
239         So no need to do it here, that's duplicated.
240         (WebCore::ScriptElement::~ScriptElement): Deleted. ScriptElement does not use addClient/removeClient.
241         (WebCore::ScriptElement::stopLoadRequest): Deleted.
242         (WebCore::ScriptElement::executeScriptForHTMLScriptRunner): Deleted. executeScriptForHTMLScriptRunner and executeScriptForScriptRunner are
243         merged into executeScriptForRunner.
244         (WebCore::ScriptElement::notifyFinished): Deleted.
245         * dom/ScriptElement.h:
246         (WebCore::ScriptElement::~ScriptElement):
247         (WebCore::ScriptElement::willExecuteInOrder): Used in ScriptRunner to determine whether the script is async or defer.
248         (WebCore::ScriptElement::willExecuteWhenDocumentFinishedParsing): Deleted.
249         * dom/ScriptRunner.cpp:
250         (WebCore::ScriptRunner::~ScriptRunner): HashSet's iterator will return `const PendingScript&`.
251         Another option is using HashSet<RefPtr<PendingScript>>. Here, we use a little bit weired const_cast.
252         (WebCore::ScriptRunner::queueScriptForExecution): Use PendingScript::setClient to wait loading.
253         (WebCore::ScriptRunner::notifyFinished): Notify the script ready here.
254         (WebCore::ScriptRunner::timerFired): Use executeScriptForScriptRunner.
255         (WebCore::ScriptRunner::notifyScriptReady): Deleted.
256         * dom/ScriptRunner.h:
257         * html/parser/HTMLScriptRunner.cpp:
258         (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent): Use executeScriptForScriptRunner.
259
260 2016-09-08  Yusuke Suzuki  <utatane.tea@gmail.com>
261
262         [WTF] HashTable's rehash is not compatible to Ref<T> and ASan
263         https://bugs.webkit.org/show_bug.cgi?id=161763
264
265         Reviewed by Mark Lam.
266
267         Include wtf/text/StringHash.h to avoid linking errors in EFL port.
268
269         * loader/ResourceLoadStatistics.h:
270
271 2016-09-08  Chris Dumez  <cdumez@apple.com>
272
273         HTMLObjectElement.hspace / vspace attributes should be unsigned
274         https://bugs.webkit.org/show_bug.cgi?id=161766
275
276         Reviewed by Ryosuke Niwa.
277
278         HTMLObjectElement.hspace / vspace attributes should be unsigned:
279         - https://html.spec.whatwg.org/#HTMLObjectElement-partial
280
281         Firefox agrees with the specification but those were signed in WebKit.
282
283         No new tests, rebaselined existing test.
284
285         * html/HTMLObjectElement.idl:
286
287 2016-09-08  Chris Dumez  <cdumez@apple.com>
288
289         HTMLObjectElement.codebase attribute should reflect as a URL
290         https://bugs.webkit.org/show_bug.cgi?id=161768
291
292         Reviewed by Alex Christensen.
293
294         HTMLObjectElement.codebase attribute should reflect as a URL:
295         - https://html.spec.whatwg.org/#dom-applet-codebase
296
297         Chrome and Firefox agree with the specification.
298
299         No new test, rebaselined existing test.
300
301         * html/HTMLObjectElement.idl:
302
303 2016-09-08  Chris Dumez  <cdumez@apple.com>
304
305         ol.start may return incorrect value for reversed lists when not explicitly set
306         https://bugs.webkit.org/show_bug.cgi?id=161713
307
308         Reviewed by Zalan Bujtas.
309
310         ol.start may return incorrect value for reversed lists when not explicitly set.
311         This is because we're supposed to return the number of rendered <li> child
312         elements, which relies on layout. However, we did not make sure the layout is
313         up-to-date before counting the number of li child elements. This patch fixes
314         the issue.
315
316         No new tests, rebaselined existing tests.
317
318         * html/HTMLOListElement.h:
319
320 2016-09-08  Chris Dumez  <cdumez@apple.com>
321
322         Add support for HTMLIframeElement.allowFullscreen attribute
323         https://bugs.webkit.org/show_bug.cgi?id=161757
324
325         Reviewed by Sam Weinig.
326
327         Add support for HTMLIframeElement.allowFullscreen attribute:
328         - https://html.spec.whatwg.org/#dom-iframe-allowfullscreen
329
330         Firefox and Chrome already support it, unprefixed.
331
332         Note that the HTMLIframeElement.allowFullscreen attribute reflects the
333         allowfullscreen content attribute which we already support.
334
335         Test: fullscreen/full-screen-iframe-allowFullscreen.html
336
337         * html/HTMLIFrameElement.idl:
338
339 2016-09-08  Chris Dumez  <cdumez@apple.com>
340
341         frame.longDesc / iframe.longDesc should reflect as a URL
342         https://bugs.webkit.org/show_bug.cgi?id=161764
343
344         Reviewed by Alex Christensen.
345
346         frame.longDesc / iframe.longDesc should reflect as a URL:
347         - https://html.spec.whatwg.org/#dom-iframe-longdesc
348         - https://html.spec.whatwg.org/#dom-frame-longdesc
349
350         They already do in Chrome and Firefox.
351
352         No new tests, rebaselined existing tests.
353
354         * html/HTMLFrameElement.idl:
355         * html/HTMLIFrameElement.idl:
356
357 2016-09-08  Alex Christensen  <achristensen@webkit.org>
358
359         URLParser: Handle \ in paths of special URLs according to spec
360         https://bugs.webkit.org/show_bug.cgi?id=161781
361
362         Reviewed by Tim Horton.
363
364         Covered by new API tests.
365
366         * platform/URLParser.cpp:
367         (WebCore::bufferView):
368         (WebCore::URLParser::copyURLPartsUntil):
369         (WebCore::URLParser::parse):
370         * platform/URLParser.h:
371
372 2016-09-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
373
374         Move the BitmapImage platform dependent code to a new file named NativeImage[CG|Cairo].cpp
375         https://bugs.webkit.org/show_bug.cgi?id=158684
376
377         Reviewed by Simon Fraser.
378
379         This is a refactoring patch. It moves the BitmapImage platform dependent
380         code from BitmapImage to NativeImage[CG|Cairo].cpp. The new APIs are
381         responsible of drawing a NativeImagePtr and answering some metadata queries.
382
383         No new tests -- Code refactoring, no behavior change.
384
385         * PlatformAppleWin.cmake:
386         * PlatformEfl.cmake:
387         * PlatformGTK.cmake:
388         * PlatformMac.cmake:
389         * PlatformWinCairo.cmake:
390         * WebCore.xcodeproj/project.pbxproj:
391         * loader/cache/MemoryCache.h:
392         * loader/icon/IconDatabaseBase.h:
393         * page/mac/TextIndicatorWindow.mm:
394         (-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]):
395         (createContentCrossfadeAnimation):
396         * platform/graphics/BitmapImage.cpp:
397         (WebCore::BitmapImage::BitmapImage):
398         (WebCore::BitmapImage::destroyDecodedData):
399         (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
400         (WebCore::BitmapImage::dataChanged):
401         (WebCore::BitmapImage::ensureFrameAtIndexIsCached):
402         (WebCore::BitmapImage::frameImageAtIndex):
403         (WebCore::BitmapImage::nativeImage):
404         (WebCore::BitmapImage::nativeImageForCurrentFrame):
405         (WebCore::BitmapImage::nativeImageOfSize):
406         (WebCore::BitmapImage::framesNativeImages):
407         (WebCore::BitmapImage::frameIsCompleteAtIndex):
408         (WebCore::BitmapImage::frameDurationAtIndex):
409         (WebCore::BitmapImage::frameHasAlphaAtIndex):
410         (WebCore::BitmapImage::frameOrientationAtIndex):
411         (WebCore::BitmapImage::singlePixelSolidColor):
412         (WebCore::BitmapImage::draw):
413         (WebCore::BitmapImage::drawPattern):
414         (WebCore::BitmapImage::canAnimate):
415         (WebCore::BitmapImage::clearTimer):
416         (WebCore::BitmapImage::startTimer):
417         (WebCore::BitmapImage::stopAnimation):
418         (WebCore::BitmapImage::resetAnimation):
419         (WebCore::BitmapImage::hasSingleSecurityOrigin): Deleted.
420         (WebCore::BitmapImage::filenameExtension): Deleted.
421         (WebCore::BitmapImage::ensureFrameIsCached): Deleted.
422         * platform/graphics/BitmapImage.h:
423         (WebCore::FrameData::FrameData):
424         m_hasAlpha can be initialized with false because it is accessed only in
425         BitmapImage::frameHasAlphaAtIndex() and it is guarded by m_haveMetadata.
426         Both m_haveMetadata and m_hasAlpha are set in BitmapImage constructor
427         and in BitmapImage::cacheFrame().
428         
429         (WebCore::FrameData::~FrameData):
430         (WebCore::FrameData::clear):
431         * platform/graphics/Icon.h:
432         * platform/graphics/Image.h:
433         (WebCore::Image::nativeImage):
434         (WebCore::Image::nativeImageOfSize):
435         (WebCore::Image::framesNativeImages):
436         (WebCore::Image::orientationForCurrentFrame): Deleted.
437         (WebCore::Image::getCGImageRef): Deleted.
438         (WebCore::Image::getFirstCGImageRefOfSize): Deleted.
439         (WebCore::Image::getCGImageArray): Deleted.
440         * platform/graphics/ImageSource.cpp:
441         (WebCore::ImageSource::calculateMaximumSubsamplingLevel):
442         (WebCore::ImageSource::size):
443         (WebCore::ImageSource::sizeRespectingOrientation):
444         * platform/graphics/ImageSource.h:
445         * platform/graphics/MediaPlayer.h:
446         * platform/graphics/NativeImage.h: Added.
447         * platform/graphics/NativeImagePtr.h: Removed.
448         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
449         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updatePausedImage):
450         * platform/graphics/cairo/BitmapImageCairo.cpp: Removed.
451         * platform/graphics/cairo/NativeImageCairo.cpp: Added.
452         (WebCore::nativeImageSize):
453         (WebCore::nativeImageHasAlpha):
454         (WebCore::nativeImageSinglePixelSolidColor):
455         (WebCore::subsamplingScale):
456         (WebCore::drawNativeImage):
457         (WebCore::clearNativeImageSubImages):
458         * platform/graphics/cg/BitmapImageCG.cpp: Removed.
459         * platform/graphics/cg/ImageDecoderCG.cpp:
460         (WebCore::ImageDecoder::size):
461         * platform/graphics/cg/ImageDecoderCG.h:
462         * platform/graphics/cg/NativeImageCG.cpp: Added.
463         (WebCore::nativeImageSize):
464         (WebCore::nativeImageHasAlpha):
465         (WebCore::nativeImageSinglePixelSolidColor):
466         (WebCore::subsamplingScale):
467         (WebCore::drawNativeImage):
468         (WebCore::clearNativeImageSubImages):
469         * platform/graphics/cg/PatternCG.cpp:
470         (WebCore::Pattern::createPlatformPattern):
471         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
472         (TextTrackRepresentationCocoa::update):
473         * platform/graphics/mac/ImageMac.mm:
474         (WebCore::BitmapImage::getTIFFRepresentation):
475         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
476         (WebCore::MockRealtimeVideoSourceMac::updatePlatformLayer):
477         (WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer):
478         * platform/win/DragImageCGWin.cpp:
479         (WebCore::createDragImageFromImage):
480
481 2016-09-08  Alex Christensen  <achristensen@webkit.org>
482
483         URLParser: Parsing empty URLs with a base URL should return the base URL
484         https://bugs.webkit.org/show_bug.cgi?id=161777
485
486         Reviewed by Tim Horton.
487
488         Covered by an API test and progress towards passing all web platform tests when using URLParser.
489
490         * platform/URLParser.cpp:
491         (WebCore::URLParser::parse):
492
493 2016-09-08  Alex Christensen  <achristensen@webkit.org>
494
495         URLParser failures should preserve the original input string
496         https://bugs.webkit.org/show_bug.cgi?id=161769
497
498         Reviewed by Tim Horton.
499
500         No new tests, but covered by updates to API tests.
501         This also represents many newly passing web platform tests when using URLParser.
502
503         * platform/URLParser.cpp:
504         (WebCore::URLParser::failure):
505         (WebCore::URLParser::parse):
506         * platform/URLParser.h:
507
508 2016-09-08  Alex Christensen  <achristensen@webkit.org>
509
510         URLParser should parse URLs with a user but no password
511         https://bugs.webkit.org/show_bug.cgi?id=161773
512
513         Reviewed by Brady Eidson.
514
515         Covered by new API tests.
516
517         * platform/URLParser.cpp:
518         (WebCore::URLParser::parseAuthority):
519
520 2016-09-08  Alex Christensen  <achristensen@webkit.org>
521
522         Fix URLs after r205669.
523         https://bugs.webkit.org/show_bug.cgi?id=161731
524
525         * platform/URLParser.cpp:
526         (WebCore::URLParser::enabled):
527         I accidentally committed enabling the URLParser by default.  Not ready yet.
528
529 2016-09-08  Chris Dumez  <cdumez@apple.com>
530
531         Align proto getter / setter behavior with other browsers
532         https://bugs.webkit.org/show_bug.cgi?id=161455
533
534         Reviewed by Saam Barati.
535
536         Align cross-origin __proto__ getter / setter behavior with other
537         browsers and the specification:
538
539         [[SetPrototypeOf]] should throw a TypeError:
540         - https://html.spec.whatwg.org/#windowproxy-setprototypeof
541         - https://html.spec.whatwg.org/#location-setprototypeof
542         - https://tc39.github.io/ecma262/#sec-object.setprototypeof (step 5)
543
544         [[GetPrototypeOf]] should return null cross-origin:
545         - https://html.spec.whatwg.org/#windowproxy-getprototypeof
546         - https://html.spec.whatwg.org/#location-getprototypeof
547
548         Test: js/dom/setPrototypeOf-location-window.html
549
550         * bindings/js/JSDOMWindowBase.cpp:
551         (WebCore::JSDOMWindowBase::JSDOMWindowBase): Deleted.
552         * bindings/js/JSDOMWindowCustom.cpp:
553         (WebCore::JSDOMWindow::setPrototype):
554         (WebCore::JSDOMWindow::getPrototype):
555         (WebCore::JSDOMWindow::preventExtensions):
556         * bindings/js/JSLocationCustom.cpp:
557         (WebCore::JSLocation::setPrototype):
558         (WebCore::JSLocation::getPrototype):
559         * bindings/js/JSWorkerGlobalScopeBase.cpp:
560         (WebCore::JSWorkerGlobalScopeBase::supportsRichSourceInfo): Deleted.
561         * bindings/js/JSWorkerGlobalScopeBase.h:
562         * bindings/scripts/CodeGeneratorJS.pm:
563         (GenerateHeader):
564         * bindings/scripts/IDLAttributes.txt:
565         * page/DOMWindow.idl:
566         * page/Location.idl:
567
568 2016-09-08  Alex Christensen  <achristensen@webkit.org>
569
570         URLParser should parse ports after IPv4 and IPv6 hosts
571         https://bugs.webkit.org/show_bug.cgi?id=161731
572
573         Reviewed by Brady Eidson.
574
575         Covered by new API tests.
576
577         * platform/URLParser.cpp:
578         (WebCore::URLParser::parsePort):
579         (WebCore::URLParser::parseHost):
580
581 2016-09-08  Alex Christensen  <achristensen@webkit.org>
582
583         URLParser should correctly handle \ in path
584         https://bugs.webkit.org/show_bug.cgi?id=161762
585
586         Reviewed by Brady Eidson.
587
588         Covered by new API tests.
589
590         * platform/URLParser.cpp:
591         (WebCore::isSpecialScheme):
592         (WebCore::bufferView):
593         (WebCore::URLParser::parse):
594         Treat \ as / in the path of special URLs as described in the spec and tested in web platform tests.
595         Also a slight performance improvement using StringViews instead of copied Strings.
596
597 2016-09-08  Alex Christensen  <achristensen@webkit.org>
598
599         URLParser should handle URLs with empty authority
600         https://bugs.webkit.org/show_bug.cgi?id=161711
601
602         Reviewed by Brady Eidson.
603
604         Covered by new API tests.
605
606         * platform/URLParser.cpp:
607         (WebCore::URLParser::parse):
608         (WebCore::URLParser::parseAuthority):
609
610 2016-09-08  Chris Dumez  <cdumez@apple.com>
611
612         HTMLImageElement.hspace / vspace attributes should be unsigned
613         https://bugs.webkit.org/show_bug.cgi?id=161754
614
615         Reviewed by Alex Christensen.
616
617         HTMLImageElement.hspace / vspace attributes should be unsigned:
618         - https://html.spec.whatwg.org/#HTMLImageElement-partial
619
620         Firefox agrees with the specification, however, those were signed in
621         webKit.
622
623         No new tests, rebaselined existing test.
624
625         * html/HTMLImageElement.idl:
626
627 2016-09-08  Chris Dumez  <cdumez@apple.com>
628
629         Update parseHTMLNonNegativeInteger() to return an unsigned value
630         https://bugs.webkit.org/show_bug.cgi?id=161759
631
632         Reviewed by Alex Christensen.
633
634         Update parseHTMLNonNegativeInteger() to return an unsigned value instead
635         of a signed one as the value can never be negative.
636
637         * html/HTMLElement.cpp:
638         (WebCore::HTMLElement::parseBorderWidthAttribute):
639         * html/HTMLImageElement.cpp:
640         (WebCore::HTMLImageElement::width):
641         (WebCore::HTMLImageElement::height):
642         * html/HTMLInputElement.cpp:
643         (WebCore::HTMLInputElement::maxLengthAttributeChanged):
644         (WebCore::HTMLInputElement::minLengthAttributeChanged):
645         * html/HTMLTextAreaElement.cpp:
646         (WebCore::HTMLTextAreaElement::maxLengthAttributeChanged):
647         (WebCore::HTMLTextAreaElement::minLengthAttributeChanged):
648         * html/ImageInputType.cpp:
649         (WebCore::ImageInputType::height):
650         (WebCore::ImageInputType::width):
651         * html/parser/HTMLParserIdioms.cpp:
652         (WebCore::parseHTMLNonNegativeInteger):
653         (WebCore::parseHTTPRefreshInternal):
654         * html/parser/HTMLParserIdioms.h:
655
656 2016-09-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
657
658         Get rid of the color profile from ImageFrame and ImageDecoder
659         https://bugs.webkit.org/show_bug.cgi?id=159699
660
661         Reviewed by Simon Fraser.
662
663         The color profile is set but it is never used.
664
665         * platform/image-decoders/ImageDecoder.cpp:
666         (WebCore::ImageFrame::setColorProfile): Deleted.
667         * platform/image-decoders/ImageDecoder.h:
668         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
669         (WebCore::JPEGImageReader::decode):
670         (WebCore::JPEGImageDecoder::outputScanlines):
671         (WebCore::readColorProfile): Deleted.
672         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
673         * platform/image-decoders/png/PNGImageDecoder.cpp:
674         (WebCore::PNGImageDecoder::headerAvailable):
675         (WebCore::PNGImageDecoder::rowAvailable):
676         (WebCore::readColorProfile): Deleted.
677
678 2016-09-08  Dave Hyatt  <hyatt@apple.com>
679
680         [CSS Parser] Add support for new CSS selector parsing
681         https://bugs.webkit.org/show_bug.cgi?id=161749
682
683         Reviewed by Dean Jackson.
684
685         * CMakeLists.txt:
686         * WebCore.xcodeproj/project.pbxproj:
687         * contentextensions/ContentExtensionParser.cpp:
688         (WebCore::ContentExtensions::isValidSelector):
689         * css/CSSDefaultStyleSheets.cpp:
690         (WebCore::parseUASheet):
691         * css/CSSFontFaceSet.cpp:
692         (WebCore::CSSFontFaceSet::matchingFaces):
693         * css/CSSGrammar.y.in:
694         * css/CSSSelector.cpp:
695         (WebCore::CSSSelector::selectorText):
696         * css/CSSSelector.h:
697         * css/DOMCSSNamespace.cpp:
698         (WebCore::DOMCSSNamespace::supports):
699         * css/FontFace.cpp:
700         (WebCore::FontFace::parseString):
701         (WebCore::FontFace::setVariant):
702         * css/MediaList.cpp:
703         (WebCore::MediaQuerySet::internalParse):
704         (WebCore::MediaQuerySet::parse):
705         * css/SelectorChecker.cpp:
706         (WebCore::SelectorChecker::matchRecursively):
707         * css/SelectorFilter.cpp:
708         (WebCore::SelectorFilter::collectIdentifierHashes):
709         * css/SelectorPseudoClassAndCompatibilityElementMap.in:
710         * css/SelectorPseudoTypeMap.h:
711         * css/SourceSizeList.cpp:
712         (WebCore::parseSizesAttribute):
713         * css/StyleProperties.cpp:
714         (WebCore::MutableStyleProperties::MutableStyleProperties):
715         * css/StyleProperties.h:
716         * css/StyleRuleImport.cpp:
717         (WebCore::StyleRuleImport::setCSSStyleSheet):
718         * css/StyleSheetContents.cpp:
719         (WebCore::StyleSheetContents::StyleSheetContents):
720         (WebCore::StyleSheetContents::parserAddNamespace):
721         (WebCore::StyleSheetContents::namespaceURIFromPrefix):
722         (WebCore::StyleSheetContents::determineNamespace): Deleted.
723         * css/StyleSheetContents.h:
724         * css/WebKitCSSMatrix.cpp:
725         (WebCore::WebKitCSSMatrix::setMatrixValue):
726         * css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
727         * css/parser/CSSParser.cpp:
728         (WebCore::strictCSSParserContext):
729         (WebCore::CSSParserContext::CSSParserContext):
730         (WebCore::CSSParser::parseColor):
731         (WebCore::CSSParser::shouldAcceptUnitLessValues):
732         (WebCore::CSSParser::parseValue):
733         (WebCore::CSSParser::parseColumnWidth):
734         (WebCore::CSSParser::parseColumnCount):
735         (WebCore::CSSParser::parseFontWeight):
736         (WebCore::CSSParser::parseColorParameters):
737         (WebCore::CSSParser::parseHSLParameters):
738         (WebCore::CSSParser::parseShadow):
739         (WebCore::CSSParser::parseBorderImageSlice):
740         (WebCore::CSSParser::parseBorderImageQuad):
741         (WebCore::CSSParser::parseDeprecatedLinearGradient):
742         (WebCore::CSSParser::parseLinearGradient):
743         (WebCore::CSSParser::parseTransformValue):
744         (WebCore::CSSParser::parseBuiltinFilterArguments):
745         (WebCore::CSSParser::determineNameInNamespace):
746         * css/parser/CSSParser.h:
747         (WebCore::CSSParser::inStrictMode):
748         (WebCore::CSSParser::inQuirksMode):
749         * css/parser/CSSParserMode.h:
750         (WebCore::isQuirksModeBehavior):
751         (WebCore::isUASheetBehavior):
752         (WebCore::isUnitLessLengthParsingEnabledForMode):
753         (WebCore::isCSSViewportParsingEnabledForMode):
754         (WebCore::strictToCSSParserMode):
755         (WebCore::isStrictParserMode):
756         * css/parser/CSSParserValues.cpp:
757         (WebCore::CSSParserSelector::parsePseudoElementSelectorFromStringView):
758         (WebCore::CSSParserSelector::parsePseudoClassSelectorFromStringView):
759         (WebCore::CSSParserSelector::setSelectorList):
760         (WebCore::CSSParserSelector::appendTagHistory):
761         (WebCore::CSSParserSelector::releaseTagHistory):
762         (WebCore::CSSParserSelector::isHostPseudoSelector):
763         * css/parser/CSSParserValues.h:
764         (WebCore::CSSParserSelector::match):
765         (WebCore::CSSParserSelector::pseudoElementType):
766         (WebCore::CSSParserSelector::selectorList):
767         (WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching):
768         * css/parser/CSSPropertyParser.h:
769         (WebCore::CSSPropertyParser::inQuirksMode):
770         * css/parser/CSSSelectorParser.cpp: Added.
771         (WebCore::CSSSelectorParser::parseSelector):
772         (WebCore::CSSSelectorParser::CSSSelectorParser):
773         (WebCore::CSSSelectorParser::consumeComplexSelectorList):
774         (WebCore::CSSSelectorParser::consumeCompoundSelectorList):
775         (WebCore::CSSSelectorParser::consumeComplexSelector):
776         (WebCore::CSSSelectorParser::consumeCompoundSelector):
777         (WebCore::CSSSelectorParser::consumeSimpleSelector):
778         (WebCore::CSSSelectorParser::consumeName):
779         (WebCore::CSSSelectorParser::consumeId):
780         (WebCore::CSSSelectorParser::consumeClass):
781         (WebCore::CSSSelectorParser::consumeAttribute):
782         (WebCore::CSSSelectorParser::consumePseudo):
783         (WebCore::CSSSelectorParser::consumeCombinator):
784         (WebCore::CSSSelectorParser::consumeAttributeMatch):
785         (WebCore::CSSSelectorParser::consumeAttributeFlags):
786         (WebCore::CSSSelectorParser::consumeANPlusB):
787         (WebCore::CSSSelectorParser::defaultNamespace):
788         (WebCore::CSSSelectorParser::determineNamespace):
789         (WebCore::CSSSelectorParser::prependTypeSelectorIfNeeded):
790         (WebCore::CSSSelectorParser::addSimpleSelectorToCompound):
791         (WebCore::CSSSelectorParser::splitCompoundAtImplicitShadowCrossingCombinator):
792         * css/parser/CSSSelectorParser.h: Added.
793         (WebCore::CSSSelectorParser::DisallowPseudoElementsScope::DisallowPseudoElementsScope):
794         (WebCore::CSSSelectorParser::DisallowPseudoElementsScope::~DisallowPseudoElementsScope):
795         * cssjit/SelectorCompiler.cpp:
796         (WebCore::SelectorCompiler::fragmentRelationForSelectorRelation):
797         * dom/StyledElement.cpp:
798         (WebCore::StyledElement::rebuildPresentationAttributeStyle):
799         * svg/SVGFontFaceElement.cpp:
800         (WebCore::SVGFontFaceElement::SVGFontFaceElement):
801
802 2016-09-08  Simon Fraser  <simon.fraser@apple.com>
803
804         Don't run transitions to or from undefined Lengths
805         https://bugs.webkit.org/show_bug.cgi?id=161750
806         rdar://problem/28170460
807
808         Reviewed by Zalan Bujtas.
809
810         For properties like max-height whose default value is 'none', we would erroneously
811         attempt to run transitions/animations, and then assert when one of the endpoints
812         was undefined.
813
814         So don't attempt to blend such Length values, just as do when they are auto.
815
816         Fixes some transitions on apple.com and developer.apple.com.
817
818         Test: transitions/transition-to-from-undefined.html
819
820         * page/animation/CSSPropertyAnimation.cpp:
821         (WebCore::CSSPropertyAnimation::blendProperties):
822         * platform/Length.cpp:
823         (WebCore::blend):
824
825 2016-09-08  Myles C. Maxfield  <mmaxfield@apple.com>
826
827         Support new emoji group candidates
828         https://bugs.webkit.org/show_bug.cgi?id=161664
829         <rdar://problem/24802695>
830         <rdar://problem/27666433>
831
832         Reviewed by Simon Fraser.
833
834         Support more emoji group candidates. This includes joining groups into a single glyph, as
835         well as atomic deletions of the entire group when the backspace key is pressed.
836
837         Tests: editing/deleting/delete-emoji.html:
838                fast/text/emoji-num-glyphs.html:
839
840         * platform/text/CharacterProperties.h:
841         (WebCore::isEmojiGroupCandidate):
842
843 2016-09-08  Chris Dumez  <cdumez@apple.com>
844
845         HTMLImageElement.width / height attributes should be unsigned
846         https://bugs.webkit.org/show_bug.cgi?id=161730
847
848         Reviewed by Alex Christensen.
849
850         HTMLImageElement.width / height attributes should be unsigned as per
851         the HTML specification:
852         - https://html.spec.whatwg.org/#htmlimageelement
853
854         However, they are signed in WebKit. Firefox agrees with the
855         specification.
856
857         No new tests, rebaselined existing test.
858
859         * bindings/js/JSImageConstructor.cpp:
860         (WebCore::JSImageConstructor::construct):
861         (WebCore::createImageConstructor): Deleted.
862         * html/HTMLImageElement.cpp:
863         (WebCore::HTMLImageElement::createForJSConstructor):
864         (WebCore::HTMLImageElement::width):
865         (WebCore::HTMLImageElement::height):
866         (WebCore::HTMLImageElement::setHeight):
867         (WebCore::HTMLImageElement::setWidth):
868         * html/HTMLImageElement.h:
869         * html/HTMLImageElement.idl:
870         * html/ImageDocument.cpp:
871         (WebCore::ImageDocument::restoreImageSize):
872
873 2016-09-08  Filip Pizlo  <fpizlo@apple.com>
874
875         Move JSMap/JSSet over to Auxiliary MarkedSpace
876         https://bugs.webkit.org/show_bug.cgi?id=161744
877
878         Reviewed by Saam Barati.
879
880         No new tests because no change in behavior.
881
882         * bindings/js/SerializedScriptValue.cpp:
883
884 2016-09-08  Commit Queue  <commit-queue@webkit.org>
885
886         Unreviewed, rolling out r205652.
887         https://bugs.webkit.org/show_bug.cgi?id=161748
888
889         Crashing under ASan (Requested by yusukesuzuki on #webkit).
890
891         Reverted changeset:
892
893         "ScriptRunner should be driven by PendingScript rather than
894         ScriptElement"
895         https://bugs.webkit.org/show_bug.cgi?id=161726
896         http://trac.webkit.org/changeset/205652
897
898 2016-09-08  Yusuke Suzuki  <utatane.tea@gmail.com>
899
900         ScriptRunner should be driven by PendingScript rather than ScriptElement
901         https://bugs.webkit.org/show_bug.cgi?id=161726
902
903         Reviewed by Ryosuke Niwa.
904
905         ScriptRunner is driven by ScriptElement::notifyFinished. While ScriptRunner is driven by this,
906         HTMLScriptRunner does not use it. Instead, HTMLScriptRunner uses PendingScriptClient. As a result,
907         ScriptElement::notifyFinished is used only when the script is annotated with "defer" or "async"
908         while all the external script will load the LoadableScript. It is confusing.
909         This patch removes ScriptElement::notifyFinished and use PendingScript's observability
910         in ScriptRunner instead.
911
912         This patch also fixes the behavior about ignore-destructive-writes counter[1]. When dispatching
913         the load and error events, this ignore-destructive-writes counter should not be incremeneted by
914         this execution. The added tests ensure this behavior.
915
916         [1]: https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block
917
918         * dom/ScriptElement.cpp: Drop LoadableScriptClient interface.
919         (WebCore::ScriptElement::prepareScript): Do not use addClient. ScriptRunner use PendingScript::{setClient,clearClient} instead.
920         (WebCore::ScriptElement::executeScriptForScriptRunner): IgnoreDestructiveWriteCountIncrementer will be done in ScriptElement::executeScript.
921         So no need to do it here, that's duplicated.
922         (WebCore::ScriptElement::~ScriptElement): Deleted. ScriptElement does not use addClient/removeClient.
923         (WebCore::ScriptElement::stopLoadRequest): Deleted.
924         (WebCore::ScriptElement::executeScriptForHTMLScriptRunner): Deleted. executeScriptForHTMLScriptRunner and executeScriptForScriptRunner are
925         merged into executeScriptForRunner.
926         (WebCore::ScriptElement::notifyFinished): Deleted.
927         * dom/ScriptElement.h:
928         (WebCore::ScriptElement::~ScriptElement):
929         (WebCore::ScriptElement::willExecuteInOrder): Used in ScriptRunner to determine whether the script is async or defer.
930         (WebCore::ScriptElement::willExecuteWhenDocumentFinishedParsing): Deleted.
931         * dom/ScriptRunner.cpp:
932         (WebCore::ScriptRunner::~ScriptRunner): HashSet's iterator will return `const PendingScript&`.
933         Another option is using HashSet<RefPtr<PendingScript>>. Here, we use a little bit weired const_cast.
934         (WebCore::ScriptRunner::queueScriptForExecution): Use PendingScript::setClient to wait loading.
935         (WebCore::ScriptRunner::notifyFinished): Notify the script ready here.
936         (WebCore::ScriptRunner::timerFired): Use executeScriptForScriptRunner.
937         (WebCore::ScriptRunner::notifyScriptReady): Deleted.
938         * dom/ScriptRunner.h:
939         * html/parser/HTMLScriptRunner.cpp:
940         (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent): Use executeScriptForScriptRunner.
941
942 2016-09-08  Alex Christensen  <achristensen@webkit.org>
943
944         Re-land r205580 after r205649 fixed the test failures
945         https://bugs.webkit.org/show_bug.cgi?id=161668
946
947         Re-landing changesets:
948
949         "Punycode encode non-ascii hosts in URLParser"
950         https://bugs.webkit.org/show_bug.cgi?id=161655
951         http://trac.webkit.org/changeset/205521
952
953         "Fix query-only and fragment-only relative URLs when using
954         URLParser"
955         https://bugs.webkit.org/show_bug.cgi?id=161657
956         http://trac.webkit.org/changeset/205526
957
958         "URLParser should parse / as a relative URL"
959         https://bugs.webkit.org/show_bug.cgi?id=161667
960         http://trac.webkit.org/changeset/205532
961
962 2016-09-08  Alex Christensen  <achristensen@webkit.org>
963
964         Add range check in URLParser's serializeIPv6
965         https://bugs.webkit.org/show_bug.cgi?id=161743
966
967         Reviewed by David Kilzer.
968
969         No new tests, but this fixes API tests in some release builds after
970         the patch from https://bugs.webkit.org/show_bug.cgi?id=161668 is recommitted.
971
972         * platform/URLParser.cpp:
973         (WebCore::serializeIPv6):
974         Don't go out of bounds.  Don't assume that the memory immediately after the end of the array will be empty.
975
976 2016-09-07  Alex Christensen  <achristensen@webkit.org>
977
978         Roll out r205580 and r205582.
979         https://bugs.webkit.org/show_bug.cgi?id=161668
980
981         I need to figure out why this is failing on the bots before landing any more URLParser progress.
982
983 2016-09-07  Yusuke Suzuki  <utatane.tea@gmail.com>
984
985         Unreviewed, EFL build fix after r205581
986         https://bugs.webkit.org/show_bug.cgi?id=161674
987
988         * dom/LoadableClassicScript.cpp:
989         (WebCore::LoadableClassicScript::notifyFinished):
990
991 2016-09-07  Alex Christensen  <achristensen@webkit.org>
992
993         Fix API tests after r205580
994         https://bugs.webkit.org/show_bug.cgi?id=161668
995
996         No new tests, but this fixes API tests on bots.
997
998         * platform/URLParser.cpp:
999         (WebCore::domainToASCII):
1000         This function seems to be appending characters to strings sometimes on some configurations.
1001         This definitely needs further investigation, but this will fix the bots, and nothing else
1002         will be affected because the URLParser is disabled by default.
1003
1004 2016-09-07  Yusuke Suzuki  <utatane.tea@gmail.com>
1005
1006         Introduce abstract class LoadableScript for classic script and module graph
1007         https://bugs.webkit.org/show_bug.cgi?id=161674
1008
1009         Reviewed by Ryosuke Niwa.
1010
1011         To prepare for ScriptModuleGraph, we introduce the abstract class over the classic script
1012         and the module script, LoadableScript.
1013
1014         No behavior change.
1015
1016         * CMakeLists.txt:
1017         * WebCore.xcodeproj/project.pbxproj:
1018         * dom/LoadableClassicScript.cpp: Added. LoadableClassicScript is the derived class from the
1019         LoadableScript. In the module patch, we will introduce LoadableScriptModuleGraph which is also
1020         the derived class from the LoadableScript. It is used for the external classic script.
1021         A CachedResourceHandle used here alone does not prevent the underlying CachedResource from purging its
1022         data buffer. This LoadableClassicScript holds a client until this class is destroyed in order to
1023         guarantee that the data buffer will not be purged.
1024         (WebCore::LoadableClassicScript::create):
1025         (WebCore::LoadableClassicScript::LoadableClassicScript):
1026         (WebCore::LoadableClassicScript::~LoadableClassicScript):
1027         (WebCore::LoadableClassicScript::isLoaded):
1028         (WebCore::LoadableClassicScript::wasErrored): Beyond the boolean value, this can return the detail
1029         of the error. This detailed information will be used to report it to the inspector in the ScriptElement.
1030         (WebCore::LoadableClassicScript::wasCanceled):
1031         (WebCore::LoadableClassicScript::notifyFinished): Nosniff and cross-origin loading errors are handled here,
1032         instead of exposing CachedScript*.
1033         (WebCore::LoadableClassicScript::execute): Execute the cached script by using the given ScriptElement.
1034         * dom/LoadableClassicScript.h: Copied from Source/WebCore/dom/PendingScript.h.
1035         (isType):
1036         * dom/LoadableScript.cpp: Copied from Source/WebCore/dom/ScriptRunner.h. New wrapper for CachedScript
1037         and ScriptModuleGraph. We introduce a new wrapper to handle the above 2 things in the same way.
1038         We take the way to introduce a new wrapper instead of introducing a new interface that is inherited by
1039         CachedScript and ScriptModuleGraph. This is because ScriptModuleGraph is ref-counted while CachedScript
1040         is managed by CachedResourceHandle. While this patch does not contain ScriptModuleGraph part, this
1041         should be added in the module patch and at that time, this should be managed by this LoadableScript's
1042         subclass. And we introduce TypeCasts traits for LoadableScript to allow `is<>` and `downcast<>`.
1043         (WebCore::LoadableScript::addClient):
1044         (WebCore::LoadableScript::removeClient):
1045         (WebCore::LoadableScript::notifyClientFinished):
1046         * dom/LoadableScript.h: Copied from Source/WebCore/dom/ScriptRunner.h.
1047         (WebCore::LoadableScript::~LoadableScript):
1048         (WebCore::LoadableScript::isClassicScript):
1049         (WebCore::LoadableScript::isModuleGraph):
1050         * dom/LoadableScriptClient.h: Copied from Source/WebCore/dom/ScriptRunner.h.
1051         (WebCore::LoadableScriptClient::~LoadableScriptClient):
1052         * dom/PendingScript.cpp: Use LoadableScript instead of CachedScript.
1053         (WebCore::PendingScript::create):
1054         (WebCore::PendingScript::PendingScript):
1055         (WebCore::PendingScript::~PendingScript):
1056         (WebCore::PendingScript::loadableScript):
1057         (WebCore::PendingScript::notifyFinished):
1058         (WebCore::PendingScript::isLoaded):
1059         (WebCore::PendingScript::wasErrored):
1060         (WebCore::PendingScript::cachedScript): Deleted.
1061         * dom/PendingScript.h:
1062         * dom/ScriptElement.cpp:
1063         (WebCore::ScriptElement::ScriptElement):
1064         (WebCore::ScriptElement::handleSourceAttribute): Change sourceUrl to sourceURL to be consistent.
1065         (WebCore::ScriptElement::prepareScript):
1066         (WebCore::ScriptElement::requestClassicScript): requestScript is renamed to requestClassicScript.
1067         (WebCore::ScriptElement::requestScriptWithCache): Extract the code requesting the
1068         CachedScript from requestScript. This will also be used by the module fetcher.
1069         (WebCore::ScriptElement::executeScript): Now inspector error reporting is also done in this function.
1070         When an error occurs, LoadableScript::wasErrored() returns the error which may include the information
1071         to report the error to the inspector. nosniff and cross-origin loading errors are now detected by the
1072         LoadableClassicScript and reported through this wasErrored().
1073         (WebCore::ScriptElement::stopLoadRequest):
1074         (WebCore::ScriptElement::executeScriptAndDispatchEvent):
1075         (WebCore::ScriptElement::executeScriptForScriptRunner): Move the code from ScriptRunner. This function
1076         calls removeClient(*this) because ScriptRunner is driven by the ScriptElement's notification. Only when using
1077         ScriptRunner, we call addClient(*this) for ScriptElement. This is tricky, we should refactor this in the separated
1078         bug (https://bugs.webkit.org/show_bug.cgi?id=161726).
1079         (WebCore::ScriptElement::executeScriptForHTMLScriptRunner): Move the code from HTMLScriptRunner.
1080         (WebCore::ScriptElement::notifyFinished):
1081         (WebCore::ScriptElement::requestScript): Deleted.
1082         (WebCore::ScriptElement::execute): Deleted.
1083         * dom/ScriptElement.h:
1084         (WebCore::ScriptElement::loadableScript):
1085         (WebCore::ScriptElement::cachedScript): Deleted.
1086         * dom/ScriptRunner.cpp:
1087         (WebCore::ScriptRunner::queueScriptForExecution):
1088         (WebCore::ScriptRunner::timerFired): Use ScriptElement::executeScriptForScriptRunner.
1089         * dom/ScriptRunner.h:
1090         * html/parser/HTMLScriptRunner.cpp:
1091         (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent):
1092         (WebCore::requestPendingScript):
1093         (WebCore::HTMLScriptRunner::requestParsingBlockingScript):
1094         (WebCore::HTMLScriptRunner::sourceFromPendingScript): Deleted.
1095         * html/parser/HTMLScriptRunner.h: Use ScriptElement::executeScriptForHTMLScriptRunner.
1096         * xml/parser/XMLDocumentParserLibxml2.cpp: Currently, we do nothing about XMLDocument in this patch.
1097         We should support the module script, but before that, we should refactor this pending script handling.
1098         (WebCore::XMLDocumentParser::endElementNs):
1099
1100 2016-09-07  Alex Christensen  <achristensen@webkit.org>
1101
1102         Unreviewed, revert r205533.
1103         https://bugs.webkit.org/show_bug.cgi?id=161668
1104
1105         Re-landing changesets:
1106
1107         "Punycode encode non-ascii hosts in URLParser"
1108         https://bugs.webkit.org/show_bug.cgi?id=161655
1109         http://trac.webkit.org/changeset/205521
1110
1111         "Fix query-only and fragment-only relative URLs when using
1112         URLParser"
1113         https://bugs.webkit.org/show_bug.cgi?id=161657
1114         http://trac.webkit.org/changeset/205526
1115
1116         "URLParser should parse / as a relative URL"
1117         https://bugs.webkit.org/show_bug.cgi?id=161667
1118         http://trac.webkit.org/changeset/205532
1119
1120 2016-09-07  Simon Fraser  <simon.fraser@apple.com>
1121
1122         Enable the <meter> element on iOS
1123         https://bugs.webkit.org/show_bug.cgi?id=161714
1124         rdar://problem/8978410
1125
1126         Reviewed by Tim Horton.
1127
1128         Define ENABLE_METER_ELEMENT unconditionally now.
1129         
1130         Rendering falls back to html.css rendering, which makes <meter> looks similar between
1131         macOS and iOS.
1132
1133         Tested by enabling existing tests.
1134
1135         * Configurations/FeatureDefines.xcconfig:
1136
1137 2016-09-07  Eric Carlson  <eric.carlson@apple.com>
1138
1139         [MediaStream] applyConstraints pt. 2 - advanced constraints
1140         https://bugs.webkit.org/show_bug.cgi?id=161715
1141         <rdar://problem/28195461>
1142
1143         Reviewed by Dean Jackson.
1144
1145         Test: fast/mediastream/apply-constraints-advanced.html
1146
1147         * platform/mediastream/MediaConstraints.cpp:
1148         (WebCore::MediaConstraint::create): Return Ref<>, not RefPtr<>.
1149         (WebCore::MediaConstraint::copy): New
1150         (WebCore::IntConstraint::copy): Ditto.
1151         (WebCore::DoubleConstraint::copy): Ditto.
1152         (WebCore::BooleanConstraint::copy): Ditto.
1153         (WebCore::StringConstraint::copy): Ditto.
1154         (WebCore::StringConstraint::fitnessDistance): New, compute the fitness distance between the
1155           constraint and the specified value.
1156         (WebCore::StringConstraint::merge): New, merge value into constraint.
1157         (WebCore::FlattenedConstraint::set): New, add or replace a constraint.
1158         (WebCore::FlattenedConstraint::merge): New, merge or add a constraint.
1159         * platform/mediastream/MediaConstraints.h:
1160         (WebCore::MediaConstraint::fitnessDistance):
1161         (WebCore::MediaConstraint::merge):
1162         (WebCore::NumericConstraint::nearlyEqual):
1163         (WebCore::FlattenedConstraint::isEmpty):
1164         (WebCore::FlattenedConstraint::begin):
1165         (WebCore::FlattenedConstraint::end):
1166         (WebCore::MediaConstraint::~MediaConstraint): Deleted.
1167         (WebCore::MediaConstraint::find): Deleted.
1168         (WebCore::MediaConstraint::getIdeal): Deleted.
1169
1170         * platform/mediastream/RealtimeMediaSource.cpp:
1171         (WebCore::RealtimeMediaSource::fitnessDistance): Return the fitness distance between the source
1172           capabilities and a constraint.
1173         (WebCore::applyNumericConstraint): New, apply a numeric constraint.
1174         (WebCore::RealtimeMediaSource::applyConstraint): Use applyNumericConstraint.
1175         (WebCore::RealtimeMediaSource::selectSettings): New, implement the SelectSettings algorithm
1176         (WebCore::RealtimeMediaSource::applyConstraints):
1177         (WebCore::RealtimeMediaSource::supportsConstraint): Deleted.
1178         (WebCore::value): Deleted.
1179         * platform/mediastream/RealtimeMediaSource.h:
1180
1181 2016-09-07  Mark Lam  <mark.lam@apple.com>
1182
1183         Add CatchScope and force all exception checks to be via ThrowScope or CatchScope.
1184         https://bugs.webkit.org/show_bug.cgi?id=161498
1185
1186         Reviewed by Geoffrey Garen.
1187
1188         No new test because there is no behavior change in general except for 1 bug fix.
1189         That bug is already caught by existing tests with the introduction of the CatchScope.
1190
1191         Fixes a bug in JSEventListener::handleEvent() where the exception thrown from
1192         a failed attempt to get the handleEvent callback is not handled.
1193
1194         * ForwardingHeaders/runtime/CatchScope.h: Added.
1195         * Modules/encryptedmedia/CDMSessionClearKey.cpp:
1196         (WebCore::CDMSessionClearKey::update):
1197         * Modules/indexeddb/IDBObjectStore.cpp:
1198         (WebCore::IDBObjectStore::putOrAdd):
1199         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1200         (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd):
1201         * Modules/mediastream/SDPProcessor.cpp:
1202         (WebCore::SDPProcessor::callScript):
1203         * Modules/plugins/QuickTimePluginReplacement.mm:
1204         (WebCore::QuickTimePluginReplacement::ensureReplacementScriptInjected):
1205         (WebCore::QuickTimePluginReplacement::installReplacement):
1206         * bindings/js/ArrayValue.cpp:
1207         (WebCore::ArrayValue::get):
1208         * bindings/js/Dictionary.cpp:
1209         (WebCore::Dictionary::getOwnPropertiesAsStringHashMap):
1210         * bindings/js/IDBBindingUtilities.cpp:
1211         (WebCore::toJS):
1212         * bindings/js/JSApplePaySessionCustom.cpp:
1213         (WebCore::JSApplePaySession::completeShippingMethodSelection):
1214         (WebCore::JSApplePaySession::completeShippingContactSelection):
1215         (WebCore::JSApplePaySession::completePaymentMethodSelection):
1216         * bindings/js/JSAudioTrackCustom.cpp:
1217         (WebCore::JSAudioTrack::setKind):
1218         (WebCore::JSAudioTrack::setLanguage):
1219         * bindings/js/JSBlobCustom.cpp:
1220         (WebCore::constructJSBlob):
1221         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
1222         (WebCore::JSCSSStyleDeclaration::getPropertyCSSValue):
1223         * bindings/js/JSCommandLineAPIHostCustom.cpp:
1224         (WebCore::getJSListenerFunctions):
1225         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
1226         (WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier):
1227         (WebCore::getHashAlgorithm):
1228         (WebCore::createAesCbcParams):
1229         (WebCore::createAesKeyGenParams):
1230         (WebCore::createHmacParams):
1231         (WebCore::createHmacKeyParams):
1232         (WebCore::createRsaKeyGenParams):
1233         (WebCore::createRsaOaepParams):
1234         (WebCore::createRsaSsaParams):
1235         * bindings/js/JSCryptoKeySerializationJWK.cpp:
1236         (WebCore::getJSArrayFromJSON):
1237         (WebCore::getStringFromJSON):
1238         (WebCore::getBooleanFromJSON):
1239         (WebCore::JSCryptoKeySerializationJWK::JSCryptoKeySerializationJWK):
1240         (WebCore::JSCryptoKeySerializationJWK::reconcileUsages):
1241         (WebCore::JSCryptoKeySerializationJWK::keyDataOctetSequence):
1242         (WebCore::JSCryptoKeySerializationJWK::keyDataRSAComponents):
1243         (WebCore::JSCryptoKeySerializationJWK::keyData):
1244         (WebCore::buildJSONForRSAComponents):
1245         (WebCore::addUsagesToJSON):
1246         (WebCore::JSCryptoKeySerializationJWK::serialize):
1247         * bindings/js/JSCustomElementInterface.cpp:
1248         (WebCore::JSCustomElementInterface::constructElement):
1249         (WebCore::constructCustomElementSynchronously):
1250         (WebCore::JSCustomElementInterface::upgradeElement):
1251         * bindings/js/JSCustomElementRegistryCustom.cpp:
1252         (WebCore::getCustomElementCallback):
1253         (WebCore::JSCustomElementRegistry::define):
1254         (WebCore::whenDefinedPromise):
1255         (WebCore::JSCustomElementRegistry::whenDefined):
1256         * bindings/js/JSDOMBinding.cpp:
1257         (WebCore::valueToUSVString):
1258         (WebCore::reportException):
1259         (WebCore::reportCurrentException):
1260         (WebCore::setDOMException):
1261         (WebCore::hasIteratorMethod):
1262         (WebCore::toSmallerInt):
1263         (WebCore::toSmallerUInt):
1264         (WebCore::toInt32EnforceRange):
1265         (WebCore::toUInt32EnforceRange):
1266         (WebCore::toInt64EnforceRange):
1267         (WebCore::toUInt64EnforceRange):
1268         (WebCore::throwNotSupportedError):
1269         (WebCore::throwInvalidStateError):
1270         (WebCore::throwSecurityError):
1271         * bindings/js/JSDOMBinding.h:
1272         (WebCore::toJSSequence):
1273         (WebCore::toJS):
1274         (WebCore::jsFrozenArray):
1275         (WebCore::NativeValueTraits<String>::nativeValue):
1276         (WebCore::NativeValueTraits<unsigned>::nativeValue):
1277         (WebCore::NativeValueTraits<float>::nativeValue):
1278         (WebCore::NativeValueTraits<double>::nativeValue):
1279         (WebCore::toNativeArray):
1280         * bindings/js/JSDOMGlobalObject.cpp:
1281         (WebCore::makeThisTypeErrorForBuiltins):
1282         (WebCore::makeGetterTypeErrorForBuiltins):
1283         * bindings/js/JSDOMGlobalObjectTask.cpp:
1284         * bindings/js/JSDOMIterator.h:
1285         (WebCore::iteratorForEach):
1286         * bindings/js/JSDOMPromise.cpp:
1287         (WebCore::rejectPromiseWithExceptionIfAny):
1288         * bindings/js/JSDOMPromise.h:
1289         (WebCore::callPromiseFunction):
1290         * bindings/js/JSDOMStringMapCustom.cpp:
1291         (WebCore::JSDOMStringMap::putDelegate):
1292         * bindings/js/JSDOMWindowBase.cpp:
1293         (WebCore::JSDOMWindowMicrotaskCallback::call):
1294         * bindings/js/JSDOMWindowCustom.cpp:
1295         (WebCore::JSDOMWindow::setLocation):
1296         (WebCore::JSDOMWindow::open):
1297         (WebCore::JSDOMWindow::showModalDialog):
1298         (WebCore::handlePostMessage):
1299         (WebCore::JSDOMWindow::setTimeout):
1300         (WebCore::JSDOMWindow::setInterval):
1301         * bindings/js/JSDataCueCustom.cpp:
1302         (WebCore::constructJSDataCue):
1303         * bindings/js/JSDeviceMotionEventCustom.cpp:
1304         (WebCore::readAccelerationArgument):
1305         (WebCore::readRotationRateArgument):
1306         (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent):
1307         * bindings/js/JSDictionary.cpp:
1308         (WebCore::JSDictionary::tryGetProperty):
1309         (WebCore::JSDictionary::convertValue):
1310         * bindings/js/JSDictionary.h:
1311         (WebCore::JSDictionary::tryGetPropertyAndResult):
1312         * bindings/js/JSDocumentCustom.cpp:
1313         (WebCore::JSDocument::getCSSCanvasContext):
1314         * bindings/js/JSEventListener.cpp:
1315         (WebCore::JSEventListener::handleEvent):
1316         * bindings/js/JSFileCustom.cpp:
1317         (WebCore::constructJSFile):
1318         * bindings/js/JSGeolocationCustom.cpp:
1319         (WebCore::createPositionOptions):
1320         (WebCore::JSGeolocation::getCurrentPosition):
1321         (WebCore::JSGeolocation::watchPosition):
1322         * bindings/js/JSHTMLAllCollectionCustom.cpp:
1323         (WebCore::callHTMLAllCollection):
1324         * bindings/js/JSHTMLCanvasElementCustom.cpp:
1325         (WebCore::get3DContextAttributes):
1326         (WebCore::JSHTMLCanvasElement::getContext):
1327         (WebCore::JSHTMLCanvasElement::probablySupportsContext):
1328         * bindings/js/JSHTMLElementCustom.cpp:
1329         (WebCore::constructJSHTMLElement):
1330         * bindings/js/JSHistoryCustom.cpp:
1331         (WebCore::JSHistory::pushState):
1332         (WebCore::JSHistory::replaceState):
1333         * bindings/js/JSIDBDatabaseCustom.cpp:
1334         (WebCore::JSIDBDatabase::createObjectStore):
1335         * bindings/js/JSLazyEventListener.cpp:
1336         (WebCore::JSLazyEventListener::initializeJSFunction):
1337         * bindings/js/JSMainThreadExecState.h:
1338         (WebCore::JSMainThreadExecState::linkAndEvaluateModule):
1339         (WebCore::JSMainThreadExecState::~JSMainThreadExecState):
1340         * bindings/js/JSMessageEventCustom.cpp:
1341         (WebCore::handleInitMessageEvent):
1342         * bindings/js/JSMessagePortCustom.cpp:
1343         (WebCore::fillMessagePortArray):
1344         * bindings/js/JSMessagePortCustom.h:
1345         (WebCore::handlePostMessage):
1346         * bindings/js/JSMockContentFilterSettingsCustom.cpp:
1347         (WebCore::JSMockContentFilterSettings::setDecisionPoint):
1348         (WebCore::toDecision):
1349         (WebCore::JSMockContentFilterSettings::setDecision):
1350         (WebCore::JSMockContentFilterSettings::setUnblockRequestDecision):
1351         * bindings/js/JSNodeFilterCustom.cpp:
1352         (WebCore::JSNodeFilter::acceptNode):
1353         * bindings/js/JSNodeOrString.cpp:
1354         (WebCore::toNodeOrStringVector):
1355         * bindings/js/JSSQLTransactionCustom.cpp:
1356         (WebCore::JSSQLTransaction::executeSql):
1357         * bindings/js/JSSVGLengthCustom.cpp:
1358         (WebCore::JSSVGLength::convertToSpecifiedUnits):
1359         * bindings/js/JSStorageCustom.cpp:
1360         (WebCore::JSStorage::getOwnPropertyNames):
1361         (WebCore::JSStorage::putDelegate):
1362         * bindings/js/JSTextTrackCustom.cpp:
1363         (WebCore::JSTextTrack::setLanguage):
1364         * bindings/js/JSVideoTrackCustom.cpp:
1365         (WebCore::JSVideoTrack::setKind):
1366         (WebCore::JSVideoTrack::setLanguage):
1367         * bindings/js/JSWebGL2RenderingContextCustom.cpp:
1368         (WebCore::JSWebGL2RenderingContext::getIndexedParameter):
1369         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
1370         (WebCore::getObjectParameter):
1371         (WebCore::JSWebGLRenderingContextBase::getExtension):
1372         (WebCore::JSWebGLRenderingContextBase::getFramebufferAttachmentParameter):
1373         (WebCore::JSWebGLRenderingContextBase::getParameter):
1374         (WebCore::JSWebGLRenderingContextBase::getProgramParameter):
1375         (WebCore::JSWebGLRenderingContextBase::getShaderParameter):
1376         (WebCore::toVector):
1377         (WebCore::dataFunctionf):
1378         (WebCore::dataFunctionMatrix):
1379         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
1380         (WebCore::createAlgorithmFromJSValue):
1381         (WebCore::cryptoKeyFormatFromJSValue):
1382         (WebCore::cryptoKeyUsagesFromJSValue):
1383         (WebCore::JSWebKitSubtleCrypto::encrypt):
1384         (WebCore::JSWebKitSubtleCrypto::decrypt):
1385         (WebCore::JSWebKitSubtleCrypto::sign):
1386         (WebCore::JSWebKitSubtleCrypto::verify):
1387         (WebCore::JSWebKitSubtleCrypto::digest):
1388         (WebCore::JSWebKitSubtleCrypto::generateKey):
1389         (WebCore::importKey):
1390         (WebCore::JSWebKitSubtleCrypto::importKey):
1391         (WebCore::exportKey):
1392         (WebCore::JSWebKitSubtleCrypto::exportKey):
1393         (WebCore::JSWebKitSubtleCrypto::wrapKey):
1394         (WebCore::JSWebKitSubtleCrypto::unwrapKey):
1395         * bindings/js/JSWorkerCustom.cpp:
1396         (WebCore::constructJSWorker):
1397         * bindings/js/JSWorkerGlobalScopeCustom.cpp:
1398         (WebCore::JSWorkerGlobalScope::importScripts):
1399         (WebCore::JSWorkerGlobalScope::setTimeout):
1400         (WebCore::JSWorkerGlobalScope::setInterval):
1401         * bindings/js/ReadableStreamDefaultController.cpp:
1402         (WebCore::ReadableStreamDefaultController::invoke):
1403         (WebCore::ReadableStreamDefaultController::isControlledReadableStreamLocked):
1404         * bindings/js/ReadableStreamDefaultController.h:
1405         (WebCore::ReadableStreamDefaultController::enqueue):
1406         * bindings/js/ScheduledAction.cpp:
1407         (WebCore::ScheduledAction::create):
1408         * bindings/js/ScriptGlobalObject.cpp:
1409         (WebCore::ScriptGlobalObject::set):
1410         * bindings/js/SerializedScriptValue.cpp:
1411         (WebCore::CloneBase::shouldTerminate):
1412         (WebCore::CloneDeserializer::deserialize):
1413         (WebCore::SerializedScriptValue::create):
1414         (WebCore::SerializedScriptValue::deserialize):
1415         * bindings/js/WorkerScriptController.cpp:
1416         (WebCore::WorkerScriptController::evaluate):
1417         * bindings/scripts/CodeGeneratorJS.pm:
1418         (GenerateDictionaryImplementationContent):
1419         (GenerateImplementation):
1420         (GenerateParametersCheck):
1421         (GenerateImplementationFunctionCall):
1422         (GenerateConstructorDefinition):
1423         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1424         (WebCore::jsTestActiveDOMObjectPrototypeFunctionPostMessage):
1425         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
1426         (WebCore::jsTestCustomNamedGetterPrototypeFunctionAnotherFunction):
1427         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1428         (WebCore::JSTestEventConstructorConstructor::construct):
1429         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1430         (WebCore::jsTestEventTargetPrototypeFunctionItem):
1431         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1432         (WebCore::setJSTestGlobalObjectRegularAttribute):
1433         (WebCore::setJSTestGlobalObjectPublicAndPrivateAttribute):
1434         (WebCore::setJSTestGlobalObjectPublicAndPrivateConditionalAttribute):
1435         (WebCore::setJSTestGlobalObjectEnabledAtRuntimeAttribute):
1436         (WebCore::jsTestGlobalObjectInstanceFunctionRegularOperation):
1437         (WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation1):
1438         (WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation2):
1439         * bindings/scripts/test/JS/JSTestInterface.cpp:
1440         (WebCore::JSTestInterfaceConstructor::construct):
1441         (WebCore::setJSTestInterfaceConstructorImplementsStaticAttr):
1442         (WebCore::setJSTestInterfaceImplementsStr2):
1443         (WebCore::setJSTestInterfaceImplementsStr3):
1444         (WebCore::setJSTestInterfaceImplementsNode):
1445         (WebCore::setJSTestInterfaceConstructorSupplementalStaticAttr):
1446         (WebCore::setJSTestInterfaceSupplementalStr2):
1447         (WebCore::setJSTestInterfaceSupplementalStr3):
1448         (WebCore::setJSTestInterfaceSupplementalNode):
1449         (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2):
1450         (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
1451         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
1452         (WebCore::setJSTestJSBuiltinConstructorTestAttributeRWCustom):
1453         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
1454         (WebCore::JSTestNamedConstructorNamedConstructor::construct):
1455         * bindings/scripts/test/JS/JSTestNode.cpp:
1456         (WebCore::setJSTestNodeName):
1457         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
1458         (WebCore::setJSTestNondeterministicNondeterministicWriteableAttr):
1459         (WebCore::setJSTestNondeterministicNondeterministicExceptionAttr):
1460         (WebCore::setJSTestNondeterministicNondeterministicGetterExceptionAttr):
1461         (WebCore::setJSTestNondeterministicNondeterministicSetterExceptionAttr):
1462         * bindings/scripts/test/JS/JSTestObj.cpp:
1463         (WebCore::convertDictionary<TestObj::Dictionary>):
1464         (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
1465         (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
1466         (WebCore::convertDictionary<AlternateDictionaryName>):
1467         (WebCore::setJSTestObjConstructorStaticStringAttr):
1468         (WebCore::setJSTestObjTestSubObjEnabledBySettingConstructor):
1469         (WebCore::setJSTestObjEnumAttr):
1470         (WebCore::setJSTestObjByteAttr):
1471         (WebCore::setJSTestObjOctetAttr):
1472         (WebCore::setJSTestObjShortAttr):
1473         (WebCore::setJSTestObjClampedShortAttr):
1474         (WebCore::setJSTestObjEnforceRangeShortAttr):
1475         (WebCore::setJSTestObjUnsignedShortAttr):
1476         (WebCore::setJSTestObjLongAttr):
1477         (WebCore::setJSTestObjLongLongAttr):
1478         (WebCore::setJSTestObjUnsignedLongLongAttr):
1479         (WebCore::setJSTestObjStringAttr):
1480         (WebCore::setJSTestObjUsvstringAttr):
1481         (WebCore::setJSTestObjTestObjAttr):
1482         (WebCore::setJSTestObjTestNullableObjAttr):
1483         (WebCore::setJSTestObjLenientTestObjAttr):
1484         (WebCore::setJSTestObjStringAttrTreatingNullAsEmptyString):
1485         (WebCore::setJSTestObjUsvstringAttrTreatingNullAsEmptyString):
1486         (WebCore::setJSTestObjImplementationEnumAttr):
1487         (WebCore::setJSTestObjXMLObjAttr):
1488         (WebCore::setJSTestObjCreate):
1489         (WebCore::setJSTestObjReflectedStringAttr):
1490         (WebCore::setJSTestObjReflectedUSVStringAttr):
1491         (WebCore::setJSTestObjReflectedIntegralAttr):
1492         (WebCore::setJSTestObjReflectedUnsignedIntegralAttr):
1493         (WebCore::setJSTestObjReflectedBooleanAttr):
1494         (WebCore::setJSTestObjReflectedURLAttr):
1495         (WebCore::setJSTestObjReflectedUSVURLAttr):
1496         (WebCore::setJSTestObjReflectedCustomIntegralAttr):
1497         (WebCore::setJSTestObjReflectedCustomBooleanAttr):
1498         (WebCore::setJSTestObjReflectedCustomURLAttr):
1499         (WebCore::setJSTestObjEnabledAtRuntimeAttribute):
1500         (WebCore::setJSTestObjTypedArrayAttr):
1501         (WebCore::setJSTestObjAttrWithGetterException):
1502         (WebCore::setJSTestObjAttrWithGetterExceptionWithMessage):
1503         (WebCore::setJSTestObjAttrWithSetterException):
1504         (WebCore::setJSTestObjAttrWithSetterExceptionWithMessage):
1505         (WebCore::setJSTestObjStringAttrWithGetterException):
1506         (WebCore::setJSTestObjStringAttrWithSetterException):
1507         (WebCore::setJSTestObjCustomAttr):
1508         (WebCore::setJSTestObjOnfoo):
1509         (WebCore::setJSTestObjOnwebkitfoo):
1510         (WebCore::setJSTestObjWithScriptStateAttribute):
1511         (WebCore::setJSTestObjWithCallWithAndSetterCallWithAttribute):
1512         (WebCore::setJSTestObjWithScriptExecutionContextAttribute):
1513         (WebCore::setJSTestObjWithScriptStateAttributeRaises):
1514         (WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises):
1515         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute):
1516         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
1517         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
1518         (WebCore::setJSTestObjWithScriptArgumentsAndCallStackAttribute):
1519         (WebCore::setJSTestObjConditionalAttr1):
1520         (WebCore::setJSTestObjConditionalAttr2):
1521         (WebCore::setJSTestObjConditionalAttr3):
1522         (WebCore::setJSTestObjConditionalAttr4Constructor):
1523         (WebCore::setJSTestObjConditionalAttr5Constructor):
1524         (WebCore::setJSTestObjConditionalAttr6Constructor):
1525         (WebCore::setJSTestObjAnyAttribute):
1526         (WebCore::setJSTestObjMutablePoint):
1527         (WebCore::setJSTestObjImmutablePoint):
1528         (WebCore::setJSTestObjStrawberry):
1529         (WebCore::setJSTestObjId):
1530         (WebCore::setJSTestObjReplaceableAttribute):
1531         (WebCore::setJSTestObjNullableLongSettableAttribute):
1532         (WebCore::setJSTestObjNullableStringSettableAttribute):
1533         (WebCore::setJSTestObjNullableUSVStringSettableAttribute):
1534         (WebCore::setJSTestObjNullableStringValue):
1535         (WebCore::setJSTestObjAttributeWithReservedEnumType):
1536         (WebCore::setJSTestObjPutForwardsAttribute):
1537         (WebCore::setJSTestObjPutForwardsNullableAttribute):
1538         (WebCore::setJSTestObjStringifierAttribute):
1539         (WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation1):
1540         (WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation2):
1541         (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs):
1542         (WebCore::jsTestObjPrototypeFunctionByteMethodWithArgs):
1543         (WebCore::jsTestObjPrototypeFunctionOctetMethodWithArgs):
1544         (WebCore::jsTestObjPrototypeFunctionLongMethodWithArgs):
1545         (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
1546         (WebCore::jsTestObjPrototypeFunctionMethodWithArgTreatingNullAsEmptyString):
1547         (WebCore::jsTestObjPrototypeFunctionMethodWithXPathNSResolverParameter):
1548         (WebCore::jsTestObjPrototypeFunctionNullableStringSpecialMethod):
1549         (WebCore::jsTestObjPrototypeFunctionMethodWithEnumArg):
1550         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalEnumArg):
1551         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalEnumArgAndDefaultValue):
1552         (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows):
1553         (WebCore::jsTestObjPrototypeFunctionMethodWithUSVStringArg):
1554         (WebCore::jsTestObjPrototypeFunctionMethodWithNullableUSVStringArg):
1555         (WebCore::jsTestObjPrototypeFunctionMethodWithUSVStringArgTreatingNullAsEmptyString):
1556         (WebCore::jsTestObjPrototypeFunctionSerializedValue):
1557         (WebCore::jsTestObjPrototypeFunctionPrivateMethod):
1558         (WebCore::jsTestObjPrototypeFunctionPublicAndPrivateMethod):
1559         (WebCore::jsTestObjPrototypeFunctionAddEventListener):
1560         (WebCore::jsTestObjPrototypeFunctionRemoveEventListener):
1561         (WebCore::jsTestObjPrototypeFunctionWithScriptStateObj):
1562         (WebCore::jsTestObjPrototypeFunctionWithScriptStateObjException):
1563         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateObjException):
1564         (WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces):
1565         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg):
1566         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValue):
1567         (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg):
1568         (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs):
1569         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalString):
1570         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUSVString):
1571         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomicString):
1572         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue):
1573         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringAndDefaultValue):
1574         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsNull):
1575         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined):
1576         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsNull):
1577         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsEmptyString):
1578         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUSVStringIsEmptyString):
1579         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsEmptyString):
1580         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalDoubleIsNaN):
1581         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalFloatIsNaN):
1582         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalLongLong):
1583         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalLongLongIsZero):
1584         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLong):
1585         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLongIsZero):
1586         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalSequence):
1587         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalSequenceIsEmpty):
1588         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalBoolean):
1589         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalBooleanIsFalse):
1590         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalXPathNSResolver):
1591         (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg):
1592         (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackFunctionArg):
1593         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1):
1594         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
1595         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod3):
1596         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4):
1597         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod7):
1598         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod9):
1599         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod10):
1600         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod11):
1601         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1):
1602         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2):
1603         (WebCore::jsTestObjConstructorFunctionClassMethodWithOptional):
1604         (WebCore::jsTestObjConstructorFunctionOverloadedMethod11):
1605         (WebCore::jsTestObjConstructorFunctionOverloadedMethod12):
1606         (WebCore::jsTestObjPrototypeFunctionClassMethodWithClamp):
1607         (WebCore::jsTestObjPrototypeFunctionClassMethodWithEnforceRange):
1608         (WebCore::jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence):
1609         (WebCore::jsTestObjPrototypeFunctionStringArrayFunction):
1610         (WebCore::jsTestObjPrototypeFunctionMethodWithAndWithoutNullableSequence):
1611         (WebCore::jsTestObjPrototypeFunctionGetElementById):
1612         (WebCore::jsTestObjPrototypeFunctionConvert3):
1613         (WebCore::jsTestObjPrototypeFunctionConvert4):
1614         (WebCore::jsTestObjPrototypeFunctionVariadicStringMethod):
1615         (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
1616         (WebCore::jsTestObjPrototypeFunctionAny):
1617         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
1618         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise):
1619         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
1620         (WebCore::jsTestObjPrototypeFunctionConditionalOverload1):
1621         (WebCore::jsTestObjPrototypeFunctionConditionalOverload2):
1622         (WebCore::jsTestObjPrototypeFunctionSingleConditionalOverload1):
1623         (WebCore::jsTestObjPrototypeFunctionSingleConditionalOverload2):
1624         (WebCore::jsTestObjPrototypeFunctionAttachShadowRoot):
1625         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1626         (WebCore::constructJSTestOverloadedConstructors1):
1627         (WebCore::constructJSTestOverloadedConstructors2):
1628         (WebCore::constructJSTestOverloadedConstructors4):
1629         (WebCore::constructJSTestOverloadedConstructors5):
1630         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
1631         (WebCore::constructJSTestOverloadedConstructorsWithSequence1):
1632         (WebCore::constructJSTestOverloadedConstructorsWithSequence2):
1633         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1634         (WebCore::jsTestOverrideBuiltinsPrototypeFunctionNamedItem):
1635         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1636         (WebCore::setJSTestSerializedScriptValueInterfaceValue):
1637         (WebCore::setJSTestSerializedScriptValueInterfaceCachedValue):
1638         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1639         (WebCore::JSTestTypedefsConstructor::construct):
1640         (WebCore::setJSTestTypedefsUnsignedLongLongAttr):
1641         (WebCore::setJSTestTypedefsImmutableSerializedScriptValue):
1642         (WebCore::setJSTestTypedefsAttrWithGetterException):
1643         (WebCore::setJSTestTypedefsAttrWithSetterException):
1644         (WebCore::setJSTestTypedefsStringAttrWithGetterException):
1645         (WebCore::setJSTestTypedefsStringAttrWithSetterException):
1646         (WebCore::jsTestTypedefsPrototypeFunctionFunc):
1647         (WebCore::jsTestTypedefsPrototypeFunctionSetShadow):
1648         (WebCore::jsTestTypedefsPrototypeFunctionMethodWithSequenceArg):
1649         (WebCore::jsTestTypedefsPrototypeFunctionNullableSequenceArg):
1650         (WebCore::jsTestTypedefsPrototypeFunctionFuncWithClamp):
1651         (WebCore::jsTestTypedefsPrototypeFunctionStringSequenceFunction):
1652         (WebCore::jsTestTypedefsPrototypeFunctionStringSequenceFunction2):
1653         (WebCore::jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude):
1654         * bridge/NP_jsobject.cpp:
1655         (_NPN_InvokeDefault):
1656         (_NPN_Invoke):
1657         (_NPN_Evaluate):
1658         (_NPN_GetProperty):
1659         (_NPN_SetProperty):
1660         (_NPN_RemoveProperty):
1661         (_NPN_HasProperty):
1662         (_NPN_HasMethod):
1663         (_NPN_Enumerate):
1664         (_NPN_Construct):
1665         * bridge/c/c_instance.cpp:
1666         (JSC::Bindings::CInstance::moveGlobalExceptionToExecState):
1667         * bridge/objc/WebScriptObject.mm:
1668         (WebCore::addExceptionToConsole):
1669         (-[WebScriptObject callWebScriptMethod:withArguments:]):
1670         (-[WebScriptObject evaluateWebScript:]):
1671         (-[WebScriptObject setValue:forKey:]):
1672         (-[WebScriptObject valueForKey:]):
1673         (-[WebScriptObject removeWebScriptKey:]):
1674         (-[WebScriptObject hasWebScriptKey:]):
1675         (-[WebScriptObject webScriptValueAtIndex:]):
1676         (-[WebScriptObject setWebScriptValueAtIndex:value:]):
1677         * contentextensions/ContentExtensionParser.cpp:
1678         (WebCore::ContentExtensions::getDomainList):
1679         (WebCore::ContentExtensions::getTypeFlags):
1680         (WebCore::ContentExtensions::loadTrigger):
1681         (WebCore::ContentExtensions::loadAction):
1682         (WebCore::ContentExtensions::loadEncodedRules):
1683         * html/HTMLMediaElement.cpp:
1684         (WebCore::controllerJSValue):
1685         (WebCore::HTMLMediaElement::updateCaptionContainer):
1686         (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
1687         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
1688         (WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
1689         (WebCore::HTMLMediaElement::getCurrentMediaControlsStatus):
1690         * html/HTMLPlugInImageElement.cpp:
1691         (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
1692
1693 2016-09-07  Chris Dumez  <cdumez@apple.com>
1694
1695         Fix handling of negative radius in HTMLAreaElement's coords when in circle state
1696         https://bugs.webkit.org/show_bug.cgi?id=161690
1697
1698         Reviewed by Daniel Bates.
1699
1700         Fix handling of negative radius in HTMLAreaElement's coords when in
1701         circle state:
1702         - https://html.spec.whatwg.org/#attr-area-shape-circle
1703
1704         The radius must be non-negative as per the specification. However, our
1705         code fails to check.
1706
1707         Firefox and Chrome both reject negative radius.
1708
1709         No new tests, rebaselined existing test.
1710
1711         * html/HTMLAreaElement.cpp:
1712         (WebCore::HTMLAreaElement::getRegion):
1713
1714 2016-09-07  Chris Dumez  <cdumez@apple.com>
1715
1716         Align HTMLAreaElement shape parsing with the specification
1717         https://bugs.webkit.org/show_bug.cgi?id=161698
1718
1719         Reviewed by Daniel Bates.
1720
1721         Align HTMLAreaElement shape parsing with the specification:
1722         - https://html.spec.whatwg.org/#attr-area-shape
1723
1724         In particular, add support for circ / polygon non conforming shapes
1725         and use rectangle as default state.
1726
1727         This also aligns our behavior with Chrome.
1728
1729         No new tests, rebaselined existing test.
1730
1731         * html/HTMLAreaElement.cpp:
1732         (WebCore::HTMLAreaElement::parseAttribute):
1733
1734 2016-09-07  Daniel Bates  <dabates@apple.com>
1735
1736         Fix WebCore build when building for device with iOS 10 beta SDK
1737
1738         Define SPI macro kIOReturnSuccess.
1739
1740         * platform/spi/cocoa/IOReturnSPI.h:
1741
1742 2016-09-07  Michael Catanzaro  <mcatanzaro@igalia.com>
1743
1744         [EFL] Switch to ENABLE_NETWORK_CACHE
1745         https://bugs.webkit.org/show_bug.cgi?id=152676
1746
1747         Reviewed by Alex Christensen.
1748
1749         * PlatformEfl.cmake: Add GRefPtrSoup to build.
1750         * platform/network/soup/SoupNetworkSession.cpp:
1751         (WebCore::SoupNetworkSession::clearOldSoupCache): Renamed from clearCache.
1752         (WebCore::SoupNetworkSession::setCache): Deleted.
1753         (WebCore::SoupNetworkSession::cache): Deleted.
1754         (WebCore::SoupNetworkSession::clearCache): Deleted.
1755         * platform/network/soup/SoupNetworkSession.h:
1756
1757 2016-09-07  Chris Dumez  <cdumez@apple.com>
1758
1759         Drop legacy canvas.probablySupportsContext()
1760         https://bugs.webkit.org/show_bug.cgi?id=161692
1761
1762         Reviewed by Alex Christensen.
1763
1764         Drop legacy canvas.probablySupportsContext() as it is no longer in the specification:
1765         - https://html.spec.whatwg.org/#htmlcanvaselement
1766
1767         Firefox and Chrome do not support canvas.probablySupportsContext().
1768
1769         No new tests, rebaselined existing test.
1770
1771         * bindings/js/JSHTMLCanvasElementCustom.cpp:
1772         (WebCore::JSHTMLCanvasElement::probablySupportsContext): Deleted.
1773         * html/HTMLCanvasElement.cpp:
1774         (WebCore::HTMLCanvasElement::getContext):
1775         (WebCore::HTMLCanvasElement::probablySupportsContext): Deleted.
1776         * html/HTMLCanvasElement.h:
1777         * html/HTMLCanvasElement.idl:
1778
1779 2016-09-07  Simon Fraser  <simon.fraser@apple.com>
1780
1781         Rename ScrollBehavior to ScrollAlignment::Behavior
1782         https://bugs.webkit.org/show_bug.cgi?id=161677
1783
1784         Reviewed by Tim Horton.
1785
1786         Free up ScrollBehavior for future use with CSS OM View scrolling by renaming the
1787         existing ScrollBehavior, which is about alignment when scrolling into view.
1788
1789         Renamed ScrollBehavior* to ScrollAlignment.*, and made ScrollBehavior an enum class
1790         in the struct.
1791
1792         No behavior change.
1793
1794         * CMakeLists.txt:
1795         * WebCore.xcodeproj/project.pbxproj:
1796         * editing/FrameSelection.h:
1797         * rendering/RenderLayer.cpp:
1798         (WebCore::RenderLayer::getRectToExpose):
1799         * rendering/RenderObject.h:
1800         * rendering/RenderingAllInOne.cpp:
1801         * rendering/ScrollAlignment.cpp: Renamed from Source/WebCore/rendering/ScrollBehavior.cpp.
1802         * rendering/ScrollAlignment.h: Renamed from Source/WebCore/rendering/ScrollBehavior.h.
1803         (WebCore::ScrollAlignment::getVisibleBehavior):
1804         (WebCore::ScrollAlignment::getPartialBehavior):
1805         (WebCore::ScrollAlignment::getHiddenBehavior):
1806         * rendering/ScrollBehavior.h:
1807         (WebCore::ScrollAlignment::getVisibleBehavior): Deleted.
1808         (WebCore::ScrollAlignment::getPartialBehavior): Deleted.
1809         (WebCore::ScrollAlignment::getHiddenBehavior): Deleted.
1810
1811 2016-09-07  Dave Hyatt  <hyatt@apple.com>
1812
1813         Add CSSAtRule id info for new parser
1814         https://bugs.webkit.org/show_bug.cgi?id=161695
1815
1816         Reviewed by Sam Weinig.
1817
1818         * WebCore.xcodeproj/project.pbxproj:
1819         * css/parser/CSSAtRuleID.cpp: Added.
1820         (WebCore::cssAtRuleID):
1821         * css/parser/CSSAtRuleID.h: Added.
1822
1823 2016-09-07  Youenn Fablet  <youenn@apple.com>
1824
1825         [Streams API] Separate compile flag for ReadableStream and WritableStream
1826         https://bugs.webkit.org/show_bug.cgi?id=161044
1827
1828         Reviewed by Alex Christensen.
1829
1830         Moving from STREAMS_API to READABLE_STREAM_API and WRITABLE_STREAM_API compilation flags.
1831         No change of behavior.
1832
1833         * CMakeLists.txt: Triggering regeneration of builtin wrapper files based on individual builtin header file content change to cope with @conditional changes.
1834         * Configurations/FeatureDefines.xcconfig:
1835         * DerivedSources.cpp:
1836         * DerivedSources.make: Triggering regeneration of builtin wrapper files based on file content change to cope with @conditional changes.
1837         * Modules/fetch/FetchBody.cpp:
1838         * Modules/fetch/FetchBody.h:
1839         * Modules/fetch/FetchBodyOwner.cpp:
1840         (WebCore::FetchBodyOwner::isDisturbed):
1841         (WebCore::FetchBodyOwner::blobLoadingSucceeded):
1842         (WebCore::FetchBodyOwner::blobLoadingFailed):
1843         (WebCore::FetchBodyOwner::blobChunk):
1844         * Modules/fetch/FetchBodyOwner.h:
1845         * Modules/fetch/FetchResponse.cpp:
1846         (WebCore::FetchResponse::BodyLoader::didSucceed):
1847         (WebCore::FetchResponse::BodyLoader::didFail):
1848         (WebCore::FetchResponse::BodyLoader::didReceiveData):
1849         * Modules/fetch/FetchResponse.h:
1850         * Modules/fetch/FetchResponse.idl:
1851         * Modules/fetch/FetchResponse.js:
1852         (initializeFetchResponse):
1853         * Modules/fetch/FetchResponseSource.cpp:
1854         * Modules/fetch/FetchResponseSource.h:
1855         * Modules/streams/ByteLengthQueuingStrategy.idl:
1856         * Modules/streams/ByteLengthQueuingStrategy.js:
1857         * Modules/streams/CountQueuingStrategy.idl:
1858         * Modules/streams/CountQueuingStrategy.js:
1859         * Modules/streams/ReadableStream.idl:
1860         * Modules/streams/ReadableStream.js:
1861         * Modules/streams/ReadableStreamDefaultController.idl:
1862         * Modules/streams/ReadableStreamDefaultController.js:
1863         * Modules/streams/ReadableStreamDefaultReader.idl:
1864         * Modules/streams/ReadableStreamDefaultReader.js:
1865         * Modules/streams/ReadableStreamInternals.js:
1866         * Modules/streams/ReadableStreamSource.h:
1867         * Modules/streams/ReadableStreamSource.idl:
1868         * Modules/streams/StreamInternals.js:
1869         * Modules/streams/WritableStream.idl:
1870         * Modules/streams/WritableStream.js:
1871         * Modules/streams/WritableStreamInternals.js:
1872         * bindings/js/JSDOMGlobalObject.cpp:
1873         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
1874         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
1875         * bindings/js/JSReadableStreamPrivateConstructors.h:
1876         * bindings/js/JSReadableStreamSourceCustom.cpp:
1877         * bindings/js/ReadableStreamDefaultController.cpp:
1878         * bindings/js/ReadableStreamDefaultController.h:
1879         * testing/Internals.cpp:
1880         * testing/Internals.h:
1881         * testing/Internals.idl:
1882
1883 2016-09-07  Carlos Garcia Campos  <cgarcia@igalia.com>
1884
1885         [GTK] Crash of WebProcess on the last WebView disconnect
1886         https://bugs.webkit.org/show_bug.cgi?id=161605
1887
1888         Reviewed by Michael Catanzaro.
1889
1890         Stop tracking X11 GL contexts to be cleanered on an exit handler. This was added to work around bugs on drivers,
1891         and it's assuming that all GLContext not deleted when the exit handler is called are leaked, which is no longer
1892         true, because PlatformDisplay now owns a GLContext and is deleted after exit handlers.
1893
1894         * platform/graphics/GLContext.cpp:
1895         (WebCore::GLContext::GLContext):
1896         (WebCore::GLContext::~GLContext):
1897         (WebCore::activeContextList): Deleted.
1898         (WebCore::GLContext::addActiveContext): Deleted.
1899         (WebCore::GLContext::removeActiveContext): Deleted.
1900         (WebCore::GLContext::cleanupActiveContextsAtExit): Deleted.
1901
1902 2016-09-07  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
1903
1904         Templatize JS bindings code generator of functions with variadic parameters
1905         https://bugs.webkit.org/show_bug.cgi?id=158835
1906
1907         Reviewed by Darin Adler.
1908
1909         Add template functions to handle function with variadic parameter for DOM objects.
1910
1911         * Modules/mediastream/RTCPeerConnection.cpp:
1912         (WebCore::RTCPeerConnection::addTrack):
1913         * Modules/mediastream/RTCPeerConnection.h:
1914         * bindings/js/JSDOMBinding.h:
1915         (WebCore::VariadicHelperBase::convert):
1916         (WebCore::toArguments):
1917         (WebCore::jsFrozenArray):
1918         (WebCore::toRefPtrNativeArray):
1919         (WebCore::toNativeArray):
1920         * bindings/scripts/CodeGeneratorJS.pm:
1921         (GenerateParametersCheck):
1922         (GetVariadicType):
1923         * bindings/scripts/test/JS/JSTestObj.cpp:
1924         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod12):
1925         (WebCore::jsTestObjPrototypeFunctionVariadicStringMethod):
1926         (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
1927         (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
1928         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
1929         (WebCore::jsTestObjPrototypeFunctionAny):
1930         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1931         (WebCore::constructJSTestOverloadedConstructors5):
1932
1933 2016-09-06  Commit Queue  <commit-queue@webkit.org>
1934
1935         Unreviewed, rolling out r205521, r205526, and r205532.
1936         https://bugs.webkit.org/show_bug.cgi?id=161668
1937
1938         broke API tests (Requested by alexchristensen on #webkit).
1939
1940         Reverted changesets:
1941
1942         "Punycode encode non-ascii hosts in URLParser"
1943         https://bugs.webkit.org/show_bug.cgi?id=161655
1944         http://trac.webkit.org/changeset/205521
1945
1946         "Fix query-only and fragment-only relative URLs when using
1947         URLParser"
1948         https://bugs.webkit.org/show_bug.cgi?id=161657
1949         http://trac.webkit.org/changeset/205526
1950
1951         "URLParser should parse / as a relative URL"
1952         https://bugs.webkit.org/show_bug.cgi?id=161667
1953         http://trac.webkit.org/changeset/205532
1954
1955 2016-09-06  Alex Christensen  <achristensen@webkit.org>
1956
1957         URLParser should parse / as a relative URL
1958         https://bugs.webkit.org/show_bug.cgi?id=161667
1959
1960         Reviewed by Tim Horton.
1961
1962         Covered by a new API test.
1963
1964         * platform/URLParser.cpp:
1965         (WebCore::URLParser::parse):
1966
1967 2016-09-06  Joseph Pecoraro  <pecoraro@apple.com>
1968
1969         Web Inspector: Avoid linkifying some schemes in console logs
1970         https://bugs.webkit.org/show_bug.cgi?id=161648
1971         <rdar://problem/16413270>
1972
1973         Reviewed by Brian Burg.
1974
1975         * inspector/InspectorFrontendHost.cpp:
1976         (WebCore::InspectorFrontendHost::openInNewTab):
1977         If a javascript: link is passed just ignore it.
1978
1979 2016-09-06  Alex Christensen  <achristensen@webkit.org>
1980
1981         Fix query-only and fragment-only relative URLs when using URLParser
1982         https://bugs.webkit.org/show_bug.cgi?id=161657
1983
1984         Reviewed by Tim Horton.
1985
1986         Covered by new API tests and progress towards passing the web platform tests when using URLParser.
1987
1988         * platform/URLParser.cpp:
1989         (WebCore::URLParser::parse):
1990
1991 2016-09-06  Chris Dumez  <cdumez@apple.com>
1992
1993         Add support for input.minLength / textArea.minLength
1994         https://bugs.webkit.org/show_bug.cgi?id=161644
1995
1996         Reviewed by Darin Adler.
1997
1998         Add support for input.minLength / textArea.minLength:
1999         - https://html.spec.whatwg.org/#dom-input-minlength
2000         - https://html.spec.whatwg.org/#dom-textarea-minlength
2001
2002         Chrome implements this, Firefox does not yet.
2003
2004         No new tests, rebaselined existing tests.
2005
2006         * html/FormAssociatedElement.cpp:
2007         (WebCore::FormAssociatedElement::tooShort):
2008         (WebCore::FormAssociatedElement::valid):
2009         (WebCore::FormAssociatedElement::typeMismatch): Deleted.
2010         * html/FormAssociatedElement.h:
2011         * html/HTMLAttributeNames.in:
2012         * html/HTMLInputElement.cpp:
2013         (WebCore::HTMLInputElement::HTMLInputElement):
2014         (WebCore::HTMLInputElement::isValidValue):
2015         (WebCore::HTMLInputElement::tooShort):
2016         (WebCore::HTMLInputElement::tooLong):
2017         (WebCore::HTMLInputElement::parseAttribute):
2018         (WebCore::HTMLInputElement::effectiveMaxLength):
2019         (WebCore::HTMLInputElement::maxLengthAttributeChanged):
2020         (WebCore::HTMLInputElement::minLengthAttributeChanged):
2021         (WebCore::HTMLInputElement::patternMismatch): Deleted.
2022         (WebCore::parseAcceptAttribute): Deleted.
2023         (WebCore::HTMLInputElement::isEnumeratable): Deleted.
2024         (WebCore::HTMLInputElement::supportLabels): Deleted.
2025         * html/HTMLInputElement.h:
2026         (WebCore::HTMLInputElement::supportsMinLength):
2027         (WebCore::HTMLInputElement::supportsMaxLength): Deleted.
2028         * html/HTMLInputElement.idl:
2029         * html/HTMLTextAreaElement.cpp:
2030         (WebCore::HTMLTextAreaElement::parseAttribute):
2031         (WebCore::HTMLTextAreaElement::maxLengthAttributeChanged):
2032         (WebCore::HTMLTextAreaElement::minLengthAttributeChanged):
2033         (WebCore::HTMLTextAreaElement::validationMessage):
2034         (WebCore::HTMLTextAreaElement::tooShort):
2035         (WebCore::HTMLTextAreaElement::tooLong):
2036         (WebCore::HTMLTextAreaElement::isValidValue):
2037         * html/HTMLTextAreaElement.h:
2038         * html/HTMLTextAreaElement.idl:
2039         * html/HTMLTextFormControlElement.cpp:
2040         (WebCore::HTMLTextFormControlElement::setMaxLength):
2041         (WebCore::HTMLTextFormControlElement::setMinLength):
2042         * html/HTMLTextFormControlElement.h:
2043         (WebCore::HTMLTextFormControlElement::maxLength):
2044         (WebCore::HTMLTextFormControlElement::setMaxLength):
2045         (WebCore::HTMLTextFormControlElement::minLength):
2046         (WebCore::HTMLTextFormControlElement::setMinLength):
2047         * html/InputType.cpp:
2048         (WebCore::InputType::validationMessage):
2049         * html/ValidityState.idl:
2050         * platform/LocalizedStrings.cpp:
2051         (WebCore::validationMessageTooShortText):
2052         * platform/LocalizedStrings.h:
2053
2054 2016-09-06  Alex Christensen  <achristensen@webkit.org>
2055
2056         Punycode encode non-ascii hosts in URLParser
2057         https://bugs.webkit.org/show_bug.cgi?id=161655
2058
2059         Reviewed by Tim Horton.
2060
2061         Covered by new API tests based on the web platform tests.
2062
2063         * platform/URLParser.cpp:
2064         (WebCore::URLParser::parse):
2065         (WebCore::containsOnlyASCII):
2066         (WebCore::domainToASCII):
2067
2068 2016-09-06  Saam Barati  <sbarati@apple.com>
2069
2070         Make JSMap and JSSet faster
2071         https://bugs.webkit.org/show_bug.cgi?id=160989
2072
2073         Reviewed by Filip Pizlo.
2074
2075         * ForwardingHeaders/runtime/HashMapImpl.h: Added.
2076         * ForwardingHeaders/runtime/MapBase.h: Added.
2077         * bindings/js/SerializedScriptValue.cpp:
2078         (WebCore::CloneSerializer::serialize):
2079         (WebCore::CloneDeserializer::deserialize):
2080
2081 2016-09-06  Myles C. Maxfield  <mmaxfield@apple.com>
2082
2083         Strikethrough positions are erroneously snapped twice
2084         https://bugs.webkit.org/show_bug.cgi?id=161647
2085         <rdar://problem/11542470>
2086
2087         Reviewed by Zalan Bujtas.
2088
2089         Because we're using an int for the position of the baseline, the math to calculate the
2090         strikethrough position is snapped. Then, we snap it again inside GraphicsContext.
2091
2092         Test: fast/text/strikethrough-int.html
2093
2094         * rendering/InlineTextBox.cpp:
2095         (WebCore::InlineTextBox::paintDecoration):
2096         * rendering/TextDecorationPainter.h:
2097         (WebCore::TextDecorationPainter::setBaseline):
2098
2099 2016-09-06  David Kilzer  <ddkilzer@apple.com>
2100
2101         [iOS] Remove soft linking of MobileCoreServices.framework
2102         <https://webkit.org/b/161641>
2103         <rdar://problem/10420118>
2104
2105         Reviewed by Darin Adler.
2106
2107         * Configurations/WebCore.xcconfig: Add hard link to
2108         MobileCoreServices.framework.
2109
2110         * editing/ios/EditorIOS.mm: Change #include to #import.
2111         * platform/graphics/cg/ImageSourceCGMac.mm:
2112         * platform/graphics/mac/ImageMac.mm:
2113         * platform/ios/PasteboardIOS.mm:
2114         * platform/ios/PlatformPasteboardIOS.mm:
2115         * platform/network/ios/WebCoreURLResponseIOS.mm:
2116         * platform/network/mac/UTIUtilities.mm:
2117         - Rearrange import statements as needed.
2118         - Remove soft link to MobileCoreServices.framework.
2119         - Add import of <MobileCoreServices/MobileCoreServices.h> as
2120           needed.
2121
2122         * rendering/RenderThemeIOS.mm: Remove unused soft link to
2123         MobileCoreServices.framework.
2124
2125 2016-09-06  Chris Dumez  <cdumez@apple.com>
2126
2127         Align srcset attribute parsing with the HTML specification
2128         https://bugs.webkit.org/show_bug.cgi?id=161636
2129
2130         Reviewed by Darin Adler.
2131
2132         Align srcset attribute parsing with the HTML specification:
2133         - https://html.spec.whatwg.org/#parse-a-srcset-attribute
2134
2135         The new behavior is also consistent with Firefox and Chrome
2136         as all 3 browsers now pass 100% of the checks at:
2137         - http://w3c-test.org/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html
2138
2139         No new tests, rebaselined existing tests.
2140
2141         * html/parser/HTMLParserIdioms.cpp:
2142         (WebCore::parseValidHTMLNonNegativeIntegerInternal):
2143         (WebCore::parseValidHTMLNonNegativeInteger):
2144         (WebCore::parseValidHTMLFloatingPointNumberInternal):
2145         (WebCore::parseValidHTMLFloatingPointNumber):
2146         * html/parser/HTMLParserIdioms.h:
2147         Add convenience for parsing *valid* HTML non-negative integers and
2148         *valid* floating point number values.
2149
2150         * html/parser/HTMLSrcsetParser.cpp:
2151         (WebCore::parseDescriptors):
2152         - Use parseValidHTMLFloatingPointNumber() to parse density so that the value
2153           is parsed as a valid HTML floating point number value, as per the spec.
2154         - Use parseValidHTMLNonNegativeInteger() to parse width and height so that
2155           the value is parsed as a valid HTML non-negative integer value, as per the
2156           spec.
2157         - Return false if descriptor does not have a h, w and x at the end as per:
2158           https://html.spec.whatwg.org/#parse-a-srcset-attribute (step 13: Anything else)
2159         - Return false if height is set but not width, as per:
2160           https://html.spec.whatwg.org/#parse-a-srcset-attribute (step 14)
2161
2162         (WebCore::parseImageCandidatesFromSrcsetAttribute):
2163         - Skip whitespace if URL does not end with a comma instead of assuming there is
2164           a single space character, as per:
2165           https://html.spec.whatwg.org/#parse-a-srcset-attribute (step 8. Otherwise 1.)
2166
2167 2016-09-06  Fujii Hironori  <Hironori.Fujii@sony.com>
2168
2169         [CMake] Decouple generating bindings of WebCore and WebCoreTestSupport
2170         https://bugs.webkit.org/show_bug.cgi?id=161474
2171
2172         Generating bindings of WebCore and WebCoreTestSupport shares a
2173         single supplementalDependencyFile.  But, nothing supplements any
2174         IDL of WebCoreTestSupport.  This introduces unnecessary
2175         dependencies.
2176
2177         Reviewed by Alex Christensen.
2178
2179         * CMakeLists.txt: Do not input any IDL of WebCoreTestSupport to
2180         preprocess-idls.pl.  Do not use supplementalDependencyFile to
2181         generate bindings of WebCoreTestSupport.  Add SettingsMacros.h as
2182         a source file of WebCoreDerivedSources to ensure make_settings.pl
2183         is finished before compiling WebCoreDerivedSources.
2184
2185 2016-09-06  Zalan Bujtas  <zalan@apple.com>
2186
2187         ASSERTION FAILED: !paintInfo.overlapTestRequests->contains(this) in WebCore::RenderWidget::paintContents
2188         https://bugs.webkit.org/show_bug.cgi?id=135602
2189         <rdar://problem/27701733>
2190
2191         Reviewed by Simon Fraser.
2192
2193         ASSERT is updated to support multiple fragments painting. We just have to ensure that the FrameView's rect
2194         has not changed between the 2 paintContents calls.  
2195
2196         Test: fast/layers/assert-on-overlap-testing-with-frames-inside-columns.html
2197
2198         * rendering/RenderWidget.cpp:
2199         (WebCore::RenderWidget::paintContents):
2200
2201 2016-09-06  Commit Queue  <commit-queue@webkit.org>
2202
2203         Unreviewed, rolling out r205504.
2204         https://bugs.webkit.org/show_bug.cgi?id=161645
2205
2206         Broke the iOS device build (Requested by ryanhaddad on
2207         #webkit).
2208
2209         Reverted changeset:
2210
2211         "Make JSMap and JSSet faster"
2212         https://bugs.webkit.org/show_bug.cgi?id=160989
2213         http://trac.webkit.org/changeset/205504
2214
2215 2016-09-06  Zalan Bujtas  <zalan@apple.com>
2216
2217         Remove unused overlap checking functions from FrameView.
2218         https://bugs.webkit.org/show_bug.cgi?id=161635
2219
2220         Reviewed by Simon Fraser.
2221
2222         No change in functionality.
2223
2224         * page/FrameView.cpp:
2225         (WebCore::FrameView::isOverlappedIncludingAncestors): Deleted.
2226         * page/FrameView.h:
2227
2228 2016-09-06  Simon Fraser  <simon.fraser@apple.com>
2229
2230         Align element.scroll() / scrollTo() / scrollBy() with the CSSOM specification
2231         https://bugs.webkit.org/show_bug.cgi?id=161610
2232
2233         Reviewed by Darin Adler, Chris Dumez.
2234
2235         Implement Element.scroll(), scrollBy() and scrollTo() with x,y and ScrollToOptions
2236         on Element, according to <https://drafts.csswg.org/cssom-view/#element-scrolling-members>
2237
2238         WebKit's behavior of treating scrolls on the body element in both quirks and strict mode
2239         is preserved.
2240
2241         Tests: fast/dom/Element/scrolling-funtions-on-body-quirks.html
2242                fast/dom/Element/scrolling-funtions-on-body.html
2243                fast/dom/Element/scrolling-funtions-on-element.html
2244
2245         * dom/Element.cpp:
2246         (WebCore::Element::scrollBy):
2247         (WebCore::normalizeNonFiniteValue):
2248         (WebCore::Element::scrollTo):
2249         * dom/Element.h:
2250         * dom/Element.idl:
2251         * html/HTMLBodyElement.cpp:
2252         (WebCore::HTMLBodyElement::scrollTo):
2253         * html/HTMLBodyElement.h:
2254
2255 2016-09-06  Saam Barati  <sbarati@apple.com>
2256
2257         Make JSMap and JSSet faster
2258         https://bugs.webkit.org/show_bug.cgi?id=160989
2259
2260         Reviewed by Filip Pizlo.
2261
2262         * ForwardingHeaders/runtime/HashMapImpl.h: Added.
2263         * ForwardingHeaders/runtime/MapBase.h: Added.
2264         * bindings/js/SerializedScriptValue.cpp:
2265         (WebCore::CloneSerializer::serialize):
2266         (WebCore::CloneDeserializer::deserialize):
2267
2268 2016-09-05  Alex Christensen  <achristensen@webkit.org>
2269
2270         Implement relative file urls and begin implementing character encoding in URLParser
2271         https://bugs.webkit.org/show_bug.cgi?id=161618
2272
2273         Reviewed by Tim Horton.
2274
2275         Covered by new API tests.
2276         Also, this is a significant step towards passing the URL web platform tests when using the URLParser,
2277         which is still off by default.
2278
2279         * platform/URLParser.cpp:
2280         (WebCore::isInSimpleEncodeSet):
2281         (WebCore::isInDefaultEncodeSet):
2282         (WebCore::isInUserInfoEncodeSet):
2283         (WebCore::isInvalidDomainCharacter):
2284         (WebCore::shouldCopyFileURL):
2285         (WebCore::percentEncode):
2286         (WebCore::utf8PercentEncode):
2287         (WebCore::encodeQuery):
2288         (WebCore::isDefaultPort):
2289         (WebCore::isPercentEncodedDot):
2290         (WebCore::URLParser::parse):
2291         (WebCore::percentDecode):
2292         (WebCore::domainToASCII):
2293         (WebCore::hasInvalidDomainCharacter):
2294         (WebCore::URLParser::parsePort):
2295         (WebCore::URLParser::parseHost):
2296         (WebCore::isTabOrNewline): Deleted.
2297         * platform/URLParser.h:
2298
2299 2016-09-06  Daniel Bates  <dabates@apple.com>
2300
2301         Fix the Apple-internal build following <https://trac.webkit.org/changeset/205488>
2302         (https://bugs.webkit.org/show_bug.cgi?id=161090)
2303
2304         Use the default linkage for QuartzCore constants to match the linkage used for such constants
2305         in the Apple-internal SDK.
2306
2307         * platform/spi/cocoa/QuartzCoreSPI.h:
2308
2309 2016-09-06  Daniel Bates  <dabates@apple.com>
2310
2311         <table> inside <div align="right"> with large content inside = no scrollbar
2312         https://bugs.webkit.org/show_bug.cgi?id=3352
2313
2314         Reviewed by Brent Fulgham.
2315
2316         Respect "right" text-alignment only if the width of the child does not overflow the
2317         width of its containing block. This makes our margin computation more closely conform
2318         to section "Block-level, non-replaced elements in normal flow" of the CSS 2.1
2319         spec., <http://www.w3.org/TR/CSS21/>, and to the behavior observed in Firefox, Chrome,
2320         IE version 9 or later and Microsoft Edge.
2321
2322         Test: fast/block/align-overflow-child.html
2323
2324         * rendering/RenderBox.cpp:
2325         (WebCore::RenderBox::computeInlineDirectionMargins):
2326
2327 2016-09-06  Daniel Bates  <dabates@apple.com>
2328
2329         Remove EXTERN_C from WTF
2330         https://bugs.webkit.org/show_bug.cgi?id=161090
2331
2332         Reviewed by Brent Fulgham.
2333
2334         Guard external C declarations in WTF_EXTERN_C_BEGIN, WTF_EXTERN_C_END.
2335
2336         * platform/spi/cf/CFLocaleSPI.h:
2337         * platform/spi/cf/CFNetworkConnectionCacheSPI.h:
2338         * platform/spi/cf/CFNetworkSPI.h: Additionally, remove the workaround for <rdar://problem/18337182>
2339         as this bug was fixed in El Capitan.
2340         * platform/spi/cf/CFUtilitiesSPI.h:
2341         * platform/spi/cocoa/CoreTextSPI.h:
2342         * platform/spi/cocoa/DataDetectorsCoreSPI.h:
2343         * platform/spi/cocoa/IOPMLibSPI.h:
2344         * platform/spi/cocoa/MachVMSPI.h:
2345         * platform/spi/cocoa/QuartzCoreSPI.h:
2346         * platform/spi/ios/MobileGestaltSPI.h:
2347         * platform/spi/ios/QuickLookSPI.h:
2348         * platform/spi/win/CoreTextSPIWin.cpp:
2349         * platform/spi/win/CoreTextSPIWin.h:
2350
2351 2016-09-06  Ryan Haddad  <ryanhaddad@apple.com>
2352
2353         Unreviewed, rolling out r205407.
2354
2355         Not the correct way to implement this functionality
2356
2357         Reverted changeset:
2358
2359         "Consult with the FrameLoaderClient about whether or not
2360         content extensions should be enabled when loading this URL."
2361         https://bugs.webkit.org/show_bug.cgi?id=161441
2362         http://trac.webkit.org/changeset/205407
2363
2364 2016-09-06  Youenn Fablet  <youenn@apple.com>
2365
2366         http/tests/security/contentSecurityPolicy/worker-csp-blocks-xhr-redirect-cross-origin.html is flaky
2367         https://bugs.webkit.org/show_bug.cgi?id=161627
2368
2369         Reviewed by Darin Adler.
2370
2371         Covered by changed expectation.
2372
2373         * loader/DocumentThreadableLoader.cpp:
2374         (WebCore::DocumentThreadableLoader::redirectReceived): Clearing the resource in lieu of clearing the request. This will stop the resource load.
2375         * loader/SubresourceLoader.cpp:
2376         (WebCore::SubresourceLoader::didReceiveResponse): Adding an ASSERT to ensure that no valid redirect responses is mistakenly processed here.
2377
2378 2016-09-06  Zalan Bujtas  <zalan@apple.com>
2379
2380         ASSERTION FAILED: !currBox->needsLayout() in WebCore::RenderBlock::checkPositionedObjectsNeedLayout
2381         https://bugs.webkit.org/show_bug.cgi?id=120291
2382         <rdar://problem/27683456>
2383
2384         Reviewed by David Hyatt.
2385
2386         This patch ensures that we always set the 'positioned child needs layout' bit on the containing block
2387         when a new positioned descendant gets inserted. It fixes cases for simplified layout when
2388         we ended up not laying out the descendant element. 
2389
2390         Test: fast/block/positioning/assert-when-positioned-descendant-is-not-getting-laid-out.html
2391
2392         * rendering/RenderBlock.cpp:
2393         (WebCore::RenderBlock::insertPositionedObject):
2394
2395 2016-09-06  Youenn Fablet  <youenn@apple.com>
2396
2397         CachedResourceLoader is not taking into account fetch options to use or not cached resources
2398         https://bugs.webkit.org/show_bug.cgi?id=161389
2399
2400         Reviewed by Darin Adler.
2401
2402         Tests: http/tests/fetch/fetching-same-resource-with-diffferent-options.html
2403                http/tests/security/cross-origin-cached-resource-parallel.html
2404                http/tests/security/cross-origin-cached-resource.html
2405                http/tests/security/load-image-after-redirection-2.html
2406                http/tests/security/shape-outside-and-cached-resources.html
2407
2408         Adding CORS checks for the response in case of CORS fetch mode, in SubresourceLoader.
2409         Removing the CORS checks in Image and DocumentThreadableLoader.
2410
2411         The direction of this patch is to make CachedResource origin-specific/fetch mode specific.
2412
2413         This will remove the need for CachedResource clients to do CORS checks when receiving the notifyFinished call.
2414         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.
2415
2416         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.
2417         Note that the risk was already there in case of a resource loaded through redirections.
2418         Reusing a cached resource for a load with different options also leads to bad computation of the resource tainting.
2419
2420         As a first step, improvements are done but only for CachedImage resources.
2421
2422         This patch limits the direct reuse of cached resources as follow:
2423         - If the request and existing resources have different origins.
2424         - If the fetch mode is different between request and existing resource.
2425
2426         In those cases, a new CachedResource is created with the correct options and origin.
2427         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).
2428
2429         If the matching CachedResource is still loading, we trigger a reload (with caching=false to not disturb the being loaded resource).
2430         This should be made more efficient at some point, especially if the matching CachedResource already has its response set.
2431
2432         This triggers a change of behavior: previously, the CORS checks were done by the ImageLoader when the resource was finished loading.
2433         The CORS checks were controlled by the crossOrigin attribute, which may be set or unset between the load start and the load end.
2434
2435         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.
2436         This is more consistent as the actual request was built with CORS enabled.
2437
2438         * loader/CrossOriginPreflightChecker.cpp:
2439         (WebCore::CrossOriginPreflightChecker::startPreflight): Setting correctly the preflight options as per fetch spec.
2440         * loader/DocumentThreadableLoader.cpp:
2441         (WebCore::DocumentThreadableLoader::didReceiveResponse): Removing CORS check.
2442         (WebCore::DocumentThreadableLoader::loadRequest): Adding CORS check in sync mode.
2443         * loader/ImageLoader.cpp:
2444         (WebCore::ImageLoader::updateFromElement):
2445         (WebCore::ImageLoader::notifyFinished):
2446         * loader/SubresourceLoader.cpp:
2447         (WebCore::SubresourceLoader::didReceiveResponse): Adding CORS checks to the response
2448         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl): Helper routine to do CORS checks
2449         * loader/SubresourceLoader.h:
2450         * loader/cache/CachedImage.cpp:
2451         (WebCore::CachedImage::cloneData): Responsible to set image content from another CachedImage.
2452         * loader/cache/CachedImage.h:
2453         * loader/cache/CachedResource.cpp:
2454         (WebCore::CachedResource::computeOrigin): Helper routine to set the origin and whether the resource is cross-origin or not.
2455         (WebCore::CachedResource::load): Using computeOrigin.
2456         (WebCore::CachedResource::loadFrom): Loading from a CachedResource from the same type and which finished loading.
2457         * loader/cache/CachedResource.h:
2458         (WebCore::CachedResource::cloneData):
2459         * loader/cache/CachedResourceLoader.cpp:
2460         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Helper routine responsible to adapt the CachedResource
2461         that can be reused to the origin and options of a new request.
2462         (WebCore::CachedResourceLoader::requestResource): Calling updateCachedResourceWithCurrentRequest before actually returning the resource.
2463         (WebCore::CachedResourceLoader::determineRevalidationPolicy): Space clean-up.
2464         * loader/cache/CachedResourceLoader.h:
2465         * loader/cache/CachedResourceRequest.h:
2466         (WebCore::CachedResourceRequest::setCachingPolicy):
2467         * style/StylePendingResources.cpp:
2468         (WebCore::Style::loadPendingImage): Allowing data URLs for ShapeOutside data.
2469
2470 2016-09-05  Darin Adler  <darin@apple.com>
2471
2472         More bindings improvements, particularly things not needed for JavaScript bindings
2473         https://bugs.webkit.org/show_bug.cgi?id=161572
2474
2475         Reviewed by Sam Weinig.
2476
2477         * WebCore.xcodeproj/project.pbxproj: Export a couple of files needed for legacy bindings.
2478
2479         * bindings/js/JSDOMWindowCustom.cpp:
2480         (WebCore::addCrossOriginWindowPropertyNames): Mark array const.
2481         * bindings/js/JSLocationCustom.cpp:
2482         (WebCore::addCrossOriginLocationPropertyNames): Ditto.
2483
2484         * dom/DOMImplementation.cpp:
2485         (WebCore::addString): Deleted.
2486         (WebCore::isSupportedSVG10Feature): Deleted.
2487         (WebCore::isSupportedSVG11Feature): Deleted.
2488         (WebCore::DOMImplementation::hasFeature): Deleted.
2489
2490         * dom/DOMImplementation.h: Changed hasFeature to take no arguments and to always
2491         return true, as specified in the DOM spec.
2492
2493         * dom/DOMImplementation.idl: Removed the arguments to hasFeature.
2494
2495         * dom/Document.cpp:
2496         (WebCore::Document::defaultCharsetForLegacyBindings): Renamed from
2497         defaultCharsetForBindings, because this function is used only by the
2498         non-JavaScript bindings.
2499         * dom/Document.h: Updated for the above.
2500
2501         * dom/DocumentType.h: Removed entitiesForBindings,
2502         notationsForBindings, and internalSubsetForBindings, all of which were
2503         empty functions. The empty implementations are now in the legacy bindings.
2504
2505         * dom/Element.cpp:
2506         (WebCore::Element::dispatchSimulatedClickForBindings): Deleted.
2507         This code is now at the single call site, in HTMLElement.
2508         * dom/Element.h: Updated for the above change.
2509
2510         * dom/Node.cpp:
2511         (WebCore::Node::isSupportedForBindings): Deleted. This is only used in the
2512         legacy bindings, and since it only returns a value other than "true" for
2513         SVG features, it is now in the SVGTests class.
2514         * dom/Node.h: Updated for the above change.
2515
2516         * html/HTMLElement.cpp:
2517         (WebCore::HTMLElement::click): Call simulateClick with the appropriate
2518         arguments rather than calling dispatchSimulatedClickForBindings.
2519
2520         * svg/SVGTests.cpp:
2521         (WebCore::supportedSVGFeatures): Added. Moved here from DOMImplementation,
2522         but also refactored.
2523         (WebCore::SVGTests::isValid): Changed to use the function above, rather than
2524         calling DOMImplementation::hasFeature. This change fixes a bug where feature names
2525         that do not look like valid SVG feature names, names such as "xxx", were returning
2526         true claiming that the feature was supported. This behavior was helpful in the
2527         general DOMImplementation function, but harmful here. This bug was causing test
2528         failures in some of our SVG tests.
2529         (WebCore::SVGTests::hasFeatureForLegacyBindings): Added. Uses the set above to
2530         implement the legacy behavior of hasFeature. It's better to have this in parallel
2531         with the SVGTests::isValid function rather than having either depend on the other.
2532
2533         * svg/SVGTests.h: Added exported SVGTests::isValid function.
2534
2535 2016-09-05  Commit Queue  <commit-queue@webkit.org>
2536
2537         Unreviewed, rolling out r205450.
2538         https://bugs.webkit.org/show_bug.cgi?id=161614
2539
2540         Made tests flaky, causing false positives on EWS (Requested by
2541         ap on #webkit).
2542
2543         Reverted changeset:
2544
2545         "CachedResourceLoader is not taking into account fetch options
2546         to use or not cached resources"
2547         https://bugs.webkit.org/show_bug.cgi?id=161389
2548         http://trac.webkit.org/changeset/205450
2549
2550 2016-08-31  Filip Pizlo  <fpizlo@apple.com>
2551
2552         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
2553         https://bugs.webkit.org/show_bug.cgi?id=160125
2554
2555         Reviewed by Geoffrey Garen and Keith Miller.
2556
2557         No new tests because no new WebCore behavior.
2558         
2559         Just rewiring #includes.
2560
2561         * ForwardingHeaders/heap/HeapInlines.h: Added.
2562         * ForwardingHeaders/interpreter/Interpreter.h: Removed.
2563         * ForwardingHeaders/runtime/AuxiliaryBarrierInlines.h: Added.
2564         * Modules/indexeddb/IDBCursorWithValue.cpp:
2565         * Modules/indexeddb/client/TransactionOperation.cpp:
2566         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2567         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2568         * bindings/js/JSApplePayPaymentAuthorizedEventCustom.cpp:
2569         * bindings/js/JSApplePayPaymentMethodSelectedEventCustom.cpp:
2570         * bindings/js/JSApplePayShippingContactSelectedEventCustom.cpp:
2571         * bindings/js/JSApplePayShippingMethodSelectedEventCustom.cpp:
2572         * bindings/js/JSClientRectCustom.cpp:
2573         * bindings/js/JSDOMBinding.cpp:
2574         * bindings/js/JSDOMBinding.h:
2575         * bindings/js/JSDeviceMotionEventCustom.cpp:
2576         * bindings/js/JSDeviceOrientationEventCustom.cpp:
2577         * bindings/js/JSErrorEventCustom.cpp:
2578         * bindings/js/JSIDBCursorWithValueCustom.cpp:
2579         * bindings/js/JSIDBIndexCustom.cpp:
2580         * bindings/js/JSPopStateEventCustom.cpp:
2581         * bindings/js/JSWebGL2RenderingContextCustom.cpp:
2582         * bindings/js/JSWorkerGlobalScopeCustom.cpp:
2583         * bindings/js/WorkerScriptController.cpp:
2584         * contentextensions/ContentExtensionParser.cpp:
2585         * dom/ErrorEvent.cpp:
2586         * html/HTMLCanvasElement.cpp:
2587         * html/MediaDocument.cpp:
2588         * inspector/CommandLineAPIModule.cpp:
2589         * loader/EmptyClients.cpp:
2590         * page/CaptionUserPreferences.cpp:
2591         * page/Frame.cpp:
2592         * page/PageGroup.cpp:
2593         * page/UserContentController.cpp:
2594         * platform/mock/mediasource/MockBox.cpp:
2595         * testing/GCObservation.cpp:
2596
2597 2016-09-05  Fujii Hironori  <Hironori.Fujii@sony.com>
2598
2599         run-bindings-tests fails since r205422
2600         https://bugs.webkit.org/show_bug.cgi?id=161595
2601
2602         Reviewed by Darin Adler.
2603
2604         Rebaseline binding tests after r205422.
2605
2606         * bindings/scripts/test/JS/JSInterfaceName.cpp:
2607         * bindings/scripts/test/JS/JSInterfaceName.h:
2608         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2609         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
2610         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
2611         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
2612         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
2613         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
2614         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
2615         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
2616         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2617         * bindings/scripts/test/JS/JSTestEventConstructor.h:
2618         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2619         * bindings/scripts/test/JS/JSTestEventTarget.h:
2620         * bindings/scripts/test/JS/JSTestException.cpp:
2621         * bindings/scripts/test/JS/JSTestException.h:
2622         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2623         * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
2624         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2625         * bindings/scripts/test/JS/JSTestGlobalObject.h:
2626         * bindings/scripts/test/JS/JSTestInterface.cpp:
2627         * bindings/scripts/test/JS/JSTestInterface.h:
2628         * bindings/scripts/test/JS/JSTestIterable.cpp:
2629         * bindings/scripts/test/JS/JSTestIterable.h:
2630         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
2631         * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
2632         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
2633         * bindings/scripts/test/JS/JSTestNamedConstructor.h:
2634         * bindings/scripts/test/JS/JSTestNode.cpp:
2635         * bindings/scripts/test/JS/JSTestNode.h:
2636         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
2637         * bindings/scripts/test/JS/JSTestNondeterministic.h:
2638         * bindings/scripts/test/JS/JSTestObj.cpp:
2639         * bindings/scripts/test/JS/JSTestObj.h:
2640         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2641         * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
2642         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
2643         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
2644         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2645         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
2646         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2647         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
2648         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2649         * bindings/scripts/test/JS/JSTestTypedefs.h:
2650         * bindings/scripts/test/JS/JSattribute.cpp:
2651         * bindings/scripts/test/JS/JSattribute.h:
2652         * bindings/scripts/test/JS/JSreadonly.cpp:
2653         * bindings/scripts/test/JS/JSreadonly.h:
2654
2655 2016-09-05  Fujii Hironori  <Hironori.Fujii@sony.com>
2656
2657         [CMake] Duplicated IDL files in WebCore_IDL_FILES
2658         https://bugs.webkit.org/show_bug.cgi?id=161592
2659
2660         Reviewed by Darin Adler.
2661
2662         * CMakeLists.txt: Removed duplicated IDL files.
2663         * DerivedSources.cpp: Added #if ENABLE(USER_MESSAGE_HANDLERS)
2664
2665 2016-09-05  Joseph Pecoraro  <pecoraro@apple.com>
2666
2667         [Mac] Static Analyzer warnings about unused values in CDMSessionAVStreamSession.mm
2668         https://bugs.webkit.org/show_bug.cgi?id=161598
2669
2670         Reviewed by Darin Adler.
2671
2672         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
2673         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
2674         (WebCore::CDMSessionAVStreamSession::generateKeyReleaseMessage):
2675         Make this parameter a reference again, accidentally lost in r195410.
2676         Now assignments to the parameter make sense.
2677
2678 2016-09-05  Youenn Fablet  <youenn@apple.com>
2679
2680         Clean CSS stylesheets should be accessible from JavaScript
2681         https://bugs.webkit.org/show_bug.cgi?id=158728
2682
2683         Reviewed by Darin Adler.
2684
2685         Covered by updated tests.
2686
2687         Making use of the resource response type to evaluate whether to make the CSS stylesheets visible
2688         for stylesheet link elements and for stylesheet processing instructions.
2689         Ideally, the origin flag should be a boolean.
2690
2691         To keep behavior consistent in cors-check-unaware cases, the flag might remain unset.
2692         In that case, the behavior remains the same (checking of the stylesheet URL).
2693         The origin flag is set to true or false only in case of fetch mode being set to cors using the crossorigin attribute.
2694
2695         Updated CSSStyleSheet::create to take a Node reference. Updated callers accordingly.
2696
2697         * contentextensions/ContentExtensionStyleSheet.cpp:
2698         (WebCore::ContentExtensions::ContentExtensionStyleSheet::ContentExtensionStyleSheet): Updated to pass a Node reference and not pointer.
2699         * css/CSSStyleSheet.cpp:
2700         (WebCore::CSSStyleSheet::create): Makes origin flag undefined if boolean parameter is not passed.
2701         Otherwise origin flag is set according given boolean value.
2702         (WebCore::CSSStyleSheet::createInline): Makes origin flag set to true.
2703         (WebCore::CSSStyleSheet::CSSStyleSheet): Adding origin flag initialization.
2704         (WebCore::CSSStyleSheet::canAccessRules): Returning according the origin flag if set.
2705         Returning as before in case the flag is not set.
2706         * css/CSSStyleSheet.h: Adding origin clean flag.
2707         * dom/ExtensionStyleSheets.cpp:
2708         (WebCore::ExtensionStyleSheets::addUserStyleSheet):
2709         (WebCore::ExtensionStyleSheets::addAuthorStyleSheetForTesting):
2710         (WebCore::ExtensionStyleSheets::maybeAddContentExtensionSheet):
2711         * html/HTMLLinkElement.cpp:
2712         (WebCore::HTMLLinkElement::initializeStyleSheet): Helper routine used in setCSSStyleSheet.
2713         Sets origin clean flag if the resource is clean.
2714         (WebCore::HTMLLinkElement::setCSSStyleSheet): Making use of initializeStyleSheet.
2715         * html/HTMLLinkElement.h:
2716
2717 2016-09-05  Youenn Fablet  <youenn@apple.com>
2718
2719         CachedResourceLoader is not taking into account fetch options to use or not cached resources
2720         https://bugs.webkit.org/show_bug.cgi?id=161389
2721
2722         Reviewed by Darin Adler.
2723
2724         Tests: http/tests/fetch/fetching-same-resource-with-diffferent-options.html
2725                http/tests/security/cross-origin-cached-resource-parallel.html
2726                http/tests/security/cross-origin-cached-resource.html
2727                http/tests/security/load-image-after-redirection-2.html
2728                http/tests/security/shape-outside-and-cached-resources.html
2729
2730         Adding CORS checks for the response in case of CORS fetch mode, in SubresourceLoader.
2731         Removing the CORS checks in Image and DocumentThreadableLoader.
2732
2733         The direction of this patch is to make CachedResource origin-specific/fetch mode specific.
2734
2735         This will remove the need for CachedResource clients to do CORS checks when receiving the notifyFinished call.
2736         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.
2737
2738         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.
2739         Note that the risk was already there in case of a resource loaded through redirections.
2740         Reusing a cached resource for a load with different options also leads to bad computation of the resource tainting.
2741
2742         As a first step, improvements are done but only for CachedImage resources.
2743
2744         This patch limits the direct reuse of cached resources as follow:
2745         - If the request and existing resources have different origins.
2746         - If the fetch mode is different between request and existing resource.
2747
2748         In those cases, a new CachedResource is created with the correct options and origin.
2749         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).
2750
2751         If the matching CachedResource is still loading, we trigger a reload (with caching=false to not disturb the being loaded resource).
2752         This should be made more efficient at some point, especially if the matching CachedResource already has its response set.
2753
2754         This triggers a change of behavior: previously, the CORS checks were done by the ImageLoader when the resource was finished loading.
2755         The CORS checks were controlled by the crossOrigin attribute, which may be set or unset between the load start and the load end.
2756
2757         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.
2758         This is more consistent as the actual request was built with CORS enabled.
2759
2760         * loader/CrossOriginPreflightChecker.cpp:
2761         (WebCore::CrossOriginPreflightChecker::startPreflight): Setting correctly the preflight options as per fetch spec.
2762         * loader/DocumentThreadableLoader.cpp:
2763         (WebCore::DocumentThreadableLoader::didReceiveResponse): Removing CORS check.
2764         (WebCore::DocumentThreadableLoader::loadRequest): Adding CORS check in sync mode.
2765         * loader/ImageLoader.cpp:
2766         (WebCore::ImageLoader::updateFromElement):
2767         (WebCore::ImageLoader::notifyFinished):
2768         * loader/SubresourceLoader.cpp:
2769         (WebCore::SubresourceLoader::didReceiveResponse): Adding CORS checks to the response
2770         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl): Helper routine to do CORS checks
2771         * loader/SubresourceLoader.h:
2772         * loader/cache/CachedImage.cpp:
2773         (WebCore::CachedImage::cloneData): Responsible to set image content from another CachedImage.
2774         * loader/cache/CachedImage.h:
2775         * loader/cache/CachedResource.cpp:
2776         (WebCore::CachedResource::computeOrigin): Helper routine to set the origin and whether the resource is cross-origin or not.
2777         (WebCore::CachedResource::load): Using computeOrigin.
2778         (WebCore::CachedResource::loadFrom): Loading from a CachedResource from the same type and which finished loading.
2779         * loader/cache/CachedResource.h:
2780         (WebCore::CachedResource::cloneData):
2781         * loader/cache/CachedResourceLoader.cpp:
2782         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Helper routine responsible to adapt the CachedResource
2783         that can be reused to the origin and options of a new request.
2784         (WebCore::CachedResourceLoader::requestResource): Calling updateCachedResourceWithCurrentRequest before actually returning the resource.
2785         (WebCore::CachedResourceLoader::determineRevalidationPolicy): Space clean-up.
2786         * loader/cache/CachedResourceLoader.h:
2787         * loader/cache/CachedResourceRequest.h:
2788         (WebCore::CachedResourceRequest::setCachingPolicy):
2789         * style/StylePendingResources.cpp:
2790         (WebCore::Style::loadPendingImage): Allowing data URLs for ShapeOutside data.
2791
2792 2016-09-05  Frederic Wang  <fwang@igalia.com>
2793
2794         More refactoring of RenderMathMLScripts
2795         https://bugs.webkit.org/show_bug.cgi?id=161371
2796
2797         Reviewed by Darin Adler.
2798
2799         This is a follow-up of bug 161084. The function getScriptMetricsAndLayoutIfNeeded was quite
2800         complicated and it was not obvious that we have to call it twice with the same reference
2801         to a struture holding vertical metrics. We extract the part retrieving layout parameters
2802         into verticalParameters and move its layoutIfNeeded calls into layoutBlock. Then it can
2803         be reduced to a simple function that retrieve the vertical metrics in one call.
2804         We also improve getBaseAndScripts to make clear that it is performing validation. It returns
2805         a ReferenceChildren structure encapsulating pointers to important children so that we no
2806         longer pass these pointers as function parameters. We continue to need them to browse the
2807         list of prescripts & postscripts but we refactor a bit the loop to avoid explicit mention
2808         of RenderBox*.
2809
2810         No new tests, already covered by existing tests.
2811
2812         * rendering/mathml/RenderMathMLScripts.cpp:
2813         (WebCore::RenderMathMLScripts::validateAndGetReferenceChildren): We now store the pointers to
2814         the base, firstPostScript and firstPreScript children in the ReferenceChildren structure. We
2815         also add a pointer to the prescriptDelimiter for convenience.
2816         (WebCore::RenderMathMLScripts::italicCorrection): Use the ReferenceChildren structure so that
2817         we are sure the base has been validated before calling this function.
2818         (WebCore::RenderMathMLScripts::computePreferredLogicalWidths): Retrieve the reference
2819         children with validateAndGetReferenceChildren instead of calling getBaseAndScripts and use
2820         ReferenceChildren to handle these children and to call italicCorrection. The loops for
2821         SubSup, UnderOver, Multiscripts are also rewritten a bit to avoid declaring a null RenderBox*
2822         outside of them and hence allow to use auto.
2823         (WebCore::RenderMathMLScripts::verticalParameters): This part to extract the layout
2824         parameters is extracted from getScriptMetricsAndLayoutIfNeeded. The parameters are returned
2825         as a VerticalParameters struct.
2826         (WebCore::RenderMathMLScripts::verticalMetrics): This is the remaining part of
2827         getScriptMetricsAndLayoutIfNeeded It used to call layoutIfNeeded on children and to
2828         calculate maximum vertical metrics. For Multiscripts it was called twice: We did a first
2829         call to handle the prescripts and then pass the result again in the second call to handle
2830         the postscripts. We modify a bit the loop so that all the scripts are handled in one call and
2831         hence we can directly return a VerticalMetrics. Again, the reference children are now handled
2832         using the ReferenceChildren structure passed as a parameter.
2833         (WebCore::RenderMathMLScripts::layoutBlock): We retrieve the reference children with
2834         validateAndGetReferenceChildren instead of calling getBaseAndScripts and use
2835         ReferenceChildren to handle these children and to call italicCorrection. We layout all the
2836         children if needed in one loop at the beginning instead of doing that when their vertical
2837         metrics are needed. We can now also retrieve vertical metrics with a single call.
2838         (WebCore::RenderMathMLScripts::getBaseAndScripts): Renamed validateAndGetReferenceChildren.
2839         (WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded): Deleted. Split into
2840         verticalParameters and verticalMetrics.
2841         * rendering/mathml/RenderMathMLScripts.h: New structure to handle the pointers to reference
2842         children. Update the signature of getBaseAndScripts to use this struture and give a clearer
2843         name. Update the signature of italicCorrection to use this structure too. Add a new structure
2844         VerticalParameters and declare the helper function to retrieve them. Rename ScriptMetrics
2845         to VerticalMetrics and update the signature of the function needed to retrieve it.
2846
2847 2016-09-05  Zan Dobersek  <zdobersek@igalia.com>
2848
2849         MediaPlayerPrivateGStreamerBase: improve build guards in nativeImageForCurrentTime()
2850         https://bugs.webkit.org/show_bug.cgi?id=161594
2851
2852         Reviewed by Philippe Normand.
2853
2854         Guard the uses of cairo-gl API in nativeImageForCurrentTime() with the
2855         USE(CAIRO) && ENABLE(ACCELERATED_2D_CANVAS) pair of build guards. This
2856         API is only made available when the ACCELERATED_2D_CANVAS option is
2857         enabled. Placing the guards this way thus avoids compilation errors
2858         when compiling USE_GSTREAMER_GL code without the accelerated 2D canvas
2859         support enabled.
2860
2861         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2862         (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
2863
2864 2016-09-04  Sam Weinig  <sam@webkit.org>
2865
2866         Remove the CREATE_DOM_WRAPPER macro
2867         https://bugs.webkit.org/show_bug.cgi?id=161580
2868
2869         Reviewed by Dan Bernstein.
2870
2871         The CREATE_DOM_WRAPPER has irritated me for too long! Replace it
2872         with direct calls to createWrapper<ImplementationType>, which has
2873         been upgraded to not require specifying both the implementation type
2874         and the wrapper type by way of the new JSDOMWrapperConverterTraits
2875         struct which provides mapping from ImplementationType -> JSWrapper.
2876         createWrapper<ImplementationType> has also been upgraded to have a
2877         specialization for when the object being passed in needs to be casted.
2878
2879         * bindings/js/JSAnimationTimelineCustom.cpp:
2880         (WebCore::toJSNewlyCreated):
2881         * bindings/js/JSBlobCustom.cpp:
2882         (WebCore::toJSNewlyCreated):
2883         (WebCore::constructJSBlob):
2884         * bindings/js/JSCSSRuleCustom.cpp:
2885         (WebCore::toJSNewlyCreated):
2886         * bindings/js/JSCSSValueCustom.cpp:
2887         (WebCore::toJSNewlyCreated):
2888         * bindings/js/JSDataCueCustom.cpp:
2889         (WebCore::constructJSDataCue):
2890         * bindings/js/JSDocumentCustom.cpp:
2891         (WebCore::createNewDocumentWrapper):
2892         * bindings/js/JSDocumentFragmentCustom.cpp:
2893         (WebCore::toJSNewlyCreated):
2894         * bindings/js/JSElementCustom.cpp:
2895         (WebCore::createNewElementWrapper):
2896         * bindings/js/JSEventCustom.cpp:
2897         (WebCore::toJSNewlyCreated):
2898         * bindings/js/JSFileCustom.cpp:
2899         (WebCore::constructJSFile):
2900         * bindings/js/JSHTMLCollectionCustom.cpp:
2901         (WebCore::toJSNewlyCreated):
2902         * bindings/js/JSHTMLDocumentCustom.cpp:
2903         (WebCore::toJSNewlyCreated):
2904         * bindings/js/JSIDBCursorCustom.cpp:
2905         (WebCore::toJSNewlyCreated):
2906         * bindings/js/JSImageDataCustom.cpp:
2907         (WebCore::toJSNewlyCreated):
2908         * bindings/js/JSNodeCustom.cpp:
2909         (WebCore::createWrapperInline):
2910         * bindings/js/JSNodeListCustom.cpp:
2911         (WebCore::createWrapper):
2912         * bindings/js/JSPerformanceEntryCustom.cpp:
2913         (WebCore::toJSNewlyCreated):
2914         * bindings/js/JSSVGPathSegCustom.cpp:
2915         (WebCore::toJSNewlyCreated):
2916         * bindings/js/JSStyleSheetCustom.cpp:
2917         (WebCore::toJSNewlyCreated):
2918         * bindings/js/JSTextCustom.cpp:
2919         (WebCore::toJSNewlyCreated):
2920         * bindings/js/JSTextTrackCueCustom.cpp:
2921         (WebCore::toJSNewlyCreated):
2922         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
2923         (WebCore::toJSNewlyCreated):
2924         * bindings/js/JSXMLDocumentCustom.cpp:
2925         (WebCore::toJSNewlyCreated):
2926         * dom/make_names.pl:
2927         (printWrapperFunctions):
2928         (printWrapperFactoryCppFile):
2929         Replace CREATE_DOM_WRAPPER with direct calls to createWrapper.
2930
2931         * bindings/js/JSWorkerGlobalScopeBase.h:
2932         Add #include of JSDOMWrapper.h to allow generated subclasses to use 
2933         JSDOMWrapperConverterTraits.
2934
2935         * bindings/js/JSDOMBinding.h:
2936         (WebCore::castDOMObjectForWrapperCreation): Deleted.
2937         Remove CREATE_DOM_WRAPPER and castDOMObjectForWrapperCreation and 
2938         specialize createWrapper.
2939
2940         * bindings/js/JSDOMWrapper.h:
2941         Forward declare JSDOMWrapperConverterTraits.
2942
2943         * bindings/scripts/CodeGeneratorJS.pm:
2944         (GenerateHeader):
2945         Add specialization of JSDOMWrapperConverterTraits for each header.
2946
2947         (GenerateImplementation):
2948         (GenerateConstructorDefinition):
2949         Replace CREATE_DOM_WRAPPER with direct calls to createWrapper.
2950
2951 2016-09-04  Antti Koivisto  <antti@apple.com>
2952
2953         Remove Style::PendingResources
2954         https://bugs.webkit.org/show_bug.cgi?id=161574
2955
2956         Reviewed by Andreas Kling.
2957
2958         RenderStyle contains all the information needed to initialize resource loads. There is no need for this side structure.
2959
2960         * css/CSSFilterImageValue.cpp:
2961         (WebCore::CSSFilterImageValue::loadSubimages):
2962
2963             Load external SVG resources along with any image resources.
2964
2965         * css/CSSToStyleMap.cpp:
2966         (WebCore::CSSToStyleMap::styleImage):
2967         (WebCore::CSSToStyleMap::mapFillImage):
2968         (WebCore::CSSToStyleMap::mapNinePieceImage):
2969         * css/CSSToStyleMap.h:
2970         * css/StyleBuilderConverter.h:
2971         (WebCore::StyleBuilderConverter::convertStyleImage):
2972         (WebCore::StyleBuilderConverter::convertShapeValue):
2973         * css/StyleBuilderCustom.h:
2974         (WebCore::StyleBuilderCustom::applyValueCursor):
2975         (WebCore::StyleBuilderCustom::applyValueContent):
2976         * css/StyleResolver.cpp:
2977         (WebCore::StyleResolver::State::clear):
2978         (WebCore::StyleResolver::styleImage):
2979         (WebCore::StyleResolver::createFilterOperations):
2980         (WebCore::StyleResolver::loadPendingResources):
2981         (WebCore::StyleResolver::State::ensurePendingResources): Deleted.
2982         (WebCore::StyleResolver::styleCachedImageFromValue): Deleted.
2983         (WebCore::StyleResolver::styleGeneratedImageFromValue): Deleted.
2984         * css/StyleResolver.h:
2985         (WebCore::StyleResolver::State::takePendingResources): Deleted.
2986         * platform/graphics/filters/FilterOperation.cpp:
2987         (WebCore::ReferenceFilterOperation::loadExternalDocumentIfNeeded):
2988         (WebCore::ReferenceFilterOperation::getOrCreateCachedSVGDocumentReference): Deleted.
2989         * platform/graphics/filters/FilterOperation.h:
2990         (WebCore::ReferenceFilterOperation::cachedSVGDocumentReference):
2991         * rendering/style/StyleCachedImage.cpp:
2992         (WebCore::StyleCachedImage::StyleCachedImage):
2993         * style/StylePendingResources.cpp:
2994         (WebCore::Style::loadPendingResources):
2995
2996             Trigger resource loads by checking pending resources in RenderStyle unconditionally. Keeping track of them
2997             separately wasn't necessary or a meaningful optimization.
2998
2999         (WebCore::Style::loadPendingImages): Deleted.
3000         (WebCore::Style::loadPendingSVGFilters): Deleted.
3001         * style/StylePendingResources.h:
3002
3003 2016-09-04  Antti Koivisto  <antti@apple.com>
3004
3005         Reverse ownership relation of StyleCachedImage and CSSImageValue
3006         https://bugs.webkit.org/show_bug.cgi?id=161447
3007
3008         Reviewed by Andreas Kling.
3009
3010         Currently StyleCachedImage (which represents an image in RenderStyle) has a weak ref to the
3011         underlying CSSImageValue/CSSImageSetValue which actually owns it. This is awkwards especially since
3012         StyleGeneratedImage, the other StyleImage subclass has reversed relationship where it refs
3013         the underlying CSSImageGeneratorValue.
3014
3015         This patch makes StyleCachedImage similar to StyleGeneratedImage. StyleCachedImage now refs the
3016         underlying CSSImageValue/CSSImageSetValue. CSSImageValues no longer need to know about StyleCachedImage.
3017         Instead they reference CachedImages (memory cache objects) directly. StyleCachedImage instances are now
3018         conceptually unique to RenderStyle instances. Actual resources are shared as before by sharing CachedImages.
3019
3020         * css/CSSCursorImageValue.cpp:
3021         (WebCore::CSSCursorImageValue::loadImage):
3022         (WebCore::CSSCursorImageValue::cachedImage):
3023         (WebCore::CSSCursorImageValue::styleImage): Deleted.
3024         * css/CSSCursorImageValue.h:
3025         * css/CSSImageGeneratorValue.cpp:
3026         (WebCore::CSSImageGeneratorValue::cachedImageForCSSValue):
3027         * css/CSSImageSetValue.cpp:
3028         (WebCore::CSSImageSetValue::~CSSImageSetValue):
3029         (WebCore::CSSImageSetValue::loadBestFitImage):
3030         (WebCore::CSSImageSetValue::traverseSubresources):
3031         (WebCore::CSSImageSetValue::styleImage): Deleted.
3032         * css/CSSImageSetValue.h:
3033         * css/CSSImageValue.cpp:
3034         (WebCore::CSSImageValue::CSSImageValue):
3035         (WebCore::CSSImageValue::~CSSImageValue):
3036         (WebCore::CSSImageValue::isPending):
3037         (WebCore::CSSImageValue::loadImage):
3038         (WebCore::CSSImageValue::traverseSubresources):
3039         (WebCore::CSSImageValue::knownToBeOpaque):
3040         (WebCore::CSSImageValue::styleImage): Deleted.
3041         * css/CSSImageValue.h:
3042         * css/StyleBuilderCustom.h:
3043         (WebCore::StyleBuilderCustom::applyValueContent):
3044         * css/StyleResolver.cpp:
3045         (WebCore::StyleResolver::styleImage):
3046         (WebCore::StyleResolver::styleCachedImageFromValue):
3047         (WebCore::StyleResolver::styleGeneratedImageFromValue):
3048         (WebCore::StyleResolver::cachedOrPendingFromValue): Deleted.
3049         (WebCore::StyleResolver::generatedOrPendingFromValue): Deleted.
3050         (WebCore::StyleResolver::setOrPendingFromValue): Deleted.
3051         (WebCore::StyleResolver::cursorOrPendingFromValue): Deleted.
3052         * css/StyleResolver.h:
3053         * editing/TextIterator.cpp:
3054         (WebCore::fullyClipsContents):
3055         * page/PageSerializer.cpp:
3056         (WebCore::PageSerializer::retrieveResourcesForProperties):
3057         * rendering/style/FillLayer.cpp:
3058         (WebCore::FillLayer::imagesIdentical):
3059
3060             Compare data equality instead of pointer equality for StyleImages (since StyleImages are no longer shared).
3061
3062         (WebCore::layerImagesIdentical): Deleted.
3063         * rendering/style/StyleCachedImage.cpp:
3064         (WebCore::StyleCachedImage::StyleCachedImage):
3065         (WebCore::StyleCachedImage::~StyleCachedImage):
3066         (WebCore::StyleCachedImage::cachedImage):
3067         (WebCore::StyleCachedImage::cssValue):
3068         (WebCore::StyleCachedImage::canRender):
3069         (WebCore::StyleCachedImage::isPending):
3070         (WebCore::StyleCachedImage::isLoaded):
3071         (WebCore::StyleCachedImage::errorOccurred):
3072         (WebCore::StyleCachedImage::imageSize):
3073         (WebCore::StyleCachedImage::imageHasRelativeWidth):
3074         (WebCore::StyleCachedImage::imageHasRelativeHeight):
3075         (WebCore::StyleCachedImage::computeIntrinsicDimensions):
3076         (WebCore::StyleCachedImage::usesImageContainerSize):
3077         (WebCore::StyleCachedImage::setContainerSizeForRenderer):
3078         (WebCore::StyleCachedImage::addClient):
3079         (WebCore::StyleCachedImage::removeClient):
3080         (WebCore::StyleCachedImage::image):
3081         (WebCore::StyleCachedImage::knownToBeOpaque):
3082         (WebCore::StyleCachedImage::setCachedImage): Deleted.
3083         * rendering/style/StyleCachedImage.h:
3084
3085 2016-09-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3086
3087         Media controls behave strangely when videos mute from within a playing handler
3088         https://bugs.webkit.org/show_bug.cgi?id=161559
3089         <rdar://problem/28018438>
3090
3091         Reviewed by Darin Adler.
3092
3093         Defer showing media controls until after the media element has fired its onplaying handler. This handles cases
3094         where videos that autoplay may initially meet the criteria for main content, but once the video begins to play,
3095         the page may change the media in some way (e.g. muting) that makes the video no longer main content. This causes
3096         media controls to flicker in and out.
3097
3098         These changes are covered by existing unit tests, which have been refactored to check media controller state
3099         after all autoplaying videos have begun playing. Also adds an additional unit test.
3100
3101         * html/HTMLMediaElement.cpp:
3102         (WebCore::HTMLMediaElement::notifyAboutPlaying):
3103         (WebCore::HTMLMediaElement::hasEverNotifiedAboutPlaying):
3104         * html/HTMLMediaElement.h:
3105         * html/MediaElementSession.cpp:
3106         (WebCore::MediaElementSession::canShowControlsManager):
3107
3108 2016-09-03  Ryosuke Niwa  <rniwa@webkit.org>
3109
3110         Update the semantics of defined-ness of custom elements per spec changes
3111         https://bugs.webkit.org/show_bug.cgi?id=161570
3112
3113         Reviewed by Darin Adler.
3114
3115         This patch adds the notion of a custom element that failed to construct or upgrade so that :defined
3116         doesn't apply to such an element. We also set the defined flag inside the HTMLElement constructor in
3117         the case of synchronous construction instead of waiting for the custom element constructor to finish.
3118         https://dom.spec.whatwg.org/#concept-create-element
3119
3120         Conceptually, there are four distinct states for an element:
3121         1. The element is a built-in element
3122         2. The element is a custom element yet to be defined (an upgrade candidate).
3123         3. The element is a well-defined custom element (constructed or upgraded).
3124         4. The element has failed to construct or upgrade as a custom element (because the custom element
3125         constructor threw an exception or returned an unexpected object).
3126
3127         In the latest DOM/HTML specifications, these states are called as 1. "uncustomized", 2. "undefined",
3128         3. "custom", and 4. "failed": https://dom.spec.whatwg.org/#concept-element-defined
3129
3130         This patch refactors Node flags to introduce these distinct states as the following:
3131         1. Neither IsCustomElement nor IsEditingTextOrUnresolvedCustomElementFlag is set.
3132         2. IsCustomElement and IsEditingTextOrUnresolvedCustomElementFlag are set.
3133         isCustomElementUpgradeCandidate() and isUndefinedCustomElement() return true.
3134         3. IsCustomElement is set and IsEditingTextOrUnresolvedCustomElementFlag is unset.
3135         isDefinedCustomElement() returns true.
3136         4. IsCustomElement is unset and IsEditingTextOrUnresolvedCustomElementFlag is set.
3137         isFailedCustomElement() and isUndefinedCustomElement() return true.
3138
3139         Per a spec change, this patch also makes :defined applied to a synchronously constructed custom element
3140         immediately after super() call in the constructor. When the constructor throws an exception or fails to
3141         return the right element, the HTML parser marks the fallback element with setIsUndefinedCustomElement.
3142
3143         Tests: fast/custom-elements/defined-pseudo-class.html
3144                fast/custom-elements/defined-rule.html
3145                fast/custom-elements/upgrading/Node-cloneNode.html
3146
3147         * bindings/js/JSCustomElementInterface.cpp:
3148         (WebCore::JSCustomElementInterface::constructElement): Don't set :defined flag here since that's done
3149         in the HTMLElement constructor now.
3150         (WebCore::JSCustomElementInterface::upgradeElement): Mark the element as failed-to-upgrade as needed.
3151         * bindings/js/JSElementCustom.cpp:
3152         (WebCore::toJSNewlyCreated):
3153         * bindings/js/JSHTMLElementCustom.cpp:
3154         (WebCore::constructJSHTMLElement):
3155         * css/SelectorCheckerTestFunctions.h:
3156         (WebCore::isDefinedElement):
3157         * dom/CustomElementReactionQueue.cpp:
3158         (WebCore::CustomElementReactionQueue::enqueueElementUpgradeIfDefined): Enqueue custom element reactions
3159         only if the element is well defined (successfully constructed or upgraded).
3160         (WebCore::CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded): Ditto.
3161         (WebCore::CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded): Ditto.
3162         (WebCore::CustomElementReactionQueue::enqueueAdoptedCallbackIfNeeded): Ditto.
3163         (WebCore::CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded): Ditto.
3164         * dom/CustomElementRegistry.cpp:
3165         (WebCore::enqueueUpgradeInShadowIncludingTreeOrder):
3166         * dom/Document.cpp:
3167         (WebCore::createUpgradeCandidateElement):
3168         (WebCore::createFallbackHTMLElement):
3169         * dom/Element.cpp:
3170         (WebCore::Element::attributeChanged):
3171         (WebCore::Element::didMoveToNewDocument):
3172         (WebCore::Element::insertedInto):
3173         (WebCore::Element::removedFrom):
3174         (WebCore::Element::setCustomElementIsResolved): Deleted.
3175         (WebCore::Element::setIsDefinedCustomElement): Renamed from setCustomElementIsResolved.
3176         (WebCore::Element::setIsFailedCustomElement): Added.
3177         (WebCore::Element::setIsCustomElementUpgradeCandidate): Added.
3178         (WebCore::Element::customElementInterface):
3179         * dom/Element.h:
3180         * dom/Node.h:
3181         (WebCore::Node::setIsCustomElement): Deleted.
3182         (WebCore::Node::isUndefinedCustomElement): Renamed from isUnresolvedCustomElement.
3183         (WebCore::Node::setIsUnresolvedCustomElement): Deleted.
3184         (WebCore::Node::isCustomElementUpgradeCandidate): Added.
3185         (WebCore::Node::isDefinedCustomElement): Renamed from isCustomElement.
3186         (WebCore::Node::isFailedCustomElement): Added.
3187         * dom/make_names.pl:
3188         (printWrapperFactoryCppFile): Use the HTMLElement wrapper on upgrade candidates. When a custom element
3189         failed to upgrade, the HTMLElement constructor would have created the wrapper so we never run this code.
3190         * html/parser/HTMLConstructionSite.cpp:
3191         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface): 
3192         * html/parser/HTMLDocumentParser.cpp:
3193         (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder): Mark the HTMLUnknownElement created when
3194         the custom element constructor failed to run successfully as a failed custom element so that :define
3195         wouldn't apply to this element.
3196
3197 2016-09-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3198
3199         Refactor the heuristic for showing media controls to take all media sessions into account
3200         https://bugs.webkit.org/show_bug.cgi?id=161503
3201         <rdar://problem/28033783>
3202
3203         Reviewed by Darin Adler.
3204
3205         Currently, when selecting a media session to show playback controls for, we grab the first media session that
3206         passes our heuristic. Using this method, we are unable to take additional factors into account, such as whether
3207         another media session's element is scrolled in view, or if another media session has been interacted with more
3208         recently. To address this, we make the following changes:
3209
3210             1.  Consider the list of all MediaElementSessions.
3211
3212             2.  Select only the MediaElementSessions capable of showing media controls and sort the list by a special
3213                 heuristic that takes visibility and time of last user interaction into account. The first element on
3214                 this list is the strongest candidate for main content.
3215
3216             3.  If this strongest candidate is visible in the viewport, or it is playing with audio, we return this
3217                 as the chosen candidate. Otherwise, we return this session only if no other non-candidate video could be
3218                 confused as the main content (i.e. the non-candidate video is not only visible in the viewport, but also
3219                 large enough to be considered main content).
3220
3221         Using this new method of determining the video to show controls for, we retain previous behavior for pages with
3222         a single video. On pages with multiple videos, the above logic ensures that if the current controlled video is
3223         paused, scrolled out of view, and then a new video is scrolled into view, we will either hide media controls to
3224         avoid confusion if that video could be confused for main content (using the mechanism in step 3), or we
3225         hook up the media controls to the new video if it satisfies main content (using the mechanism in step 2).
3226
3227         This patch also adds 6 new TestWebKitAPI unit tests.
3228
3229         * html/HTMLMediaElement.cpp:
3230         (WebCore::mediaElementSessionInfoForSession):
3231         (WebCore::preferMediaControlsForCandidateSessionOverOtherCandidateSession):
3232         (WebCore::mediaSessionMayBeConfusedWithMainContent):
3233         (WebCore::bestMediaSessionForShowingPlaybackControlsManager):
3234         (WebCore::HTMLMediaElement::didAttachRenderers):
3235         (WebCore::HTMLMediaElement::layoutSizeChanged):
3236         (WebCore::HTMLMediaElement::isVisibleInViewportChanged):
3237         (WebCore::HTMLMediaElement::resetPlaybackSessionState):
3238         (WebCore::HTMLMediaElement::isVisibleInViewport):
3239         (WebCore::HTMLMediaElement::updatePlaybackControlsManager):
3240         * html/HTMLMediaElement.h:
3241         * html/MediaElementSession.cpp:
3242         (WebCore::MediaElementSession::removeBehaviorRestriction):
3243         (WebCore::MediaElementSession::canShowControlsManager):
3244         (WebCore::MediaElementSession::isLargeEnoughForMainContent):
3245         (WebCore::MediaElementSession::mostRecentUserInteractionTime):
3246         (WebCore::MediaElementSession::wantsToObserveViewportVisibilityForMediaControls):
3247         (WebCore::MediaElementSession::wantsToObserveViewportVisibilityForAutoplay):
3248         (WebCore::MediaElementSession::resetPlaybackSessionState):
3249         (WebCore::MediaElementSession::canControlControlsManager): Deleted.
3250         * html/MediaElementSession.h:
3251         * platform/audio/PlatformMediaSession.h:
3252         (WebCore::PlatformMediaSession::resetPlaybackSessionState):
3253         (WebCore::PlatformMediaSession::canControlControlsManager): Deleted.
3254         * platform/audio/PlatformMediaSessionManager.cpp:
3255         (WebCore::PlatformMediaSessionManager::currentSessionsMatching):
3256         (WebCore::PlatformMediaSessionManager::currentSessionMatching): Deleted.
3257         * platform/audio/PlatformMediaSessionManager.h:
3258         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
3259         (WebPlaybackSessionModelMediaElement::setMediaElement):
3260
3261 2016-09-03  Darin Adler  <darin@apple.com>
3262
3263         Streamline DOMImplementation, and move it to our new DOM exception system
3264         https://bugs.webkit.org/show_bug.cgi?id=161295
3265
3266         Reviewed by Ryosuke Niwa.
3267
3268         * WebCore.xcodeproj/project.pbxproj: Added new headers to project.
3269
3270         * bindings/js/JSDOMBinding.h:
3271         (WebCore::toJS): Added an overload for ExceptionOr<>; this handles the
3272         exception case here so it doesn't need to be handled in generated code
3273         for the binding. Implemented here so that ExceptionOr.h does not know
3274         about bindings. But since this is a template, it will only compile when
3275         instantiated and there is no need to include ExceptionOr.h and indirectly
3276         the Variant.h header in this header.
3277         (WebCore::toJSNewlyCreated): Ditto.
3278
3279         * bindings/scripts/CodeGeneratorJS.pm:
3280         (GenerateCallbackImplementation): Refer to JSC::Exception with explicit
3281         namespace to avoid ambiguity with WebCore::Exception.
3282
3283         * dom/DOMImplementation.cpp:
3284         (WebCore::DOMImplementation::createDocumentType): Changed to return
3285         ExceptionOr.
3286         (WebCore::createXMLDocument): Added. Helper used in createDocument.
3287         (WebCore::DOMImplementation::getInterface): Deleted. This was unused.
3288         (WebCore::DOMImplementation::createDocument): Changed to return
3289         ExceptionOr.
3290         (WebCore::DOMImplementation::createCSSStyleSheet): Removed the unused
3291         ExceptionCode out argument.
3292         (WebCore::isValidXMLMIMETypeChar): Deleted. Moved to MIMETypeRegistry.
3293         (WebCore::DOMImplementation::isXMLMIMEType): Ditto.
3294         (WebCore::DOMImplementation::isTextMIMEType): Ditto.
3295
3296         * dom/DOMImplementation.h: Changed functions as described above to
3297         return ExceptionOr values. Also removed unused getInterface function,
3298         and isXMLMIMEType and isTextMIMEType, which both moved to the
3299         MIMETypeRegistry class alongside all the other similar MIME type
3300         functions.
3301
3302         * dom/DOMImplementation.idl: Reorganized this to match the IDL files
3303         in the specifications a little better. Also removed [RaisesException]
3304         since that is only needed for the old legacy ExceptionCode& style.
3305
3306         * dom/Document.cpp:
3307         (WebCore::Document::setXMLVersion): Removed call to the
3308         DOMImplementation::hasFeature function since the values passed in
3309         unconditionally result in the return value "true". This is left over
3310         either from specification language, or from an ancient version of this
3311         code that worked in a "no XML supported" mode.
3312         (WebCore::Document::setXMLStandalone): Ditto.
3313
3314         * dom/Document.h: Removed the ExceptionCode& out argument from setXMLStandalone.
3315         * dom/Document.idl: Removed [SetterRaisesException] from xmlStandalone.
3316
3317         * dom/Exception.h: Added.
3318         * dom/ExceptionOr.h: Added.
3319
3320         * html/HTMLTemplateElement.cpp: Removed unneeded include of DOMImplementation.h.
3321
3322         * inspector/InspectorPageAgent.cpp:
3323         (WebCore::createXHRTextDecoder): Use isXMLMIMEType in its new location in
3324         MIMETypeRegistry.
3325         * inspector/NetworkResourcesData.cpp:
3326         (WebCore::createOtherResourceTextDecoder): Ditto.
3327
3328         * loader/FrameLoader.cpp: Removed unneeded include of DOMImplementation.h.
3329
3330         * loader/TextResourceDecoder.cpp:
3331         (WebCore::TextResourceDecoder::determineContentType): Use isXMLMIMEType in its
3332         new location in MIMETypeRegistry.
3333
3334         * platform/MIMETypeRegistry.cpp:
3335         (WebCore::MIMETypeRegistry::isTextMIMEType): Added. Moved here from
3336         DOMImplementation.
3337         (WebCore::isValidXMLMIMETypeChar): Ditto.
3338         (WebCore::MIMETypeRegistry::isXMLMIMEType): Ditto.
3339
3340         * platform/MIMETypeRegistry.h: Added isXMLMIMEType and isTextMIMEType.
3341         Made isUnsupportedTextMIMEType private.
3342
3343         * svg/SVGElement.cpp:
3344         (WebCore::SVGElement::isSupported): Deleted. This function was never called.
3345         * svg/SVGElement.h: Updated for the above change.
3346
3347         * xml/XMLHttpRequest.cpp:
3348         (WebCore::XMLHttpRequest::responseIsXML): Use isXMLMIMEType in its new
3349         location in MIMETypeRegistry.
3350
3351         * xml/parser/XMLDocumentParserLibxml2.cpp:
3352         (WebCore::XMLDocumentParser::startDocument): Updated since setXMLStandalone
3353         no longer can raise an exception.
3354
3355 2016-09-03  Ryosuke Niwa  <rniwa@webkit.org>
3356
3357         Unbreak customElements.whenDefined after r205383 with a crash fix
3358         https://bugs.webkit.org/show_bug.cgi?id=161562
3359
3360         Reviewed by Darin Adler.
3361
3362         The crash was caused by DeferredWrapper::contextDestroyed not calling ContextDestructionObserver::contextDestroyed.
3363
3364         This caused m_scriptExecutionContext to not being set to nullptr when the Document was destroyed before DOMWindow
3365         during a single GC sweeping, and resulted in a use-after-free in ContextDestructionObserver's destructor.
3366
3367         Fixed the crash and reverted r205383.
3368
3369         Tests: fast/custom-elements/CustomElementRegistry.html
3370
3371         * bindings/js/JSCustomElementRegistryCustom.cpp:
3372         (WebCore::whenDefinedPromise):
3373         * bindings/js/JSDOMPromise.cpp:
3374         (WebCore::DeferredWrapper::contextDestroyed): Fixed the crash.
3375         * dom/CustomElementRegistry.cpp:
3376         (WebCore::CustomElementRegistry::addElementDefinition):
3377         * dom/CustomElementRegistry.h:
3378         (WebCore::CustomElementRegistry::promiseMap):
3379
3380 2016-09-03  Chris Dumez  <cdumez@apple.com>
3381
3382         Align cross-Origin Object.getOwnPropertyNames() with the HTML specification
3383         https://bugs.webkit.org/show_bug.cgi?id=161457
3384
3385         Reviewed by Darin Adler.
3386
3387         Align cross-Origin Object.getOwnPropertyNames() with the HTML specification:
3388         - https://html.spec.whatwg.org/#windowproxy-ownpropertykeys
3389         - https://html.spec.whatwg.org/#location-ownpropertykeys
3390         - https://html.spec.whatwg.org/#crossoriginproperties-(-o-)
3391
3392         We should list cross origin properties.
3393
3394         Firefox complies with the specification. However, WebKit was returning an
3395         empty array and logs a security error message.
3396
3397         No new tests, updated existing test.
3398
3399         * bindings/js/JSDOMWindowCustom.cpp:
3400         (WebCore::addCrossOriginPropertyNames):
3401         (WebCore::JSDOMWindow::getOwnPropertyNames):
3402         * bindings/js/JSLocationCustom.cpp:
3403         (WebCore::addCrossOriginPropertyNames):
3404         (WebCore::JSLocation::getOwnPropertyNames):
3405
3406 2016-09-03  Frédéric Wang  <fwang@igalia.com>
3407
3408         Constructors of MathML renderers should only accept MathMLPresentationElement-derived classes
3409         https://bugs.webkit.org/show_bug.cgi?id=161378
3410
3411         Reviewed by Darin Adler.
3412
3413         We update constructors of RenderMathMLBlock, to only accept MathMLPresentationElement
3414         instances as a parameter. Similarly, we make the constructor of RenderMathMLToken only
3415         accept MathMLTokenElement instances.
3416
3417         No new tests, behavior is unchanged.
3418
3419         * rendering/mathml/RenderMathMLBlock.cpp:
3420         (WebCore::RenderMathMLBlock::RenderMathMLBlock):
3421         * rendering/mathml/RenderMathMLBlock.h:
3422         * rendering/mathml/RenderMathMLToken.cpp:
3423         (WebCore::RenderMathMLToken::RenderMathMLToken):
3424         * rendering/mathml/RenderMathMLToken.h:
3425
3426 2016-09-03  Brian Weinstein  <bweinstein@apple.com>
3427
3428         Consult with the FrameLoaderClient about whether or not content extensions should be enabled when loading this URL.
3429         https://bugs.webkit.org/show_bug.cgi?id=161441
3430
3431         Reviewed by Darin Adler.
3432
3433         * loader/DocumentLoader.cpp:
3434         (WebCore::DocumentLoader::startLoadingMainResource): If content extensions aren't already disabled, consult with the
3435         FrameLoaderClient about whether or not we should use content extensions for this URL.
3436         * loader/FrameLoaderClient.h: Add the FrameLoaderClient call to determine if we should use content extensions for a given
3437         URL...
3438         * loader/EmptyClients.h: ... And add a stub implementation.
3439
3440 2016-09-03  Michael Catanzaro  <mcatanzaro@igalia.com>
3441
3442         Silence -Wparentheses warning triggered by r205266
3443
3444         Unreviewed
3445
3446         * platform/URL.cpp:
3447         (WebCore::URL::URL):
3448
3449 2016-09-03  Joseph Pecoraro  <pecoraro@apple.com>
3450
3451         Use ASCIILiteral in some more places
3452         https://bugs.webkit.org/show_bug.cgi?id=161557
3453
3454         Reviewed by Darin Adler.
3455
3456         * Modules/indexeddb/IDBDatabaseException.cpp:
3457         (WebCore::IDBDatabaseException::getErrorName):
3458         (WebCore::IDBDatabaseException::getErrorDescription):
3459         * Modules/websockets/WebSocket.cpp:
3460         (WebCore::WebSocket::binaryType):
3461         * css/FontFace.cpp:
3462         (WebCore::FontFace::stretch):