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

Unified 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: Add $Error and $String.indexOf to safe builtins 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 side-by-side diff with in-line comments
Download patch
Index: extensions/renderer/resources/binding.js
diff --git a/extensions/renderer/resources/binding.js b/extensions/renderer/resources/binding.js
index c95cf854c16b529ad668eb8747356f19531d604a..0ed3aa8bf08e88aa65c0065f11175e1babe39688 100644
--- a/extensions/renderer/resources/binding.js
+++ b/extensions/renderer/resources/binding.js
@@ -46,7 +46,8 @@ APIFunctions.prototype.setHook_ =
if ($Object.hasOwnProperty(this.unavailableApiFunctions_, apiName))
return;
if (!$Object.hasOwnProperty(this.apiFunctions_, apiName))
- throw new Error('Tried to set hook for unknown API "' + apiName + '"');
+ throw new $Error.self(
+ 'Tried to set hook for unknown API "' + apiName + '"');
this.apiFunctions_[apiName][propertyName] = customizedFunction;
};
@@ -136,7 +137,7 @@ function getPlatform() {
function isPlatformSupported(schemaNode, platform) {
return !schemaNode.platforms ||
- schemaNode.platforms.indexOf(platform) > -1;
+ $Array.indexOf(schemaNode.platforms, platform) > -1;
}
function isManifestVersionSupported(schemaNode, manifestVersion) {
@@ -288,7 +289,7 @@ Binding.prototype = {
if (schema.functions) {
$Array.forEach(schema.functions, function(functionDef) {
if (functionDef.name in mod) {
- throw new Error('Function ' + functionDef.name +
+ throw new $Error.self('Function ' + functionDef.name +
' already defined in ' + schema.namespace);
}
@@ -312,7 +313,7 @@ Binding.prototype = {
// doesn't depend on so much v8::Extension machinery.
if (logging.DCHECK_IS_ON() &&
schemaUtils.isFunctionSignatureAmbiguous(apiFunction.definition)) {
- throw new Error(
+ throw new $Error.self(
apiFunction.name + ' has ambiguous optional arguments. ' +
'To implement custom disambiguation logic, add ' +
'"allowAmbiguousOptionalArguments" to the function\'s schema.');
@@ -359,7 +360,7 @@ Binding.prototype = {
if (schema.events) {
$Array.forEach(schema.events, function(eventDef) {
if (eventDef.name in mod) {
- throw new Error('Event ' + eventDef.name +
+ throw new $Error.self('Event ' + eventDef.name +
' already defined in ' + schema.namespace);
not at google - send to devlin 2014/08/19 16:45:54 Fix indentation.
}
if (!isSchemaNodeSupported(eventDef, platform, manifestVersion))
@@ -430,7 +431,8 @@ Binding.prototype = {
// Recursively add properties.
addProperties(value, propertyDef);
} else if (type !== 'string') {
- throw new Error('NOT IMPLEMENTED (extension_api.json error): ' +
+ throw new $Error.self(
+ 'NOT IMPLEMENTED (extension_api.json error): ' +
'Cannot parse values for type "' + type + '"');
}
m[propertyName] = value;

Powered by Google App Engine
This is Rietveld 408576698