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

Unified Diff: content/renderer/web_ui_extension.cc

Issue 611483002: Fix for crash when attaching a frame in WebUI renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: As suggested, factored out the solution and used in other extensions. Created 6 years, 3 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 | « content/renderer/skia_benchmarking_extension.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/web_ui_extension.cc
diff --git a/content/renderer/web_ui_extension.cc b/content/renderer/web_ui_extension.cc
index 11565f2b4acb6f85e9e0695bb04b2d4fd05dffba..127912630d8ffbafd00dba8c85b79ccef258d6b3 100644
--- a/content/renderer/web_ui_extension.cc
+++ b/content/renderer/web_ui_extension.cc
@@ -12,6 +12,7 @@
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view.h"
#include "content/public/renderer/v8_value_converter.h"
+#include "content/renderer/chrome_object_extensions_utils.h"
#include "content/renderer/web_ui_extension_data.h"
#include "gin/arguments.h"
#include "gin/function_template.h"
@@ -69,13 +70,8 @@ void WebUIExtension::Install(blink::WebFrame* frame) {
v8::Context::Scope context_scope(context);
- v8::Handle<v8::Object> global = context->Global();
- v8::Handle<v8::Object> chrome =
- global->Get(gin::StringToV8(isolate, "chrome"))->ToObject();
- if (chrome.IsEmpty()) {
- chrome = v8::Object::New(isolate);
- global->Set(gin::StringToSymbol(isolate, "chrome"), chrome);
- }
+ v8::Handle<v8::Object> chrome = GetOrCreateChromeObject(isolate,
+ context->Global());
chrome->Set(gin::StringToSymbol(isolate, "send"),
gin::CreateFunctionTemplate(
isolate, base::Bind(&WebUIExtension::Send))->GetFunction());
« no previous file with comments | « content/renderer/skia_benchmarking_extension.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698