Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(904)

Side by Side Diff: Source/devtools/front_end/sdk/ResourceScriptMapping.js

Issue 352953002: DevTools: properly support targets in LiveEditSupport (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix test Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 265
266 if (this._uiSourceCode.contentType() === WebInspector.resourceTypes.Script) 266 if (this._uiSourceCode.contentType() === WebInspector.resourceTypes.Script)
267 this._script = scripts[0]; 267 this._script = scripts[0];
268 268
269 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working CopyChanged, this._workingCopyChanged, this); 269 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working CopyChanged, this._workingCopyChanged, this);
270 this._update(); 270 this._update();
271 } 271 }
272 272
273 WebInspector.ResourceScriptFile.prototype = { 273 WebInspector.ResourceScriptFile.prototype = {
274 /** 274 /**
275 * @param {function(boolean)=} callback 275 * @param {function(?string,!DebuggerAgent.SetScriptSourceError=,!WebInspect or.Script=)=} callback
276 */ 276 */
277 commitLiveEdit: function(callback) 277 commitLiveEdit: function(callback)
278 { 278 {
279 var target = this._resourceScriptMapping._target;
279 /** 280 /**
280 * @param {?string} error 281 * @param {?string} error
281 * @param {!DebuggerAgent.SetScriptSourceError=} errorData 282 * @param {!DebuggerAgent.SetScriptSourceError=} errorData
282 * @this {WebInspector.ResourceScriptFile} 283 * @this {WebInspector.ResourceScriptFile}
283 */ 284 */
284 function innerCallback(error, errorData) 285 function innerCallback(error, errorData)
285 { 286 {
286 if (error) { 287 if (!error)
287 this._update(); 288 this._scriptSource = source;
288 WebInspector.LiveEditSupport.logDetailedError(error, errorData, this._script);
289 if (callback)
290 callback(false);
291 return;
292 }
293
294 this._scriptSource = source;
295 this._update(); 289 this._update();
296 WebInspector.LiveEditSupport.logSuccess();
297 if (callback) 290 if (callback)
298 callback(true); 291 callback(error, errorData, this._script);
299 } 292 }
300 if (!this._script) 293 if (!this._script)
301 return; 294 return;
302 var source = this._uiSourceCode.workingCopy(); 295 var source = this._uiSourceCode.workingCopy();
303 this._resourceScriptMapping._debuggerModel.setScriptSource(this._script. scriptId, source, innerCallback.bind(this)); 296 target.debuggerModel.setScriptSource(this._script.scriptId, source, inne rCallback.bind(this));
304 }, 297 },
305 298
306 /** 299 /**
307 * @return {boolean} 300 * @return {boolean}
308 */ 301 */
309 _isDiverged: function() 302 _isDiverged: function()
310 { 303 {
311 if (this._uiSourceCode.isDirty()) 304 if (this._uiSourceCode.isDirty())
312 return true; 305 return true;
313 if (!this._script) 306 if (!this._script)
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 return this._script.target(); 400 return this._script.target();
408 }, 401 },
409 402
410 dispose: function() 403 dispose: function()
411 { 404 {
412 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyChanged, this._workingCopyChanged, this); 405 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyChanged, this._workingCopyChanged, this);
413 }, 406 },
414 407
415 __proto__: WebInspector.Object.prototype 408 __proto__: WebInspector.Object.prototype
416 } 409 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sdk/LiveEditSupport.js ('k') | Source/devtools/front_end/sdk/Target.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698