Index: LayoutTests/inspector/console/console-custom-formatters.html |
diff --git a/LayoutTests/inspector/console/console-custom-formatters.html b/LayoutTests/inspector/console/console-custom-formatters.html |
index 09464db234f91358ca9f67cd6b9a8daf2a55ae19..4aa79c17fc737a7fa515992645864d51512ea691 100644 |
--- a/LayoutTests/inspector/console/console-custom-formatters.html |
+++ b/LayoutTests/inspector/console/console-custom-formatters.html |
@@ -53,14 +53,80 @@ var formatter2 = { |
} |
}; |
-window.devtoolsFormatters = [formatter1, formatter2]; |
+var configTest = {}; |
+var formatterWithConfig1 = { |
+ header: function(x, config) |
+ { |
+ if (x !== configTest || config) |
+ return null; |
+ |
+ return ["span", {}, "Formatter with config ", ["object", {"object": x, "config": {"info": "additional info"}}]]; |
+ }, |
+ |
+ hasBody: function(x) |
+ { |
+ return false; |
+ }, |
+ |
+ body: function(x) |
+ { |
+ throw "Unreachable" |
+ } |
+} |
+ |
+var formatterWithConfig2 = { |
+ header: function(x, config) |
+ { |
+ if (x !== configTest || !config) |
+ return null; |
+ |
+ return ["span", {}, "Header ", "info: ", config.info]; |
+ }, |
+ |
+ hasBody: function(x, config) |
+ { |
+ return config && config.info; |
+ }, |
+ |
+ body: function(x, config) |
+ { |
+ return ["span", {}, "body", "info: ", config.info] |
+ } |
+} |
+ |
+var selfReferenceTest = {}; |
+var selfReferencingFormatter = { |
+ header: function(x) |
+ { |
+ if (x !== selfReferenceTest) |
+ return null; |
+ |
+ return ["span", {}, "Formatter with config ", ["object", {"object": x}]]; |
+ }, |
+ |
+ hasBody: function(x) |
+ { |
+ return false; |
+ }, |
+ |
+ body: function(x) |
+ { |
+ throw "Unreachable" |
+ } |
+ |
+} |
+ |
+window.devtoolsFormatters = [formatter1, formatter2, formatterWithConfig1, formatterWithConfig2, selfReferencingFormatter]; |
function logVars() |
{ |
console.log(a); |
console.log(b); |
console.log(c); |
- window.devtoolsFormatters = [formatter2, formatter1]; |
+ console.log(configTest); |
+ console.log(selfReferenceTest); |
+ //swap first formatters: test that header+body should be generated by the same formatter |
+ window.devtoolsFormatters = [formatter2, formatter1, formatterWithConfig1, formatterWithConfig2, selfReferencingFormatter]; |
} |
function test() |