| OLD | NEW |
| 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; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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 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 // Clobbering %FunctionPrototype%.caller and .arguments will break because |
| 33 // these properties are poisoned accessors in ES6. |
| 32 if (name == 'constructor' || | 34 if (name == 'constructor' || |
| 33 name == 'toString' || | 35 name == 'toString' || |
| 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' || |
| 39 (obj !== Function && qualifiedName == 'Function.caller') || |
| 40 (obj !== Function && qualifiedName == 'Function.arguments') || |
| 37 qualifiedName == 'Object.valueOf') { | 41 qualifiedName == 'Object.valueOf') { |
| 38 return; | 42 return; |
| 39 } | 43 } |
| 40 if (typeof obj[name] == 'function') { | 44 if (typeof obj[name] == 'function') { |
| 41 obj[name] = function() { | 45 obj[name] = function() { |
| 42 throw new Error('Clobbered ' + qualifiedName + ' function'); | 46 throw new Error('Clobbered ' + qualifiedName + ' function'); |
| 43 }; | 47 }; |
| 44 } else { | 48 } else { |
| 45 defineGetter.call(obj, name, function() { | 49 defineGetter.call(obj, name, function() { |
| 46 throw new Error('Clobbered ' + qualifiedName + ' getter'); | 50 throw new Error('Clobbered ' + qualifiedName + ' getter'); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 if (!message) | 298 if (!message) |
| 295 message = kMessage; | 299 message = kMessage; |
| 296 | 300 |
| 297 chrome.runtime.sendMessage(extensionId, message, | 301 chrome.runtime.sendMessage(extensionId, message, |
| 298 {'includeTlsChannelId': includeTlsChannelId}, | 302 {'includeTlsChannelId': includeTlsChannelId}, |
| 299 checkTlsChannelIdResponse); | 303 checkTlsChannelIdResponse); |
| 300 } | 304 } |
| 301 }; | 305 }; |
| 302 | 306 |
| 303 }()); | 307 }()); |
| OLD | NEW |