OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
4 <script src="resources/obfuscated.js"></script> | 4 <script src="resources/obfuscated.js"></script> |
5 | 5 |
| 6 <script id="outline">function first(x,y) { } |
| 7 var second = function(y |
| 8 , |
| 9 z) { } |
| 10 Object = function(arg) { |
| 11 } |
| 12 Object.prototype.functionOnPrototype = function ( a, b , |
| 13 c, d , |
| 14 e , f ) { function innerFunction1() { |
| 15 var innerFunction2 = function(arg1,arg2) {} } } |
| 16 /** |
| 17 * @constructor |
| 18 * @param {string} name |
| 19 */ |
| 20 window.Cat = function(name) |
| 21 { |
| 22 this._name = name; |
| 23 } |
| 24 |
| 25 window.Cat.prototype = { |
| 26 mew: function() |
| 27 { |
| 28 console.log("Mew!"); |
| 29 }, |
| 30 |
| 31 get name() |
| 32 { |
| 33 return this._name; |
| 34 }, |
| 35 |
| 36 feed: function() |
| 37 { |
| 38 // noop |
| 39 }, |
| 40 |
| 41 set name(newName) |
| 42 { |
| 43 this._name = newName; |
| 44 } |
| 45 }; |
| 46 </script> |
| 47 |
6 <script> | 48 <script> |
7 | 49 |
8 var test = function() | 50 function getScriptText() |
9 { | 51 { |
| 52 return document.querySelector("#outline").textContent; |
| 53 } |
| 54 |
| 55 function test() |
| 56 { |
| 57 |
10 var worker = Runtime.startWorker("script_formatter_worker"); | 58 var worker = Runtime.startWorker("script_formatter_worker"); |
11 var parsedScript = "function first(x,y) { }\n var second = function(y \n , \
nz) { }\n Object = function(arg) {\n}\n Object.prototype.functionOnPrototype = f
unction ( a, b , \n c, d , \n e , f ) { function innerFunction1(
) {\n var innerFunction2 = function(arg1,arg2) {} } }"; | |
12 | 59 |
13 worker.onmessage = InspectorTest.safeWrap(function(event) | 60 worker.onmessage = InspectorTest.safeWrap(function(event) |
14 { | 61 { |
15 InspectorTest.addObject(event.data); | 62 InspectorTest.addObject(event.data); |
16 InspectorTest.completeTest(); | 63 InspectorTest.completeTest(); |
17 }); | 64 }); |
18 | 65 |
19 worker.onerror = function(event) | 66 worker.onerror = function(event) |
20 { | 67 { |
21 InspectorTest.addResult("Error in worker: " + event.data); | 68 InspectorTest.addResult("Error in worker: " + event.data); |
22 InspectorTest.completeTest(); | 69 InspectorTest.completeTest(); |
23 }; | 70 }; |
24 | 71 |
25 worker.postMessage({ method: "javaScriptOutline", params: { content: parsedS
cript } }); | 72 InspectorTest.evaluateInPage("getScriptText()", onScriptText); |
| 73 function onScriptText(result) |
| 74 { |
| 75 worker.postMessage({ method: "javaScriptOutline", params: { content: res
ult.value } }); |
| 76 } |
26 } | 77 } |
27 | 78 |
28 </script> | 79 </script> |
29 | 80 |
30 </head> | 81 </head> |
31 | 82 |
32 <body onload="runTest()"> | 83 <body onload="runTest()"> |
33 <p>Tests the script outline extraction functionality. | 84 <p>Tests the script outline extraction functionality. |
34 </p> | 85 </p> |
35 | 86 |
36 </body> | 87 </body> |
37 </html> | 88 </html> |
OLD | NEW |