| 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() | 8 function loadDynamicAnonymousScript() |
| 9 { | 9 { |
| 10 function testFunction() | 10 function testFunction() |
| 11 { | 11 { |
| 12 debugger; | 12 debugger; |
| 13 } | 13 } |
| 14 var scriptElement = document.createElement("script"); | 14 var scriptElement = document.createElement("script"); |
| 15 scriptElement.textContent = String(testFunction); | 15 scriptElement.textContent = String(testFunction); |
| 16 docuemnt.head.appendChild(scriptElement); | 16 docuemnt.head.appendChild(scriptElement); |
| 17 } | 17 } |
| 18 | 18 |
| 19 function test() | 19 function test() |
| 20 { | 20 { |
| 21 var panel = WebInspector.panels.sources; | 21 var panel = UI.panels.sources; |
| 22 | 22 |
| 23 function pathToFileName(path) | 23 function pathToFileName(path) |
| 24 { | 24 { |
| 25 return path.substring(path.lastIndexOf("/") + 1).replace(/VM[\d]+/, "VMX
X"); | 25 return path.substring(path.lastIndexOf("/") + 1).replace(/VM[\d]+/, "VMX
X"); |
| 26 } | 26 } |
| 27 | 27 |
| 28 function dumpBreakpointStorageAndLocations() | 28 function dumpBreakpointStorageAndLocations() |
| 29 { | 29 { |
| 30 var breakpointManager = WebInspector.breakpointManager; | 30 var breakpointManager = Bindings.breakpointManager; |
| 31 var breakpoints = breakpointManager._storage._setting.get(); | 31 var breakpoints = breakpointManager._storage._setting.get(); |
| 32 InspectorTest.addResult(" Dumping breakpoint storage"); | 32 InspectorTest.addResult(" Dumping breakpoint storage"); |
| 33 for (var i = 0; i < breakpoints.length; ++i) | 33 for (var i = 0; i < breakpoints.length; ++i) |
| 34 InspectorTest.addResult(" " + pathToFileName(breakpoints[i].s
ourceFileId) + ":" + breakpoints[i].lineNumber + ", enabled:" + breakpoints[i].e
nabled); | 34 InspectorTest.addResult(" " + pathToFileName(breakpoints[i].s
ourceFileId) + ":" + breakpoints[i].lineNumber + ", enabled:" + breakpoints[i].e
nabled); |
| 35 | 35 |
| 36 locations = breakpointManager.allBreakpointLocations(); | 36 locations = breakpointManager.allBreakpointLocations(); |
| 37 InspectorTest.addResult(" Dumping breakpoint locations"); | 37 InspectorTest.addResult(" Dumping breakpoint locations"); |
| 38 for (var i = 0; i < locations.length; ++i) { | 38 for (var i = 0; i < locations.length; ++i) { |
| 39 var uiLocation = locations[i].uiLocation; | 39 var uiLocation = locations[i].uiLocation; |
| 40 var uiSourceCode = uiLocation.uiSourceCode; | 40 var uiSourceCode = uiLocation.uiSourceCode; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 61 var prefix = this.main ? "" : "Original"; | 61 var prefix = this.main ? "" : "Original"; |
| 62 InspectorTest.addResult(" " + prefix + "TextEditor.addBreakpoint(line
Number = " + lineNumber + ", disabled = " + disabled + ")"); | 62 InspectorTest.addResult(" " + prefix + "TextEditor.addBreakpoint(line
Number = " + lineNumber + ", disabled = " + disabled + ")"); |
| 63 } | 63 } |
| 64 | 64 |
| 65 function removeBreakpointSniffer(lineNumber) | 65 function removeBreakpointSniffer(lineNumber) |
| 66 { | 66 { |
| 67 var prefix = this.main ? "" : "Original"; | 67 var prefix = this.main ? "" : "Original"; |
| 68 InspectorTest.addResult(" " + prefix + "TextEditor.removeBreakpoint(l
ineNumber = " + lineNumber + ")"); | 68 InspectorTest.addResult(" " + prefix + "TextEditor.removeBreakpoint(l
ineNumber = " + lineNumber + ")"); |
| 69 } | 69 } |
| 70 | 70 |
| 71 WebInspector.breakpointManager._storage._breakpoints = {}; | 71 Bindings.breakpointManager._storage._breakpoints = {}; |
| 72 | 72 |
| 73 InspectorTest.runDebuggerTestSuite([ | 73 InspectorTest.runDebuggerTestSuite([ |
| 74 function testEditUndo(next) | 74 function testEditUndo(next) |
| 75 { | 75 { |
| 76 var javaScriptSourceFrame, uiSourceCode, script, originalJavaScriptS
ourceFrame, originalUISourceCode; | 76 var javaScriptSourceFrame, uiSourceCode, script, originalJavaScriptS
ourceFrame, originalUISourceCode; |
| 77 | 77 |
| 78 InspectorTest.showScriptSource("edit-me-breakpoints.js", didShowScri
ptSource); | 78 InspectorTest.showScriptSource("edit-me-breakpoints.js", didShowScri
ptSource); |
| 79 | 79 |
| 80 function didShowScriptSource(sourceFrame) | 80 function didShowScriptSource(sourceFrame) |
| 81 { | 81 { |
| 82 javaScriptSourceFrame = sourceFrame; | 82 javaScriptSourceFrame = sourceFrame; |
| 83 uiSourceCode = sourceFrame._uiSourceCode; | 83 uiSourceCode = sourceFrame._uiSourceCode; |
| 84 javaScriptSourceFrame._textEditor.main = true; | 84 javaScriptSourceFrame._textEditor.main = true; |
| 85 | 85 |
| 86 InspectorTest.addSniffer(javaScriptSourceFrame._textEditor.__pro
to__, "addBreakpoint", addBreakpointSniffer, true); | 86 InspectorTest.addSniffer(javaScriptSourceFrame._textEditor.__pro
to__, "addBreakpoint", addBreakpointSniffer, true); |
| 87 InspectorTest.addSniffer(javaScriptSourceFrame._textEditor.__pro
to__, "removeBreakpoint", removeBreakpointSniffer, true); | 87 InspectorTest.addSniffer(javaScriptSourceFrame._textEditor.__pro
to__, "removeBreakpoint", removeBreakpointSniffer, true); |
| 88 | 88 |
| 89 InspectorTest.addResult("Setting breakpoint:"); | 89 InspectorTest.addResult("Setting breakpoint:"); |
| 90 InspectorTest.addSniffer(WebInspector.BreakpointManager.TargetBr
eakpoint.prototype, "_didSetBreakpointInDebugger", breakpointResolved); | 90 InspectorTest.addSniffer(Bindings.BreakpointManager.TargetBreakp
oint.prototype, "_didSetBreakpointInDebugger", breakpointResolved); |
| 91 InspectorTest.setBreakpoint(sourceFrame, 2, "", true); | 91 InspectorTest.setBreakpoint(sourceFrame, 2, "", true); |
| 92 } | 92 } |
| 93 | 93 |
| 94 function breakpointResolved(callback, breakpointId, locations) | 94 function breakpointResolved(callback, breakpointId, locations) |
| 95 { | 95 { |
| 96 var location = locations[0]; | 96 var location = locations[0]; |
| 97 script = InspectorTest.debuggerModel.scriptForId(location.script
Id); | 97 script = InspectorTest.debuggerModel.scriptForId(location.script
Id); |
| 98 | 98 |
| 99 dumpBreakpointStorageAndLocations(); | 99 dumpBreakpointStorageAndLocations(); |
| 100 InspectorTest.addResult("Editing source:"); | 100 InspectorTest.addResult("Editing source:"); |
| 101 InspectorTest.replaceInSource(javaScriptSourceFrame, "}", "}//")
; | 101 InspectorTest.replaceInSource(javaScriptSourceFrame, "}", "}//")
; |
| 102 | 102 |
| 103 originalUISourceCode = WebInspector.debuggerWorkspaceBinding.raw
LocationToUILocation(location).uiSourceCode; | 103 originalUISourceCode = Bindings.debuggerWorkspaceBinding.rawLoca
tionToUILocation(location).uiSourceCode; |
| 104 InspectorTest.showUISourceCode(originalUISourceCode, didShowOrig
inalUISourceCode); | 104 InspectorTest.showUISourceCode(originalUISourceCode, didShowOrig
inalUISourceCode); |
| 105 } | 105 } |
| 106 | 106 |
| 107 function didShowOriginalUISourceCode(sourceFrame) | 107 function didShowOriginalUISourceCode(sourceFrame) |
| 108 { | 108 { |
| 109 originalJavaScriptSourceFrame = sourceFrame; | 109 originalJavaScriptSourceFrame = sourceFrame; |
| 110 InspectorTest.assertTrue(originalJavaScriptSourceFrame !== javaS
criptSourceFrame, "Edited and original javaScriptSourceFrames should differ."); | 110 InspectorTest.assertTrue(originalJavaScriptSourceFrame !== javaS
criptSourceFrame, "Edited and original javaScriptSourceFrames should differ."); |
| 111 InspectorTest.assertTrue(originalUISourceCode !== uiSourceCode,
"Edited and original uiSourceCodes should differ."); | 111 InspectorTest.assertTrue(originalUISourceCode !== uiSourceCode,
"Edited and original uiSourceCodes should differ."); |
| 112 | 112 |
| 113 dumpBreakpointStorageAndLocations(); | 113 dumpBreakpointStorageAndLocations(); |
| 114 InspectorTest.addResult("Undoing source editing:"); | 114 InspectorTest.addResult("Undoing source editing:"); |
| 115 InspectorTest.addSniffer(WebInspector.BreakpointManager.TargetBr
eakpoint.prototype, "_didSetBreakpointInDebugger", breakpointResolvedAgain); | 115 InspectorTest.addSniffer(Bindings.BreakpointManager.TargetBreakp
oint.prototype, "_didSetBreakpointInDebugger", breakpointResolvedAgain); |
| 116 InspectorTest.undoSourceEditing(javaScriptSourceFrame); | 116 InspectorTest.undoSourceEditing(javaScriptSourceFrame); |
| 117 } | 117 } |
| 118 | 118 |
| 119 function breakpointResolvedAgain() | 119 function breakpointResolvedAgain() |
| 120 { | 120 { |
| 121 dumpBreakpointStorageAndLocations(); | 121 dumpBreakpointStorageAndLocations(); |
| 122 InspectorTest.addResult("Finally removing breakpoint:"); | 122 InspectorTest.addResult("Finally removing breakpoint:"); |
| 123 InspectorTest.removeBreakpoint(javaScriptSourceFrame, 2); | 123 InspectorTest.removeBreakpoint(javaScriptSourceFrame, 2); |
| 124 | 124 |
| 125 dumpBreakpointStorageAndLocations(); | 125 dumpBreakpointStorageAndLocations(); |
| 126 next(); | 126 next(); |
| 127 } | 127 } |
| 128 }, | 128 }, |
| 129 | 129 |
| 130 function testEditCommit(next) | 130 function testEditCommit(next) |
| 131 { | 131 { |
| 132 var javaScriptSourceFrame, uiSourceCode, script, originalJavaScriptS
ourceFrame, originalUISourceCode; | 132 var javaScriptSourceFrame, uiSourceCode, script, originalJavaScriptS
ourceFrame, originalUISourceCode; |
| 133 | 133 |
| 134 InspectorTest.showScriptSource("edit-me-breakpoints.js", didShowScri
ptSource); | 134 InspectorTest.showScriptSource("edit-me-breakpoints.js", didShowScri
ptSource); |
| 135 | 135 |
| 136 function didShowScriptSource(sourceFrame) | 136 function didShowScriptSource(sourceFrame) |
| 137 { | 137 { |
| 138 javaScriptSourceFrame = sourceFrame; | 138 javaScriptSourceFrame = sourceFrame; |
| 139 uiSourceCode = sourceFrame._uiSourceCode; | 139 uiSourceCode = sourceFrame._uiSourceCode; |
| 140 | 140 |
| 141 InspectorTest.addResult("Setting breakpoint:"); | 141 InspectorTest.addResult("Setting breakpoint:"); |
| 142 InspectorTest.addSniffer(WebInspector.BreakpointManager.TargetBr
eakpoint.prototype, "_didSetBreakpointInDebugger", breakpointResolved); | 142 InspectorTest.addSniffer(Bindings.BreakpointManager.TargetBreakp
oint.prototype, "_didSetBreakpointInDebugger", breakpointResolved); |
| 143 InspectorTest.setBreakpoint(sourceFrame, 2, "", true); | 143 InspectorTest.setBreakpoint(sourceFrame, 2, "", true); |
| 144 } | 144 } |
| 145 | 145 |
| 146 function breakpointResolved(callback, breakpointId, locations) | 146 function breakpointResolved(callback, breakpointId, locations) |
| 147 { | 147 { |
| 148 var location = locations[0]; | 148 var location = locations[0]; |
| 149 script = InspectorTest.debuggerModel.scriptForId(location.script
Id); | 149 script = InspectorTest.debuggerModel.scriptForId(location.script
Id); |
| 150 | 150 |
| 151 dumpBreakpointStorageAndLocations(); | 151 dumpBreakpointStorageAndLocations(); |
| 152 InspectorTest.addResult("Editing source:"); | 152 InspectorTest.addResult("Editing source:"); |
| 153 InspectorTest.replaceInSource(javaScriptSourceFrame, "}", "}//")
; | 153 InspectorTest.replaceInSource(javaScriptSourceFrame, "}", "}//")
; |
| 154 | 154 |
| 155 originalUISourceCode = WebInspector.debuggerWorkspaceBinding.raw
LocationToUILocation(location).uiSourceCode; | 155 originalUISourceCode = Bindings.debuggerWorkspaceBinding.rawLoca
tionToUILocation(location).uiSourceCode; |
| 156 InspectorTest.showUISourceCode(originalUISourceCode, didShowOrig
inalUISourceCode); | 156 InspectorTest.showUISourceCode(originalUISourceCode, didShowOrig
inalUISourceCode); |
| 157 } | 157 } |
| 158 | 158 |
| 159 function didShowOriginalUISourceCode(sourceFrame) | 159 function didShowOriginalUISourceCode(sourceFrame) |
| 160 { | 160 { |
| 161 originalJavaScriptSourceFrame = sourceFrame; | 161 originalJavaScriptSourceFrame = sourceFrame; |
| 162 InspectorTest.assertTrue(originalJavaScriptSourceFrame !== javaS
criptSourceFrame, "Edited and original javaScriptSourceFrames should differ."); | 162 InspectorTest.assertTrue(originalJavaScriptSourceFrame !== javaS
criptSourceFrame, "Edited and original javaScriptSourceFrames should differ."); |
| 163 InspectorTest.assertTrue(originalUISourceCode !== uiSourceCode,
"Edited and original uiSourceCodes should differ."); | 163 InspectorTest.assertTrue(originalUISourceCode !== uiSourceCode,
"Edited and original uiSourceCodes should differ."); |
| 164 | 164 |
| 165 dumpBreakpointStorageAndLocations(); | 165 dumpBreakpointStorageAndLocations(); |
| 166 InspectorTest.addResult("Committing edited source:"); | 166 InspectorTest.addResult("Committing edited source:"); |
| 167 InspectorTest.addSniffer(WebInspector.BreakpointManager.TargetBr
eakpoint.prototype, "_didSetBreakpointInDebugger", breakpointResolvedAgain); | 167 InspectorTest.addSniffer(Bindings.BreakpointManager.TargetBreakp
oint.prototype, "_didSetBreakpointInDebugger", breakpointResolvedAgain); |
| 168 InspectorTest.commitSource(javaScriptSourceFrame); | 168 InspectorTest.commitSource(javaScriptSourceFrame); |
| 169 } | 169 } |
| 170 | 170 |
| 171 function breakpointResolvedAgain() | 171 function breakpointResolvedAgain() |
| 172 { | 172 { |
| 173 dumpBreakpointStorageAndLocations(); | 173 dumpBreakpointStorageAndLocations(); |
| 174 InspectorTest.addResult("Finally removing breakpoint:"); | 174 InspectorTest.addResult("Finally removing breakpoint:"); |
| 175 InspectorTest.removeBreakpoint(javaScriptSourceFrame, 2); | 175 InspectorTest.removeBreakpoint(javaScriptSourceFrame, 2); |
| 176 | 176 |
| 177 dumpBreakpointStorageAndLocations(); | 177 dumpBreakpointStorageAndLocations(); |
| 178 next(); | 178 next(); |
| 179 } | 179 } |
| 180 }, | 180 }, |
| 181 | 181 |
| 182 function testEditCommitFailEditCommit(next) | 182 function testEditCommitFailEditCommit(next) |
| 183 { | 183 { |
| 184 var javaScriptSourceFrame, uiSourceCode, script, originalJavaScriptS
ourceFrame, originalUISourceCode; | 184 var javaScriptSourceFrame, uiSourceCode, script, originalJavaScriptS
ourceFrame, originalUISourceCode; |
| 185 | 185 |
| 186 InspectorTest.showScriptSource("edit-me-breakpoints.js", didShowScri
ptSource); | 186 InspectorTest.showScriptSource("edit-me-breakpoints.js", didShowScri
ptSource); |
| 187 | 187 |
| 188 function didShowScriptSource(sourceFrame) | 188 function didShowScriptSource(sourceFrame) |
| 189 { | 189 { |
| 190 javaScriptSourceFrame = sourceFrame; | 190 javaScriptSourceFrame = sourceFrame; |
| 191 uiSourceCode = sourceFrame._uiSourceCode; | 191 uiSourceCode = sourceFrame._uiSourceCode; |
| 192 | 192 |
| 193 InspectorTest.addResult("Setting breakpoint:"); | 193 InspectorTest.addResult("Setting breakpoint:"); |
| 194 InspectorTest.addSniffer(WebInspector.BreakpointManager.TargetBr
eakpoint.prototype, "_didSetBreakpointInDebugger", breakpointResolved); | 194 InspectorTest.addSniffer(Bindings.BreakpointManager.TargetBreakp
oint.prototype, "_didSetBreakpointInDebugger", breakpointResolved); |
| 195 InspectorTest.setBreakpoint(sourceFrame, 2, "", true); | 195 InspectorTest.setBreakpoint(sourceFrame, 2, "", true); |
| 196 } | 196 } |
| 197 | 197 |
| 198 function breakpointResolved(callback, breakpointId, locations) | 198 function breakpointResolved(callback, breakpointId, locations) |
| 199 { | 199 { |
| 200 var location = locations[0]; | 200 var location = locations[0]; |
| 201 script = InspectorTest.debuggerModel.scriptForId(location.script
Id); | 201 script = InspectorTest.debuggerModel.scriptForId(location.script
Id); |
| 202 | 202 |
| 203 dumpBreakpointStorageAndLocations(); | 203 dumpBreakpointStorageAndLocations(); |
| 204 InspectorTest.addResult("Editing source:"); | 204 InspectorTest.addResult("Editing source:"); |
| 205 InspectorTest.replaceInSource(javaScriptSourceFrame, "}", "//}")
; | 205 InspectorTest.replaceInSource(javaScriptSourceFrame, "}", "//}")
; |
| 206 | 206 |
| 207 originalUISourceCode = WebInspector.debuggerWorkspaceBinding.raw
LocationToUILocation(location).uiSourceCode; | 207 originalUISourceCode = Bindings.debuggerWorkspaceBinding.rawLoca
tionToUILocation(location).uiSourceCode; |
| 208 InspectorTest.showUISourceCode(originalUISourceCode, didShowOrig
inalUISourceCode); | 208 InspectorTest.showUISourceCode(originalUISourceCode, didShowOrig
inalUISourceCode); |
| 209 } | 209 } |
| 210 | 210 |
| 211 function didShowOriginalUISourceCode(sourceFrame) | 211 function didShowOriginalUISourceCode(sourceFrame) |
| 212 { | 212 { |
| 213 originalJavaScriptSourceFrame = sourceFrame; | 213 originalJavaScriptSourceFrame = sourceFrame; |
| 214 InspectorTest.assertTrue(originalJavaScriptSourceFrame !== javaS
criptSourceFrame, "Edited and original javaScriptSourceFrames should differ."); | 214 InspectorTest.assertTrue(originalJavaScriptSourceFrame !== javaS
criptSourceFrame, "Edited and original javaScriptSourceFrames should differ."); |
| 215 InspectorTest.assertTrue(originalUISourceCode !== uiSourceCode,
"Edited and original uiSourceCodes should differ."); | 215 InspectorTest.assertTrue(originalUISourceCode !== uiSourceCode,
"Edited and original uiSourceCodes should differ."); |
| 216 | 216 |
| 217 dumpBreakpointStorageAndLocations(); | 217 dumpBreakpointStorageAndLocations(); |
| 218 InspectorTest.addResult("Committing edited source:"); | 218 InspectorTest.addResult("Committing edited source:"); |
| 219 InspectorTest.addSniffer(InspectorTest.debuggerModel, "_didEditS
criptSource", commitFailed); | 219 InspectorTest.addSniffer(InspectorTest.debuggerModel, "_didEditS
criptSource", commitFailed); |
| 220 InspectorTest.commitSource(javaScriptSourceFrame); | 220 InspectorTest.commitSource(javaScriptSourceFrame); |
| 221 } | 221 } |
| 222 | 222 |
| 223 function commitFailed(error) | 223 function commitFailed(error) |
| 224 { | 224 { |
| 225 InspectorTest.assertTrue(!!error, "Commit should have failed."); | 225 InspectorTest.assertTrue(!!error, "Commit should have failed."); |
| 226 dumpBreakpointStorageAndLocations(); | 226 dumpBreakpointStorageAndLocations(); |
| 227 InspectorTest.addResult("Editing source again so that live edit
could succeed:"); | 227 InspectorTest.addResult("Editing source again so that live edit
could succeed:"); |
| 228 InspectorTest.replaceInSource(javaScriptSourceFrame, "//}", "}//
"); | 228 InspectorTest.replaceInSource(javaScriptSourceFrame, "//}", "}//
"); |
| 229 | 229 |
| 230 dumpBreakpointStorageAndLocations(); | 230 dumpBreakpointStorageAndLocations(); |
| 231 InspectorTest.addResult("Committing edited source again:"); | 231 InspectorTest.addResult("Committing edited source again:"); |
| 232 InspectorTest.addSniffer(WebInspector.BreakpointManager.TargetBr
eakpoint.prototype, "_didSetBreakpointInDebugger", breakpointResolvedAgain); | 232 InspectorTest.addSniffer(Bindings.BreakpointManager.TargetBreakp
oint.prototype, "_didSetBreakpointInDebugger", breakpointResolvedAgain); |
| 233 InspectorTest.commitSource(javaScriptSourceFrame); | 233 InspectorTest.commitSource(javaScriptSourceFrame); |
| 234 } | 234 } |
| 235 | 235 |
| 236 function breakpointResolvedAgain() | 236 function breakpointResolvedAgain() |
| 237 { | 237 { |
| 238 dumpBreakpointStorageAndLocations(); | 238 dumpBreakpointStorageAndLocations(); |
| 239 InspectorTest.addResult("Finally removing breakpoint:"); | 239 InspectorTest.addResult("Finally removing breakpoint:"); |
| 240 InspectorTest.removeBreakpoint(javaScriptSourceFrame, 2); | 240 InspectorTest.removeBreakpoint(javaScriptSourceFrame, 2); |
| 241 | 241 |
| 242 dumpBreakpointStorageAndLocations(); | 242 dumpBreakpointStorageAndLocations(); |
| 243 next(); | 243 next(); |
| 244 } | 244 } |
| 245 }, | 245 }, |
| 246 | 246 |
| 247 function testEditCommitFailUndoCommit(next) | 247 function testEditCommitFailUndoCommit(next) |
| 248 { | 248 { |
| 249 var javaScriptSourceFrame, uiSourceCode, script, originalJavaScriptS
ourceFrame, originalUISourceCode; | 249 var javaScriptSourceFrame, uiSourceCode, script, originalJavaScriptS
ourceFrame, originalUISourceCode; |
| 250 | 250 |
| 251 InspectorTest.showScriptSource("edit-me-breakpoints.js", didShowScri
ptSource); | 251 InspectorTest.showScriptSource("edit-me-breakpoints.js", didShowScri
ptSource); |
| 252 | 252 |
| 253 function didShowScriptSource(sourceFrame) | 253 function didShowScriptSource(sourceFrame) |
| 254 { | 254 { |
| 255 javaScriptSourceFrame = sourceFrame; | 255 javaScriptSourceFrame = sourceFrame; |
| 256 uiSourceCode = sourceFrame._uiSourceCode; | 256 uiSourceCode = sourceFrame._uiSourceCode; |
| 257 | 257 |
| 258 InspectorTest.addResult("Setting breakpoint:"); | 258 InspectorTest.addResult("Setting breakpoint:"); |
| 259 InspectorTest.addSniffer(WebInspector.BreakpointManager.TargetBr
eakpoint.prototype, "_didSetBreakpointInDebugger", breakpointResolved); | 259 InspectorTest.addSniffer(Bindings.BreakpointManager.TargetBreakp
oint.prototype, "_didSetBreakpointInDebugger", breakpointResolved); |
| 260 InspectorTest.setBreakpoint(sourceFrame, 2, "", true); | 260 InspectorTest.setBreakpoint(sourceFrame, 2, "", true); |
| 261 } | 261 } |
| 262 | 262 |
| 263 function breakpointResolved(callback, breakpointId, locations) | 263 function breakpointResolved(callback, breakpointId, locations) |
| 264 { | 264 { |
| 265 var location = locations[0]; | 265 var location = locations[0]; |
| 266 script = InspectorTest.debuggerModel.scriptForId(location.script
Id); | 266 script = InspectorTest.debuggerModel.scriptForId(location.script
Id); |
| 267 | 267 |
| 268 dumpBreakpointStorageAndLocations(); | 268 dumpBreakpointStorageAndLocations(); |
| 269 InspectorTest.addResult("Editing source:"); | 269 InspectorTest.addResult("Editing source:"); |
| 270 InspectorTest.replaceInSource(javaScriptSourceFrame, "}", "//}")
; | 270 InspectorTest.replaceInSource(javaScriptSourceFrame, "}", "//}")
; |
| 271 | 271 |
| 272 originalUISourceCode = WebInspector.debuggerWorkspaceBinding.raw
LocationToUILocation(location).uiSourceCode; | 272 originalUISourceCode = Bindings.debuggerWorkspaceBinding.rawLoca
tionToUILocation(location).uiSourceCode; |
| 273 InspectorTest.showUISourceCode(originalUISourceCode, didShowOrig
inalUISourceCode); | 273 InspectorTest.showUISourceCode(originalUISourceCode, didShowOrig
inalUISourceCode); |
| 274 } | 274 } |
| 275 | 275 |
| 276 function didShowOriginalUISourceCode(sourceFrame) | 276 function didShowOriginalUISourceCode(sourceFrame) |
| 277 { | 277 { |
| 278 originalJavaScriptSourceFrame = sourceFrame; | 278 originalJavaScriptSourceFrame = sourceFrame; |
| 279 InspectorTest.assertTrue(originalJavaScriptSourceFrame !== javaS
criptSourceFrame, "Edited and original javaScriptSourceFrames should differ."); | 279 InspectorTest.assertTrue(originalJavaScriptSourceFrame !== javaS
criptSourceFrame, "Edited and original javaScriptSourceFrames should differ."); |
| 280 InspectorTest.assertTrue(originalUISourceCode !== uiSourceCode,
"Edited and original uiSourceCodes should differ."); | 280 InspectorTest.assertTrue(originalUISourceCode !== uiSourceCode,
"Edited and original uiSourceCodes should differ."); |
| 281 | 281 |
| 282 dumpBreakpointStorageAndLocations(); | 282 dumpBreakpointStorageAndLocations(); |
| 283 InspectorTest.addResult("Committing edited source:"); | 283 InspectorTest.addResult("Committing edited source:"); |
| 284 InspectorTest.addSniffer(InspectorTest.debuggerModel, "_didEditS
criptSource", commitFailed); | 284 InspectorTest.addSniffer(InspectorTest.debuggerModel, "_didEditS
criptSource", commitFailed); |
| 285 InspectorTest.commitSource(javaScriptSourceFrame); | 285 InspectorTest.commitSource(javaScriptSourceFrame); |
| 286 } | 286 } |
| 287 | 287 |
| 288 function commitFailed(error) | 288 function commitFailed(error) |
| 289 { | 289 { |
| 290 InspectorTest.assertTrue(!!error, "Commit should have failed."); | 290 InspectorTest.assertTrue(!!error, "Commit should have failed."); |
| 291 dumpBreakpointStorageAndLocations(); | 291 dumpBreakpointStorageAndLocations(); |
| 292 InspectorTest.addResult("Undoing source editing:"); | 292 InspectorTest.addResult("Undoing source editing:"); |
| 293 InspectorTest.undoSourceEditing(javaScriptSourceFrame); | 293 InspectorTest.undoSourceEditing(javaScriptSourceFrame); |
| 294 | 294 |
| 295 dumpBreakpointStorageAndLocations(); | 295 dumpBreakpointStorageAndLocations(); |
| 296 InspectorTest.addResult("Committing edited source again:"); | 296 InspectorTest.addResult("Committing edited source again:"); |
| 297 InspectorTest.addSniffer(WebInspector.BreakpointManager.TargetBr
eakpoint.prototype, "_didSetBreakpointInDebugger", breakpointResolvedAgain); | 297 InspectorTest.addSniffer(Bindings.BreakpointManager.TargetBreakp
oint.prototype, "_didSetBreakpointInDebugger", breakpointResolvedAgain); |
| 298 InspectorTest.commitSource(javaScriptSourceFrame); | 298 InspectorTest.commitSource(javaScriptSourceFrame); |
| 299 } | 299 } |
| 300 | 300 |
| 301 function breakpointResolvedAgain() | 301 function breakpointResolvedAgain() |
| 302 { | 302 { |
| 303 dumpBreakpointStorageAndLocations(); | 303 dumpBreakpointStorageAndLocations(); |
| 304 InspectorTest.addResult("Finally removing breakpoint:"); | 304 InspectorTest.addResult("Finally removing breakpoint:"); |
| 305 InspectorTest.removeBreakpoint(javaScriptSourceFrame, 2); | 305 InspectorTest.removeBreakpoint(javaScriptSourceFrame, 2); |
| 306 | 306 |
| 307 dumpBreakpointStorageAndLocations(); | 307 dumpBreakpointStorageAndLocations(); |
| 308 next(); | 308 next(); |
| 309 } | 309 } |
| 310 }, | 310 }, |
| 311 ]); | 311 ]); |
| 312 }; | 312 }; |
| 313 | 313 |
| 314 </script> | 314 </script> |
| 315 </head> | 315 </head> |
| 316 <body onload="runTest()"> | 316 <body onload="runTest()"> |
| 317 <p>Tests breakpoints are correctly dimmed and restored in JavaScriptSourceFrame
during live edit.</p> | 317 <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> | 318 <a href="https://bugs.webkit.org/show_bug.cgi?id=99598">Bug 99598</a> |
| 319 </body> | 319 </body> |
| 320 </html> | 320 </html> |
| OLD | NEW |