| OLD | NEW |
| 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 #include "extensions/renderer/safe_builtins.h" | 5 #include "extensions/renderer/safe_builtins.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "extensions/renderer/script_context.h" | 10 #include "extensions/renderer/script_context.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 " safe.self = builtin;\n" | 59 " safe.self = builtin;\n" |
| 60 " makeCallable(builtin.prototype, safe, false, protoPropertyNames);\n" | 60 " makeCallable(builtin.prototype, safe, false, protoPropertyNames);\n" |
| 61 " if (staticPropertyNames)\n" | 61 " if (staticPropertyNames)\n" |
| 62 " makeCallable(builtin, safe, true, staticPropertyNames);\n" | 62 " makeCallable(builtin, safe, true, staticPropertyNames);\n" |
| 63 " Save(builtin.name, safe);\n" | 63 " Save(builtin.name, safe);\n" |
| 64 "}\n" | 64 "}\n" |
| 65 "\n" | 65 "\n" |
| 66 "// Save only what is needed by the extension modules.\n" | 66 "// Save only what is needed by the extension modules.\n" |
| 67 "saveBuiltin(Object,\n" | 67 "saveBuiltin(Object,\n" |
| 68 " ['hasOwnProperty'],\n" | 68 " ['hasOwnProperty'],\n" |
| 69 " ['create', 'defineProperty', 'getOwnPropertyDescriptor',\n" | 69 " ['create', 'defineProperty', 'freeze',\n" |
| 70 " 'getPrototypeOf', 'keys']);\n" | 70 " 'getOwnPropertyDescriptor', 'getPrototypeOf', 'keys']);\n" |
| 71 "saveBuiltin(Function,\n" | 71 "saveBuiltin(Function,\n" |
| 72 " ['apply', 'bind', 'call']);\n" | 72 " ['apply', 'bind', 'call']);\n" |
| 73 "saveBuiltin(Array,\n" | 73 "saveBuiltin(Array,\n" |
| 74 " ['concat', 'forEach', 'indexOf', 'join', 'push', 'slice',\n" | 74 " ['concat', 'forEach', 'indexOf', 'join', 'push', 'slice',\n" |
| 75 " 'splice', 'map', 'filter']);\n" | 75 " 'splice', 'map', 'filter']);\n" |
| 76 "saveBuiltin(String,\n" | 76 "saveBuiltin(String,\n" |
| 77 " ['indexOf', 'slice', 'split']);\n" | 77 " ['indexOf', 'slice', 'split']);\n" |
| 78 "saveBuiltin(RegExp,\n" | 78 "saveBuiltin(RegExp,\n" |
| 79 " ['test']);\n" | 79 " ['test']);\n" |
| 80 "saveBuiltin(Error,\n" | 80 "saveBuiltin(Error,\n" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 232 |
| 233 v8::Local<v8::Object> SafeBuiltins::GetString() const { | 233 v8::Local<v8::Object> SafeBuiltins::GetString() const { |
| 234 return Load("String", context_->v8_context()); | 234 return Load("String", context_->v8_context()); |
| 235 } | 235 } |
| 236 | 236 |
| 237 v8::Local<v8::Object> SafeBuiltins::GetError() const { | 237 v8::Local<v8::Object> SafeBuiltins::GetError() const { |
| 238 return Load("Error", context_->v8_context()); | 238 return Load("Error", context_->v8_context()); |
| 239 } | 239 } |
| 240 | 240 |
| 241 } // namespace extensions | 241 } // namespace extensions |
| OLD | NEW |