OLD | NEW |
1 function trimURL(url) | 1 function trimURL(url) |
2 { | 2 { |
3 if (!url) | 3 if (!url) |
4 return; | 4 return; |
5 if (/^data:/.test(url)) | 5 if (/^data:/.test(url)) |
6 return url.replace(/,.*$/, "..."); | 6 return url.replace(/,.*$/, "..."); |
7 return url.replace(/.*\//, ".../"); | 7 return url.replace(/.*\//, ".../"); |
8 } | 8 } |
9 | 9 |
10 function dumpObject(object, nondeterministicProps, prefix, firstLinePrefix) | 10 function dumpObject(object, nondeterministicProps, prefix, firstLinePrefix) |
11 { | 11 { |
12 prefix = prefix || ""; | 12 prefix = prefix || ""; |
13 firstLinePrefix = firstLinePrefix || prefix; | 13 firstLinePrefix = firstLinePrefix || prefix; |
14 output(firstLinePrefix + "{"); | 14 output(firstLinePrefix + "{"); |
15 var propertyNames = Object.keys(object); | 15 var propertyNames = []; |
| 16 for (var property in object) |
| 17 propertyNames.push(property); |
16 propertyNames.sort(); | 18 propertyNames.sort(); |
17 | 19 |
18 for (var i = 0; i < propertyNames.length; ++i) { | 20 for (var i = 0; i < propertyNames.length; ++i) { |
19 var prop = propertyNames[i]; | 21 var prop = propertyNames[i]; |
20 var prefixWithName = prefix + " " + prop + " : "; | 22 var prefixWithName = prefix + " " + prop + " : "; |
21 var propValue = object[prop]; | 23 var propValue = object[prop]; |
22 if (nondeterministicProps && prop in nondeterministicProps) { | 24 if (nondeterministicProps && prop in nondeterministicProps) { |
23 var value = nondeterministicProps[prop] === "url" ? trimURL(propValu
e) : "<" + typeof propValue + ">"; | 25 var value = nondeterministicProps[prop] === "url" ? trimURL(propValu
e) : "<" + typeof propValue + ">"; |
24 output(prefixWithName + value); | 26 output(prefixWithName + value); |
25 } else if (typeof propValue === "object" && propValue != null) | 27 } else if (typeof propValue === "object" && propValue != null) |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 nextTest.call(this); | 118 nextTest.call(this); |
117 } | 119 } |
118 return callbackWrapper; | 120 return callbackWrapper; |
119 } | 121 } |
120 | 122 |
121 function bind(func, thisObject) | 123 function bind(func, thisObject) |
122 { | 124 { |
123 var args = Array.prototype.slice.call(arguments, 2); | 125 var args = Array.prototype.slice.call(arguments, 2); |
124 return function() { return func.apply(thisObject, args.concat(Array.prototyp
e.slice.call(arguments, 0))); }; | 126 return function() { return func.apply(thisObject, args.concat(Array.prototyp
e.slice.call(arguments, 0))); }; |
125 } | 127 } |
OLD | NEW |