Index: third_party/WebKit/Source/devtools/front_end/sources/JavaScriptCompiler.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptCompiler.js b/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptCompiler.js |
index 2076cae469510e07f159060bf4bdf2c4ab811b88..a60c646e623f1b2e1948ba7f44a7de8c9520ede6 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptCompiler.js |
+++ b/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptCompiler.js |
@@ -1,81 +1,80 @@ |
// Copyright 2014 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
- |
/** |
- * @constructor |
- * @param {!WebInspector.JavaScriptSourceFrame} sourceFrame |
+ * @unrestricted |
*/ |
-WebInspector.JavaScriptCompiler = function(sourceFrame) |
-{ |
+WebInspector.JavaScriptCompiler = class { |
+ /** |
+ * @param {!WebInspector.JavaScriptSourceFrame} sourceFrame |
+ */ |
+ constructor(sourceFrame) { |
this._sourceFrame = sourceFrame; |
this._compiling = false; |
-}; |
+ } |
-WebInspector.JavaScriptCompiler.CompileDelay = 1000; |
+ scheduleCompile() { |
+ if (this._compiling) { |
+ this._recompileScheduled = true; |
+ return; |
+ } |
+ if (this._timeout) |
+ clearTimeout(this._timeout); |
+ this._timeout = setTimeout(this._compile.bind(this), WebInspector.JavaScriptCompiler.CompileDelay); |
+ } |
-WebInspector.JavaScriptCompiler.prototype = { |
- scheduleCompile: function() |
- { |
- if (this._compiling) { |
- this._recompileScheduled = true; |
- return; |
- } |
- if (this._timeout) |
- clearTimeout(this._timeout); |
- this._timeout = setTimeout(this._compile.bind(this), WebInspector.JavaScriptCompiler.CompileDelay); |
- }, |
- |
- /** |
- * @return {?WebInspector.Target} |
- */ |
- _findTarget: function() |
- { |
- var targets = WebInspector.targetManager.targets(); |
- var sourceCode = this._sourceFrame.uiSourceCode(); |
- for (var i = 0; i < targets.length; ++i) { |
- var scriptFile = WebInspector.debuggerWorkspaceBinding.scriptFile(sourceCode, targets[i]); |
- if (scriptFile) |
- return targets[i]; |
- } |
- return WebInspector.targetManager.mainTarget(); |
- }, |
+ /** |
+ * @return {?WebInspector.Target} |
+ */ |
+ _findTarget() { |
+ var targets = WebInspector.targetManager.targets(); |
+ var sourceCode = this._sourceFrame.uiSourceCode(); |
+ for (var i = 0; i < targets.length; ++i) { |
+ var scriptFile = WebInspector.debuggerWorkspaceBinding.scriptFile(sourceCode, targets[i]); |
+ if (scriptFile) |
+ return targets[i]; |
+ } |
+ return WebInspector.targetManager.mainTarget(); |
+ } |
- _compile: function() |
- { |
- var target = this._findTarget(); |
- if (!target) |
- return; |
- var runtimeModel = target.runtimeModel; |
- var currentExecutionContext = WebInspector.context.flavor(WebInspector.ExecutionContext); |
- if (!currentExecutionContext) |
- return; |
+ _compile() { |
+ var target = this._findTarget(); |
+ if (!target) |
+ return; |
+ var runtimeModel = target.runtimeModel; |
+ var currentExecutionContext = WebInspector.context.flavor(WebInspector.ExecutionContext); |
+ if (!currentExecutionContext) |
+ return; |
- this._compiling = true; |
- var code = this._sourceFrame.textEditor.text(); |
- runtimeModel.compileScript(code, "", false, currentExecutionContext.id, compileCallback.bind(this, target)); |
+ this._compiling = true; |
+ var code = this._sourceFrame.textEditor.text(); |
+ runtimeModel.compileScript(code, '', false, currentExecutionContext.id, compileCallback.bind(this, target)); |
- /** |
- * @param {!WebInspector.Target} target |
- * @param {!RuntimeAgent.ScriptId=} scriptId |
- * @param {?RuntimeAgent.ExceptionDetails=} exceptionDetails |
- * @this {WebInspector.JavaScriptCompiler} |
- */ |
- function compileCallback(target, scriptId, exceptionDetails) |
- { |
- this._compiling = false; |
- if (this._recompileScheduled) { |
- delete this._recompileScheduled; |
- this.scheduleCompile(); |
- return; |
- } |
- if (!exceptionDetails) |
- return; |
- var text = WebInspector.ConsoleMessage.simpleTextFromException(exceptionDetails); |
- this._sourceFrame.uiSourceCode().addLineMessage(WebInspector.UISourceCode.Message.Level.Error, text, exceptionDetails.lineNumber, exceptionDetails.columnNumber); |
- this._compilationFinishedForTest(); |
- } |
- }, |
+ /** |
+ * @param {!WebInspector.Target} target |
+ * @param {!RuntimeAgent.ScriptId=} scriptId |
+ * @param {?RuntimeAgent.ExceptionDetails=} exceptionDetails |
+ * @this {WebInspector.JavaScriptCompiler} |
+ */ |
+ function compileCallback(target, scriptId, exceptionDetails) { |
+ this._compiling = false; |
+ if (this._recompileScheduled) { |
+ delete this._recompileScheduled; |
+ this.scheduleCompile(); |
+ return; |
+ } |
+ if (!exceptionDetails) |
+ return; |
+ var text = WebInspector.ConsoleMessage.simpleTextFromException(exceptionDetails); |
+ this._sourceFrame.uiSourceCode().addLineMessage( |
+ WebInspector.UISourceCode.Message.Level.Error, text, exceptionDetails.lineNumber, |
+ exceptionDetails.columnNumber); |
+ this._compilationFinishedForTest(); |
+ } |
+ } |
- _compilationFinishedForTest: function() {} |
+ _compilationFinishedForTest() { |
+ } |
}; |
+ |
+WebInspector.JavaScriptCompiler.CompileDelay = 1000; |