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 #include "chrome/renderer/extensions/safe_builtins.h" | 5 #include "chrome/renderer/extensions/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 "chrome/renderer/extensions/chrome_v8_context.h" | 10 #include "chrome/renderer/extensions/chrome_v8_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 to make tests that override builtins pass.\n" | 66 "// Save only what is needed to make tests that override builtins pass.\n" |
67 "saveBuiltin(Object,\n" | 67 "saveBuiltin(Object,\n" |
68 " ['hasOwnProperty'],\n" | 68 " ['hasOwnProperty'],\n" |
69 " ['getPrototypeOf', 'keys']);\n" | 69 " ['defineProperty', 'getOwnPropertyDescriptor',\n" |
| 70 " 'getPrototypeOf', 'keys']);\n" |
70 "saveBuiltin(Function,\n" | 71 "saveBuiltin(Function,\n" |
71 " ['apply', 'bind', 'call']);\n" | 72 " ['apply', 'bind', 'call']);\n" |
72 "saveBuiltin(Array,\n" | 73 "saveBuiltin(Array,\n" |
73 " ['concat', 'forEach', 'indexOf', 'join', 'push', 'slice',\n" | 74 " ['concat', 'forEach', 'indexOf', 'join', 'push', 'slice',\n" |
74 " 'splice', 'map', 'filter']);\n" | 75 " 'splice', 'map', 'filter']);\n" |
75 "saveBuiltin(String,\n" | 76 "saveBuiltin(String,\n" |
76 " ['slice', 'split']);\n" | 77 " ['slice', 'split']);\n" |
77 "saveBuiltin(RegExp,\n" | 78 "saveBuiltin(RegExp,\n" |
78 " ['test']);\n" | 79 " ['test']);\n" |
79 "\n" | 80 "\n" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 229 |
229 v8::Local<v8::Object> SafeBuiltins::GetRegExp() const { | 230 v8::Local<v8::Object> SafeBuiltins::GetRegExp() const { |
230 return Load("RegExp", context_->v8_context()); | 231 return Load("RegExp", context_->v8_context()); |
231 } | 232 } |
232 | 233 |
233 v8::Local<v8::Object> SafeBuiltins::GetString() const { | 234 v8::Local<v8::Object> SafeBuiltins::GetString() const { |
234 return Load("String", context_->v8_context()); | 235 return Load("String", context_->v8_context()); |
235 } | 236 } |
236 | 237 |
237 } // namespace extensions | 238 } // namespace extensions |
OLD | NEW |