View | Details | Raw Unified | Return to bug 65140 | Differences between
and this patch

Collapse All | Expand All

(-)a/LayoutTests/ChangeLog (+43 lines)
Lines 1-3 Link Here
1
2011-09-01  Julien Chaffraix  <jchaffraix@webkit.org>
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
1
2011-08-09  Kent Tamura  <tkent@chromium.org>
44
2011-08-09  Kent Tamura  <tkent@chromium.org>
2
45
3
        Move <input type=month> tests to fast/forms/month/
46
        Move <input type=month> tests to fast/forms/month/
(-)a/LayoutTests/fast/css/link-disabled-attr-expected.txt (-4 / +4 lines)
Lines 3-17 Test for bug 61400: REGRESSION(84329): Stylesheets on some pages do not load Link Here
3
3
4
notsheet
4
notsheet
5
PASS link.sheet is null
5
PASS link.sheet is null
6
PASS link.disabled is false
6
FAIL link.disabled should be false. Was true.
7
sheet
7
sheet
8
PASS link.sheet is non-null.
8
PASS link.sheet is non-null.
9
PASS link.disabled is true
9
FAIL link.disabled should be true. Was false.
10
PASS link.sheet.disabled is true
10
PASS link.sheet.disabled is true
11
PASS getComputedStyle(console).whiteSpace is 'normal'
11
PASS getComputedStyle(console).whiteSpace is 'normal'
12
PASS link.disabled is false
12
PASS link.disabled is false
13
PASS link.sheet.disabled is false
13
FAIL link.sheet.disabled should be false. Was true.
14
PASS getComputedStyle(console).whiteSpace is 'pre-wrap'
14
FAIL getComputedStyle(console).whiteSpace should be pre-wrap. Was normal.
15
altsheet
15
altsheet
16
FAIL link.disabled should be true. Was false.
16
FAIL link.disabled should be true. Was false.
17
PASS link.sheet is non-null.
17
PASS link.sheet is non-null.
(-)a/LayoutTests/fast/css/stylesheet-enable-first-alternate-link-expected.txt (+5 lines)
Line 0 Link Here
1
Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
2
3
This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
4
5
PASSED
(-)a/LayoutTests/fast/css/stylesheet-enable-first-alternate-link.html (+31 lines)
Line 0 Link Here
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>
(-)a/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load-link-expected.txt (+5 lines)
Line 0 Link Here
1
Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
2
3
This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
4
5
PASSED
(-)a/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load-link.html (+31 lines)
Line 0 Link Here
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>
(-)a/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load-sheet-expected.txt (+5 lines)
Line 0 Link Here
1
Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
2
3
This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
4
5
FAILED, background = rgba(0, 0, 0, 0)
(-)a/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load-sheet.html (+31 lines)
Line 0 Link Here
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>
(-)a/LayoutTests/fast/css/stylesheet-enable-second-alternate-link-expected.txt (+5 lines)
Line 0 Link Here
1
Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
2
3
This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
4
5
FAILED, background = rgba(0, 0, 0, 0)
(-)a/LayoutTests/fast/css/stylesheet-enable-second-alternate-link.html (+31 lines)
Line 0 Link Here
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>
(-)a/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load-link-expected.txt (+5 lines)
Line 0 Link Here
1
Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
2
3
This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
4
5
FAILED, background = rgba(0, 0, 0, 0)
(-)a/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load-link.html (+31 lines)
Line 0 Link Here
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>
(-)a/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load-sheet-expected.txt (+5 lines)
Line 0 Link Here
1
Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
2
3
This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
4
5
FAILED, background = rgba(0, 0, 0, 0)
(-)a/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load-sheet.html (+31 lines)
Line 0 Link Here
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>
(-)a/LayoutTests/fast/dom/HTMLLinkElement/disabled-attribute-expected.txt (-3 / +3 lines)
Lines 5-18 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE Link Here
5
5
6
PASS test.disabled is false
6
PASS test.disabled is false
7
PASS test.disabled is true
7
PASS test.disabled is true
8
PASS test.sheet.disabled is true
8
FAIL test.sheet.disabled should be true. Was false.
9
PASS test.sheet.disabled is false
9
PASS test.sheet.disabled is false
10
PASS test.disabled is false
10
FAIL test.disabled should be false. Was true.
11
11
12
12
13
PASS test_nostyle.sheet is null
13
PASS test_nostyle.sheet is null
14
PASS test_nostyle.disabled is false
14
PASS test_nostyle.disabled is false
15
PASS test_nostyle.disabled is false
15
FAIL test_nostyle.disabled should be false. Was true.
16
PASS successfullyParsed is true
16
PASS successfullyParsed is true
17
17
18
TEST COMPLETE
18
TEST COMPLETE
(-)a/LayoutTests/fast/dom/boolean-attribute-reflection-expected.txt (+4 lines)
Lines 59-64 PASS e = make('input'); e.removeAttribute('required'); e.required is false Link Here
59
PASS e = make('input'); e.setAttribute('required', ''); e.required is true
59
PASS e = make('input'); e.setAttribute('required', ''); e.required is true
60
PASS e = make('input'); e.setAttribute('required', 'x'); e.required = false; e.getAttribute('required') is null
60
PASS e = make('input'); e.setAttribute('required', 'x'); e.required = false; e.getAttribute('required') is null
61
PASS e = make('input'); e.setAttribute('required', 'x'); e.required = true; e.getAttribute('required') is ''
61
PASS e = make('input'); e.setAttribute('required', 'x'); e.required = true; e.getAttribute('required') is ''
62
PASS e = make('link'); e.removeAttribute('disabled'); e.disabled is false
63
PASS e = make('link'); e.setAttribute('disabled', ''); e.disabled is true
64
PASS e = make('link'); e.setAttribute('disabled', 'x'); e.disabled = false; e.getAttribute('disabled') is null
65
PASS e = make('link'); e.setAttribute('disabled', 'x'); e.disabled = true; e.getAttribute('disabled') is ''
62
PASS e = make('menu'); e.removeAttribute('compact'); e.compact is false
66
PASS e = make('menu'); e.removeAttribute('compact'); e.compact is false
63
PASS e = make('menu'); e.setAttribute('compact', ''); e.compact is true
67
PASS e = make('menu'); e.setAttribute('compact', ''); e.compact is true
64
PASS e = make('menu'); e.setAttribute('compact', 'x'); e.compact = false; e.getAttribute('compact') is null
68
PASS e = make('menu'); e.setAttribute('compact', 'x'); e.compact = false; e.getAttribute('compact') is null
(-)a/LayoutTests/fast/dom/script-tests/boolean-attribute-reflection.js (+1 lines)
Lines 15-20 var attributes = [ Link Here
15
    [ "input", "multiple" ],
15
    [ "input", "multiple" ],
16
    [ "input", "readOnly" ],
16
    [ "input", "readOnly" ],
17
    [ "input", "required" ],
17
    [ "input", "required" ],
18
    [ "link", "disabled" ],
18
    [ "menu", "compact" ],
19
    [ "menu", "compact" ],
19
    [ "object", "declare" ],
20
    [ "object", "declare" ],
20
    [ "ol", "compact" ],
21
    [ "ol", "compact" ],
(-)a/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-expected.txt (+19 lines)
Line 0 Link Here
1
Test that HTMLLinkElement's disabled attribute is properly cached while set when loading a stylesheet.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
Testing value of 'disabled' prior to load just after setting them
7
PASS mainSheetLink.sheet is non-null.
8
PASS alternateSheetLink.sheet is null
9
PASS mainSheetLink.disabled is true
10
PASS alternateSheetLink.disabled is false
11
Testing the values when the alternate sheet is loaded (as this is the only one that has sheet() === null)
12
PASS mainSheetLink.sheet is non-null.
13
PASS alternateSheetLink.sheet is non-null.
14
PASS mainSheetLink.disabled is true
15
PASS alternateSheetLink.disabled is false
16
PASS successfullyParsed is true
17
18
TEST COMPLETE
19
(-)a/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error-expected.txt (+19 lines)
Line 0 Link Here
1
Test that HTMLLinkElement's disabled attribute is properly cached while set when loading a stylesheet.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
Testing value of 'disabled' prior to load just after setting them
7
PASS mainSheetLink.sheet is non-null.
8
PASS alternateSheetLink.sheet is null
9
PASS mainSheetLink.disabled is true
10
PASS alternateSheetLink.disabled is false
11
Testing the values when the alternate sheet is loaded (as this is the only one that has sheet() === null)
12
PASS mainSheetLink.sheet is non-null.
13
PASS alternateSheetLink.sheet is non-null.
14
PASS mainSheetLink.disabled is true
15
PASS alternateSheetLink.disabled is false
16
PASS successfullyParsed is true
17
18
TEST COMPLETE
19
(-)a/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error.html (+14 lines)
Line 0 Link Here
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>
(-)a/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html (+14 lines)
Line 0 Link Here
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>
(-)a/LayoutTests/http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet-in-error.js (+45 lines)
Line 0 Link Here
1
description("Test that HTMLLinkElement's disabled attribute is properly cached while set when loading a stylesheet.");
2
3
if (window.layoutTestController)
4
    layoutTestController.waitUntilDone();
5
6
window.jsTestIsAsync = true;
7
8
mainSheetLink = document.getElementsByTagName("link")[0];
9
alternateSheetLink = document.getElementsByTagName("link")[1];
10
11
mainSheetLink.disabled = true;
12
alternateSheetLink.disabled = false;
13
14
debug("Testing value of 'disabled' prior to load just after setting them");
15
shouldBeNonNull("mainSheetLink.sheet");
16
shouldBeNull("alternateSheetLink.sheet");
17
shouldBeTrue("mainSheetLink.disabled", true);
18
shouldBeFalse("alternateSheetLink.disabled");
19
20
debug("Testing the values when the alternate sheet is loaded (as this is the only one that has sheet() === null)");
21
22
function 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
29
function 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
43
onSheetLoaded(testWhenLoaded, alternateSheetLink, 500);
44
45
var successfullyParsed = true;
(-)a/LayoutTests/http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet.js (+45 lines)
Line 0 Link Here
1
description("Test that HTMLLinkElement's disabled attribute is properly cached while set when loading a stylesheet.");
2
3
if (window.layoutTestController)
4
    layoutTestController.waitUntilDone();
5
6
window.jsTestIsAsync = true;
7
8
mainSheetLink = document.getElementsByTagName("link")[0];
9
alternateSheetLink = document.getElementsByTagName("link")[1];
10
11
mainSheetLink.disabled = true;
12
alternateSheetLink.disabled = false;
13
14
debug("Testing value of 'disabled' prior to load just after setting them");
15
shouldBeNonNull("mainSheetLink.sheet");
16
shouldBeNull("alternateSheetLink.sheet");
17
shouldBeTrue("mainSheetLink.disabled", true);
18
shouldBeFalse("alternateSheetLink.disabled");
19
20
debug("Testing the values when the alternate sheet is loaded (as this is the only one that has sheet() === null)");
21
22
function 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
29
function 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
43
onSheetLoaded(testWhenLoaded, alternateSheetLink, 500);
44
45
var successfullyParsed = true;
(-)a/LayoutTests/http/tests/css/resources/slow-loading-sheet-in-error.php (+13 lines)
Line 0 Link Here
1
<?php
2
// We sleep here so that we are have enough time to test the different attributes before the stylesheet is fully loaded.
3
usleep(100);
4
5
header("HTTP/1.0 500 Internal Error");
6
header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
7
header("Cache-Control: no-cache, no-store, must-revalidate");
8
header("Pragma: no-cache");
9
header("Content-Type: text/css");
10
11
ob_flush();
12
flush();
13
?>
(-)a/LayoutTests/http/tests/css/resources/slow-loading-sheet.php (+15 lines)
Line 0 Link Here
1
<?php
2
// We sleep here so that we are have enough time to test the different attributes before the stylesheet is fully loaded.
3
usleep(100);
4
5
header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
6
header("Cache-Control: no-cache, no-store, must-revalidate");
7
header("Pragma: no-cache");
8
header("Content-Type: text/css");
9
10
$color = $_GET['color'];
11
12
echo "h1 { background-color: $color }\n";
13
ob_flush();
14
flush();
15
?>
(-)a/Source/WebCore/ChangeLog (+40 lines)
Lines 1-3 Link Here
1
2011-09-01  Julien Chaffraix  <jchaffraix@webkit.org>
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
1
2011-08-09  Emil A Eklund  <eae@chromium.org>
41
2011-08-09  Emil A Eklund  <eae@chromium.org>
2
42
3
        Switch RenderBlock to to new layout types
43
        Switch RenderBlock to to new layout types
(-)a/Source/WebCore/dom/Document.cpp (-1 / +1 lines)
Lines 2963-2969 void Document::recalcStyleSelector() Link Here
2963
            if (e->hasLocalName(linkTag)) {
2963
            if (e->hasLocalName(linkTag)) {
2964
                // <LINK> element
2964
                // <LINK> element
2965
                HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(n);
2965
                HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(n);
2966
                if (linkElement->disabled())
2966
                if (linkElement->isDisabled())
2967
                    continue;
2967
                    continue;
2968
                enabledViaScript = linkElement->isEnabledViaScript();
2968
                enabledViaScript = linkElement->isEnabledViaScript();
2969
                if (linkElement->isLoading()) {
2969
                if (linkElement->isLoading()) {
(-)a/Source/WebCore/html/HTMLLinkElement.cpp (-42 / +36 lines)
Lines 55-62 inline HTMLLinkElement::HTMLLinkElement(const QualifiedName& tagName, Document* Link Here
55
    : HTMLElement(tagName, document)
55
    : HTMLElement(tagName, document)
56
    , m_linkLoader(this)
56
    , m_linkLoader(this)
57
    , m_sizes(DOMSettableTokenList::create())
57
    , m_sizes(DOMSettableTokenList::create())
58
    , m_disabledState(Unset)
58
    , m_loading(false)
59
    , m_loading(false)
59
    , m_isEnabledViaScript(false)
60
    , m_createdByParser(createdByParser)
60
    , m_createdByParser(createdByParser)
61
    , m_isInShadowTree(false)
61
    , m_isInShadowTree(false)
62
    , m_pendingSheetType(None)
62
    , m_pendingSheetType(None)
Lines 80-122 HTMLLinkElement::~HTMLLinkElement() Link Here
80
    }
80
    }
81
}
81
}
82
82
83
void HTMLLinkElement::setDisabled(bool disabled)
83
void HTMLLinkElement::setDisabledState(bool disabled)
84
{
84
{
85
    if (!m_sheet)
85
    DisabledState oldDisabledState = m_disabledState;
86
        return;
86
    m_disabledState = disabled ? Disabled : EnabledViaScript;
87
87
    if (oldDisabledState != m_disabledState) {
88
    bool wasDisabled = m_sheet->disabled();
88
        // If we change the disabled state while the sheet is still loading, then we have to
89
    if (wasDisabled == disabled)
89
        // perform three checks:
90
        return;
90
        if (isLoading()) {
91
91
            // Check #1: The sheet becomes disabled while loading.
92
    m_sheet->setDisabled(disabled);
92
            if (m_disabledState == Disabled)
93
    m_isEnabledViaScript = !disabled;
93
                removePendingSheet();
94
94
95
    // If we change the disabled state while the sheet is still loading, then we have to
95
            // Check #2: An alternate sheet becomes enabled while it is still loading.
96
    // perform three checks:
96
            if (m_relAttribute.m_isAlternate && m_disabledState == EnabledViaScript)
97
    if (isLoading()) {
97
                addPendingSheet(Blocking);
98
        // Check #1: The sheet becomes disabled while loading.
98
99
        if (disabled)
99
            // Check #3: A main sheet becomes enabled while it was still loading and
100
            removePendingSheet();
100
            // after it was disabled via script. It takes really terrible code to make this
101
101
            // happen (a double toggle for no reason essentially). This happens on
102
        // Check #2: An alternate sheet becomes enabled while it is still loading.
102
            // virtualplastic.net, which manages to do about 12 enable/disables on only 3
103
        if (m_relAttribute.m_isAlternate && !disabled)
103
            // sheets. :)
104
            addPendingSheet(Blocking);
104
            if (!m_relAttribute.m_isAlternate && m_disabledState == EnabledViaScript && oldDisabledState == Disabled)
105
105
                addPendingSheet(Blocking);
106
        // Check #3: A main sheet becomes enabled while it was still loading and
106
107
        // after it was disabled via script. It takes really terrible code to make this
107
            // If the sheet is already loading just bail.
108
        // happen (a double toggle for no reason essentially). This happens on
108
            return;
109
        // virtualplastic.net, which manages to do about 12 enable/disables on only 3
109
        }
110
        // sheets. :)
111
        if (!m_relAttribute.m_isAlternate && !disabled && wasDisabled)
112
            addPendingSheet(Blocking);
113
110
114
        // If the sheet is already loading just bail.
111
        // Load the sheet, since it's never been loaded before.
115
        return;
112
        if (!m_sheet && m_disabledState == EnabledViaScript)
113
            process();
114
        else
115
            document()->styleSelectorChanged(DeferRecalcStyle); // Update the style selector.
116
    }
116
    }
117
118
    if (!disabled)
119
        process();
120
}
117
}
121
118
122
StyleSheet* HTMLLinkElement::sheet() const
119
StyleSheet* HTMLLinkElement::sheet() const
Lines 141-147 void HTMLLinkElement::parseMappedAttribute(Attribute* attr) Link Here
141
    } else if (attr->name() == mediaAttr) {
138
    } else if (attr->name() == mediaAttr) {
142
        m_media = attr->value().string().lower();
139
        m_media = attr->value().string().lower();
143
        process();
140
        process();
144
    } else if (attr->name() == onbeforeloadAttr)
141
    } else if (attr->name() == disabledAttr)
142
        setDisabledState(!attr->isNull());
143
    else if (attr->name() == onbeforeloadAttr)
145
        setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr));
144
        setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr));
146
#if ENABLE(LINK_PREFETCH)
145
#if ENABLE(LINK_PREFETCH)
147
    else if (attr->name() == onloadAttr)
146
    else if (attr->name() == onloadAttr)
Lines 181-187 void HTMLLinkElement::process() Link Here
181
180
182
    bool acceptIfTypeContainsTextCSS = document()->page() && document()->page()->settings() && document()->page()->settings()->treatsAnyTextCSSLinkAsStylesheet();
181
    bool acceptIfTypeContainsTextCSS = document()->page() && document()->page()->settings() && document()->page()->settings()->treatsAnyTextCSSLinkAsStylesheet();
183
182
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")))
185
        && document()->frame() && m_url.isValid()) {
184
        && document()->frame() && m_url.isValid()) {
186
        
185
        
187
        String charset = getAttribute(charsetAttr);
186
        String charset = getAttribute(charsetAttr);
Lines 440-450 void HTMLLinkElement::removePendingSheet() Link Here
440
    document()->removePendingSheet();
439
    document()->removePendingSheet();
441
}
440
}
442
441
443
bool HTMLLinkElement::disabled() const
444
{
445
    return m_sheet && m_sheet->disabled();
446
}
447
448
DOMSettableTokenList* HTMLLinkElement::sizes() const
442
DOMSettableTokenList* HTMLLinkElement::sizes() const
449
{
443
{
450
    return m_sizes.get();
444
    return m_sizes.get();
(-)a/Source/WebCore/html/HTMLLinkElement.h (-5 / +13 lines)
Lines 57-65 public: Link Here
57
57
58
    // FIXME: This should be renamed isStyleSheetLoading as this is only used for stylesheets.
58
    // FIXME: This should be renamed isStyleSheetLoading as this is only used for stylesheets.
59
    bool isLoading() const;
59
    bool isLoading() const;
60
    bool isEnabledViaScript() const { return m_isEnabledViaScript; }
60
61
    bool disabled() const;
61
    bool isDisabled() const { return m_disabledState == Disabled; }
62
    void setDisabled(bool);
62
    bool isEnabledViaScript() const { return m_disabledState == EnabledViaScript; }
63
    void setSizes(const String&);
63
    void setSizes(const String&);
64
    DOMSettableTokenList* sizes() const;
64
    DOMSettableTokenList* sizes() const;
65
65
Lines 81-88 private: Link Here
81
    virtual void linkLoaded();
81
    virtual void linkLoaded();
82
    virtual void linkLoadingErrored();
82
    virtual void linkLoadingErrored();
83
83
84
    bool isAlternate() const { return m_relAttribute.m_isAlternate; }
84
    bool isAlternate() const { return m_disabledState == Unset && m_relAttribute.m_isAlternate; }
85
    
85
    
86
    void setDisabledState(bool);
87
86
    virtual bool isURLAttribute(Attribute*) const;
88
    virtual bool isURLAttribute(Attribute*) const;
87
89
88
private:
90
private:
Lines 100-112 private: Link Here
100
    LinkLoader m_linkLoader;
102
    LinkLoader m_linkLoader;
101
    CachedResourceHandle<CachedCSSStyleSheet> m_cachedSheet;
103
    CachedResourceHandle<CachedCSSStyleSheet> m_cachedSheet;
102
    RefPtr<CSSStyleSheet> m_sheet;
104
    RefPtr<CSSStyleSheet> m_sheet;
105
    enum DisabledState {
106
        Unset,
107
        EnabledViaScript,
108
        Disabled
109
    };
110
103
    KURL m_url;
111
    KURL m_url;
104
    String m_type;
112
    String m_type;
105
    String m_media;
113
    String m_media;
106
    RefPtr<DOMSettableTokenList> m_sizes;
114
    RefPtr<DOMSettableTokenList> m_sizes;
115
    DisabledState m_disabledState;
107
    LinkRelAttribute m_relAttribute;
116
    LinkRelAttribute m_relAttribute;
108
    bool m_loading;
117
    bool m_loading;
109
    bool m_isEnabledViaScript;
110
    bool m_createdByParser;
118
    bool m_createdByParser;
111
    bool m_isInShadowTree;
119
    bool m_isInShadowTree;
112
    
120
    
(-)a/Source/WebCore/html/HTMLLinkElement.idl (-1 / +1 lines)
Lines 22-28 Link Here
22
module html {
22
module html {
23
23
24
    interface HTMLLinkElement : HTMLElement {
24
    interface HTMLLinkElement : HTMLElement {
25
        attribute boolean disabled;
25
        attribute [Reflect] boolean disabled;
26
        attribute [Reflect] DOMString charset;
26
        attribute [Reflect] DOMString charset;
27
        attribute [Reflect, URL] DOMString href;
27
        attribute [Reflect, URL] DOMString href;
28
        attribute [Reflect] DOMString hreflang;
28
        attribute [Reflect] DOMString hreflang;

Return to bug 65140