| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview Tools is a main class that wires all components of the | 6 * @fileoverview Tools is a main class that wires all components of the |
| 7 * DevTools frontend together. It is also responsible for overriding existing | 7 * DevTools frontend together. It is also responsible for overriding existing |
| 8 * WebInspector functionality while it is getting upstreamed into WebCore. | 8 * WebInspector functionality while it is getting upstreamed into WebCore. |
| 9 */ | 9 */ |
| 10 goog.provide('devtools.Tools'); | 10 goog.provide('devtools.Tools'); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 this.domAgent_.reset(); | 60 this.domAgent_.reset(); |
| 61 this.debuggerAgent_.reset(); | 61 this.debuggerAgent_.reset(); |
| 62 | 62 |
| 63 this.domAgent_.getDocumentElementAsync(); | 63 this.domAgent_.getDocumentElementAsync(); |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 | 66 |
| 67 /** | 67 /** |
| 68 * @param {string} script Script exression to be evaluated in the context of the | 68 * @param {string} script Script exression to be evaluated in the context of the |
| 69 * inspected page. | 69 * inspected page. |
| 70 * @param {function(string):undefined} callback Function to call with the | 70 * @param {function(Object|string, boolean):undefined} opt_callback Function to
call |
| 71 * result. | 71 * with the result. |
| 72 */ | 72 */ |
| 73 devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, callback) { | 73 devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, |
| 74 var callbackId = devtools.Callback.wrap(function(result) { | 74 opt_callback) { |
| 75 var pair = JSON.parse(result); | 75 var callbackId = devtools.Callback.wrap(function(result, exception) { |
| 76 if (callback) { | 76 if (opt_callback) { |
| 77 callback(pair[0], pair[1]); | 77 if (exception) { |
| 78 opt_callback(exception, true /* result is exception */); |
| 79 } else { |
| 80 opt_callback(JSON.parse(result), false); |
| 81 } |
| 78 } | 82 } |
| 79 }); | 83 }); |
| 80 RemoteToolsAgent.ExecuteUtilityFunction(callbackId, | 84 RemoteToolsAgent.EvaluateJavaScript(callbackId, script); |
| 81 'evaluate', JSON.stringify([script])); | |
| 82 }; | 85 }; |
| 83 | 86 |
| 84 | 87 |
| 85 /** | 88 /** |
| 86 * @return {devtools.DebuggerAgent} Debugger agent instance. | 89 * @return {devtools.DebuggerAgent} Debugger agent instance. |
| 87 */ | 90 */ |
| 88 devtools.ToolsAgent.prototype.getDebuggerAgent = function() { | 91 devtools.ToolsAgent.prototype.getDebuggerAgent = function() { |
| 89 return this.debuggerAgent_; | 92 return this.debuggerAgent_; |
| 90 }; | 93 }; |
| 91 | 94 |
| (...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 }; | 1066 }; |
| 1064 | 1067 |
| 1065 var originalDragEnd = WebInspector.elementDragEnd; | 1068 var originalDragEnd = WebInspector.elementDragEnd; |
| 1066 WebInspector.elementDragEnd = function() { | 1069 WebInspector.elementDragEnd = function() { |
| 1067 originalDragEnd.apply(this, arguments); | 1070 originalDragEnd.apply(this, arguments); |
| 1068 | 1071 |
| 1069 var glassPane = document.getElementById('glass-pane-for-drag'); | 1072 var glassPane = document.getElementById('glass-pane-for-drag'); |
| 1070 glassPane.parentElement.removeChild(glassPane); | 1073 glassPane.parentElement.removeChild(glassPane); |
| 1071 }; | 1074 }; |
| 1072 })(); | 1075 })(); |
| OLD | NEW |