| Index: LayoutTests/http/tests/w3c/resources/testharnessreport.js
|
| diff --git a/LayoutTests/http/tests/w3c/resources/testharnessreport.js b/LayoutTests/http/tests/w3c/resources/testharnessreport.js
|
| index 781938f0ab6fcc4f31516a1c28e7869379fcce6e..6e35da5ae1715880635e00aab9953c2dfa84b657 100644
|
| --- a/LayoutTests/http/tests/w3c/resources/testharnessreport.js
|
| +++ b/LayoutTests/http/tests/w3c/resources/testharnessreport.js
|
| @@ -38,6 +38,19 @@ function convertResult(resultStatus) {
|
| */
|
| setup({"output":false});
|
|
|
| +/* If the test has a meta tag named flags and the content contains "dom", then it's a CSSWG test.
|
| + */
|
| +function isCSSWGTest() {
|
| + var flags = document.querySelector('meta[name=flags]'),
|
| + content = flags ? flags.getAttribute('content') : null;
|
| +
|
| + return content && content.match(/\bdom\b/);
|
| +}
|
| +
|
| +function isJSTest() {
|
| + return !!document.querySelector('script[src*="/resources/testharness"]');
|
| +}
|
| +
|
| /* Using a callback function, test results will be added to the page in a
|
| * manner that allows dumpAsText to produce readable test results
|
| */
|
| @@ -47,7 +60,7 @@ add_completion_callback(function (tests, harness_status) {
|
| var results = document.createElement("pre");
|
|
|
| // Declare result string
|
| - var resultStr = "\n";
|
| + var resultStr = "This is a testharness.js-based test.\n";
|
|
|
| // Sanitizes the given text for display in test results.
|
| function sanitize(text) {
|
| @@ -77,13 +90,35 @@ add_completion_callback(function (tests, harness_status) {
|
| sanitize(tests[i].message) + "\n";
|
| }
|
| }
|
| + resultStr += "Harness: the test ran to completion.\n";
|
|
|
| - // Set results element's innerHTML to the results string
|
| - results.innerHTML = resultStr;
|
| + // Set results element's textContent to the results string
|
| + results.textContent = resultStr;
|
|
|
| - // Add results element to document
|
| - document.body.appendChild(results);
|
| + function done() {
|
| + if (self.testRunner) {
|
| + var logDiv = document.getElementById('log');
|
| + if ((isCSSWGTest() || isJSTest()) && logDiv) {
|
| + // Assume it's a CSSWG style test, and anything other than the log div isn't
|
| + // material to the testrunner output, so should be hidden from the text dump
|
| + for (var i = 0; i < document.body.children.length; i++) {
|
| + if (document.body.children[i] === logDiv) continue;
|
|
|
| - if (self.testRunner)
|
| - testRunner.notifyDone();
|
| + document.body.children[i].style.visibility = "hidden";
|
| + }
|
| + }
|
| + }
|
| +
|
| + // Add results element to document
|
| + document.body.appendChild(results);
|
| +
|
| + if (self.testRunner)
|
| + testRunner.notifyDone();
|
| + }
|
| +
|
| + if (!document.body || document.readyState === 'loading') {
|
| + window.addEventListener('load', done);
|
| + } else {
|
| + done();
|
| + }
|
| });
|
|
|