| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 var DCHECK = requireNative('logging').DCHECK; | 5 var DCHECK = requireNative('logging').DCHECK; |
| 6 var GetAvailability = requireNative('v8_context').GetAvailability; | 6 var GetAvailability = requireNative('v8_context').GetAvailability; |
| 7 var GetGlobal = requireNative('sendRequest').GetGlobal; | 7 var GetGlobal = requireNative('sendRequest').GetGlobal; |
| 8 | 8 |
| 9 // Utility for setting chrome.*.lastError. | 9 // Utility for setting chrome.*.lastError. |
| 10 // | 10 // |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 /** | 47 /** |
| 48 * Runs |callback(args)| with last error args as in set(). | 48 * Runs |callback(args)| with last error args as in set(). |
| 49 * | 49 * |
| 50 * The target chrome object is the global object's of the callback, so this | 50 * The target chrome object is the global object's of the callback, so this |
| 51 * method won't work if the real callback has been wrapped (etc). | 51 * method won't work if the real callback has been wrapped (etc). |
| 52 */ | 52 */ |
| 53 function run(name, message, stack, callback, args) { | 53 function run(name, message, stack, callback, args) { |
| 54 var targetChrome = GetGlobal(callback).chrome; | 54 var targetChrome = GetGlobal(callback).chrome; |
| 55 set(name, message, stack, targetChrome); | 55 set(name, message, stack, targetChrome); |
| 56 try { | 56 try { |
| 57 callback.apply(undefined, args); | 57 $Function.apply(callback, undefined, args); |
| 58 } finally { | 58 } finally { |
| 59 clear(targetChrome); | 59 clear(targetChrome); |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 exports.clear = clear; | 63 exports.clear = clear; |
| 64 exports.set = set; | 64 exports.set = set; |
| 65 exports.run = run; | 65 exports.run = run; |
| OLD | NEW |