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

Side by Side Diff: chrome/test/data/extensions/api_test/messaging/externally_connectable/sites/assertions.js

Issue 1055673002: [Extensions API] Remove inline enums (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 (function() { 5 (function() {
6 6
7 // We are going to kill all of the builtins, so hold onto the ones we need. 7 // We are going to kill all of the builtins, so hold onto the ones we need.
8 var defineGetter = Object.prototype.__defineGetter__; 8 var defineGetter = Object.prototype.__defineGetter__;
9 var defineSetter = Object.prototype.__defineSetter__; 9 var defineSetter = Object.prototype.__defineSetter__;
10 var Error = window.Error; 10 var Error = window.Error;
11 var forEach = Array.prototype.forEach; 11 var forEach = Array.prototype.forEach;
12 var push = Array.prototype.push; 12 var push = Array.prototype.push;
13 var hasOwnProperty = Object.prototype.hasOwnProperty; 13 var hasOwnProperty = Object.prototype.hasOwnProperty;
14 var getOwnPropertyNames = Object.getOwnPropertyNames; 14 var getOwnPropertyNames = Object.getOwnPropertyNames;
15 var stringify = JSON.stringify; 15 var stringify = JSON.stringify;
16 16
17 // Kill all of the builtins functions to give us a fairly high confidence that 17 // Kill all of the builtins functions to give us a fairly high confidence that
18 // the environment our bindings run in can't interfere with our code. 18 // the environment our bindings run in can't interfere with our code.
19 // These are taken from the ECMAScript spec. 19 // These are taken from the ECMAScript spec.
20 var builtinTypes = [ 20 var builtinTypes = [
21 Object, Function, Array, String, Boolean, Number, Math, Date, RegExp, JSON, 21 Object, Function, Array, String, Boolean, Number, Math, Date, RegExp, JSON,
22 ]; 22 ];
23 23
24 function clobber(obj, name, qualifiedName) { 24 function clobber(obj, name, qualifiedName) {
25 // Clobbering constructors would break everything. 25 // Clobbering constructors would break everything.
26 // Clobbering toString is annoying. 26 // Clobbering toString or substr is annoying.
27 // Clobbering __proto__ breaks in ways that grep can't find. 27 // Clobbering __proto__ breaks in ways that grep can't find.
28 // Clobbering function name will break because 28 // Clobbering function name will break because
29 // SafeBuiltins does not support getters yet. See crbug.com/463526. 29 // SafeBuiltins does not support getters yet. See crbug.com/463526.
30 // Clobbering Function.call would make it impossible to implement these tests. 30 // Clobbering Function.call would make it impossible to implement these tests.
31 // Clobbering Object.valueOf breaks v8. 31 // Clobbering Object.valueOf breaks v8.
32 if (name == 'constructor' || 32 if (name == 'constructor' ||
33 name == 'toString' || 33 name == 'toString' ||
34 name == 'substr' ||
Devlin 2015/04/03 00:00:56 Without these, we hit String.substr and Object.has
Devlin 2015/04/03 19:38:50 Resolved.
35 name == 'hasOwnProperty' ||
34 name == '__proto__' || 36 name == '__proto__' ||
35 name == 'name' && typeof obj == 'function' || 37 name == 'name' && typeof obj == 'function' ||
36 qualifiedName == 'Function.call' || 38 qualifiedName == 'Function.call' ||
37 qualifiedName == 'Object.valueOf') { 39 qualifiedName == 'Object.valueOf') {
38 return; 40 return;
39 } 41 }
40 if (typeof obj[name] == 'function') { 42 if (typeof obj[name] == 'function') {
41 obj[name] = function() { 43 obj[name] = function() {
42 throw new Error('Clobbered ' + qualifiedName + ' function'); 44 throw new Error('Clobbered ' + qualifiedName + ' function');
43 }; 45 };
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 if (!message) 296 if (!message)
295 message = kMessage; 297 message = kMessage;
296 298
297 chrome.runtime.sendMessage(extensionId, message, 299 chrome.runtime.sendMessage(extensionId, message,
298 {'includeTlsChannelId': includeTlsChannelId}, 300 {'includeTlsChannelId': includeTlsChannelId},
299 checkTlsChannelIdResponse); 301 checkTlsChannelIdResponse);
300 } 302 }
301 }; 303 };
302 304
303 }()); 305 }());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698