LayoutTests/ChangeLog

 12011-09-01 Julien Chaffraix <[email protected]>
 2
 3 REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
 4 https://bugs.webkit.org/show_bug.cgi?id=65140
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * fast/css/stylesheet-enable-first-alternate-link-expected.txt: Added.
 9 * fast/css/stylesheet-enable-first-alternate-link.html: Added.
 10 * fast/css/stylesheet-enable-first-alternate-on-load-link-expected.txt: Added.
 11 * fast/css/stylesheet-enable-first-alternate-on-load-link.html: Added.
 12 * fast/css/stylesheet-enable-first-alternate-on-load-sheet-expected.txt: Added.
 13 * fast/css/stylesheet-enable-first-alternate-on-load-sheet.html: Added.
 14 * fast/css/stylesheet-enable-second-alternate-link-expected.txt: Added.
 15 * fast/css/stylesheet-enable-second-alternate-link.html: Added.
 16 * fast/css/stylesheet-enable-second-alternate-on-load-link-expected.txt: Added.
 17 * fast/css/stylesheet-enable-second-alternate-on-load-link.html: Added.
 18 * fast/css/stylesheet-enable-second-alternate-on-load-sheet-expected.txt: Added.
 19 * fast/css/stylesheet-enable-second-alternate-on-load-sheet.html: Added.
 20 * http/tests/css/link-css-disabled-value-with-slow-loading-sheet-expected.txt: Added.
 21 * http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error-expected.txt: Added.
 22 * http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error.html: Added.
 23 * http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html: Added.
 24 * http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet-in-error.js: Added.
 25 (onSheetLoaded):
 26 (testWhenLoaded):
 27 * http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet.js: Added.
 28 (onSheetLoaded):
 29 (testWhenLoaded):
 30 * http/tests/css/resources/slow-loading-sheet-in-error.php: Added.
 31 * http/tests/css/resources/slow-loading-sheet.php: Added.
 32 New tests developped for 65140. The baselines matches what FF and Opera are doing (IE does not support
 33 link.sheet at the moment). Those failures are covered by bug 67436.
 34
 35 * fast/css/link-disabled-attr-expected.txt:
 36 * fast/dom/HTMLLinkElement/disabled-attribute-expected.txt:
 37 Fixed the baseline to match our behavior. The FAIL are our current deviation from the spec. Those
 38 failures are covered by bug 67436.
 39
 40 * fast/dom/boolean-attribute-reflection-expected.txt:
 41 * fast/dom/script-tests/boolean-attribute-reflection.js:
 42 Re-added link.disabled as a reflected attribute.
 43
1442011-08-09 Kent Tamura <[email protected]>
245
346 Move <input type=month> tests to fast/forms/month/

LayoutTests/fast/css/link-disabled-attr-expected.txt

@@Test for bug 61400: REGRESSION(84329): Stylesheets on some pages do not load
33
44notsheet
55PASS link.sheet is null
6 PASS link.disabled is false
 6FAIL link.disabled should be false. Was true.
77sheet
88PASS link.sheet is non-null.
9 PASS link.disabled is true
 9FAIL link.disabled should be true. Was false.
1010PASS link.sheet.disabled is true
1111PASS getComputedStyle(console).whiteSpace is 'normal'
1212PASS link.disabled is false
13 PASS link.sheet.disabled is false
14 PASS getComputedStyle(console).whiteSpace is 'pre-wrap'
 13FAIL link.sheet.disabled should be false. Was true.
 14FAIL getComputedStyle(console).whiteSpace should be pre-wrap. Was normal.
1515altsheet
1616FAIL link.disabled should be true. Was false.
1717PASS link.sheet is non-null.

LayoutTests/fast/css/stylesheet-enable-first-alternate-link-expected.txt

 1Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
 2
 3This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
 4
 5PASSED

LayoutTests/fast/css/stylesheet-enable-first-alternate-link.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<link rel="stylesheet" href="resources/red.css" media="all" title="Default Style Sheet" type="text/css" />
 5<link rel="alternate stylesheet" href="resources/green.css" media="all" title="green" type="text/css" />
 6<script type="text/javascript">
 7 if (window.layoutTestController)
 8 layoutTestController.dumpAsText();
 9
 10 var red = document.getElementsByTagName("link")[0];
 11 red.disabled = true;
 12 var green = document.getElementsByTagName("link")[1];
 13 green.disabled = true;
 14 green.disabled = false;
 15
 16 function test() {
 17 var console = document.getElementById("console");
 18 if (getComputedStyle(console, null).backgroundColor === "rgb(0, 128, 0)")
 19 console.innerHTML = "PASSED";
 20 else
 21 console.innerHTML = "FAILED, background = " + getComputedStyle(console, null).backgroundColor;
 22 }
 23 window.addEventListener("load", test, false);
 24</script>
 25</head>
 26<body>
 27<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>
 28<p>This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).</p>
 29<div id="console">FAILED</div>
 30</body>
 31</html>

LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load-link-expected.txt

 1Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
 2
 3This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
 4
 5PASSED

LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load-link.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<link rel="stylesheet" href="resources/red.css" media="all" title="Default Style Sheet" type="text/css" />
 5<link rel="alternate stylesheet" href="resources/green.css" media="all" title="green" type="text/css" />
 6<script type="text/javascript">
 7 if (window.layoutTestController)
 8 layoutTestController.dumpAsText();
 9
 10 function test() {
 11 var red = document.getElementsByTagName("link")[0];
 12 red.disabled = true;
 13 var green = document.getElementsByTagName("link")[1];
 14 green.disabled = true;
 15 green.disabled = false;
 16
 17 var console = document.getElementById("console");
 18 if (getComputedStyle(console, null).backgroundColor === "rgb(0, 128, 0)")
 19 console.innerHTML = "PASSED";
 20 else
 21 console.innerHTML = "FAILED, background = " + getComputedStyle(console, null).backgroundColor;
 22 }
 23 window.addEventListener("load", test, false);
 24</script>
 25</head>
 26<body>
 27<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>
 28<p>This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).</p>
 29<div id="console">FAILED</div>
 30</body>
 31</html>

LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load-sheet-expected.txt

 1Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
 2
 3This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
 4
 5FAILED, background = rgba(0, 0, 0, 0)

LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load-sheet.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<link rel="stylesheet" href="resources/red.css" media="all" title="Default Style Sheet" type="text/css" />
 5<link rel="alternate stylesheet" href="resources/green.css" media="all" title="green" type="text/css" />
 6<script type="text/javascript">
 7 if (window.layoutTestController)
 8 layoutTestController.dumpAsText();
 9
 10 function test() {
 11 var red = document.getElementsByTagName("link")[0];
 12 red.sheet.disabled = true;
 13 var green = document.getElementsByTagName("link")[1];
 14 green.sheet.disabled = true;
 15 green.sheet.disabled = false;
 16
 17 var console = document.getElementById("console");
 18 if (getComputedStyle(console, null).backgroundColor === "rgb(0, 128, 0)")
 19 console.innerHTML = "PASSED";
 20 else
 21 console.innerHTML = "FAILED, background = " + getComputedStyle(console, null).backgroundColor;
 22 }
 23 window.addEventListener("load", test, false);
 24</script>
 25</head>
 26<body>
 27<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>
 28<p>This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).</p>
 29<div id="console">FAILED</div>
 30</body>
 31</html>

LayoutTests/fast/css/stylesheet-enable-second-alternate-link-expected.txt

 1Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
 2
 3This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
 4
 5FAILED, background = rgba(0, 0, 0, 0)

LayoutTests/fast/css/stylesheet-enable-second-alternate-link.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<link rel="stylesheet" href="resources/red.css" media="all" title="Default Style Sheet" type="text/css" />
 5<link rel="alternate stylesheet" href="resources/red.css" media="all" title="green" type="text/css" />
 6<link rel="alternate stylesheet" href="resources/green.css" media="all" title="green" type="text/css" />
 7<script type="text/javascript">
 8 if (window.layoutTestController)
 9 layoutTestController.dumpAsText();
 10
 11 var red = document.getElementsByTagName("link")[0];
 12 red.disabled = true;
 13 var green = document.getElementsByTagName("link")[2];
 14 green.disabled = false;
 15
 16 function test() {
 17 var console = document.getElementById("console");
 18 if (getComputedStyle(console, null).backgroundColor === "rgb(0, 128, 0)")
 19 console.innerHTML = "PASSED";
 20 else
 21 console.innerHTML = "FAILED, background = " + getComputedStyle(console, null).backgroundColor;
 22 }
 23 window.addEventListener("load", test, false);
 24</script>
 25</head>
 26<body>
 27<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>
 28<p>This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).</p>
 29<div id="console">FAILED</div>
 30</body>
 31</html>

LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load-link-expected.txt

 1Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
 2
 3This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
 4
 5FAILED, background = rgba(0, 0, 0, 0)

LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load-link.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<link rel="stylesheet" href="resources/red.css" media="all" title="Default Style Sheet" type="text/css" />
 5<link rel="alternate stylesheet" href="resources/red.css" media="all" title="green" type="text/css" />
 6<link rel="alternate stylesheet" href="resources/green.css" media="all" title="green" type="text/css" />
 7<script type="text/javascript">
 8 if (window.layoutTestController)
 9 layoutTestController.dumpAsText();
 10
 11 function test() {
 12 var red = document.getElementsByTagName("link")[0];
 13 red.disabled = true;
 14 var green = document.getElementsByTagName("link")[2];
 15 green.disabled = false;
 16
 17 var console = document.getElementById("console");
 18 if (getComputedStyle(console, null).backgroundColor === "rgb(0, 128, 0)")
 19 console.innerHTML = "PASSED";
 20 else
 21 console.innerHTML = "FAILED, background = " + getComputedStyle(console, null).backgroundColor;
 22 }
 23 window.addEventListener("load", test, false);
 24</script>
 25</head>
 26<body>
 27<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>
 28<p>This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).</p>
 29<div id="console">FAILED</div>
 30</body>
 31</html>

LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load-sheet-expected.txt

 1Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
 2
 3This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
 4
 5FAILED, background = rgba(0, 0, 0, 0)

LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load-sheet.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<link rel="stylesheet" href="resources/red.css" media="all" title="Default Style Sheet" type="text/css" />
 5<link rel="alternate stylesheet" href="resources/red.css" media="all" title="green" type="text/css" />
 6<link rel="alternate stylesheet" href="resources/green.css" media="all" title="green" type="text/css" />
 7<script type="text/javascript">
 8 if (window.layoutTestController)
 9 layoutTestController.dumpAsText();
 10
 11 function test() {
 12 var red = document.getElementsByTagName("link")[0];
 13 red.sheet.disabled = true;
 14 var green = document.getElementsByTagName("link")[2];
 15 green.sheet.disabled = false;
 16
 17 var console = document.getElementById("console");
 18 if (getComputedStyle(console, null).backgroundColor === "rgb(0, 128, 0)")
 19 console.innerHTML = "PASSED";
 20 else
 21 console.innerHTML = "FAILED, background = " + getComputedStyle(console, null).backgroundColor;
 22 }
 23 window.addEventListener("load", test, false);
 24</script>
 25</head>
 26<body>
 27<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>
 28<p>This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).</p>
 29<div id="console">FAILED</div>
 30</body>
 31</html>

LayoutTests/fast/dom/HTMLLinkElement/disabled-attribute-expected.txt

@@On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
55
66PASS test.disabled is false
77PASS test.disabled is true
8 PASS test.sheet.disabled is true
 8FAIL test.sheet.disabled should be true. Was false.
99PASS test.sheet.disabled is false
10 PASS test.disabled is false
 10FAIL test.disabled should be false. Was true.
1111
1212
1313PASS test_nostyle.sheet is null
1414PASS test_nostyle.disabled is false
15 PASS test_nostyle.disabled is false
 15FAIL test_nostyle.disabled should be false. Was true.
1616PASS successfullyParsed is true
1717
1818TEST COMPLETE

LayoutTests/fast/dom/boolean-attribute-reflection-expected.txt

@@PASS e = make('input'); e.removeAttribute('required'); e.required is false
5959PASS e = make('input'); e.setAttribute('required', ''); e.required is true
6060PASS e = make('input'); e.setAttribute('required', 'x'); e.required = false; e.getAttribute('required') is null
6161PASS e = make('input'); e.setAttribute('required', 'x'); e.required = true; e.getAttribute('required') is ''
 62PASS e = make('link'); e.removeAttribute('disabled'); e.disabled is false
 63PASS e = make('link'); e.setAttribute('disabled', ''); e.disabled is true
 64PASS e = make('link'); e.setAttribute('disabled', 'x'); e.disabled = false; e.getAttribute('disabled') is null
 65PASS e = make('link'); e.setAttribute('disabled', 'x'); e.disabled = true; e.getAttribute('disabled') is ''
6266PASS e = make('menu'); e.removeAttribute('compact'); e.compact is false
6367PASS e = make('menu'); e.setAttribute('compact', ''); e.compact is true
6468PASS e = make('menu'); e.setAttribute('compact', 'x'); e.compact = false; e.getAttribute('compact') is null

LayoutTests/fast/dom/script-tests/boolean-attribute-reflection.js

@@var attributes = [
1515 [ "input", "multiple" ],
1616 [ "input", "readOnly" ],
1717 [ "input", "required" ],
 18 [ "link", "disabled" ],
1819 [ "menu", "compact" ],
1920 [ "object", "declare" ],
2021 [ "ol", "compact" ],

LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-expected.txt

 1Test that HTMLLinkElement's disabled attribute is properly cached while set when loading a stylesheet.
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6Testing value of 'disabled' prior to load just after setting them
 7PASS mainSheetLink.sheet is non-null.
 8PASS alternateSheetLink.sheet is null
 9PASS mainSheetLink.disabled is true
 10PASS alternateSheetLink.disabled is false
 11Testing the values when the alternate sheet is loaded (as this is the only one that has sheet() === null)
 12PASS mainSheetLink.sheet is non-null.
 13PASS alternateSheetLink.sheet is non-null.
 14PASS mainSheetLink.disabled is true
 15PASS alternateSheetLink.disabled is false
 16PASS successfullyParsed is true
 17
 18TEST COMPLETE
 19

LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error-expected.txt

 1Test that HTMLLinkElement's disabled attribute is properly cached while set when loading a stylesheet.
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6Testing value of 'disabled' prior to load just after setting them
 7PASS mainSheetLink.sheet is non-null.
 8PASS alternateSheetLink.sheet is null
 9PASS mainSheetLink.disabled is true
 10PASS alternateSheetLink.disabled is false
 11Testing the values when the alternate sheet is loaded (as this is the only one that has sheet() === null)
 12PASS mainSheetLink.sheet is non-null.
 13PASS alternateSheetLink.sheet is non-null.
 14PASS mainSheetLink.disabled is true
 15PASS alternateSheetLink.disabled is false
 16PASS successfullyParsed is true
 17
 18TEST COMPLETE
 19

LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<link rel="stylesheet" href="resources/slow-loading-sheet.php?color=green" media="all" title="Default Style Sheet" type="text/css" />
 5<link rel="alternate stylesheet" href="resources/slow-loading-sheet.php-in-error" media="all" title="green" type="text/css" />
 6<script src="/js-test-resources/js-test-pre.js"></script>
 7</head>
 8<body>
 9<p id="description"></p>
 10<div id="console"></div>
 11<script src="resources/link-css-disabled-value-with-slow-loading-sheet-in-error.js"></script>
 12<script src="/js-test-resources/js-test-post.js"></script>
 13</body>
 14</html>

LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<link rel="stylesheet" href="resources/slow-loading-sheet.php?color=red" media="all" title="Default Style Sheet" type="text/css" />
 5<link rel="alternate stylesheet" href="resources/slow-loading-sheet.php?color=green" media="all" title="green" type="text/css" />
 6<script src="/js-test-resources/js-test-pre.js"></script>
 7</head>
 8<body>
 9<p id="description"></p>
 10<div id="console"></div>
 11<script src="resources/link-css-disabled-value-with-slow-loading-sheet.js"></script>
 12<script src="/js-test-resources/js-test-post.js"></script>
 13</body>
 14</html>

LayoutTests/http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet-in-error.js

 1description("Test that HTMLLinkElement's disabled attribute is properly cached while set when loading a stylesheet.");
 2
 3if (window.layoutTestController)
 4 layoutTestController.waitUntilDone();
 5
 6window.jsTestIsAsync = true;
 7
 8mainSheetLink = document.getElementsByTagName("link")[0];
 9alternateSheetLink = document.getElementsByTagName("link")[1];
 10
 11mainSheetLink.disabled = true;
 12alternateSheetLink.disabled = false;
 13
 14debug("Testing value of 'disabled' prior to load just after setting them");
 15shouldBeNonNull("mainSheetLink.sheet");
 16shouldBeNull("alternateSheetLink.sheet");
 17shouldBeTrue("mainSheetLink.disabled", true);
 18shouldBeFalse("alternateSheetLink.disabled");
 19
 20debug("Testing the values when the alternate sheet is loaded (as this is the only one that has sheet() === null)");
 21
 22function onSheetLoaded(f, elem, maxtime) {
 23 if (elem.sheet || maxtime <= 0)
 24 f();
 25 else
 26 setTimeout(function () { onSheetLoaded(f, elem, maxtime - 25);}, 25);
 27}
 28
 29function testWhenLoaded() {
 30 // Those next 2 lines are a sanity check.
 31 // If the second check fails, it is likely that the test timed out and thus
 32 // you can discard the rest of results as it is not testing what we want
 33 // (namely that the disabled value is passed to the final sheet).
 34 shouldBeNonNull("mainSheetLink.sheet");
 35 shouldBeNonNull("alternateSheetLink.sheet");
 36
 37 shouldBeTrue("mainSheetLink.disabled");
 38 shouldBeFalse("alternateSheetLink.disabled");
 39
 40 finishJSTest();
 41}
 42
 43onSheetLoaded(testWhenLoaded, alternateSheetLink, 500);
 44
 45var successfullyParsed = true;

LayoutTests/http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet.js

 1description("Test that HTMLLinkElement's disabled attribute is properly cached while set when loading a stylesheet.");
 2
 3if (window.layoutTestController)
 4 layoutTestController.waitUntilDone();
 5
 6window.jsTestIsAsync = true;
 7
 8mainSheetLink = document.getElementsByTagName("link")[0];
 9alternateSheetLink = document.getElementsByTagName("link")[1];
 10
 11mainSheetLink.disabled = true;
 12alternateSheetLink.disabled = false;
 13
 14debug("Testing value of 'disabled' prior to load just after setting them");
 15shouldBeNonNull("mainSheetLink.sheet");
 16shouldBeNull("alternateSheetLink.sheet");
 17shouldBeTrue("mainSheetLink.disabled", true);
 18shouldBeFalse("alternateSheetLink.disabled");
 19
 20debug("Testing the values when the alternate sheet is loaded (as this is the only one that has sheet() === null)");
 21
 22function onSheetLoaded(f, elem, maxtime) {
 23 if (elem.sheet || maxtime <= 0)
 24 f();
 25 else
 26 setTimeout(function () { onSheetLoaded(f, elem, maxtime - 25);}, 25);
 27}
 28
 29function testWhenLoaded() {
 30 // Those next 2 lines are a sanity check.
 31 // If the second check fails, it is likely that the test timed out and thus
 32 // you can discard the rest of results as it is not testing what we want
 33 // (namely that the disabled value is passed to the final sheet).
 34 shouldBeNonNull("mainSheetLink.sheet");
 35 shouldBeNonNull("alternateSheetLink.sheet");
 36
 37 shouldBeTrue("mainSheetLink.disabled");
 38 shouldBeFalse("alternateSheetLink.disabled");
 39
 40 finishJSTest();
 41}
 42
 43onSheetLoaded(testWhenLoaded, alternateSheetLink, 500);
 44
 45var successfullyParsed = true;

LayoutTests/http/tests/css/resources/slow-loading-sheet-in-error.php

 1<?php
 2// We sleep here so that we are have enough time to test the different attributes before the stylesheet is fully loaded.
 3usleep(100);
 4
 5header("HTTP/1.0 500 Internal Error");
 6header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
 7header("Cache-Control: no-cache, no-store, must-revalidate");
 8header("Pragma: no-cache");
 9header("Content-Type: text/css");
 10
 11ob_flush();
 12flush();
 13?>

LayoutTests/http/tests/css/resources/slow-loading-sheet.php

 1<?php
 2// We sleep here so that we are have enough time to test the different attributes before the stylesheet is fully loaded.
 3usleep(100);
 4
 5header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
 6header("Cache-Control: no-cache, no-store, must-revalidate");
 7header("Pragma: no-cache");
 8header("Content-Type: text/css");
 9
 10$color = $_GET['color'];
 11
 12echo "h1 { background-color: $color }\n";
 13ob_flush();
 14flush();
 15?>

Source/WebCore/ChangeLog

 12011-09-01 Julien Chaffraix <[email protected]>
 2
 3 REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
 4 https://bugs.webkit.org/show_bug.cgi?id=65140
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Tests: fast/css/stylesheet-enable-first-alternate-link.html
 9 fast/css/stylesheet-enable-first-alternate-on-load-link.html
 10 fast/css/stylesheet-enable-first-alternate-on-load-sheet.html
 11 fast/css/stylesheet-enable-second-alternate-link.html
 12 fast/css/stylesheet-enable-second-alternate-on-load-link.html
 13 fast/css/stylesheet-enable-second-alternate-on-load-sheet.html
 14 http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error.html
 15 http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html
 16
 17 This patch basically reverts 88479 and 84329 while keeping the tests
 18 we developped during the implementation.
 19
 20 Following discussion, it looks like HTML5 will need to be amended.
 21 In the meantime, we will just revert the changes so that we can come
 22 up with a better change.
 23
 24 * dom/Document.cpp:
 25 (WebCore::Document::recalcStyleSelector):
 26 * html/HTMLLinkElement.cpp:
 27 (WebCore::HTMLLinkElement::HTMLLinkElement):
 28 (WebCore::HTMLLinkElement::setDisabledState):
 29 (WebCore::HTMLLinkElement::parseMappedAttribute):
 30 (WebCore::HTMLLinkElement::process):
 31 Revert those method to their original content.
 32
 33 * html/HTMLLinkElement.h:
 34 (WebCore::HTMLLinkElement::isDisabled):
 35 (WebCore::HTMLLinkElement::isEnabledViaScript):
 36 (WebCore::HTMLLinkElement::isAlternate):
 37 Re-introduced the DisabledState enum.
 38
 39 * html/HTMLLinkElement.idl: |disabled| is Reflect'ed again.
 40
1412011-08-09 Emil A Eklund <[email protected]>
242
343 Switch RenderBlock to to new layout types

Source/WebCore/dom/Document.cpp

@@void Document::recalcStyleSelector()
29632963 if (e->hasLocalName(linkTag)) {
29642964 // <LINK> element
29652965 HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(n);
2966  if (linkElement->disabled())
 2966 if (linkElement->isDisabled())
29672967 continue;
29682968 enabledViaScript = linkElement->isEnabledViaScript();
29692969 if (linkElement->isLoading()) {

Source/WebCore/html/HTMLLinkElement.cpp

@@inline HTMLLinkElement::HTMLLinkElement(const QualifiedName& tagName, Document*
5555 : HTMLElement(tagName, document)
5656 , m_linkLoader(this)
5757 , m_sizes(DOMSettableTokenList::create())
 58 , m_disabledState(Unset)
5859 , m_loading(false)
59  , m_isEnabledViaScript(false)
6060 , m_createdByParser(createdByParser)
6161 , m_isInShadowTree(false)
6262 , m_pendingSheetType(None)

@@HTMLLinkElement::~HTMLLinkElement()
8080 }
8181}
8282
83 void HTMLLinkElement::setDisabled(bool disabled)
 83void HTMLLinkElement::setDisabledState(bool disabled)
8484{
85  if (!m_sheet)
86  return;
87 
88  bool wasDisabled = m_sheet->disabled();
89  if (wasDisabled == disabled)
90  return;
91 
92  m_sheet->setDisabled(disabled);
93  m_isEnabledViaScript = !disabled;
94 
95  // If we change the disabled state while the sheet is still loading, then we have to
96  // perform three checks:
97  if (isLoading()) {
98  // Check #1: The sheet becomes disabled while loading.
99  if (disabled)
100  removePendingSheet();
101 
102  // Check #2: An alternate sheet becomes enabled while it is still loading.
103  if (m_relAttribute.m_isAlternate && !disabled)
104  addPendingSheet(Blocking);
105 
106  // Check #3: A main sheet becomes enabled while it was still loading and
107  // after it was disabled via script. It takes really terrible code to make this
108  // happen (a double toggle for no reason essentially). This happens on
109  // virtualplastic.net, which manages to do about 12 enable/disables on only 3
110  // sheets. :)
111  if (!m_relAttribute.m_isAlternate && !disabled && wasDisabled)
112  addPendingSheet(Blocking);
 85 DisabledState oldDisabledState = m_disabledState;
 86 m_disabledState = disabled ? Disabled : EnabledViaScript;
 87 if (oldDisabledState != m_disabledState) {
 88 // If we change the disabled state while the sheet is still loading, then we have to
 89 // perform three checks:
 90 if (isLoading()) {
 91 // Check #1: The sheet becomes disabled while loading.
 92 if (m_disabledState == Disabled)
 93 removePendingSheet();
 94
 95 // Check #2: An alternate sheet becomes enabled while it is still loading.
 96 if (m_relAttribute.m_isAlternate && m_disabledState == EnabledViaScript)
 97 addPendingSheet(Blocking);
 98
 99 // Check #3: A main sheet becomes enabled while it was still loading and
 100 // after it was disabled via script. It takes really terrible code to make this
 101 // happen (a double toggle for no reason essentially). This happens on
 102 // virtualplastic.net, which manages to do about 12 enable/disables on only 3
 103 // sheets. :)
 104 if (!m_relAttribute.m_isAlternate && m_disabledState == EnabledViaScript && oldDisabledState == Disabled)
 105 addPendingSheet(Blocking);
 106
 107 // If the sheet is already loading just bail.
 108 return;
 109 }
113110
114  // If the sheet is already loading just bail.
115  return;
 111 // Load the sheet, since it's never been loaded before.
 112 if (!m_sheet && m_disabledState == EnabledViaScript)
 113 process();
 114 else
 115 document()->styleSelectorChanged(DeferRecalcStyle); // Update the style selector.
116116 }
117 
118  if (!disabled)
119  process();
120117}
121118
122119StyleSheet* HTMLLinkElement::sheet() const

@@void HTMLLinkElement::parseMappedAttribute(Attribute* attr)
141138 } else if (attr->name() == mediaAttr) {
142139 m_media = attr->value().string().lower();
143140 process();
144  } else if (attr->name() == onbeforeloadAttr)
 141 } else if (attr->name() == disabledAttr)
 142 setDisabledState(!attr->isNull());
 143 else if (attr->name() == onbeforeloadAttr)
145144 setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr));
146145#if ENABLE(LINK_PREFETCH)
147146 else if (attr->name() == onloadAttr)

@@void HTMLLinkElement::process()
181180
182181 bool acceptIfTypeContainsTextCSS = document()->page() && document()->page()->settings() && document()->page()->settings()->treatsAnyTextCSSLinkAsStylesheet();
183182
184  if (!disabled() && (m_relAttribute.m_isStyleSheet || (acceptIfTypeContainsTextCSS && type.contains("text/css")))
 183 if (m_disabledState != Disabled && (m_relAttribute.m_isStyleSheet || (acceptIfTypeContainsTextCSS && type.contains("text/css")))
185184 && document()->frame() && m_url.isValid()) {
186185
187186 String charset = getAttribute(charsetAttr);

@@void HTMLLinkElement::removePendingSheet()
440439 document()->removePendingSheet();
441440}
442441
443 bool HTMLLinkElement::disabled() const
444 {
445  return m_sheet && m_sheet->disabled();
446 }
447 
448442DOMSettableTokenList* HTMLLinkElement::sizes() const
449443{
450444 return m_sizes.get();

Source/WebCore/html/HTMLLinkElement.h

@@public:
5757
5858 // FIXME: This should be renamed isStyleSheetLoading as this is only used for stylesheets.
5959 bool isLoading() const;
60  bool isEnabledViaScript() const { return m_isEnabledViaScript; }
61  bool disabled() const;
62  void setDisabled(bool);
 60
 61 bool isDisabled() const { return m_disabledState == Disabled; }
 62 bool isEnabledViaScript() const { return m_disabledState == EnabledViaScript; }
6363 void setSizes(const String&);
6464 DOMSettableTokenList* sizes() const;
6565

@@private:
8181 virtual void linkLoaded();
8282 virtual void linkLoadingErrored();
8383
84  bool isAlternate() const { return m_relAttribute.m_isAlternate; }
 84 bool isAlternate() const { return m_disabledState == Unset && m_relAttribute.m_isAlternate; }
8585
 86 void setDisabledState(bool);
 87
8688 virtual bool isURLAttribute(Attribute*) const;
8789
8890private:

@@private:
100102 LinkLoader m_linkLoader;
101103 CachedResourceHandle<CachedCSSStyleSheet> m_cachedSheet;
102104 RefPtr<CSSStyleSheet> m_sheet;
 105 enum DisabledState {
 106 Unset,
 107 EnabledViaScript,
 108 Disabled
 109 };
 110
103111 KURL m_url;
104112 String m_type;
105113 String m_media;
106114 RefPtr<DOMSettableTokenList> m_sizes;
 115 DisabledState m_disabledState;
107116 LinkRelAttribute m_relAttribute;
108117 bool m_loading;
109  bool m_isEnabledViaScript;
110118 bool m_createdByParser;
111119 bool m_isInShadowTree;
112120

Source/WebCore/html/HTMLLinkElement.idl

2222module html {
2323
2424 interface HTMLLinkElement : HTMLElement {
25  attribute boolean disabled;
 25 attribute [Reflect] boolean disabled;
2626 attribute [Reflect] DOMString charset;
2727 attribute [Reflect, URL] DOMString href;
2828 attribute [Reflect] DOMString hreflang;