Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: chrome/renderer/resources/extensions/last_error.js

Issue 17451011: Make the externally connectable browser test clobber all of the builtins, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698