OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <script src="resources/link-load-utilities.js" media="all"></script> | |
5 | |
6 <div><link id=thelink rel=stylesheet></div> | |
7 | |
8 <script> | |
9 if (window.testRunner) { | |
10 testRunner.dumpResourceResponseMIMETypes(); | |
11 } | |
12 | |
13 var theLink = document.getElementById("thelink"); | |
14 | |
15 var beforeloadRecurseCount = 5; | |
16 | |
17 function linkBeforeLoadHandler() { | |
18 log("Entering linkBeforeLoadHandler()."); | |
19 if (--beforeloadRecurseCount > 1) { | |
20 var newHrefAttr = theLink.getAttribute("href") + "#" + beforeloadRecurse
Count; | |
21 theLink.setAttribute("href", newHrefAttr); | |
22 } else if (beforeloadRecurseCount == 1) { | |
23 theLink.setAttribute("href", "resources/stylesheet-pre-pass.css"); | |
24 } | |
25 log("Exiting linkBeforeLoadHandler()."); | |
26 return true; | |
27 } | |
28 | |
29 function runTest() { | |
30 theLink.addEventListener("beforeload", linkBeforeLoadHandler); | |
31 | |
32 theLink.setAttribute("href", "resources/stylesheet-pre-fail.css"); | |
33 | |
34 <!-- Remove the element from the document and clean garbage, which will caus
e a crash --> | |
35 <!-- if the recursive beforeload calls caused extra client registration in t
he loader. --> | |
36 theLink.parentNode.removeChild(theLink); | |
37 theLink = null; | |
38 window.GCController.collect(); | |
39 setTimeout('testFinished()', 0); | |
40 } | |
41 </script> | |
42 | |
43 </head> | |
44 <body onload="runTest()"> | |
45 <p>This tests that a beforeload event can mutate the firing link element. This t
est passes if it does | |
46 not crash and the link element only loads its final (innermost) style sheet | |
47 <pre id="console"></pre> | |
48 </body> | |
49 </html> | |
OLD | NEW |