2 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 WebInspector.JavaScriptSourceFrame = function(model, uiSourceCode)
33 // FIXME: move all SourceFrame methods related to JavaScript debugging here and
34 // get rid of SourceFrame._delegate.
35 var delegate = new WebInspector.SourceFrameDelegateForScriptsPanel(model, uiSourceCode);
36 WebInspector.SourceFrame.call(this, delegate, uiSourceCode.url);
39 WebInspector.JavaScriptSourceFrame.prototype.__proto__ = WebInspector.SourceFrame.prototype;
41 WebInspector.SourceFrameDelegateForScriptsPanel = function(model, uiSourceCode)
43 WebInspector.SourceFrameDelegate.call(this);
45 this._uiSourceCode = uiSourceCode;
46 this._popoverObjectGroup = "popover";
49 WebInspector.SourceFrameDelegateForScriptsPanel.prototype = {
50 requestContent: function(callback)
52 this._uiSourceCode.requestContent(callback);
55 debuggingSupported: function()
60 setBreakpoint: function(lineNumber, condition, enabled)
62 this._model.setBreakpoint(this._uiSourceCode, lineNumber, condition, enabled);
64 if (!WebInspector.panels.scripts.breakpointsActivated)
65 WebInspector.panels.scripts.toggleBreakpointsClicked();
68 updateBreakpoint: function(lineNumber, condition, enabled)
70 this._model.updateBreakpoint(this._uiSourceCode, lineNumber, condition, enabled);
73 removeBreakpoint: function(lineNumber)
75 this._model.removeBreakpoint(this._uiSourceCode, lineNumber);
78 findBreakpoint: function(lineNumber)
80 return this._model.findBreakpoint(this._uiSourceCode, lineNumber);
83 continueToLine: function(lineNumber)
85 this._model.continueToLine(this._uiSourceCode, lineNumber);
88 canEditScriptSource: function()
90 return this._model.canEditScriptSource(this._uiSourceCode);
93 setScriptSource: function(text, callback)
95 this._model.setScriptSource(this._uiSourceCode, text, callback);
98 setScriptSourceIsBeingEdited: function(inEditMode)
100 WebInspector.panels.scripts.setScriptSourceIsBeingEdited(this._uiSourceCode, inEditMode);
103 debuggerPaused: function()
105 return WebInspector.panels.scripts.paused;
108 evaluateInSelectedCallFrame: function(string, callback)
110 WebInspector.panels.scripts.evaluateInSelectedCallFrame(string, this._popoverObjectGroup, false, false, callback);
113 releaseEvaluationResult: function()
115 RuntimeAgent.releaseObjectGroup(this._popoverObjectGroup);
118 suggestedFileName: function()
120 var names = WebInspector.panels.scripts._folderAndDisplayNameForScriptURL(this._uiSourceCode.url);
121 return names.displayName || "untitled.js";
125 WebInspector.SourceFrameDelegateForScriptsPanel.prototype.__proto__ = WebInspector.SourceFrameDelegate.prototype;