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

Side by Side Diff: extensions/renderer/resources/binding.js

Issue 482603002: Unify logic of stack trace generation for extension errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 Event = require('event_bindings').Event; 5 var Event = require('event_bindings').Event;
6 var forEach = require('utils').forEach; 6 var forEach = require('utils').forEach;
7 var GetAvailability = requireNative('v8_context').GetAvailability; 7 var GetAvailability = requireNative('v8_context').GetAvailability;
8 var getExtensionStackTrace =
9 require('uncaught_exception_handler').getExtensionStackTrace;
8 var lastError = require('lastError'); 10 var lastError = require('lastError');
9 var logActivity = requireNative('activityLogger'); 11 var logActivity = requireNative('activityLogger');
10 var logging = requireNative('logging'); 12 var logging = requireNative('logging');
11 var process = requireNative('process'); 13 var process = requireNative('process');
12 var schemaRegistry = requireNative('schema_registry'); 14 var schemaRegistry = requireNative('schema_registry');
13 var schemaUtils = require('schemaUtils'); 15 var schemaUtils = require('schemaUtils');
14 var utils = require('utils'); 16 var utils = require('utils');
15 var sendRequestHandler = require('sendRequest'); 17 var sendRequestHandler = require('sendRequest');
16 18
17 var contextType = process.GetContextType(); 19 var contextType = process.GetContextType();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 return ret; 64 return ret;
63 }); 65 });
64 }; 66 };
65 67
66 APIFunctions.prototype.setHandleRequestWithPromise = 68 APIFunctions.prototype.setHandleRequestWithPromise =
67 function(apiName, customizedFunction) { 69 function(apiName, customizedFunction) {
68 var prefix = this.namespace; 70 var prefix = this.namespace;
69 return this.setHook_(apiName, 'handleRequest', function() { 71 return this.setHook_(apiName, 'handleRequest', function() {
70 var name = prefix + '.' + apiName; 72 var name = prefix + '.' + apiName;
71 logActivity.LogAPICall(extensionId, name, $Array.slice(arguments)); 73 logActivity.LogAPICall(extensionId, name, $Array.slice(arguments));
72 var stack = sendRequestHandler.getExtensionStackTrace(); 74 var stack = getExtensionStackTrace();
73 var callback = arguments[arguments.length - 1]; 75 var callback = arguments[arguments.length - 1];
74 var args = $Array.slice(arguments, 0, arguments.length - 1); 76 var args = $Array.slice(arguments, 0, arguments.length - 1);
75 $Function.apply(customizedFunction, this, args).then(function(result) { 77 $Function.apply(customizedFunction, this, args).then(function(result) {
76 sendRequestHandler.safeCallbackApply( 78 sendRequestHandler.safeCallbackApply(
77 name, {'stack': stack}, callback, [result]); 79 name, {'stack': stack}, callback, [result]);
78 }).catch(function(error) { 80 }).catch(function(error) {
79 lastError.run(name, error.message, stack, callback); 81 lastError.run(name, error.message, stack, callback);
80 }); 82 });
81 }); 83 });
82 }; 84 };
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 availability.message); 472 availability.message);
471 return; 473 return;
472 } 474 }
473 475
474 this.runHooks_(mod); 476 this.runHooks_(mod);
475 return mod; 477 return mod;
476 } 478 }
477 }; 479 };
478 480
479 exports.Binding = Binding; 481 exports.Binding = Binding;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698