Diff
Modified: trunk/LayoutTests/ChangeLog (93424 => 93425)
--- trunk/LayoutTests/ChangeLog 2011-08-19 18:07:37 UTC (rev 93424)
+++ trunk/LayoutTests/ChangeLog 2011-08-19 18:54:08 UTC (rev 93425)
@@ -1,3 +1,40 @@
+2011-08-19 Julien Chaffraix <[email protected]>
+
+ REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
+ https://bugs.webkit.org/show_bug.cgi?id=65140
+ <rdar://problem/9835905>
+
+ Reviewed by Antti Koivisto.
+
+ * fast/css/link-disabled-attr-expected.txt: This change is a progression, but we are still
+ not handling updates to the selected style set properly (already covered by bug 62407).
+
+ * fast/css/stylesheet-enable-first-alternate-expected.txt: Added.
+ * fast/css/stylesheet-enable-first-alternate-on-load-expected.txt: Added.
+ * fast/css/stylesheet-enable-first-alternate-on-load.html: Added.
+ * fast/css/stylesheet-enable-first-alternate.html: Added.
+ * fast/css/stylesheet-enable-second-alternate-expected.txt: Added.
+ * fast/css/stylesheet-enable-second-alternate-on-load-expected.txt: Added.
+ * fast/css/stylesheet-enable-second-alternate-on-load.html: Added.
+ * fast/css/stylesheet-enable-second-alternate.html: Added.
+ Those are a variation on the same theme: we disable some stylesheet and enable others,
+ either directly or later.
+
+ * http/tests/css/link-css-disabled-value-with-slow-loading-sheet-expected.txt: Added.
+ * http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error-expected.txt: Added.
+ * http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error.html: Added.
+ * http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html: Added.
+ * http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet-in-error.js: Added.
+ (onSheetLoaded):
+ (testWhenLoaded):
+ * http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet.js: Added.
+ (onSheetLoaded):
+ (testWhenLoaded):
+ * http/tests/css/resources/slow-loading-sheet-in-error.php: Added.
+ * http/tests/css/resources/slow-loading-sheet.php: Added.
+ Those 2 test cases relies on a slow loading stylesheet so that we can test the disabled() value while the alternate
+ sheet is asynchronously loading and then check them again once the sheet is loaded.
+
2011-08-19 Vitaly Repeshko <[email protected]>
[chromium] Cleaning up test expectations.
Modified: trunk/LayoutTests/fast/css/link-disabled-attr-expected.txt (93424 => 93425)
--- trunk/LayoutTests/fast/css/link-disabled-attr-expected.txt 2011-08-19 18:07:37 UTC (rev 93424)
+++ trunk/LayoutTests/fast/css/link-disabled-attr-expected.txt 2011-08-19 18:54:08 UTC (rev 93425)
@@ -15,11 +15,11 @@
altsheet
FAIL link.disabled should be true. Was false.
PASS link.sheet is non-null.
-FAIL getComputedStyle(console).backgroundColor should be rgb(0, 128, 0). Was rgba(0, 0, 0, 0).
+PASS getComputedStyle(console).backgroundColor is 'rgb(0, 128, 0)'
FAIL link.disabled should be true. Was false.
-PASS getComputedStyle(console).backgroundColor is originalBG
+FAIL getComputedStyle(console).backgroundColor should be rgba(0, 0, 0, 0). Was rgb(0, 128, 0).
PASS link.disabled is false
-FAIL getComputedStyle(console).backgroundColor should be rgb(0, 128, 0). Was rgba(0, 0, 0, 0).
+PASS getComputedStyle(console).backgroundColor is 'rgb(0, 128, 0)'
PASS getComputedStyle(console).backgroundColor is originalBG
PASS successfullyParsed is true
Added: trunk/LayoutTests/fast/css/stylesheet-enable-first-alternate-expected.txt (0 => 93425)
--- trunk/LayoutTests/fast/css/stylesheet-enable-first-alternate-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/stylesheet-enable-first-alternate-expected.txt 2011-08-19 18:54:08 UTC (rev 93425)
@@ -0,0 +1,5 @@
+Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
+
+This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
+
+PASSED
Added: trunk/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load-expected.txt (0 => 93425)
--- trunk/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load-expected.txt 2011-08-19 18:54:08 UTC (rev 93425)
@@ -0,0 +1,5 @@
+Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
+
+This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
+
+PASSED
Added: trunk/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load.html (0 => 93425)
--- trunk/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load.html (rev 0)
+++ trunk/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load.html 2011-08-19 18:54:08 UTC (rev 93425)
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="" media="all" title="Default Style Sheet" type="text/css" />
+<link rel="alternate stylesheet" href="" media="all" title="green" type="text/css" />
+<script type="text/_javascript_">
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ function test() {
+ var red = document.getElementsByTagName("link")[0];
+ red.disabled = true;
+ var green = document.getElementsByTagName("link")[1];
+ green.disabled = true;
+ green.disabled = false;
+
+ var console = document.getElementById("console");
+ if (getComputedStyle(console, null).backgroundColor === "rgb(0, 128, 0)")
+ console.innerHTML = "PASSED";
+ else
+ console.innerHTML = "FAILED, background = "" + getComputedStyle(console, null).backgroundColor;
+ }
+ window.addEventListener("load", test, false);
+</script>
+</head>
+<body>
+<p>Test for <a href="" REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page</p>
+<p>This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).</p>
+<div id="console">FAILED</div>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load.html
___________________________________________________________________
Added: svn:executable
Added: trunk/LayoutTests/fast/css/stylesheet-enable-first-alternate.html (0 => 93425)
--- trunk/LayoutTests/fast/css/stylesheet-enable-first-alternate.html (rev 0)
+++ trunk/LayoutTests/fast/css/stylesheet-enable-first-alternate.html 2011-08-19 18:54:08 UTC (rev 93425)
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="" media="all" title="Default Style Sheet" type="text/css" />
+<link rel="alternate stylesheet" href="" media="all" title="green" type="text/css" />
+<script type="text/_javascript_">
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ var red = document.getElementsByTagName("link")[0];
+ red.disabled = true;
+ var green = document.getElementsByTagName("link")[1];
+ green.disabled = true;
+ green.disabled = false;
+
+ function test() {
+ var console = document.getElementById("console");
+ if (getComputedStyle(console, null).backgroundColor === "rgb(0, 128, 0)")
+ console.innerHTML = "PASSED";
+ else
+ console.innerHTML = "FAILED, background = "" + getComputedStyle(console, null).backgroundColor;
+ }
+ window.addEventListener("load", test, false);
+</script>
+</head>
+<body>
+<p>Test for <a href="" REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page</p>
+<p>This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).</p>
+<div id="console">FAILED</div>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/css/stylesheet-enable-first-alternate.html
___________________________________________________________________
Added: svn:executable
Added: trunk/LayoutTests/fast/css/stylesheet-enable-second-alternate-expected.txt (0 => 93425)
--- trunk/LayoutTests/fast/css/stylesheet-enable-second-alternate-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/stylesheet-enable-second-alternate-expected.txt 2011-08-19 18:54:08 UTC (rev 93425)
@@ -0,0 +1,5 @@
+Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
+
+This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
+
+PASSED
Added: trunk/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load-expected.txt (0 => 93425)
--- trunk/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load-expected.txt 2011-08-19 18:54:08 UTC (rev 93425)
@@ -0,0 +1,5 @@
+Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
+
+This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
+
+PASSED
Added: trunk/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load.html (0 => 93425)
--- trunk/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load.html (rev 0)
+++ trunk/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load.html 2011-08-19 18:54:08 UTC (rev 93425)
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="" media="all" title="Default Style Sheet" type="text/css" />
+<link rel="alternate stylesheet" href="" media="all" title="green" type="text/css" />
+<link rel="alternate stylesheet" href="" media="all" title="green" type="text/css" />
+<script type="text/_javascript_">
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ function test() {
+ var red = document.getElementsByTagName("link")[0];
+ red.disabled = true;
+ var green = document.getElementsByTagName("link")[2];
+ green.disabled = false;
+
+ var console = document.getElementById("console");
+ if (getComputedStyle(console, null).backgroundColor === "rgb(0, 128, 0)")
+ console.innerHTML = "PASSED";
+ else
+ console.innerHTML = "FAILED, background = "" + getComputedStyle(console, null).backgroundColor;
+ }
+ window.addEventListener("load", test, false);
+</script>
+</head>
+<body>
+<p>Test for <a href="" REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page</p>
+<p>This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).</p>
+<div id="console">FAILED</div>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load.html
___________________________________________________________________
Added: svn:executable
Added: trunk/LayoutTests/fast/css/stylesheet-enable-second-alternate.html (0 => 93425)
--- trunk/LayoutTests/fast/css/stylesheet-enable-second-alternate.html (rev 0)
+++ trunk/LayoutTests/fast/css/stylesheet-enable-second-alternate.html 2011-08-19 18:54:08 UTC (rev 93425)
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="" media="all" title="Default Style Sheet" type="text/css" />
+<link rel="alternate stylesheet" href="" media="all" title="green" type="text/css" />
+<link rel="alternate stylesheet" href="" media="all" title="green" type="text/css" />
+<script type="text/_javascript_">
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ var red = document.getElementsByTagName("link")[0];
+ red.disabled = true;
+ var green = document.getElementsByTagName("link")[2];
+ green.disabled = false;
+
+ function test() {
+ var console = document.getElementById("console");
+ if (getComputedStyle(console, null).backgroundColor === "rgb(0, 128, 0)")
+ console.innerHTML = "PASSED";
+ else
+ console.innerHTML = "FAILED, background = "" + getComputedStyle(console, null).backgroundColor;
+ }
+ window.addEventListener("load", test, false);
+</script>
+</head>
+<body>
+<p>Test for <a href="" REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page</p>
+<p>This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).</p>
+<div id="console">FAILED</div>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/css/stylesheet-enable-second-alternate.html
___________________________________________________________________
Added: svn:executable
Added: trunk/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-expected.txt (0 => 93425)
--- trunk/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-expected.txt 2011-08-19 18:54:08 UTC (rev 93425)
@@ -0,0 +1,19 @@
+Test that HTMLLinkElement's disabled attribute is properly cached while set when loading a stylesheet.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing value of 'disabled' prior to load just after setting them
+PASS mainSheetLink.sheet is non-null.
+PASS alternateSheetLink.sheet is null
+PASS mainSheetLink.disabled is true
+PASS alternateSheetLink.disabled is false
+Testing the values when the alternate sheet is loaded (as this is the only one that has sheet() === null)
+PASS mainSheetLink.sheet is non-null.
+PASS alternateSheetLink.sheet is non-null.
+PASS mainSheetLink.disabled is true
+PASS alternateSheetLink.disabled is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error-expected.txt (0 => 93425)
--- trunk/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error-expected.txt 2011-08-19 18:54:08 UTC (rev 93425)
@@ -0,0 +1,19 @@
+Test that HTMLLinkElement's disabled attribute is properly cached while set when loading a stylesheet.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing value of 'disabled' prior to load just after setting them
+PASS mainSheetLink.sheet is non-null.
+PASS alternateSheetLink.sheet is null
+PASS mainSheetLink.disabled is true
+PASS alternateSheetLink.disabled is false
+Testing the values when the alternate sheet is loaded (as this is the only one that has sheet() === null)
+PASS mainSheetLink.sheet is non-null.
+PASS alternateSheetLink.sheet is non-null.
+PASS mainSheetLink.disabled is true
+PASS alternateSheetLink.disabled is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error.html (0 => 93425)
--- trunk/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error.html (rev 0)
+++ trunk/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error.html 2011-08-19 18:54:08 UTC (rev 93425)
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="" media="all" title="Default Style Sheet" type="text/css" />
+<link rel="alternate stylesheet" href="" media="all" title="green" type="text/css" />
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error.html
___________________________________________________________________
Added: svn:executable
Added: trunk/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html (0 => 93425)
--- trunk/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html (rev 0)
+++ trunk/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html 2011-08-19 18:54:08 UTC (rev 93425)
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="" media="all" title="Default Style Sheet" type="text/css" />
+<link rel="alternate stylesheet" href="" media="all" title="green" type="text/css" />
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html
___________________________________________________________________
Added: svn:executable
Added: trunk/LayoutTests/http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet-in-error.js (0 => 93425)
--- trunk/LayoutTests/http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet-in-error.js (rev 0)
+++ trunk/LayoutTests/http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet-in-error.js 2011-08-19 18:54:08 UTC (rev 93425)
@@ -0,0 +1,45 @@
+description("Test that HTMLLinkElement's disabled attribute is properly cached while set when loading a stylesheet.");
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+window.jsTestIsAsync = true;
+
+mainSheetLink = document.getElementsByTagName("link")[0];
+alternateSheetLink = document.getElementsByTagName("link")[1];
+
+mainSheetLink.disabled = true;
+alternateSheetLink.disabled = false;
+
+debug("Testing value of 'disabled' prior to load just after setting them");
+shouldBeNonNull("mainSheetLink.sheet");
+shouldBeNull("alternateSheetLink.sheet");
+shouldBeTrue("mainSheetLink.disabled", true);
+shouldBeFalse("alternateSheetLink.disabled");
+
+debug("Testing the values when the alternate sheet is loaded (as this is the only one that has sheet() === null)");
+
+function onSheetLoaded(f, elem, maxtime) {
+ if (elem.sheet || maxtime <= 0)
+ f();
+ else
+ setTimeout(function () { onSheetLoaded(f, elem, maxtime - 25);}, 25);
+}
+
+function testWhenLoaded() {
+ // Those next 2 lines are a sanity check.
+ // If the second check fails, it is likely that the test timed out and thus
+ // you can discard the rest of results as it is not testing what we want
+ // (namely that the disabled value is passed to the final sheet).
+ shouldBeNonNull("mainSheetLink.sheet");
+ shouldBeNonNull("alternateSheetLink.sheet");
+
+ shouldBeTrue("mainSheetLink.disabled");
+ shouldBeFalse("alternateSheetLink.disabled");
+
+ finishJSTest();
+}
+
+onSheetLoaded(testWhenLoaded, alternateSheetLink, 500);
+
+var successfullyParsed = true;
Added: trunk/LayoutTests/http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet.js (0 => 93425)
--- trunk/LayoutTests/http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet.js (rev 0)
+++ trunk/LayoutTests/http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet.js 2011-08-19 18:54:08 UTC (rev 93425)
@@ -0,0 +1,45 @@
+description("Test that HTMLLinkElement's disabled attribute is properly cached while set when loading a stylesheet.");
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+window.jsTestIsAsync = true;
+
+mainSheetLink = document.getElementsByTagName("link")[0];
+alternateSheetLink = document.getElementsByTagName("link")[1];
+
+mainSheetLink.disabled = true;
+alternateSheetLink.disabled = false;
+
+debug("Testing value of 'disabled' prior to load just after setting them");
+shouldBeNonNull("mainSheetLink.sheet");
+shouldBeNull("alternateSheetLink.sheet");
+shouldBeTrue("mainSheetLink.disabled", true);
+shouldBeFalse("alternateSheetLink.disabled");
+
+debug("Testing the values when the alternate sheet is loaded (as this is the only one that has sheet() === null)");
+
+function onSheetLoaded(f, elem, maxtime) {
+ if (elem.sheet || maxtime <= 0)
+ f();
+ else
+ setTimeout(function () { onSheetLoaded(f, elem, maxtime - 25);}, 25);
+}
+
+function testWhenLoaded() {
+ // Those next 2 lines are a sanity check.
+ // If the second check fails, it is likely that the test timed out and thus
+ // you can discard the rest of results as it is not testing what we want
+ // (namely that the disabled value is passed to the final sheet).
+ shouldBeNonNull("mainSheetLink.sheet");
+ shouldBeNonNull("alternateSheetLink.sheet");
+
+ shouldBeTrue("mainSheetLink.disabled");
+ shouldBeFalse("alternateSheetLink.disabled");
+
+ finishJSTest();
+}
+
+onSheetLoaded(testWhenLoaded, alternateSheetLink, 500);
+
+var successfullyParsed = true;
Added: trunk/LayoutTests/http/tests/css/resources/slow-loading-sheet-in-error.php (0 => 93425)
--- trunk/LayoutTests/http/tests/css/resources/slow-loading-sheet-in-error.php (rev 0)
+++ trunk/LayoutTests/http/tests/css/resources/slow-loading-sheet-in-error.php 2011-08-19 18:54:08 UTC (rev 93425)
@@ -0,0 +1,13 @@
+<?php
+// We sleep here so that we are have enough time to test the different attributes before the stylesheet is fully loaded.
+usleep(100);
+
+header("HTTP/1.0 500 Internal Error");
+header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
+header("Cache-Control: no-cache, no-store, must-revalidate");
+header("Pragma: no-cache");
+header("Content-Type: text/css");
+
+ob_flush();
+flush();
+?>
Added: trunk/LayoutTests/http/tests/css/resources/slow-loading-sheet.php (0 => 93425)
--- trunk/LayoutTests/http/tests/css/resources/slow-loading-sheet.php (rev 0)
+++ trunk/LayoutTests/http/tests/css/resources/slow-loading-sheet.php 2011-08-19 18:54:08 UTC (rev 93425)
@@ -0,0 +1,15 @@
+<?php
+// We sleep here so that we are have enough time to test the different attributes before the stylesheet is fully loaded.
+usleep(100);
+
+header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
+header("Cache-Control: no-cache, no-store, must-revalidate");
+header("Pragma: no-cache");
+header("Content-Type: text/css");
+
+$color = $_GET['color'];
+
+echo "h1 { background-color: $color }\n";
+ob_flush();
+flush();
+?>
Modified: trunk/Source/WebCore/ChangeLog (93424 => 93425)
--- trunk/Source/WebCore/ChangeLog 2011-08-19 18:07:37 UTC (rev 93424)
+++ trunk/Source/WebCore/ChangeLog 2011-08-19 18:54:08 UTC (rev 93425)
@@ -1,3 +1,50 @@
+2011-08-19 Julien Chaffraix <[email protected]>
+
+ REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
+ https://bugs.webkit.org/show_bug.cgi?id=65140
+ <rdar://problem/9835905>
+
+ Reviewed by Antti Koivisto.
+
+ Tests: fast/css/stylesheet-enable-first-alternate-on-load.html
+ fast/css/stylesheet-enable-first-alternate.html
+ fast/css/stylesheet-enable-second-alternate-on-load.html
+ fast/css/stylesheet-enable-second-alternate.html
+ http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error.html
+ http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html
+
+ The gist of the issue is that we were ignoring calls to HTMLLinkElement::setDisabled that would enable a
+ style sheet when we were loading a stylesheet (m_sheet was 0 and thus ignored the call per the spec).
+
+ FF goes against the CSS OM spec in this case and always keep an associated sheet as long as 'rel' hints
+ at a stylesheet link and href is present. Instead of siding with FF, I continued to follow the
+ specification and store the enabled via _javascript_ state into m_scriptState (renamed from
+ m_isEnabledViaScript). This information gets merged back into the style sheet disabled state when it is
+ available.
+
+ While debugging the case at hand, I found some cases that were not properly handled and were fixed as
+ part of this change.
+
+ * html/HTMLLinkElement.cpp:
+ (WebCore::HTMLLinkElement::HTMLLinkElement): Updated after m_isEnabledViaScript rename.
+ (WebCore::HTMLLinkElement::setDisabled): Always call setIsEnabledViaScript so that
+ the information is properly stored (either for recalcStyleSelector or just to store
+ the state during loading).
+
+ (WebCore::HTMLLinkElement::sheetLoaded): Merge back the state from m_scriptState to
+ the sheet's disabled state.
+
+ (WebCore::HTMLLinkElement::disabled): Account for the temporary state and return the
+ right value. It matches FF and what people would expect.
+
+ (WebCore::HTMLLinkElement::areDisabledAndScriptStatesConsistent): Debug only method
+ that checks that disabled() and isEnabledViaScript() are consistent with each other
+ (under some circumstances).
+
+ * html/HTMLLinkElement.h:
+ (WebCore::HTMLLinkElement::isEnabledViaScript): Updated after m_isEnabledViaScript rename.
+ (WebCore::HTMLLinkElement::setIsEnabledViaScript): Added setter.
+
2011-08-17 Adrienne Walker <[email protected]>
[chromium] Split tiler into main thread / compositor thread versions
Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (93424 => 93425)
--- trunk/Source/WebCore/html/HTMLLinkElement.cpp 2011-08-19 18:07:37 UTC (rev 93424)
+++ trunk/Source/WebCore/html/HTMLLinkElement.cpp 2011-08-19 18:54:08 UTC (rev 93425)
@@ -56,7 +56,7 @@
, m_linkLoader(this)
, m_sizes(DOMSettableTokenList::create())
, m_loading(false)
- , m_isEnabledViaScript(false)
+ , m_scriptState(Unset)
, m_createdByParser(createdByParser)
, m_isInShadowTree(false)
, m_pendingSheetType(None)
@@ -85,15 +85,20 @@
void HTMLLinkElement::setDisabled(bool disabled)
{
+ bool wasEnabledViaScript = isEnabledViaScript();
+ setIsEnabledViaScript(!disabled);
+
if (!m_sheet)
return;
bool wasDisabled = m_sheet->disabled();
- if (wasDisabled == disabled)
+ if (wasDisabled == disabled) {
+ if (wasEnabledViaScript != isEnabledViaScript())
+ document()->styleSelectorChanged(DeferRecalcStyle);
return;
+ }
m_sheet->setDisabled(disabled);
- m_isEnabledViaScript = !disabled;
// If we change the disabled state while the sheet is still loading, then we have to
// perform three checks:
@@ -120,6 +125,8 @@
if (!disabled)
process();
+
+ ASSERT(areDisabledAndScriptStatesConsistent());
}
StyleSheet* HTMLLinkElement::sheet() const
@@ -359,10 +366,20 @@
bool HTMLLinkElement::sheetLoaded()
{
+ // Migrate the disabled information before removePendingSheet is called
+ // as it will start a recalStyleSelector which needs this information.
+ if (m_scriptState != Unset) {
+ ASSERT(!m_loading);
+ // FIXME: We should ASSERT that it was set for stylesheets only, but
+ // currently we allow setDisabled to be called regardless of the <link> rel.
+ setDisabled(m_scriptState == DisabledViaScript);
+ }
+
if (!isLoading()) {
removePendingSheet();
return true;
}
+
return false;
}
@@ -445,7 +462,20 @@
bool HTMLLinkElement::disabled() const
{
- return m_sheet && m_sheet->disabled();
+ ASSERT(areDisabledAndScriptStatesConsistent());
+
+ if (!m_sheet) {
+ // FF disagrees with the CSS OM spec and always has an associated stylesheet for alternate sheet (regardless of whether
+ // the resource is fetched). As we store the enabled state in m_scriptState while loading, return this information to be
+ // consistent with FF. sheetLoaded() is called at the end of any transfer (whether it was in error or not) so m_scriptState
+ // will be transfered back into our stylesheet and the disabled() value should always be consistent.
+ if (isLoading() && m_scriptState != Unset)
+ return m_scriptState == DisabledViaScript;
+
+ return false;
+ }
+
+ return m_sheet->disabled();
}
DOMSettableTokenList* HTMLLinkElement::sizes() const
@@ -458,4 +488,23 @@
m_sizes->setValue(value);
}
+#ifndef NDEBUG
+bool HTMLLinkElement::areDisabledAndScriptStatesConsistent() const
+{
+ if (!m_relAttribute.m_isStyleSheet)
+ return true;
+
+ // During loading, m_scriptState holds the temporary value for sheet()->disabled()
+ // so it can have any values (same for sheet()->disabled()).
+ if (isLoading())
+ return true;
+
+ if (m_scriptState == Unset)
+ return true;
+
+ bool isDisabledViaScript = m_scriptState == DisabledViaScript;
+ return isDisabledViaScript == sheet()->disabled();
+}
+#endif
+
} // namespace WebCore
Modified: trunk/Source/WebCore/html/HTMLLinkElement.h (93424 => 93425)
--- trunk/Source/WebCore/html/HTMLLinkElement.h 2011-08-19 18:07:37 UTC (rev 93424)
+++ trunk/Source/WebCore/html/HTMLLinkElement.h 2011-08-19 18:54:08 UTC (rev 93425)
@@ -57,7 +57,7 @@
// FIXME: This should be renamed isStyleSheetLoading as this is only used for stylesheets.
bool isLoading() const;
- bool isEnabledViaScript() const { return m_isEnabledViaScript; }
+ bool isEnabledViaScript() const { return m_scriptState == EnabledViaScript; }
bool disabled() const;
void setDisabled(bool);
void setSizes(const String&);
@@ -85,7 +85,6 @@
virtual bool isURLAttribute(Attribute*) const;
-private:
virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
virtual void finishParsingChildren();
@@ -97,6 +96,11 @@
private:
HTMLLinkElement(const QualifiedName&, Document*, bool createdByParser);
+ void setIsEnabledViaScript(bool enabled) { m_scriptState = enabled ? EnabledViaScript : DisabledViaScript; }
+#ifndef NDEBUG
+ bool areDisabledAndScriptStatesConsistent() const;
+#endif
+
LinkLoader m_linkLoader;
CachedResourceHandle<CachedCSSStyleSheet> m_cachedSheet;
RefPtr<CSSStyleSheet> m_sheet;
@@ -106,10 +110,11 @@
RefPtr<DOMSettableTokenList> m_sizes;
LinkRelAttribute m_relAttribute;
bool m_loading;
- bool m_isEnabledViaScript;
+ enum EnabledViaScriptState { Unset, EnabledViaScript, DisabledViaScript };
+ EnabledViaScriptState m_scriptState;
bool m_createdByParser;
bool m_isInShadowTree;
-
+
PendingSheetType m_pendingSheetType;
};