WebKit Bugzilla
Attachment 104613 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]
Patch 6: Solve the valid ASSERT by adding a custom setter to |disabled| that forwards the information through the associated <link> (if any).
bug-65140-20110819200125.patch (text/plain), 34.91 KB, created by
Julien Chaffraix
on 2011-08-19 20:01:26 PDT
(
hide
)
Description:
Patch 6: Solve the valid ASSERT by adding a custom setter to |disabled| that forwards the information through the associated <link> (if any).
Filename:
MIME Type:
Creator:
Julien Chaffraix
Created:
2011-08-19 20:01:26 PDT
Size:
34.91 KB
patch
obsolete
>Subversion Revision: 93446 >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 4f93afb05766765f68bdd6a074ab5e85e02994c3..0da6670055c9143611f389809f9997cdc388a04f 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 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 James Robinson <jamesr@chromium.org> > > [chromium] Update chromium test expectations >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 7c1a8d9511bd95eac9400043350fd1376a8520e9..732c3b7f138bd6a2749a8beff751d95495e04c84 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,60 @@ >+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 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. >+ >+ * css/StyleSheet.idl: >+ * bindings/js/JSStyleSheetCustom.cpp: >+ (WebCore::JSStyleSheet::setDisabled): >+ * bindings/v8/custom/V8StyleSheetCustom.cpp: >+ (WebCore::V8StyleSheet::disabledAccessorSetter): >+ Made |disabled| setter custom binding so that we can forward any request through our associated >+ <link> element (if we have one). This is the most sane option as this makes sure that m_scriptState >+ and m_sheet->disabled() are always in sync while ensuring that m_scriptState is never enabled when JS >+ was not the caller. >+ >+ * 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-19 Beth Dakin <bdakin@apple.com> > > https://bugs.webkit.org/show_bug.cgi?id=66590 >diff --git a/Source/WebCore/bindings/js/JSStyleSheetCustom.cpp b/Source/WebCore/bindings/js/JSStyleSheetCustom.cpp >index 21e00b168c2254118114d2a491e1e4e20511c6e6..51dc350660fa07da6152fe8099d8b40c5565f2da 100644 >--- a/Source/WebCore/bindings/js/JSStyleSheetCustom.cpp >+++ b/Source/WebCore/bindings/js/JSStyleSheetCustom.cpp >@@ -27,9 +27,11 @@ > #include "JSStyleSheet.h" > > #include "CSSStyleSheet.h" >-#include "Node.h" >+#include "HTMLLinkElement.h" >+#include "HTMLNames.h" > #include "JSCSSStyleSheet.h" > #include "JSNode.h" >+#include "Node.h" > > using namespace JSC; > >@@ -61,4 +63,15 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, StyleSheet* style > return wrapper; > } > >+void JSStyleSheet::setDisabled(ExecState* exec, JSValue value) >+{ >+ StyleSheet* styleSheet = static_cast<StyleSheet*>(impl()); >+ bool disabled = value.toBoolean(exec); >+ if (styleSheet->ownerNode() && styleSheet->ownerNode()->hasTagName(HTMLNames::linkTag)) { >+ HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(styleSheet->ownerNode()); >+ linkElement->setDisabled(disabled); >+ } else >+ styleSheet->setDisabled(disabled); >+} >+ > } // namespace WebCore >diff --git a/Source/WebCore/bindings/v8/custom/V8StyleSheetCustom.cpp b/Source/WebCore/bindings/v8/custom/V8StyleSheetCustom.cpp >index 0fe6af850ad33938350db6fabfbd03aa1d77f9ad..d7820789e0a12d8a453533ea9828def6926ab8b8 100644 >--- a/Source/WebCore/bindings/v8/custom/V8StyleSheetCustom.cpp >+++ b/Source/WebCore/bindings/v8/custom/V8StyleSheetCustom.cpp >@@ -31,9 +31,12 @@ > #include "config.h" > #include "V8StyleSheet.h" > >+#include "HTMLLinkElement.h" >+#include "HTMLNames.h" > #include "V8DOMWrapper.h" > #include "V8CSSStyleSheet.h" > #include "V8Node.h" >+#include "V8Proxy.h" > > namespace WebCore { > >@@ -51,4 +54,17 @@ v8::Handle<v8::Value> toV8(StyleSheet* impl) > return wrapper; > } > >+void V8StyleSheet::disabledAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) >+{ >+ INC_STATS("DOM.StyleSheet.disabled._set"); >+ StyleSheet* imp = V8StyleSheet::toNative(info.Holder()); >+ bool disabled = value->BooleanValue(); >+ if (imp->ownerNode() && imp->ownerNode()->hasTagName(HTMLNames::linkTag)) { >+ HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(imp->ownerNode()); >+ linkElement->setDisabled(disabled); >+ } else >+ imp->setDisabled(disabled); >+ return; >+} >+ > } // namespace WebCore >diff --git a/Source/WebCore/css/StyleSheet.idl b/Source/WebCore/css/StyleSheet.idl >index 6d5df807658d13eb21a869049c7869bdd6133b82..d6b0b80f2cd558e831380d653076b4259d818cf9 100644 >--- a/Source/WebCore/css/StyleSheet.idl >+++ b/Source/WebCore/css/StyleSheet.idl >@@ -29,7 +29,7 @@ module stylesheets { > V8DependentLifetime > ] StyleSheet { > readonly attribute [ConvertNullStringTo=Null] DOMString type; >- attribute boolean disabled; >+ attribute [CustomSetter] boolean disabled; > readonly attribute Node ownerNode; > readonly attribute StyleSheet parentStyleSheet; > readonly attribute [ConvertNullStringTo=Null] DOMString href; >diff --git a/Source/WebCore/html/HTMLLinkElement.cpp b/Source/WebCore/html/HTMLLinkElement.cpp >index 4bc6e933ecd0df3bcec39b1cc8ca3f98f97889d2..eab2d4128771596e44b6a46816ae2dbe2765c2d6 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(areDisabledAndScriptStatesConsistent()); > } > > 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(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 @@ void HTMLLinkElement::setSizes(const String& value) > 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 (!sheet() || 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..ac518d292fc43514c6aede2451f5de89ac7bfba2 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 areDisabledAndScriptStatesConsistent() 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