summaryrefslogtreecommitdiffstats
path: root/gin/converter.h
diff options
context:
space:
mode:
authorrdevlin.cronin <rdevlin.cronin@chromium.org>2015-11-12 17:14:47 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-13 01:16:25 +0000
commit415b73b1a400a994a86e6f29709aa0271e895dd5 (patch)
treeb2064603d7bcf31762c4f6f148dfc64f1953d4e9 /gin/converter.h
parent38b1bde891a3a7b98c016ef3c34f5df70183fd8e (diff)
downloadchromium_src-415b73b1a400a994a86e6f29709aa0271e895dd5.zip
chromium_src-415b73b1a400a994a86e6f29709aa0271e895dd5.tar.gz
chromium_src-415b73b1a400a994a86e6f29709aa0271e895dd5.tar.bz2
[Extensions] Don't allow gin::Define to be overridden
Use DefineOwnProperty instead of Set in for gin, including gin::Define. Replace Set in v8_helpers as well, to avoid the same problem. Also update callsites from JS to CHECK expected arguments, rather than DCHECK (since receiving unexpected arguments likely means executing untrusted code). BUG=549986 Review URL: https://codereview.chromium.org/1433293004 Cr-Commit-Position: refs/heads/master@{#359460}
Diffstat (limited to 'gin/converter.h')
-rw-r--r--gin/converter.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/gin/converter.h b/gin/converter.h
index 8d17d41..12348e2 100644
--- a/gin/converter.h
+++ b/gin/converter.h
@@ -20,7 +20,8 @@ bool SetProperty(v8::Isolate* isolate,
v8::Local<v8::Object> object,
KeyType key,
v8::Local<v8::Value> value) {
- auto maybe = object->Set(isolate->GetCurrentContext(), key, value);
+ auto maybe =
+ object->DefineOwnProperty(isolate->GetCurrentContext(), key, value);
return !maybe.IsNothing() && maybe.FromJust();
}