| 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 = []; | 15 var propertyNames = []; |
| 16 for (var property in object) | 16 for (var property in object) |
| 17 propertyNames.push(property); | 17 propertyNames.push(property); |
| 18 propertyNames.sort(); | 18 propertyNames.sort(); |
| 19 | 19 |
| 20 for (var i = 0; i < propertyNames.length; ++i) { | 20 for (var i = 0; i < propertyNames.length; ++i) { |
| 21 var prop = propertyNames[i]; | 21 var prop = propertyNames[i]; |
| 22 var prefixWithName = prefix + " " + prop + " : "; | 22 var prefixWithName = prefix + " " + prop + " : "; |
| 23 var propValue = object[prop]; | 23 var propValue = object[prop]; |
| 24 if (nondeterministicProps && prop in nondeterministicProps) { | 24 if (nondeterministicProps && prop in nondeterministicProps) { |
| 25 var value = nondeterministicProps[prop] === "url" ? trimURL(propValu
e) : "<" + typeof propValue + ">"; | 25 var value = nondeterministicProps[prop] === "url" ? trimURL(propValu
e) : "<" + typeof propValue + ">"; |
| 26 output(prefixWithName + value); | 26 output(prefixWithName + value); |
| 27 } else if (typeof propValue === "object" && propValue != null) | 27 } else if (typeof propValue === "object" && propValue != null) |
| 28 dumpObject(propValue, nondeterministicProps, prefix + " ", prefix
WithName); | 28 dumpObject(propValue, nondeterministicProps, prefix + " ", prefix
WithName); |
| 29 else if (typeof propValue === "string") | 29 else if (typeof propValue === "string") |
| (...skipping 15 matching lines...) Expand all Loading... |
| 45 output(result); | 45 output(result); |
| 46 } | 46 } |
| 47 | 47 |
| 48 function evaluateOnFrontend(expression, callback) | 48 function evaluateOnFrontend(expression, callback) |
| 49 { | 49 { |
| 50 window._extensionServerForTests.sendRequest({ command: "evaluateForTestInFro
ntEnd", expression: expression }, callback); | 50 window._extensionServerForTests.sendRequest({ command: "evaluateForTestInFro
ntEnd", expression: expression }, callback); |
| 51 } | 51 } |
| 52 | 52 |
| 53 function invokePageFunctionAsync(functionName, callback) | 53 function invokePageFunctionAsync(functionName, callback) |
| 54 { | 54 { |
| 55 evaluateOnFrontend("InspectorTest.invokePageFunctionAsync('" + functionName
+ "', reply)", callback); | 55 evaluateOnFrontend("InspectorTest.callFunctionInPageAsync('" + functionName
+ "').then(() => reply())", callback); |
| 56 } | 56 } |
| 57 | 57 |
| 58 function output(message) | 58 function output(message) |
| 59 { | 59 { |
| 60 evaluateOnFrontend("InspectorTest.addResult(unescape('" + escape(message) +
"'));"); | 60 evaluateOnFrontend("InspectorTest.addResult(unescape('" + escape(message) +
"'));"); |
| 61 } | 61 } |
| 62 | 62 |
| 63 function onError(event) | 63 function onError(event) |
| 64 { | 64 { |
| 65 window.removeEventListener("error", onError); | 65 window.removeEventListener("error", onError); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 nextTest.call(this); | 118 nextTest.call(this); |
| 119 } | 119 } |
| 120 return callbackWrapper; | 120 return callbackWrapper; |
| 121 } | 121 } |
| 122 | 122 |
| 123 function bind(func, thisObject) | 123 function bind(func, thisObject) |
| 124 { | 124 { |
| 125 var args = Array.prototype.slice.call(arguments, 2); | 125 var args = Array.prototype.slice.call(arguments, 2); |
| 126 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))); }; |
| 127 } | 127 } |
| OLD | NEW |