OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; | 42 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; |
43 this._projectId = "liveedit:" + target.id(); | 43 this._projectId = "liveedit:" + target.id(); |
44 this._projectDelegate = new WebInspector.DebuggerProjectDelegate(workspace,
this._projectId, WebInspector.projectTypes.LiveEdit); | 44 this._projectDelegate = new WebInspector.DebuggerProjectDelegate(workspace,
this._projectId, WebInspector.projectTypes.LiveEdit); |
45 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.Glob
alObjectCleared, this._debuggerReset, this); | 45 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.Glob
alObjectCleared, this._debuggerReset, this); |
46 this._debuggerReset(); | 46 this._debuggerReset(); |
47 } | 47 } |
48 | 48 |
49 WebInspector.LiveEditSupport.prototype = { | 49 WebInspector.LiveEditSupport.prototype = { |
50 /** | 50 /** |
51 * @param {!WebInspector.UISourceCode} uiSourceCode | 51 * @param {!WebInspector.UISourceCode} uiSourceCode |
52 * @return {!WebInspector.UISourceCode} | 52 * @return {?WebInspector.UISourceCode} |
53 */ | 53 */ |
54 uiSourceCodeForLiveEdit: function(uiSourceCode) | 54 uiSourceCodeForLiveEdit: function(uiSourceCode) |
55 { | 55 { |
56 var debuggerModelLocation = this._debuggerWorkspaceBinding.uiLocationToR
awLocation(this.target(), uiSourceCode, 0, 0); | 56 var debuggerModelLocation = this._debuggerWorkspaceBinding.uiLocationToR
awLocation(this.target(), uiSourceCode, 0, 0); |
| 57 if (!debuggerModelLocation) |
| 58 return null; |
57 var uiLocation = this._debuggerWorkspaceBinding.rawLocationToUILocation(
debuggerModelLocation); | 59 var uiLocation = this._debuggerWorkspaceBinding.rawLocationToUILocation(
debuggerModelLocation); |
58 | 60 |
59 // FIXME: Support live editing of scripts mapped to some file. | 61 // FIXME: Support live editing of scripts mapped to some file. |
60 if (uiLocation.uiSourceCode !== uiSourceCode) | 62 if (uiLocation.uiSourceCode !== uiSourceCode) |
61 return uiLocation.uiSourceCode; | 63 return uiLocation.uiSourceCode; |
62 | 64 |
63 var script = debuggerModelLocation.script(); | 65 var script = debuggerModelLocation.script(); |
64 if (this._uiSourceCodeForScriptId[script.scriptId]) | 66 if (this._uiSourceCodeForScriptId[script.scriptId]) |
65 return this._uiSourceCodeForScriptId[script.scriptId]; | 67 return this._uiSourceCodeForScriptId[script.scriptId]; |
66 | 68 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 WebInspector.console.error(message); | 151 WebInspector.console.error(message); |
150 } else { | 152 } else { |
151 WebInspector.console.addMessage(WebInspector.UIString("Unknown LiveEdit
error: %s; %s", JSON.stringify(errorData), error), warningLevel); | 153 WebInspector.console.addMessage(WebInspector.UIString("Unknown LiveEdit
error: %s; %s", JSON.stringify(errorData), error), warningLevel); |
152 } | 154 } |
153 } | 155 } |
154 | 156 |
155 WebInspector.LiveEditSupport.logSuccess = function() | 157 WebInspector.LiveEditSupport.logSuccess = function() |
156 { | 158 { |
157 WebInspector.console.log(WebInspector.UIString("Recompilation and update suc
ceeded.")); | 159 WebInspector.console.log(WebInspector.UIString("Recompilation and update suc
ceeded.")); |
158 } | 160 } |
OLD | NEW |