| 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="../../../http/tests/inspector/debugger-test.js"></script> | 4 <script src="../../../http/tests/inspector/debugger-test.js"></script> |
| 5 <script>// It is important that script starts on line 5 (zero-based 4) | 5 <script>// It is important that script starts on line 5 (zero-based 4) |
| 6 | 6 |
| 7 function nonFormattedFunction() { var i = 2 + 2; var a = 4; return a + i; } | 7 function nonFormattedFunction() { var i = 2 + 2; var a = 4; return a + i; } |
| 8 | 8 |
| 9 function dummyScript() | 9 function dummyScript() |
| 10 { | 10 { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 { | 45 { |
| 46 var scripts = InspectorTest.debuggerModel.scripts; | 46 var scripts = InspectorTest.debuggerModel.scripts; |
| 47 for (var scriptId in scripts) { | 47 for (var scriptId in scripts) { |
| 48 var scriptCandidate = scripts[scriptId]; | 48 var scriptCandidate = scripts[scriptId]; |
| 49 if (scriptCandidate.sourceURL === InspectorTest.mainTarget.inspected
URL() && scriptCandidate.lineOffset === 4) { | 49 if (scriptCandidate.sourceURL === InspectorTest.mainTarget.inspected
URL() && scriptCandidate.lineOffset === 4) { |
| 50 script = scriptCandidate; | 50 script = scriptCandidate; |
| 51 break; | 51 break; |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 | 54 |
| 55 uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(InspectorTest.m
ainTarget.inspectedURL()); | 55 uiSourceCode = Workspace.workspace.uiSourceCodeForURL(InspectorTest.main
Target.inspectedURL()); |
| 56 var linkifyMe = "at triggerError (http://localhost/show/:22:11)"; | 56 var linkifyMe = "at triggerError (http://localhost/show/:22:11)"; |
| 57 var fragment = WebInspector.linkifyStringAsFragment(linkifyMe); | 57 var fragment = Components.linkifyStringAsFragment(linkifyMe); |
| 58 var anchor = fragment.querySelector('a'); | 58 var anchor = fragment.querySelector('a'); |
| 59 InspectorTest.addResult("The string \"" + linkifyMe + " \" linkifies to
url: " + anchor.href); | 59 InspectorTest.addResult("The string \"" + linkifyMe + " \" linkifies to
url: " + anchor.href); |
| 60 InspectorTest.addResult("The lineNumber is " + anchor.lineNumber + " wit
h type " + (typeof anchor.lineNumber)); | 60 InspectorTest.addResult("The lineNumber is " + anchor.lineNumber + " wit
h type " + (typeof anchor.lineNumber)); |
| 61 InspectorTest.addResult("The columnNumber is " + anchor.columnNumber + "
with type " + (typeof anchor.columnNumber)); | 61 InspectorTest.addResult("The columnNumber is " + anchor.columnNumber + "
with type " + (typeof anchor.columnNumber)); |
| 62 | 62 |
| 63 linkifier = new WebInspector.Linkifier(); | 63 linkifier = new Components.Linkifier(); |
| 64 var count1 = liveLocationsCount(); | 64 var count1 = liveLocationsCount(); |
| 65 link = linkifier.linkifyScriptLocation(WebInspector.targetManager.mainTa
rget(), null, InspectorTest.mainTarget.inspectedURL(), 8, 0, "dummy-class"); | 65 link = linkifier.linkifyScriptLocation(SDK.targetManager.mainTarget(), n
ull, InspectorTest.mainTarget.inspectedURL(), 8, 0, "dummy-class"); |
| 66 var count2 = liveLocationsCount(); | 66 var count2 = liveLocationsCount(); |
| 67 | 67 |
| 68 InspectorTest.addResult("listeners added on raw source code: " + (count2
- count1)); | 68 InspectorTest.addResult("listeners added on raw source code: " + (count2
- count1)); |
| 69 InspectorTest.addResult("original location: " + link.textContent); | 69 InspectorTest.addResult("original location: " + link.textContent); |
| 70 InspectorTest.addSniffer(WebInspector.ScriptFormatterEditorAction.protot
ype, "_updateButton", uiSourceCodeScriptFormatted); | 70 InspectorTest.addSniffer(Sources.ScriptFormatterEditorAction.prototype,
"_updateButton", uiSourceCodeScriptFormatted); |
| 71 scriptFormatter._toggleFormatScriptSource(); | 71 scriptFormatter._toggleFormatScriptSource(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 function uiSourceCodeScriptFormatted() | 74 function uiSourceCodeScriptFormatted() |
| 75 { | 75 { |
| 76 InspectorTest.addResult("pretty printed location: " + link.textContent); | 76 InspectorTest.addResult("pretty printed location: " + link.textContent); |
| 77 scriptFormatter._discardFormattedUISourceCodeScript(WebInspector.panels.
sources.visibleView.uiSourceCode()); | 77 scriptFormatter._discardFormattedUISourceCodeScript(UI.panels.sources.vi
sibleView.uiSourceCode()); |
| 78 InspectorTest.addResult("reverted location: " + link.textContent); | 78 InspectorTest.addResult("reverted location: " + link.textContent); |
| 79 | 79 |
| 80 var count1 = liveLocationsCount(); | 80 var count1 = liveLocationsCount(); |
| 81 linkifier.reset(); | 81 linkifier.reset(); |
| 82 var count2 = liveLocationsCount(); | 82 var count2 = liveLocationsCount(); |
| 83 | 83 |
| 84 InspectorTest.addResult("listeners removed from raw source code: " + (co
unt1 - count2)); | 84 InspectorTest.addResult("listeners removed from raw source code: " + (co
unt1 - count2)); |
| 85 | 85 |
| 86 InspectorTest.completeDebuggerTest(); | 86 InspectorTest.completeDebuggerTest(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 function liveLocationsCount() | 89 function liveLocationsCount() |
| 90 { | 90 { |
| 91 return WebInspector.debuggerWorkspaceBinding._ensureInfoForScript(script
)._locations.size; | 91 return Bindings.debuggerWorkspaceBinding._ensureInfoForScript(script)._l
ocations.size; |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 </script> | 95 </script> |
| 96 </head> | 96 </head> |
| 97 | 97 |
| 98 <body onload="onload()"> | 98 <body onload="onload()"> |
| 99 <p> | 99 <p> |
| 100 Tests that Linkifier works correctly. | 100 Tests that Linkifier works correctly. |
| 101 <p> | 101 <p> |
| 102 | 102 |
| 103 </body> | 103 </body> |
| 104 </html> | 104 </html> |
| OLD | NEW |