| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions | |
| 6 * are met: | |
| 7 * 1. Redistributions of source code must retain the above copyright | |
| 8 * notice, this list of conditions and the following disclaimer. | |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | |
| 10 * notice, this list of conditions and the following disclaimer in the | |
| 11 * documentation and/or other materials provided with the distribution. | |
| 12 * | |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 24 */ | |
| 25 | |
| 26 WebInspector.CallStackSidebarPane = function() | |
| 27 { | |
| 28 WebInspector.SidebarPane.call(this, WebInspector.UIString("Call Stack")); | |
| 29 } | |
| 30 | |
| 31 WebInspector.CallStackSidebarPane.prototype = { | |
| 32 update: function(callFrame, sourceIDMap) | |
| 33 { | |
| 34 this.bodyElement.removeChildren(); | |
| 35 | |
| 36 this.placards = []; | |
| 37 delete this._selectedCallFrame; | |
| 38 | |
| 39 if (!callFrame) { | |
| 40 var infoElement = document.createElement("div"); | |
| 41 infoElement.className = "info"; | |
| 42 infoElement.textContent = WebInspector.UIString("Not Paused"); | |
| 43 this.bodyElement.appendChild(infoElement); | |
| 44 return; | |
| 45 } | |
| 46 | |
| 47 var title; | |
| 48 var subtitle; | |
| 49 var scriptOrResource; | |
| 50 | |
| 51 do { | |
| 52 switch (callFrame.type) { | |
| 53 case "function": | |
| 54 title = callFrame.functionName || WebInspector.UIString("(anonym
ous function)"); | |
| 55 break; | |
| 56 case "program": | |
| 57 title = WebInspector.UIString("(program)"); | |
| 58 break; | |
| 59 } | |
| 60 | |
| 61 scriptOrResource = sourceIDMap[callFrame.sourceID]; | |
| 62 subtitle = WebInspector.displayNameForURL(scriptOrResource.sourceURL
|| scriptOrResource.url); | |
| 63 | |
| 64 if (callFrame.line > 0) { | |
| 65 if (subtitle) | |
| 66 subtitle += ":" + callFrame.line; | |
| 67 else | |
| 68 subtitle = WebInspector.UIString("line %d", callFrame.line); | |
| 69 } | |
| 70 | |
| 71 var placard = new WebInspector.Placard(title, subtitle); | |
| 72 placard.callFrame = callFrame; | |
| 73 | |
| 74 placard.element.addEventListener("click", this._placardSelected.bind
(this), false); | |
| 75 | |
| 76 this.placards.push(placard); | |
| 77 this.bodyElement.appendChild(placard.element); | |
| 78 | |
| 79 callFrame = callFrame.caller; | |
| 80 } while (callFrame); | |
| 81 }, | |
| 82 | |
| 83 get selectedCallFrame() | |
| 84 { | |
| 85 return this._selectedCallFrame; | |
| 86 }, | |
| 87 | |
| 88 set selectedCallFrame(x) | |
| 89 { | |
| 90 if (this._selectedCallFrame === x) | |
| 91 return; | |
| 92 | |
| 93 this._selectedCallFrame = x; | |
| 94 | |
| 95 for (var i = 0; i < this.placards.length; ++i) { | |
| 96 var placard = this.placards[i]; | |
| 97 placard.selected = (placard.callFrame === this._selectedCallFrame); | |
| 98 } | |
| 99 | |
| 100 this.dispatchEventToListeners("call frame selected"); | |
| 101 }, | |
| 102 | |
| 103 _placardSelected: function(event) | |
| 104 { | |
| 105 var placardElement = event.target.enclosingNodeOrSelfWithClass("placard"
); | |
| 106 this.selectedCallFrame = placardElement.placard.callFrame; | |
| 107 } | |
| 108 } | |
| 109 | |
| 110 WebInspector.CallStackSidebarPane.prototype.__proto__ = WebInspector.SidebarPane
.prototype; | |
| OLD | NEW |