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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 if (this._uiSourceCode.project().type() === WebInspector.projectTypes.Sn
ippets) | 351 if (this._uiSourceCode.project().type() === WebInspector.projectTypes.Sn
ippets) |
352 return; | 352 return; |
353 if (!this._script) | 353 if (!this._script) |
354 return; | 354 return; |
355 var debuggerModel = this._resourceScriptMapping._debuggerModel; | 355 var debuggerModel = this._resourceScriptMapping._debuggerModel; |
356 var source = this._uiSourceCode.workingCopy(); | 356 var source = this._uiSourceCode.workingCopy(); |
357 debuggerModel.setScriptSource(this._script.scriptId, source, scriptSourc
eWasSet.bind(this)); | 357 debuggerModel.setScriptSource(this._script.scriptId, source, scriptSourc
eWasSet.bind(this)); |
358 | 358 |
359 /** | 359 /** |
360 * @param {?string} error | 360 * @param {?string} error |
361 * @param {!DebuggerAgent.SetScriptSourceError=} errorData | 361 * @param {!RuntimeAgent.ExceptionDetails=} exceptionDetails |
362 * @this {WebInspector.ResourceScriptFile} | 362 * @this {WebInspector.ResourceScriptFile} |
363 */ | 363 */ |
364 function scriptSourceWasSet(error, errorData) | 364 function scriptSourceWasSet(error, exceptionDetails) |
365 { | 365 { |
366 if (!error && !errorData) | 366 if (!error && !exceptionDetails) |
367 this._scriptSource = source; | 367 this._scriptSource = source; |
368 this._update(); | 368 this._update(); |
369 | 369 |
370 if (!error && !errorData) | 370 if (!error && !exceptionDetails) |
371 return; | 371 return; |
372 var warningLevel = WebInspector.Console.MessageLevel.Warning; | 372 if (!exceptionDetails) { |
373 if (!errorData) { | 373 WebInspector.console.addMessage(WebInspector.UIString("LiveEdit
failed: %s", error), WebInspector.Console.MessageLevel.Warning); |
374 WebInspector.console.addMessage(WebInspector.UIString("LiveEdit
failed: %s", error), warningLevel); | |
375 return; | 374 return; |
376 } | 375 } |
377 if (errorData) { | 376 var messageText = WebInspector.UIString("LiveEdit compile failed: %s
", exceptionDetails.text); |
378 var messageText = WebInspector.UIString("LiveEdit compile failed
: %s", errorData.message); | 377 this._uiSourceCode.addLineMessage(WebInspector.UISourceCode.Message.
Level.Error, messageText, exceptionDetails.lineNumber, exceptionDetails.columnNu
mber); |
379 this._uiSourceCode.addLineMessage(WebInspector.UISourceCode.Mess
age.Level.Error, messageText, errorData.lineNumber - 1, errorData.columnNumber +
1); | |
380 } else { | |
381 WebInspector.console.addMessage(WebInspector.UIString("Unknown L
iveEdit error: %s; %s", JSON.stringify(errorData), error), warningLevel); | |
382 } | |
383 } | 378 } |
384 }, | 379 }, |
385 | 380 |
386 _update: function() | 381 _update: function() |
387 { | 382 { |
388 if (this._isDiverged() && !this._hasDivergedFromVM) | 383 if (this._isDiverged() && !this._hasDivergedFromVM) |
389 this._divergeFromVM(); | 384 this._divergeFromVM(); |
390 else if (!this._isDiverged() && this._hasDivergedFromVM) | 385 else if (!this._isDiverged() && this._hasDivergedFromVM) |
391 this._mergeToVM(); | 386 this._mergeToVM(); |
392 }, | 387 }, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 /** | 479 /** |
485 * @return {boolean} | 480 * @return {boolean} |
486 */ | 481 */ |
487 hasSourceMapURL: function() | 482 hasSourceMapURL: function() |
488 { | 483 { |
489 return this._script && !!this._script.sourceMapURL; | 484 return this._script && !!this._script.sourceMapURL; |
490 }, | 485 }, |
491 | 486 |
492 __proto__: WebInspector.Object.prototype | 487 __proto__: WebInspector.Object.prototype |
493 } | 488 } |
OLD | NEW |