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

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

Issue 2718133003: Rewrite extensions console to not leak function templates. (Closed)
Patch Set: devlin Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « extensions/renderer/module_system.cc ('k') | no next file » | 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/object_backed_native_handler.h" 5 #include "extensions/renderer/object_backed_native_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/public/child/worker_thread.h" 10 #include "content/public/child/worker_thread.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 v8::Local<v8::Value> handler_function_value; 51 v8::Local<v8::Value> handler_function_value;
52 v8::Local<v8::Value> feature_name_value; 52 v8::Local<v8::Value> feature_name_value;
53 // See comment in header file for why we do this. 53 // See comment in header file for why we do this.
54 if (!GetPrivate(context, data, kHandlerFunction, &handler_function_value) || 54 if (!GetPrivate(context, data, kHandlerFunction, &handler_function_value) ||
55 handler_function_value->IsUndefined() || 55 handler_function_value->IsUndefined() ||
56 !GetPrivate(context, data, kFeatureName, &feature_name_value) || 56 !GetPrivate(context, data, kFeatureName, &feature_name_value) ||
57 !feature_name_value->IsString()) { 57 !feature_name_value->IsString()) {
58 ScriptContext* script_context = 58 ScriptContext* script_context =
59 ScriptContextSet::GetContextByV8Context(context); 59 ScriptContextSet::GetContextByV8Context(context);
60 console::Error(script_context ? script_context->GetRenderFrame() : nullptr, 60 console::AddMessage(
61 "Extension view no longer exists"); 61 script_context ? script_context->GetRenderFrame() : nullptr,
62 content::CONSOLE_MESSAGE_LEVEL_ERROR,
63 "Extension view no longer exists");
62 return; 64 return;
63 } 65 }
64 66
65 // We can't access the ScriptContextSet on a worker thread. Luckily, we also 67 // We can't access the ScriptContextSet on a worker thread. Luckily, we also
66 // don't inject many bindings into worker threads. 68 // don't inject many bindings into worker threads.
67 // TODO(devlin): Figure out a way around this. 69 // TODO(devlin): Figure out a way around this.
68 if (content::WorkerThread::GetCurrentId() == 0) { 70 if (content::WorkerThread::GetCurrentId() == 0) {
69 ScriptContext* script_context = 71 ScriptContext* script_context =
70 ScriptContextSet::GetContextByV8Context(context); 72 ScriptContextSet::GetContextByV8Context(context);
71 v8::Local<v8::String> feature_name_string = 73 v8::Local<v8::String> feature_name_string =
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 v8::Local<v8::Object> obj, 223 v8::Local<v8::Object> obj,
222 const char* key) { 224 const char* key) {
223 obj->DeletePrivate(context, 225 obj->DeletePrivate(context,
224 v8::Private::ForApi( 226 v8::Private::ForApi(
225 context->GetIsolate(), 227 context->GetIsolate(),
226 v8::String::NewFromUtf8(context->GetIsolate(), key))) 228 v8::String::NewFromUtf8(context->GetIsolate(), key)))
227 .FromJust(); 229 .FromJust();
228 } 230 }
229 231
230 } // namespace extensions 232 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/module_system.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698