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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 "saveBuiltin(Object,\n" | 67 "saveBuiltin(Object,\n" |
68 " ['hasOwnProperty'],\n" | 68 " ['hasOwnProperty'],\n" |
69 " ['create', 'defineProperty', 'freeze',\n" | 69 " ['create', 'defineProperty', 'freeze',\n" |
70 " 'getOwnPropertyDescriptor', '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', 'substr']);\n" |
78 "saveBuiltin(RegExp,\n" | 78 "saveBuiltin(RegExp,\n" |
79 " ['test']);\n" | 79 " ['test']);\n" |
80 "saveBuiltin(Error,\n" | 80 "saveBuiltin(Error,\n" |
81 " [],\n" | 81 " [],\n" |
82 " ['captureStackTrace']);\n" | 82 " ['captureStackTrace']);\n" |
83 "\n" | 83 "\n" |
84 "// JSON is trickier because extensions can override toJSON in\n" | 84 "// JSON is trickier because extensions can override toJSON in\n" |
85 "// incompatible ways, and we need to prevent that.\n" | 85 "// incompatible ways, and we need to prevent that.\n" |
86 "var builtinTypes = [\n" | 86 "var builtinTypes = [\n" |
87 " Object, Function, Array, String, Boolean, Number, Date, RegExp\n" | 87 " Object, Function, Array, String, Boolean, Number, Date, RegExp\n" |
(...skipping 144 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 |