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

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

Issue 1433293004: [Extensions] Don't allow gin::Define to be overridden (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/file_system_natives.cc ('k') | extensions/renderer/v8_helpers.h » ('j') | 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/module_system.h" 5 #include "extensions/renderer/module_system.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 94 }
95 Fatal(context_, CreateExceptionString(try_catch) + "{" + stack_trace + "}"); 95 Fatal(context_, CreateExceptionString(try_catch) + "{" + stack_trace + "}");
96 } 96 }
97 }; 97 };
98 98
99 // Sets a property on the "exports" object for bindings. Called by JS with 99 // Sets a property on the "exports" object for bindings. Called by JS with
100 // exports.$set(<key>, <value>). 100 // exports.$set(<key>, <value>).
101 void SetExportsProperty( 101 void SetExportsProperty(
102 const v8::FunctionCallbackInfo<v8::Value>& args) { 102 const v8::FunctionCallbackInfo<v8::Value>& args) {
103 v8::Local<v8::Object> obj = args.This(); 103 v8::Local<v8::Object> obj = args.This();
104 DCHECK_EQ(2, args.Length()); 104 CHECK_EQ(2, args.Length());
105 DCHECK(args[0]->IsString()); 105 CHECK(args[0]->IsString());
106 v8::Maybe<bool> result = 106 v8::Maybe<bool> result =
107 obj->DefineOwnProperty(args.GetIsolate()->GetCurrentContext(), 107 obj->DefineOwnProperty(args.GetIsolate()->GetCurrentContext(),
108 args[0]->ToString(), args[1], v8::ReadOnly); 108 args[0]->ToString(), args[1], v8::ReadOnly);
109 if (!result.FromMaybe(false)) 109 if (!result.FromMaybe(false))
110 LOG(ERROR) << "Failed to set private property on the export."; 110 LOG(ERROR) << "Failed to set private property on the export.";
111 } 111 }
112 112
113 } // namespace 113 } // namespace
114 114
115 std::string ModuleSystem::ExceptionHandler::CreateExceptionString( 115 std::string ModuleSystem::ExceptionHandler::CreateExceptionString(
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 746
747 void ModuleSystem::ClobberExistingNativeHandler(const std::string& name) { 747 void ModuleSystem::ClobberExistingNativeHandler(const std::string& name) {
748 NativeHandlerMap::iterator existing_handler = native_handler_map_.find(name); 748 NativeHandlerMap::iterator existing_handler = native_handler_map_.find(name);
749 if (existing_handler != native_handler_map_.end()) { 749 if (existing_handler != native_handler_map_.end()) {
750 clobbered_native_handlers_.push_back(existing_handler->second); 750 clobbered_native_handlers_.push_back(existing_handler->second);
751 native_handler_map_.erase(existing_handler); 751 native_handler_map_.erase(existing_handler);
752 } 752 }
753 } 753 }
754 754
755 } // namespace extensions 755 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/file_system_natives.cc ('k') | extensions/renderer/v8_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698