Title: [186620] branches/safari-600.8-branch

Diff

Modified: branches/safari-600.8-branch/LayoutTests/ChangeLog (186619 => 186620)


--- branches/safari-600.8-branch/LayoutTests/ChangeLog	2015-07-09 21:02:51 UTC (rev 186619)
+++ branches/safari-600.8-branch/LayoutTests/ChangeLog	2015-07-09 21:02:56 UTC (rev 186620)
@@ -1,5 +1,31 @@
 2015-07-09  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r186553. rdar://problem/21716372
+
+    2015-07-08  Matthew Hanson  <matthew_han...@apple.com>
+
+            Merge r182829. rdar://problem/21716511
+
+        2015-04-14  Chris Dumez  <cdu...@apple.com>
+
+                Regression(r180020): Web Inspector crashes on pages that have a stylesheet with an invalid MIME type
+                https://bugs.webkit.org/show_bug.cgi?id=143745
+                <rdar://problem/20243916>
+
+                Reviewed by Joseph Pecoraro.
+
+                Add layout test that shows the Web inspector on a page that has
+                a stylesheet with an invalid MIME type, to make sure we don't
+                crash.
+
+                * http/tests/inspector/css/bad-mime-type-expected.txt: Added.
+                * http/tests/inspector/css/bad-mime-type.html: Added.
+                * http/tests/misc/css-accept-any-type.html:
+                * http/tests/misc/css-reject-any-type-in-strict-mode.html:
+                * http/tests/misc/resources/stylesheet-bad-mime-type.php: Renamed from LayoutTests/http/tests/misc/resources/stylesheet.php.
+
+2015-07-09  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r186551. rdar://problem/21716372
 
     2015-07-08  Matthew Hanson  <matthew_han...@apple.com>

Added: branches/safari-600.8-branch/LayoutTests/http/tests/inspector/css/bad-mime-type-expected.txt (0 => 186620)


--- branches/safari-600.8-branch/LayoutTests/http/tests/inspector/css/bad-mime-type-expected.txt	                        (rev 0)
+++ branches/safari-600.8-branch/LayoutTests/http/tests/inspector/css/bad-mime-type-expected.txt	2015-07-09 21:02:56 UTC (rev 186620)
@@ -0,0 +1,3 @@
+Tests that showing Web Inspector on a page that has a stylesheet with an invalid MIME type does not crash.
+
+This test passes if it does not crash.

Added: branches/safari-600.8-branch/LayoutTests/http/tests/inspector/css/bad-mime-type.html (0 => 186620)


--- branches/safari-600.8-branch/LayoutTests/http/tests/inspector/css/bad-mime-type.html	                        (rev 0)
+++ branches/safari-600.8-branch/LayoutTests/http/tests/inspector/css/bad-mime-type.html	2015-07-09 21:02:56 UTC (rev 186620)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script type="text/_javascript_" src=""
+
+<!-- This stylesheet is served with an invalid MIME type -->
+<link rel="stylesheet" href=""
+
+<script>
+function test()
+{
+    InspectorTest.completeTest();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Tests that showing Web Inspector on a page that has a stylesheet with an invalid MIME type does not crash.</p>
+<p>This test passes if it does not crash.</p>
+</body>
+</html>

Modified: branches/safari-600.8-branch/LayoutTests/http/tests/misc/css-accept-any-type.html (186619 => 186620)


--- branches/safari-600.8-branch/LayoutTests/http/tests/misc/css-accept-any-type.html	2015-07-09 21:02:51 UTC (rev 186619)
+++ branches/safari-600.8-branch/LayoutTests/http/tests/misc/css-accept-any-type.html	2015-07-09 21:02:56 UTC (rev 186620)
@@ -1,7 +1,7 @@
 <html>
 <head>
     <title></title>
-    <link rel="stylesheet" href=""
+    <link rel="stylesheet" href=""
     <script>
         function test()
         {

Modified: branches/safari-600.8-branch/LayoutTests/http/tests/misc/css-reject-any-type-in-strict-mode.html (186619 => 186620)


--- branches/safari-600.8-branch/LayoutTests/http/tests/misc/css-reject-any-type-in-strict-mode.html	2015-07-09 21:02:51 UTC (rev 186619)
+++ branches/safari-600.8-branch/LayoutTests/http/tests/misc/css-reject-any-type-in-strict-mode.html	2015-07-09 21:02:56 UTC (rev 186620)
@@ -2,7 +2,7 @@
 <html>
 <head>
     <title></title>
-    <link rel="stylesheet" href=""
+    <link rel="stylesheet" href=""
     <script>
         function test()
         {

Copied: branches/safari-600.8-branch/LayoutTests/http/tests/misc/resources/stylesheet-bad-mime-type.php (from rev 186619, branches/safari-600.8-branch/LayoutTests/http/tests/misc/resources/stylesheet.php) (0 => 186620)


--- branches/safari-600.8-branch/LayoutTests/http/tests/misc/resources/stylesheet-bad-mime-type.php	                        (rev 0)
+++ branches/safari-600.8-branch/LayoutTests/http/tests/misc/resources/stylesheet-bad-mime-type.php	2015-07-09 21:02:56 UTC (rev 186620)
@@ -0,0 +1,10 @@
+<?php
+    if (preg_match("/\*\/\*/", $_SERVER["HTTP_ACCEPT"])) {
+?>
+        p#target { position: relative; }
+        /* This stylesheet is served as text/html */
+<?php
+    } else {
+        header("Not acceptable", true, 406);
+    }
+?>

Deleted: branches/safari-600.8-branch/LayoutTests/http/tests/misc/resources/stylesheet.php (186619 => 186620)


--- branches/safari-600.8-branch/LayoutTests/http/tests/misc/resources/stylesheet.php	2015-07-09 21:02:51 UTC (rev 186619)
+++ branches/safari-600.8-branch/LayoutTests/http/tests/misc/resources/stylesheet.php	2015-07-09 21:02:56 UTC (rev 186620)
@@ -1,10 +0,0 @@
-<?php
-    if (preg_match("/\*\/\*/", $_SERVER["HTTP_ACCEPT"])) {
-?>
-        p#target { position: relative; }
-        /* This stylesheet is served as text/html */
-<?php
-    } else {
-        header("Not acceptable", true, 406);
-    }
-?>

Modified: branches/safari-600.8-branch/Source/_javascript_Core/ChangeLog (186619 => 186620)


--- branches/safari-600.8-branch/Source/_javascript_Core/ChangeLog	2015-07-09 21:02:51 UTC (rev 186619)
+++ branches/safari-600.8-branch/Source/_javascript_Core/ChangeLog	2015-07-09 21:02:56 UTC (rev 186620)
@@ -1,3 +1,26 @@
+2015-07-09  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r186553. rdar://problem/21716372
+
+    2015-07-08  Matthew Hanson  <matthew_han...@apple.com>
+
+            Merge r182829. rdar://problem/21716511
+
+        2015-04-14  Chris Dumez  <cdu...@apple.com>
+
+                Regression(r180020): Web Inspector crashes on pages that have a stylesheet with an invalid MIME type
+                https://bugs.webkit.org/show_bug.cgi?id=143745
+                <rdar://problem/20243916>
+
+                Reviewed by Joseph Pecoraro.
+
+                Add assertion in ContentSearchUtilities::findMagicComment() to make
+                sure the content String is not null or we would crash in
+                JSC::Yarr::interpret() later.
+
+                * inspector/ContentSearchUtilities.cpp:
+                (Inspector::ContentSearchUtilities::findMagicComment):
+
 2015-06-18  Babak Shafiei  <bshaf...@apple.com>
 
         Roll out patch for r182827.

Modified: branches/safari-600.8-branch/Source/_javascript_Core/inspector/ContentSearchUtilities.cpp (186619 => 186620)


--- branches/safari-600.8-branch/Source/_javascript_Core/inspector/ContentSearchUtilities.cpp	2015-07-09 21:02:51 UTC (rev 186619)
+++ branches/safari-600.8-branch/Source/_javascript_Core/inspector/ContentSearchUtilities.cpp	2015-07-09 21:02:56 UTC (rev 186620)
@@ -181,6 +181,7 @@
 
 static String findMagicComment(const String& content, const String& patternString)
 {
+    ASSERT(!content.isNull());
     const char* error = nullptr;
     JSC::Yarr::YarrPattern pattern(patternString, false, true, &error);
     ASSERT(!error);

Modified: branches/safari-600.8-branch/Source/WebCore/ChangeLog (186619 => 186620)


--- branches/safari-600.8-branch/Source/WebCore/ChangeLog	2015-07-09 21:02:51 UTC (rev 186619)
+++ branches/safari-600.8-branch/Source/WebCore/ChangeLog	2015-07-09 21:02:56 UTC (rev 186620)
@@ -1,5 +1,40 @@
 2015-07-09  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r186553. rdar://problem/21716372
+
+    2015-07-08  Matthew Hanson  <matthew_han...@apple.com>
+
+            Merge r182829. rdar://problem/21716511
+
+        2015-04-14  Chris Dumez  <cdu...@apple.com>
+
+                Regression(r180020): Web Inspector crashes on pages that have a stylesheet with an invalid MIME type
+                https://bugs.webkit.org/show_bug.cgi?id=143745
+                <rdar://problem/20243916>
+
+                Reviewed by Joseph Pecoraro.
+
+                After r180020, we are stricter and no longer accept CSS resources that
+                are not served with a CSS MIME type. Showing Web inspector on a page
+                with such bad resource would crash because
+                InspectorPageAgent::cachedResourceContent() would return true but
+                the result String would be null. This null String would then later
+                be passed to the Yarr interpreter and crash on a String::is8Bit()
+                call.
+
+                cachedResourceContent() calls CachedCSSStyleSheet::sheetText(). Before
+                r180020, it would return the text, even if the MIME type was incorrect.
+                However, this is no longer the case and we now need to make sure that
+                cachedResourceContent() returns false if sheetText() returns a null
+                String.
+
+                Test: http/tests/inspector/css/bad-mime-type.html
+
+                * inspector/InspectorPageAgent.cpp:
+                (WebCore::InspectorPageAgent::cachedResourceContent):
+
+2015-07-09  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r186551. rdar://problem/21716372
 
     2015-07-08  Matthew Hanson  <matthew_han...@apple.com>

Modified: branches/safari-600.8-branch/Source/WebCore/inspector/InspectorPageAgent.cpp (186619 => 186620)


--- branches/safari-600.8-branch/Source/WebCore/inspector/InspectorPageAgent.cpp	2015-07-09 21:02:51 UTC (rev 186619)
+++ branches/safari-600.8-branch/Source/WebCore/inspector/InspectorPageAgent.cpp	2015-07-09 21:02:56 UTC (rev 186620)
@@ -173,8 +173,9 @@
     if (cachedResource) {
         switch (cachedResource->type()) {
         case CachedResource::CSSStyleSheet:
+            // This can return a null String if the MIME type is invalid.
             *result = toCachedCSSStyleSheet(cachedResource)->sheetText();
-            return true;
+            return !result->isNull();
         case CachedResource::Script:
             *result = toCachedScript(cachedResource)->script();
             return true;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to