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

Unified Diff: extensions/renderer/runtime_custom_bindings.cc

Issue 1948773002: Create array of extension views without side effects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/runtime_custom_bindings.cc
diff --git a/extensions/renderer/runtime_custom_bindings.cc b/extensions/renderer/runtime_custom_bindings.cc
index 915abf8be4fb0d4a89b6beb8fd4c2e060bc80ea9..8c6f2705e7e927e4bc18f563f72836a6fca3d2a0 100644
--- a/extensions/renderer/runtime_custom_bindings.cc
+++ b/extensions/renderer/runtime_custom_bindings.cc
@@ -156,6 +156,7 @@ void RuntimeCustomBindings::GetExtensionViews(
std::vector<content::RenderFrame*> frames =
ExtensionFrameHelper::GetExtensionFrames(extension_id, browser_window_id,
view_type);
+ v8::Local<v8::Context> v8_context = args.GetIsolate()->GetCurrentContext();
v8::Local<v8::Array> v8_views = v8::Array::New(args.GetIsolate());
int v8_index = 0;
for (content::RenderFrame* frame : frames) {
@@ -171,7 +172,9 @@ void RuntimeCustomBindings::GetExtensionViews(
if (!context.IsEmpty()) {
v8::Local<v8::Value> window = context->Global();
DCHECK(!window.IsEmpty());
- v8_views->Set(v8::Integer::New(args.GetIsolate(), v8_index++), window);
+ v8::Maybe<bool> maybe =
+ v8_views->CreateDataProperty(v8_context, v8_index++, window);
+ DCHECK(maybe.IsJust() && maybe.FromJust());
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698