WebKit Bugzilla
Attachment 104520 Details for
Bug 65140
: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
New version 5: Tweaked the debug-only code + added testing for an alternate stylesheet in error.
bug-65140-20110819101456.patch (text/plain), 31.26 KB, created by
Julien Chaffraix
on 2011-08-19 10:14:57 PDT
(
hide
)
Description:
New version 5: Tweaked the debug-only code + added testing for an alternate stylesheet in error.
Filename:
MIME Type:
Creator:
Julien Chaffraix
Created:
2011-08-19 10:14:57 PDT
Size:
31.26 KB
patch
obsolete
>Subversion Revision: 93420 >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 5aee437053ee05680911246308f76503a8f0de9b..c1a036c0f7f98fd8f76ca355f897b5adfd4403d7 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,40 @@ >+2011-08-19 Julien Chaffraix <jchaffraix@webkit.org> >+ >+ 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 NOBODY (OOPS!). >+ >+ * 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-18 Pavel Podivilov <podivilov@chromium.org> > > Web Inspector: extract breakpoint management code to a separate class and add tests. >diff --git a/LayoutTests/fast/css/link-disabled-attr-expected.txt b/LayoutTests/fast/css/link-disabled-attr-expected.txt >index 571acb28d772660fc2adb4c22fa820fc56a6dfce..f41370a125f4298030d5b6410f595c5ca1313cd9 100644 >--- a/LayoutTests/fast/css/link-disabled-attr-expected.txt >+++ b/LayoutTests/fast/css/link-disabled-attr-expected.txt >@@ -15,11 +15,11 @@ PASS getComputedStyle(console).whiteSpace is 'pre-wrap' > 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 > >diff --git a/LayoutTests/fast/css/stylesheet-enable-first-alternate-expected.txt b/LayoutTests/fast/css/stylesheet-enable-first-alternate-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c0528fb758a91d7f306820711150f98a5d1702c4 >--- /dev/null >+++ b/LayoutTests/fast/css/stylesheet-enable-first-alternate-expected.txt >@@ -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 >diff --git a/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load-expected.txt b/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c0528fb758a91d7f306820711150f98a5d1702c4 >--- /dev/null >+++ b/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load-expected.txt >@@ -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 >diff --git a/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load.html b/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load.html >new file mode 100755 >index 0000000000000000000000000000000000000000..a295e42dc24f4129aa3ab7927f6ea964781e0bdd >--- /dev/null >+++ b/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load.html >@@ -0,0 +1,31 @@ >+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> >+<html> >+<head> >+<link rel="stylesheet" href="resources/red.css" media="all" title="Default Style Sheet" type="text/css" /> >+<link rel="alternate stylesheet" href="resources/green.css" 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="https://bugs.webkit.org/show_bug.cgi?id=65140">65140</a>: 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> >diff --git a/LayoutTests/fast/css/stylesheet-enable-first-alternate.html b/LayoutTests/fast/css/stylesheet-enable-first-alternate.html >new file mode 100755 >index 0000000000000000000000000000000000000000..f559063f91c320cb97b9441aac3d61f5522e1533 >--- /dev/null >+++ b/LayoutTests/fast/css/stylesheet-enable-first-alternate.html >@@ -0,0 +1,31 @@ >+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> >+<html> >+<head> >+<link rel="stylesheet" href="resources/red.css" media="all" title="Default Style Sheet" type="text/css" /> >+<link rel="alternate stylesheet" href="resources/green.css" 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="https://bugs.webkit.org/show_bug.cgi?id=65140">65140</a>: 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> >diff --git a/LayoutTests/fast/css/stylesheet-enable-second-alternate-expected.txt b/LayoutTests/fast/css/stylesheet-enable-second-alternate-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c0528fb758a91d7f306820711150f98a5d1702c4 >--- /dev/null >+++ b/LayoutTests/fast/css/stylesheet-enable-second-alternate-expected.txt >@@ -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 >diff --git a/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load-expected.txt b/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c0528fb758a91d7f306820711150f98a5d1702c4 >--- /dev/null >+++ b/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load-expected.txt >@@ -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 >diff --git a/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load.html b/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load.html >new file mode 100755 >index 0000000000000000000000000000000000000000..cc8086e0b4a27c7ffd81a33c0d0253155142c66d >--- /dev/null >+++ b/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load.html >@@ -0,0 +1,31 @@ >+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> >+<html> >+<head> >+<link rel="stylesheet" href="resources/red.css" media="all" title="Default Style Sheet" type="text/css" /> >+<link rel="alternate stylesheet" href="resources/red.css" media="all" title="green" type="text/css" /> >+<link rel="alternate stylesheet" href="resources/green.css" 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="https://bugs.webkit.org/show_bug.cgi?id=65140">65140</a>: 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> >diff --git a/LayoutTests/fast/css/stylesheet-enable-second-alternate.html b/LayoutTests/fast/css/stylesheet-enable-second-alternate.html >new file mode 100755 >index 0000000000000000000000000000000000000000..00e5c2c21dd6f5b550051322409e3357774f8a6d >--- /dev/null >+++ b/LayoutTests/fast/css/stylesheet-enable-second-alternate.html >@@ -0,0 +1,31 @@ >+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> >+<html> >+<head> >+<link rel="stylesheet" href="resources/red.css" media="all" title="Default Style Sheet" type="text/css" /> >+<link rel="alternate stylesheet" href="resources/red.css" media="all" title="green" type="text/css" /> >+<link rel="alternate stylesheet" href="resources/green.css" 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="https://bugs.webkit.org/show_bug.cgi?id=65140">65140</a>: 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> >diff --git a/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-expected.txt b/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..61400aaa0ec0a4e20cfd76b0a3520b9174e36548 >--- /dev/null >+++ b/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-expected.txt >@@ -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 >+ >diff --git a/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error-expected.txt b/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..61400aaa0ec0a4e20cfd76b0a3520b9174e36548 >--- /dev/null >+++ b/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error-expected.txt >@@ -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 >+ >diff --git a/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error.html b/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error.html >new file mode 100755 >index 0000000000000000000000000000000000000000..d16c83d3ccbb92cc1249577b235eb0ca56688c90 >--- /dev/null >+++ b/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error.html >@@ -0,0 +1,14 @@ >+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> >+<html> >+<head> >+<link rel="stylesheet" href="resources/slow-loading-sheet.php?color=green" media="all" title="Default Style Sheet" type="text/css" /> >+<link rel="alternate stylesheet" href="resources/slow-loading-sheet.php-in-error" media="all" title="green" type="text/css" /> >+<script src="/js-test-resources/js-test-pre.js"></script> >+</head> >+<body> >+<p id="description"></p> >+<div id="console"></div> >+<script src="resources/link-css-disabled-value-with-slow-loading-sheet-in-error.js"></script> >+<script src="/js-test-resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html b/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html >new file mode 100755 >index 0000000000000000000000000000000000000000..07ff2ccca1b4fe21ef1d125195a662fcfb28660a >--- /dev/null >+++ b/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html >@@ -0,0 +1,14 @@ >+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> >+<html> >+<head> >+<link rel="stylesheet" href="resources/slow-loading-sheet.php?color=red" media="all" title="Default Style Sheet" type="text/css" /> >+<link rel="alternate stylesheet" href="resources/slow-loading-sheet.php?color=green" media="all" title="green" type="text/css" /> >+<script src="/js-test-resources/js-test-pre.js"></script> >+</head> >+<body> >+<p id="description"></p> >+<div id="console"></div> >+<script src="resources/link-css-disabled-value-with-slow-loading-sheet.js"></script> >+<script src="/js-test-resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet-in-error.js b/LayoutTests/http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet-in-error.js >new file mode 100644 >index 0000000000000000000000000000000000000000..0589f2736a644895554e9d06d80fe5b9a8997ff3 >--- /dev/null >+++ b/LayoutTests/http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet-in-error.js >@@ -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; >diff --git a/LayoutTests/http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet.js b/LayoutTests/http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet.js >new file mode 100644 >index 0000000000000000000000000000000000000000..0589f2736a644895554e9d06d80fe5b9a8997ff3 >--- /dev/null >+++ b/LayoutTests/http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet.js >@@ -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; >diff --git a/LayoutTests/http/tests/css/resources/slow-loading-sheet-in-error.php b/LayoutTests/http/tests/css/resources/slow-loading-sheet-in-error.php >new file mode 100644 >index 0000000000000000000000000000000000000000..dcd17f7f7219614687941cdf895c107deaf7f5d4 >--- /dev/null >+++ b/LayoutTests/http/tests/css/resources/slow-loading-sheet-in-error.php >@@ -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(); >+?> >diff --git a/LayoutTests/http/tests/css/resources/slow-loading-sheet.php b/LayoutTests/http/tests/css/resources/slow-loading-sheet.php >new file mode 100644 >index 0000000000000000000000000000000000000000..28937d42af80305be8c38cc6f6e9f02f00bf6de9 >--- /dev/null >+++ b/LayoutTests/http/tests/css/resources/slow-loading-sheet.php >@@ -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(); >+?> >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 2090dbfa3b14d73b9fc577e765636349e094b846..902d062089613a48699cde9180933adc45070302 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,50 @@ >+2011-08-19 Julien Chaffraix <jchaffraix@webkit.org> >+ >+ 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 NOBODY (OOPS!). >+ >+ 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::areDisabledAndScriptStateConsistent): 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-19 Pavel Podivilov <podivilov@chromium.org> > > Web Inspector: update scope variables upon value changes via console. >diff --git a/Source/WebCore/html/HTMLLinkElement.cpp b/Source/WebCore/html/HTMLLinkElement.cpp >index 4bc6e933ecd0df3bcec39b1cc8ca3f98f97889d2..5f67f79dd7457615de16e2d35d1b1b8f7efb2f38 100644 >--- a/Source/WebCore/html/HTMLLinkElement.cpp >+++ b/Source/WebCore/html/HTMLLinkElement.cpp >@@ -56,7 +56,7 @@ inline HTMLLinkElement::HTMLLinkElement(const QualifiedName& tagName, Document* > , 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 @@ HTMLLinkElement::~HTMLLinkElement() > > 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 @@ void HTMLLinkElement::setDisabled(bool disabled) > > if (!disabled) > process(); >+ >+ ASSERT(areDisabledAndScriptStateConsistent()); > } > > StyleSheet* HTMLLinkElement::sheet() const >@@ -359,10 +366,20 @@ void HTMLLinkElement::linkLoadingErrored() > > 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 @@ void HTMLLinkElement::removePendingSheet() > > bool HTMLLinkElement::disabled() const > { >- return m_sheet && m_sheet->disabled(); >+ ASSERT(areDisabledAndScriptStateConsistent()); >+ >+ 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 @@ void HTMLLinkElement::setSizes(const String& value) > m_sizes->setValue(value); > } > >+#ifndef NDEBUG >+bool HTMLLinkElement::areDisabledAndScriptStateConsistent() 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 >diff --git a/Source/WebCore/html/HTMLLinkElement.h b/Source/WebCore/html/HTMLLinkElement.h >index 8fede02e5e7f92b740f8590913e8b759a6d15138..a8cad42d3f2abbe6d98c461e7e58a68e4c3044eb 100644 >--- a/Source/WebCore/html/HTMLLinkElement.h >+++ b/Source/WebCore/html/HTMLLinkElement.h >@@ -57,7 +57,7 @@ public: > > // 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 @@ private: > > virtual bool isURLAttribute(Attribute*) const; > >-private: > virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; > > virtual void finishParsingChildren(); >@@ -97,6 +96,11 @@ private: > private: > HTMLLinkElement(const QualifiedName&, Document*, bool createdByParser); > >+ void setIsEnabledViaScript(bool enabled) { m_scriptState = enabled ? EnabledViaScript : DisabledViaScript; } >+#ifndef NDEBUG >+ bool areDisabledAndScriptStateConsistent() const; >+#endif >+ > LinkLoader m_linkLoader; > CachedResourceHandle<CachedCSSStyleSheet> m_cachedSheet; > RefPtr<CSSStyleSheet> m_sheet; >@@ -106,10 +110,11 @@ private: > 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; > }; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 65140
:
102609
|
102709
|
103326
|
103566
|
104415
|
104416
|
104520
|
104526
|
104613
|
104686
|
106028