Diff
Modified: trunk/LayoutTests/ChangeLog (100368 => 100369)
--- trunk/LayoutTests/ChangeLog 2011-11-16 00:43:50 UTC (rev 100368)
+++ trunk/LayoutTests/ChangeLog 2011-11-16 00:45:48 UTC (rev 100369)
@@ -1,3 +1,23 @@
+2011-11-15 Erik Arvidsson <[email protected]>
+
+ JS Test Harness: Remove need to load external css file to reduce flakiness
+ https://bugs.webkit.org/show_bug.cgi?id=72295
+
+ Reviewed by Ojan Vafai.
+
+ Before this patch we pulled in the external CSS file using a link tag. Since this was created dynamically
+ it might not be loaded and applied when we dump the text for the test. Since the CSS contains white-space
+ pre-wrap the output was therefore different depending on this race condition. By changing this to use a
+ style element with the CSS inline there is no longer a race condition.
+
+ * css3/font-feature-settings-parsing.html: Change the order of script and stylesheets so that the injected style element does not affect the test.
+ * fast/css/counters/counter-cssText.html: Ditto.
+ * fast/css/counters/getCounterValue.html: Ditto.
+ * fast/dom/StyleSheet/gc-styleheet-wrapper.xhtml: Ditto.
+ * traversal/script-tests/exception-forwarding.js: Ditto.
+ * fast/dom/script-tests/domListEnumeration.js: Update the tests to use the right style elements.
+ * fast/js/resources/js-test-pre.js: Insert a style element with the css instead of a link element pointing to an external css file.
+
2011-11-15 Peter Kasting <[email protected]>
Mark a test as flakily failing.
Modified: trunk/LayoutTests/css3/font-feature-settings-parsing.html (100368 => 100369)
--- trunk/LayoutTests/css3/font-feature-settings-parsing.html 2011-11-16 00:43:50 UTC (rev 100368)
+++ trunk/LayoutTests/css3/font-feature-settings-parsing.html 2011-11-16 00:45:48 UTC (rev 100369)
@@ -1,6 +1,5 @@
<html>
<head>
-<script src=""
<style>
#valid_normal {
-webkit-font-feature-settings: normal;
@@ -127,6 +126,7 @@
-webkit-font-feature-settings: aaaaa;
}
</style>
+<script src=""
</head>
<body>
<div id="valid_normal"></div>
Modified: trunk/LayoutTests/fast/css/counters/counter-cssText.html (100368 => 100369)
--- trunk/LayoutTests/fast/css/counters/counter-cssText.html 2011-11-16 00:43:50 UTC (rev 100368)
+++ trunk/LayoutTests/fast/css/counters/counter-cssText.html 2011-11-16 00:45:48 UTC (rev 100369)
@@ -1,6 +1,5 @@
<html>
<head>
-<script src=""
<style>
body {
counter-reset: section;
@@ -24,6 +23,7 @@
content: counter(section, none);
}
</style>
+<script src=""
</head>
<body>
<script>
Modified: trunk/LayoutTests/fast/css/counters/getCounterValue.html (100368 => 100369)
--- trunk/LayoutTests/fast/css/counters/getCounterValue.html 2011-11-16 00:43:50 UTC (rev 100368)
+++ trunk/LayoutTests/fast/css/counters/getCounterValue.html 2011-11-16 00:45:48 UTC (rev 100369)
@@ -1,6 +1,5 @@
<html>
<head>
-<script src=""
<style>
body {
counter-reset: section;
@@ -24,6 +23,7 @@
content: counter(section, none);
}
</style>
+<script src=""
</head>
<body>
<script>
Modified: trunk/LayoutTests/fast/dom/StyleSheet/gc-styleheet-wrapper.xhtml (100368 => 100369)
--- trunk/LayoutTests/fast/dom/StyleSheet/gc-styleheet-wrapper.xhtml 2011-11-16 00:43:50 UTC (rev 100368)
+++ trunk/LayoutTests/fast/dom/StyleSheet/gc-styleheet-wrapper.xhtml 2011-11-16 00:45:48 UTC (rev 100369)
@@ -3,10 +3,10 @@
<head>
<title/>
<link rel="stylesheet" href="" type="text/css" title="testSheet"/>
-<script src=""
<style title="testSheet">
* { }
</style>
+<script src=""
</head>
<body _onload_="start()">
<script>
Modified: trunk/LayoutTests/fast/dom/script-tests/domListEnumeration.js (100368 => 100369)
--- trunk/LayoutTests/fast/dom/script-tests/domListEnumeration.js 2011-11-16 00:43:50 UTC (rev 100368)
+++ trunk/LayoutTests/fast/dom/script-tests/domListEnumeration.js 2011-11-16 00:45:48 UTC (rev 100369)
@@ -171,7 +171,7 @@
// CSSStyleDeclaration
//debug(escapeHTML(document.getElementsByTagName('style')));
-var cssStyleDeclaration = document.styleSheets[1].cssRules[0].style;
+var cssStyleDeclaration = document.styleSheets[2].cssRules[0].style;
resultArray = iterateList(cssStyleDeclaration);
shouldBe("resultArray.length", "14");
shouldBe("resultArray[0].i", "'0'");
@@ -191,7 +191,7 @@
shouldBe("resultArray[1].item", "cssValueList.item(1)");
// MediaList
-var mediaList = document.styleSheets[2].cssRules[0].media;
+var mediaList = document.styleSheets[3].cssRules[0].media;
resultArray = iterateList(mediaList);
shouldBe("resultArray.length", "8");
shouldBe("resultArray[0].i", "'0'");
Modified: trunk/LayoutTests/fast/js/resources/js-test-pre.js (100368 => 100369)
--- trunk/LayoutTests/fast/js/resources/js-test-pre.js 2011-11-16 00:43:50 UTC (rev 100368)
+++ trunk/LayoutTests/fast/js/resources/js-test-pre.js 2011-11-16 00:45:48 UTC (rev 100369)
@@ -48,46 +48,26 @@
span.innerHTML = msg + '<br />';
};
- function findPath() {
- var scripts = document.getElementsByTagName("script");
- var regExp = /^(.*resources\/)js-test-pre\.js/;
- for (var i = scripts.length - 1; i >= 0; i--) {
- var src = ""
- var match;
- regExp.lastIndex = 0;
- if (src && (match = regExp.exec(src)))
- return match[1];
- }
- return null;
- }
+ var css =
+ ".pass {" +
+ "font-weight: bold;" +
+ "color: green;" +
+ "}" +
+ ".fail {" +
+ "font-weight: bold;" +
+ "color: red;" +
+ "}" +
+ "#console {" +
+ "white-space: pre-wrap;" +
+ "font-family: monospace;" +
+ "}";
- // FIXME: No test should depend on this stylesheet.
- function hasStyleSheet() {
- var links = document.getElementsByTagName("link");
- var regExp = /resources\/js-test-style.css/;
- for (var i = 0; i < links.length; i++) {
- var link = links[i];
- if (link.rel.toLowerCase() === "stylesheet" && regExp.test(link.href))
- return true;
- }
- return false;
+ function insertStyleSheet()
+ {
+ var styleElement = document.createElement("style");
+ styleElement.textContent = css;
+ (document.head || document.documentElement).appendChild(styleElement);
}
-
- function insertStyleSheet() {
- if (hasStyleSheet())
- return;
-
- // FIXME: Once all tests have been updated to not depend on this link element
- // we should remove this and replace with a simple style element instead.
- var path = findPath();
- if (!path == null)
- return;
-
- var link = document.createElement("link");
- link.rel = "stylesheet";
- link.href = "" + "js-test-style.css";
- document.documentElement.appendChild(link);
- }
insertStyleSheet();
@@ -397,10 +377,11 @@
function isSuccessfullyParsed()
{
+ // FIXME: Remove this and only report unexpected syntax errors.
if (!errorMessage)
successfullyParsed = true;
shouldBeTrue("successfullyParsed");
- debug('<br><span class="pass">TEST COMPLETE</span>');
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
}
// It's possible for an async test to call finishJSTest() before js-test-post.js
@@ -410,11 +391,7 @@
wasFinishJSTestCalled = true;
if (!window.wasPostTestScriptParsed)
return;
- if (!errorMessage)
- successfullyParsed = true;
- // FIXME: Remove this and only report unexpected syntax errors.
- shouldBeTrue("successfullyParsed");
- debug('<br /><span class="pass">TEST COMPLETE</span>');
+ isSuccessfullyParsed();
if (window.jsTestIsAsync && window.layoutTestController)
layoutTestController.notifyDone();
}
Modified: trunk/LayoutTests/traversal/script-tests/exception-forwarding.js (100368 => 100369)
--- trunk/LayoutTests/traversal/script-tests/exception-forwarding.js 2011-11-16 00:43:50 UTC (rev 100368)
+++ trunk/LayoutTests/traversal/script-tests/exception-forwarding.js 2011-11-16 00:45:48 UTC (rev 100369)
@@ -11,11 +11,6 @@
}
}
-// Move the stylesheet added by the test harness so it does not interfere.
-// FIXME: The testing harness should have a way to remove this link and restore it once done.
-var link = document.getElementsByTagName("link")[0];
-document.documentElement.appendChild(link);
-
var i = document.createNodeIterator(document.documentElement, 0xFFFFFFFF, test, true);
shouldThrow("i.nextNode()"); // 1
shouldBe("i.nextNode()", "document.documentElement"); // 2