Title: [209373] trunk
- Revision
- 209373
- Author
- [email protected]
- Date
- 2016-12-05 18:19:40 -0800 (Mon, 05 Dec 2016)
Log Message
MediaDocuments crash with modern media controls
https://bugs.webkit.org/show_bug.cgi?id=165446
<rdar://problem/29524959>
Reviewed by Antoine Quint.
Source/WebCore:
The modern media controls inject a <style> element into
the document, which exposed a bug when used in MediaDocuments.
Such documents were not getting a charset, and the hash table
for the CSSParserContexts was crashing.
Test: media/modern-media-controls/media-documents/insert-style-should-not-crash.html
* css/parser/CSSParserMode.h: Guard against an empty charset.
(WebCore::CSSParserContextHash::hash):
* dom/InlineStyleSheetOwner.cpp: Ask for the charset with fallback.
(WebCore::parserContextForElement):
LayoutTests:
* media/modern-media-controls/media-documents/insert-style-should-not-crash-expected.txt: Added.
* media/modern-media-controls/media-documents/insert-style-should-not-crash.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (209372 => 209373)
--- trunk/LayoutTests/ChangeLog 2016-12-06 02:08:20 UTC (rev 209372)
+++ trunk/LayoutTests/ChangeLog 2016-12-06 02:19:40 UTC (rev 209373)
@@ -1,3 +1,14 @@
+2016-12-05 Dean Jackson <[email protected]>
+
+ MediaDocuments crash with modern media controls
+ https://bugs.webkit.org/show_bug.cgi?id=165446
+ <rdar://problem/29524959>
+
+ Reviewed by Antoine Quint.
+
+ * media/modern-media-controls/media-documents/insert-style-should-not-crash-expected.txt: Added.
+ * media/modern-media-controls/media-documents/insert-style-should-not-crash.html: Added.
+
2016-12-05 Dave Hyatt <[email protected]>
[CSS Parser] Avoid more tests
Added: trunk/LayoutTests/media/modern-media-controls/media-documents/insert-style-should-not-crash-expected.txt (0 => 209373)
--- trunk/LayoutTests/media/modern-media-controls/media-documents/insert-style-should-not-crash-expected.txt (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/media-documents/insert-style-should-not-crash-expected.txt 2016-12-06 02:19:40 UTC (rev 209373)
@@ -0,0 +1 @@
+
Property changes on: trunk/LayoutTests/media/modern-media-controls/media-documents/insert-style-should-not-crash-expected.txt
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/plain
\ No newline at end of property
Added: trunk/LayoutTests/media/modern-media-controls/media-documents/insert-style-should-not-crash.html (0 => 209373)
--- trunk/LayoutTests/media/modern-media-controls/media-documents/insert-style-should-not-crash.html (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/media-documents/insert-style-should-not-crash.html 2016-12-06 02:19:40 UTC (rev 209373)
@@ -0,0 +1,6 @@
+<!DOCTYPE html><!-- webkit-test-runner [ modernMediaControls=true ] -->
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+<iframe src=""
Property changes on: trunk/LayoutTests/media/modern-media-controls/media-documents/insert-style-should-not-crash.html
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Modified: trunk/Source/WebCore/ChangeLog (209372 => 209373)
--- trunk/Source/WebCore/ChangeLog 2016-12-06 02:08:20 UTC (rev 209372)
+++ trunk/Source/WebCore/ChangeLog 2016-12-06 02:19:40 UTC (rev 209373)
@@ -1,3 +1,23 @@
+2016-12-05 Dean Jackson <[email protected]>
+
+ MediaDocuments crash with modern media controls
+ https://bugs.webkit.org/show_bug.cgi?id=165446
+ <rdar://problem/29524959>
+
+ Reviewed by Antoine Quint.
+
+ The modern media controls inject a <style> element into
+ the document, which exposed a bug when used in MediaDocuments.
+ Such documents were not getting a charset, and the hash table
+ for the CSSParserContexts was crashing.
+
+ Test: media/modern-media-controls/media-documents/insert-style-should-not-crash.html
+
+ * css/parser/CSSParserMode.h: Guard against an empty charset.
+ (WebCore::CSSParserContextHash::hash):
+ * dom/InlineStyleSheetOwner.cpp: Ask for the charset with fallback.
+ (WebCore::parserContextForElement):
+
2016-12-05 Dave Hyatt <[email protected]>
[CSS Parser] shape-rendering supports crispEdges rather than crisp-edges
Modified: trunk/Source/WebCore/css/parser/CSSParserMode.h (209372 => 209373)
--- trunk/Source/WebCore/css/parser/CSSParserMode.h 2016-12-06 02:08:20 UTC (rev 209372)
+++ trunk/Source/WebCore/css/parser/CSSParserMode.h 2016-12-06 02:19:40 UTC (rev 209373)
@@ -131,7 +131,8 @@
static unsigned hash(const CSSParserContext& key)
{
auto hash = URLHash::hash(key.baseURL);
- hash ^= StringHash::hash(key.charset);
+ if (!key.charset.isEmpty())
+ hash ^= StringHash::hash(key.charset);
unsigned bits = key.isHTMLDocument << 0
& key.isHTMLDocument << 1
#if ENABLE(CSS_GRID_LAYOUT)
Modified: trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp (209372 => 209373)
--- trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp 2016-12-06 02:08:20 UTC (rev 209372)
+++ trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp 2016-12-06 02:19:40 UTC (rev 209373)
@@ -50,7 +50,7 @@
// User agent shadow trees can't contain document-relative URLs. Use blank URL as base allowing cross-document sharing.
auto& baseURL = shadowRoot && shadowRoot->mode() == ShadowRootMode::UserAgent ? blankURL() : element.document().baseURL();
- CSSParserContext result = CSSParserContext { element.document(), baseURL, element.document().encoding() };
+ CSSParserContext result = CSSParserContext { element.document(), baseURL, element.document().characterSetWithUTF8Fallback() };
if (shadowRoot && shadowRoot->mode() == ShadowRootMode::UserAgent)
result.mode = UASheetMode;
return result;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes