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

Side by Side Diff: extensions/renderer/resources/utils.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 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 createClassWrapper = requireNative('utils').createClassWrapper; 5 var createClassWrapper = requireNative('utils').createClassWrapper;
6 var nativeDeepCopy = requireNative('utils').deepCopy; 6 var nativeDeepCopy = requireNative('utils').deepCopy;
7 var schemaRegistry = requireNative('schema_registry'); 7 var schemaRegistry = requireNative('schema_registry');
8 var CHECK = requireNative('logging').CHECK; 8 var CHECK = requireNative('logging').CHECK;
9 var WARNING = requireNative('logging').WARNING; 9 var WARNING = requireNative('logging').WARNING;
10 10
(...skipping 20 matching lines...) Expand all
31 * @param {?} value 31 * @param {?} value
32 */ 32 */
33 function lookup(array_of_dictionaries, field, value) { 33 function lookup(array_of_dictionaries, field, value) {
34 var filter = function (dict) {return dict[field] == value;}; 34 var filter = function (dict) {return dict[field] == value;};
35 var matches = array_of_dictionaries.filter(filter); 35 var matches = array_of_dictionaries.filter(filter);
36 if (matches.length == 0) { 36 if (matches.length == 0) {
37 return undefined; 37 return undefined;
38 } else if (matches.length == 1) { 38 } else if (matches.length == 1) {
39 return matches[0] 39 return matches[0]
40 } else { 40 } else {
41 throw new Error("Failed lookup of field '" + field + "' with value '" + 41 throw new $Error.self(
not at google - send to devlin 2014/08/19 16:45:56 I have no idea about this one.
42 value + "'"); 42 "Failed lookup of field '" + field + "' with value '" + value + "'");
43 } 43 }
44 } 44 }
45 45
46 function loadTypeSchema(typeName, defaultSchema) { 46 function loadTypeSchema(typeName, defaultSchema) {
47 var parts = $String.split(typeName, '.'); 47 var parts = $String.split(typeName, '.');
48 if (parts.length == 1) { 48 if (parts.length == 1) {
49 if (defaultSchema == null) { 49 if (defaultSchema == null) {
50 WARNING('Trying to reference "' + typeName + '" ' + 50 WARNING('Trying to reference "' + typeName + '" ' +
51 'with neither namespace nor default schema.'); 51 'with neither namespace nor default schema.');
52 return null; 52 return null;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 */ 131 */
132 function deepCopy(value) { 132 function deepCopy(value) {
133 return nativeDeepCopy(value); 133 return nativeDeepCopy(value);
134 } 134 }
135 135
136 exports.forEach = forEach; 136 exports.forEach = forEach;
137 exports.loadTypeSchema = loadTypeSchema; 137 exports.loadTypeSchema = loadTypeSchema;
138 exports.lookup = lookup; 138 exports.lookup = lookup;
139 exports.expose = expose; 139 exports.expose = expose;
140 exports.deepCopy = deepCopy; 140 exports.deepCopy = deepCopy;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698