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

Unified Diff: extensions/renderer/runtime_custom_bindings.cc

Issue 1935953002: Create array of extension views without side effects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 cba96f6dfe02a5db756222403276a21f435f0d91..1e540f30d5fd4d5f62107d293be90f63eba3c5a0 100644
--- a/extensions/renderer/runtime_custom_bindings.cc
+++ b/extensions/renderer/runtime_custom_bindings.cc
@@ -157,6 +157,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) {
@@ -172,7 +173,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