Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: third_party/WebKit/LayoutTests/resources/testharnessreport.js

Issue 2741403002: testharnessreport: Support SVG testharness tests. (Closed)
Patch Set: . Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/resources/testharnessreport.js
diff --git a/third_party/WebKit/LayoutTests/resources/testharnessreport.js b/third_party/WebKit/LayoutTests/resources/testharnessreport.js
index 96f2dd203431960099f57c4f9cf6e2c6c7008259..cbcfbe2ef00ba6b126a33e2f9f34f238cd51f102 100644
--- a/third_party/WebKit/LayoutTests/resources/testharnessreport.js
+++ b/third_party/WebKit/LayoutTests/resources/testharnessreport.js
@@ -214,6 +214,10 @@
results.textContent = resultStr;
function done() {
+ let xhtmlNS = 'http://www.w3.org/1999/xhtml';
+ var body = null;
+ if (output_document.body && output_document.body.tagName == 'BODY' && output_document.body.namespaceURI == xhtmlNS)
+ body = output_document.body;
// A temporary workaround since |window.self| property lookup starts
// failing if the frame is detached. |output_document| may be an
// ancestor of |self| so clearing |textContent| may detach |self|.
@@ -230,17 +234,20 @@
// Anything isn't material to the testrunner output, so should
// be hidden from the text dump.
- if (output_document.body && output_document.body.tagName == 'BODY')
- output_document.body.textContent = '';
+ if (body)
+ body.textContent = '';
}
// Add results element to output_document.
- if (!output_document.body || output_document.body.tagName != 'BODY') {
- if (!output_document.documentElement)
- output_document.appendChild(output_document.createElement('html'));
- else if (output_document.body) // output_document.body is <frameset>.
- output_document.body.remove();
- output_document.documentElement.appendChild(output_document.createElement("body"));
+ if (!body) {
+ // output_document might be an SVG document.
+ if (output_document.documentElement)
+ output_document.documentElement.remove();
+ let html = output_document.createElementNS(xhtmlNS, 'html');
+ output_document.appendChild(html);
+ body = output_document.createElementNS(xhtmlNS, 'body');
+ body.setAttribute('style', 'white-space:pre;');
+ html.appendChild(body);
}
output_document.body.appendChild(results);

Powered by Google App Engine
This is Rietveld 408576698