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

Side by Side Diff: extensions/renderer/safe_builtins.cc

Issue 1864733002: Prepare Chrome Extensions for ES2015 RegExp semantics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move comment Created 4 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
« no previous file with comments | « extensions/renderer/resources/binding.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 " ['create', 'defineProperty', 'freeze',\n" 72 " ['create', 'defineProperty', 'freeze',\n"
73 " 'getOwnPropertyDescriptor', 'getPrototypeOf', 'keys']);\n" 73 " 'getOwnPropertyDescriptor', 'getPrototypeOf', 'keys']);\n"
74 "saveBuiltin(Function,\n" 74 "saveBuiltin(Function,\n"
75 " ['apply', 'bind', 'call']);\n" 75 " ['apply', 'bind', 'call']);\n"
76 "saveBuiltin(Array,\n" 76 "saveBuiltin(Array,\n"
77 " ['concat', 'forEach', 'indexOf', 'join', 'push', 'slice',\n" 77 " ['concat', 'forEach', 'indexOf', 'join', 'push', 'slice',\n"
78 " 'splice', 'map', 'filter']);\n" 78 " 'splice', 'map', 'filter']);\n"
79 "saveBuiltin(String,\n" 79 "saveBuiltin(String,\n"
80 " ['indexOf', 'slice', 'split', 'substr', 'toUpperCase',\n" 80 " ['indexOf', 'slice', 'split', 'substr', 'toUpperCase',\n"
81 " 'replace']);\n" 81 " 'replace']);\n"
82 "// Use exec rather than test to defend against clobbering in the\n"
83 "// presence of ES2015 semantics, which read RegExp.prototype.exec.\n"
82 "saveBuiltin(RegExp,\n" 84 "saveBuiltin(RegExp,\n"
83 " ['test']);\n" 85 " ['exec']);\n"
84 "saveBuiltin(Error,\n" 86 "saveBuiltin(Error,\n"
85 " [],\n" 87 " [],\n"
86 " ['captureStackTrace']);\n" 88 " ['captureStackTrace']);\n"
87 "\n" 89 "\n"
88 "// JSON is trickier because extensions can override toJSON in\n" 90 "// JSON is trickier because extensions can override toJSON in\n"
89 "// incompatible ways, and we need to prevent that.\n" 91 "// incompatible ways, and we need to prevent that.\n"
90 "var builtinTypes = [\n" 92 "var builtinTypes = [\n"
91 " Object, Function, Array, String, Boolean, Number, Date, RegExp\n" 93 " Object, Function, Array, String, Boolean, Number, Date, RegExp\n"
92 "];\n" 94 "];\n"
93 "var builtinToJSONs = builtinTypes.map(function(t) {\n" 95 "var builtinToJSONs = builtinTypes.map(function(t) {\n"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 248
247 v8::Local<v8::Object> SafeBuiltins::GetString() const { 249 v8::Local<v8::Object> SafeBuiltins::GetString() const {
248 return Load("String", context_->v8_context()); 250 return Load("String", context_->v8_context());
249 } 251 }
250 252
251 v8::Local<v8::Object> SafeBuiltins::GetError() const { 253 v8::Local<v8::Object> SafeBuiltins::GetError() const {
252 return Load("Error", context_->v8_context()); 254 return Load("Error", context_->v8_context());
253 } 255 }
254 256
255 } // namespace extensions 257 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/resources/binding.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698