Changeset 75795 in webkit
- Timestamp:
- Jan 14, 2011 7:58:16 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r75794 r75795 1 2011-01-14 Pavel Podivilov <podivilov@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: breakpoint text snippet in breakpoints sidebar pane disappears after reload. 6 https://bugs.webkit.org/show_bug.cgi?id=52215 7 8 * inspector/front-end/Breakpoint.js: 9 (WebInspector.Breakpoint): 10 (WebInspector.Breakpoint.prototype.populateLabelElement): 11 * inspector/front-end/Script.js: 12 (WebInspector.Script.prototype.get linesCount): 13 (WebInspector.Script.prototype.sourceLine): 14 (WebInspector.Script.prototype.sourceLine.didRequestSource): 15 (WebInspector.Script.prototype.set source): 16 (WebInspector.Script.prototype.requestSource.didGetScriptSource): 17 (WebInspector.Script.prototype.requestSource): 18 * inspector/front-end/ScriptView.js: 19 (WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded.didRequestSource): 20 (WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded): 21 * inspector/front-end/SourceFrame.js: 22 (WebInspector.SourceFrame.prototype._addBreakpoint): 23 * inspector/front-end/utilities.js: 24 (String.prototype.findAll): 25 1 26 2011-01-14 Pavel Podivilov <podivilov@chromium.org> 2 27 -
trunk/Source/WebCore/inspector/front-end/Breakpoint.js
r74798 r75795 38 38 this._enabled = enabled; 39 39 this._condition = condition || ""; 40 this._sourceText = "";41 40 this._hit = false; 42 41 this._debuggerModel = debuggerModel; … … 55 54 this.remove(); 56 55 WebInspector.debuggerModel.setBreakpoint(this.sourceID, this.line, enabled, this.condition); 57 },58 59 get sourceText()60 {61 return this._sourceText;62 },63 64 set sourceText(text)65 {66 this._sourceText = text;67 this.dispatchEventToListeners("label-changed");68 56 }, 69 57 … … 100 88 populateLabelElement: function(element) 101 89 { 102 var displayName = this.url ? WebInspector.displayNameForURL(this.url) : WebInspector.UIString("(program)"); 103 var labelElement = document.createTextNode(displayName + ":" + this.line); 104 element.appendChild(labelElement); 90 function didGetSourceLine(text) 91 { 92 var displayName = this.url ? WebInspector.displayNameForURL(this.url) : WebInspector.UIString("(program)"); 93 var labelElement = document.createTextNode(displayName + ":" + this.line); 94 element.appendChild(labelElement); 105 95 106 var sourceTextElement = document.createElement("div"); 107 sourceTextElement.textContent = this.sourceText; 108 sourceTextElement.className = "source-text monospace"; 109 element.appendChild(sourceTextElement); 96 var sourceTextElement = document.createElement("div"); 97 sourceTextElement.textContent = text; 98 sourceTextElement.className = "source-text monospace"; 99 element.appendChild(sourceTextElement); 100 } 101 var script = this._debuggerModel.scriptForSourceID(this.sourceID); 102 script.sourceLine(this.line, didGetSourceLine.bind(this)); 110 103 }, 111 104 -
trunk/Source/WebCore/inspector/front-end/Script.js
r75794 r75795 69 69 if (!this.source) 70 70 return 0; 71 if (this._linesCount) 72 return this._linesCount; 73 this._linesCount = 0; 74 var lastIndex = this.source.indexOf("\n"); 75 while (lastIndex !== -1) { 76 lastIndex = this.source.indexOf("\n", lastIndex + 1) 77 this._linesCount++; 71 if (!this._lineEndings) 72 this._lineEndings = this._source.findAll("\n"); 73 return this._lineEndings.length + 1; 74 }, 75 76 sourceLine: function(lineNumber, callback) 77 { 78 function extractSourceLine() 79 { 80 lineNumber -= this.startingLine; 81 callback(this._source.substring(this._lineEndings[lineNumber - 1], this._lineEndings[lineNumber])); 78 82 } 79 return this._linesCount; 83 84 if (this._lineEndings) { 85 extractSourceLine.call(this); 86 return; 87 } 88 89 function didRequestSource() 90 { 91 this._lineEndings = this._source.findAll("\n"); 92 extractSourceLine.call(this); 93 } 94 this.requestSource(didRequestSource.bind(this)); 80 95 }, 81 96 … … 88 103 { 89 104 this._source = source; 105 }, 106 107 requestSource: function(callback) 108 { 109 if (this._source) { 110 callback(this._source); 111 return; 112 } 113 114 function didGetScriptSource(source) 115 { 116 this._source = source; 117 callback(this._source); 118 } 119 InspectorBackend.getScriptSource(this.sourceID, didGetScriptSource.bind(this)); 90 120 } 91 121 } -
trunk/Source/WebCore/inspector/front-end/ScriptView.js
r75500 r75795 54 54 this.attach(); 55 55 56 if (this.script.source) 57 this._sourceFrameSetupFinished(); 58 else 59 InspectorBackend.getScriptSource(this.script.sourceID, this._didGetScriptSource.bind(this)); 60 }, 61 62 _didGetScriptSource: function(source) 63 { 64 this.script.source = source || WebInspector.UIString("<source is not available>"); 65 this._sourceFrameSetupFinished(); 66 }, 67 68 _sourceFrameSetupFinished: function() 69 { 70 this.sourceFrame.setContent("text/javascript", this._prependWhitespace(this.script.source)); 71 this._sourceFrameSetup = true; 56 function didRequestSource(source) 57 { 58 source = source || WebInspector.UIString("<source is not available>"); 59 this.sourceFrame.setContent("text/javascript", this._prependWhitespace(source)); 60 this._sourceFrameSetup = true; 61 } 62 this.script.requestSource(didRequestSource.bind(this)); 72 63 }, 73 64 -
trunk/Source/WebCore/inspector/front-end/SourceFrame.js
r75601 r75795 433 433 breakpoint.addEventListener("removed", this._breakpointRemoved, this); 434 434 435 breakpoint.sourceText = this._textModel.line(breakpoint.line - 1);436 435 this._setBreakpointDecoration(breakpoint.line, breakpoint.enabled, !!breakpoint.condition); 437 436 }, -
trunk/Source/WebCore/inspector/front-end/utilities.js
r75739 r75795 387 387 return this.indexOf(string) !== -1; 388 388 return this.match(new RegExp(string.escapeForRegExp(), "i")); 389 } 390 391 String.prototype.findAll = function(string) 392 { 393 var matches = []; 394 var i = this.indexOf(string); 395 while (i !== -1) { 396 matches.push(i); 397 i = this.indexOf(string, i + string.length); 398 } 399 return matches; 389 400 } 390 401
Note: See TracChangeset
for help on using the changeset viewer.