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 Javascript that is being injected into the inspectable page | 6 * @fileoverview Javascript that is being injected into the inspectable page |
7 * while debugging. | 7 * while debugging. |
8 */ | 8 */ |
9 goog.provide('devtools.Injected'); | 9 goog.provide('devtools.Injected'); |
10 | 10 |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 }; | 537 }; |
538 | 538 |
539 | 539 |
540 /** | 540 /** |
541 * Caches console object for subsequent calls to getConsoleObjectProperties. | 541 * Caches console object for subsequent calls to getConsoleObjectProperties. |
542 * @param {Object} obj Object to cache. | 542 * @param {Object} obj Object to cache. |
543 * @return {string} console object id. | 543 * @return {string} console object id. |
544 */ | 544 */ |
545 devtools.Injected.prototype.evaluate = function(expression) { | 545 devtools.Injected.prototype.evaluate = function(expression) { |
546 try { | 546 try { |
547 return [ this.wrapConsoleObject(window.eval(expression)), false ]; | 547 // Evaluate the expression in the global context of the inspected window. |
| 548 return [ this.wrapConsoleObject(contentWindow.eval(expression)), false ]; |
548 } catch (e) { | 549 } catch (e) { |
549 return [ e.toString(), true ]; | 550 return [ e.toString(), true ]; |
550 } | 551 } |
551 }; | 552 }; |
OLD | NEW |