| 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 src="../../../http/tests/inspector/live-edit-test.js"></script> | 5 <script src="../../../http/tests/inspector/live-edit-test.js"></script> |
| 6 <script src="resources/edit-me-breakpoints.js"></script> | 6 <script src="resources/edit-me-breakpoints.js"></script> |
| 7 <script> | 7 <script> |
| 8 function loadDynamicAnonymousScript() | |
| 9 { | |
| 10 function testFunction() | |
| 11 { | |
| 12 debugger; | |
| 13 } | |
| 14 var scriptElement = document.createElement("script"); | |
| 15 scriptElement.textContent = String(testFunction); | |
| 16 docuemnt.head.appendChild(scriptElement); | |
| 17 } | |
| 18 | 8 |
| 19 function test() | 9 function test() |
| 20 { | 10 { |
| 21 var panel = UI.panels.sources; | |
| 22 | |
| 23 function pathToFileName(path) | 11 function pathToFileName(path) |
| 24 { | 12 { |
| 25 return path.substring(path.lastIndexOf("/") + 1).replace(/VM[\d]+/, "VMX
X"); | 13 return path.substring(path.lastIndexOf("/") + 1).replace(/VM[\d]+/, "VMX
X"); |
| 26 } | 14 } |
| 27 | 15 |
| 28 function dumpBreakpointStorageAndLocations() | 16 function dumpBreakpointStorageAndLocations() |
| 29 { | 17 { |
| 30 var breakpointManager = Bindings.breakpointManager; | 18 var breakpointManager = Bindings.breakpointManager; |
| 31 var breakpoints = breakpointManager._storage._setting.get(); | 19 var breakpoints = breakpointManager._storage._setting.get(); |
| 32 InspectorTest.addResult(" Dumping breakpoint storage"); | 20 InspectorTest.addResult(" Dumping breakpoint storage"); |
| 33 for (var i = 0; i < breakpoints.length; ++i) | 21 for (var i = 0; i < breakpoints.length; ++i) |
| 34 InspectorTest.addResult(" " + pathToFileName(breakpoints[i].s
ourceFileId) + ":" + breakpoints[i].lineNumber + ", enabled:" + breakpoints[i].e
nabled); | 22 InspectorTest.addResult(" " + pathToFileName(breakpoints[i].s
ourceFileId) + ":" + breakpoints[i].lineNumber + ", enabled:" + breakpoints[i].e
nabled); |
| 35 | 23 |
| 36 locations = breakpointManager.allBreakpointLocations(); | 24 locations = breakpointManager.allBreakpointLocations(); |
| 37 InspectorTest.addResult(" Dumping breakpoint locations"); | 25 InspectorTest.addResult(" Dumping breakpoint locations"); |
| 38 for (var i = 0; i < locations.length; ++i) { | 26 for (var i = 0; i < locations.length; ++i) { |
| 39 var uiLocation = locations[i].uiLocation; | 27 var uiLocation = locations[i].uiLocation; |
| 40 var uiSourceCode = uiLocation.uiSourceCode; | 28 var uiSourceCode = uiLocation.uiSourceCode; |
| 41 var url = uiSourceCode.url(); | 29 var url = uiSourceCode.url(); |
| 42 var lineNumber = uiLocation.lineNumber; | 30 var lineNumber = uiLocation.lineNumber; |
| 43 var project = uiSourceCode.project(); | 31 var project = uiSourceCode.project(); |
| 44 InspectorTest.addResult(" url: " + pathToFileName(url) + ", l
ineNumber: " + lineNumber + ", project type: " + project.type()); | 32 InspectorTest.addResult(" url: " + pathToFileName(url) + ", l
ineNumber: " + lineNumber + ", project type: " + project.type()); |
| 45 } | 33 } |
| 46 | 34 |
| 47 breakpoints = breakpointManager.allBreakpoints(); | 35 breakpoints = breakpointManager._allBreakpoints(); |
| 48 InspectorTest.addResult(" Dumping breakpoints"); | 36 InspectorTest.addResult(" Dumping breakpoints"); |
| 49 for (var i = 0; i < breakpoints.length; ++i) { | 37 for (var i = 0; i < breakpoints.length; ++i) { |
| 50 var breakpoint = breakpoints[i]; | 38 var breakpoint = breakpoints[i]; |
| 51 var uiSourceCode = breakpointManager._workspace.uiSourceCode(breakpo
int.projectId(), breakpoint.path()); | 39 var uiSourceCode = breakpointManager._workspace.uiSourceCode(breakpo
int.projectId(), breakpoint.path()); |
| 52 var lineNumber = breakpoint.lineNumber(); | 40 var lineNumber = breakpoint.lineNumber(); |
| 53 var url = uiSourceCode.url(); | 41 var url = uiSourceCode.url(); |
| 54 var project = uiSourceCode.project(); | 42 var project = uiSourceCode.project(); |
| 55 InspectorTest.addResult(" url: " + pathToFileName(url) + ", l
ineNumber: " + lineNumber + ", project type: " + project.type()); | 43 InspectorTest.addResult(" url: " + pathToFileName(url) + ", l
ineNumber: " + lineNumber + ", project type: " + project.type()); |
| 56 } | 44 } |
| 57 } | 45 } |
| 58 | 46 |
| 59 function addBreakpointSniffer(lineNumber, disabled) | |
| 60 { | |
| 61 var prefix = this.main ? "" : "Original"; | |
| 62 InspectorTest.addResult(" " + prefix + "TextEditor.addBreakpoint(line
Number = " + lineNumber + ", disabled = " + disabled + ")"); | |
| 63 } | |
| 64 | |
| 65 function removeBreakpointSniffer(lineNumber) | |
| 66 { | |
| 67 var prefix = this.main ? "" : "Original"; | |
| 68 InspectorTest.addResult(" " + prefix + "TextEditor.removeBreakpoint(l
ineNumber = " + lineNumber + ")"); | |
| 69 } | |
| 70 | |
| 71 Bindings.breakpointManager._storage._breakpoints = {}; | 47 Bindings.breakpointManager._storage._breakpoints = {}; |
| 72 | 48 |
| 73 InspectorTest.runDebuggerTestSuite([ | 49 InspectorTest.runDebuggerTestSuite([ |
| 74 function testEditUndo(next) | 50 function testEditUndo(next) |
| 75 { | 51 { |
| 76 var javaScriptSourceFrame, uiSourceCode, script, originalJavaScriptS
ourceFrame, originalUISourceCode; | 52 var javaScriptSourceFrame, uiSourceCode, script, originalJavaScriptS
ourceFrame, originalUISourceCode; |
| 77 | 53 |
| 78 InspectorTest.showScriptSource("edit-me-breakpoints.js", didShowScri
ptSource); | 54 InspectorTest.showScriptSource("edit-me-breakpoints.js", didShowScri
ptSource); |
| 79 | 55 |
| 80 function didShowScriptSource(sourceFrame) | 56 function didShowScriptSource(sourceFrame) |
| 81 { | 57 { |
| 82 javaScriptSourceFrame = sourceFrame; | 58 javaScriptSourceFrame = sourceFrame; |
| 83 uiSourceCode = sourceFrame._uiSourceCode; | 59 uiSourceCode = sourceFrame._uiSourceCode; |
| 84 javaScriptSourceFrame._textEditor.main = true; | 60 |
| 85 | |
| 86 InspectorTest.addSniffer(javaScriptSourceFrame._textEditor.__pro
to__, "addBreakpoint", addBreakpointSniffer, true); | |
| 87 InspectorTest.addSniffer(javaScriptSourceFrame._textEditor.__pro
to__, "removeBreakpoint", removeBreakpointSniffer, true); | |
| 88 | |
| 89 InspectorTest.addResult("Setting breakpoint:"); | 61 InspectorTest.addResult("Setting breakpoint:"); |
| 90 InspectorTest.addSniffer(Bindings.BreakpointManager.TargetBreakp
oint.prototype, "_didSetBreakpointInDebugger", breakpointResolved); | 62 InspectorTest.addSniffer(Bindings.BreakpointManager.TargetBreakp
oint.prototype, "_didSetBreakpointInDebugger", breakpointResolved); |
| 91 InspectorTest.setBreakpoint(sourceFrame, 2, "", true); | 63 InspectorTest.setBreakpoint(sourceFrame, 2, "", true); |
| 92 } | 64 } |
| 93 | 65 |
| 94 function breakpointResolved(callback, breakpointId, locations) | 66 function breakpointResolved(callback, breakpointId, locations) |
| 95 { | 67 { |
| 96 var location = locations[0]; | 68 var location = locations[0]; |
| 97 script = InspectorTest.debuggerModel.scriptForId(location.script
Id); | 69 script = InspectorTest.debuggerModel.scriptForId(location.script
Id); |
| 98 | 70 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 ]); | 283 ]); |
| 312 }; | 284 }; |
| 313 | 285 |
| 314 </script> | 286 </script> |
| 315 </head> | 287 </head> |
| 316 <body onload="runTest()"> | 288 <body onload="runTest()"> |
| 317 <p>Tests breakpoints are correctly dimmed and restored in JavaScriptSourceFrame
during live edit.</p> | 289 <p>Tests breakpoints are correctly dimmed and restored in JavaScriptSourceFrame
during live edit.</p> |
| 318 <a href="https://bugs.webkit.org/show_bug.cgi?id=99598">Bug 99598</a> | 290 <a href="https://bugs.webkit.org/show_bug.cgi?id=99598">Bug 99598</a> |
| 319 </body> | 291 </body> |
| 320 </html> | 292 </html> |
| OLD | NEW |