Index: LayoutTests/resources/js-test.js |
diff --git a/LayoutTests/resources/js-test.js b/LayoutTests/resources/js-test.js |
index 10abf0bc336b48f85c4658e6af7efd4818a7443b..e4d56e4256eeb46c2152ed6dff9559d1c84d6e05 100644 |
--- a/LayoutTests/resources/js-test.js |
+++ b/LayoutTests/resources/js-test.js |
@@ -190,6 +190,16 @@ function isResultCorrect(actual, expected) |
return false; |
} |
+// Returns a sorted array of property names of object. This function returns |
+// not only own properties but also properties on prototype chains. |
+function getAllPropertyNames(object) { |
+ var properties = []; |
+ for (var property in object) { |
+ properties.push(property); |
+ } |
+ return properties.sort(); |
+} |
+ |
function stringify(v) |
{ |
if (isNewSVGTearOffType(v)) |
@@ -199,6 +209,23 @@ function stringify(v) |
else return "" + v; |
} |
+// Stringifies a DOM object. This function stringifies not only own properties |
+// but also DOM attributes which are on a prototype chain. Note that |
+// JSON.stringify only stringifies own properties. |
+function stringifyDOMObject(object) |
+{ |
+ function deepCopy(src) { |
+ if (typeof src != "object") |
+ return src; |
+ var dst = Array.isArray(src) ? [] : {}; |
+ for (var property in src) { |
+ dst[property] = deepCopy(src[property]); |
+ } |
+ return dst; |
+ } |
+ return JSON.stringify(deepCopy(object)); |
+} |
+ |
function evalAndLog(_a, _quiet) |
{ |
if (typeof _a != "string") |