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

Unified Diff: LayoutTests/http/tests/resources/testharness-helpers.js

Issue 885343002: bindings: Fixes connect-helper to use stringifyDOMObject. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed review comments. Created 5 years, 11 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
« no previous file with comments | « LayoutTests/http/tests/navigatorconnect/resources/connect-helper.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/resources/testharness-helpers.js
diff --git a/LayoutTests/http/tests/resources/testharness-helpers.js b/LayoutTests/http/tests/resources/testharness-helpers.js
index d241ac0e4882222a01807c49510d786614eab4c4..4d7af1ff9ca77c85696f35368ff3a7a1c4b2480b 100644
--- a/LayoutTests/http/tests/resources/testharness-helpers.js
+++ b/LayoutTests/http/tests/resources/testharness-helpers.js
@@ -144,3 +144,20 @@ function assert_will_be_idl_attribute(object, attribute_name, description) {
assert_true(attribute_name in object, description);
}
+
+// 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));
+}
« no previous file with comments | « LayoutTests/http/tests/navigatorconnect/resources/connect-helper.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698