OLD | NEW |
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 Loading... |
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::AddMessage( | 60 console::AddMessage(script_context, content::CONSOLE_MESSAGE_LEVEL_ERROR, |
61 script_context ? script_context->GetRenderFrame() : nullptr, | 61 "Extension view no longer exists"); |
62 content::CONSOLE_MESSAGE_LEVEL_ERROR, | |
63 "Extension view no longer exists"); | |
64 return; | 62 return; |
65 } | 63 } |
66 | 64 |
67 // We can't access the ScriptContextSet on a worker thread. Luckily, we also | 65 // We can't access the ScriptContextSet on a worker thread. Luckily, we also |
68 // don't inject many bindings into worker threads. | 66 // don't inject many bindings into worker threads. |
69 // TODO(devlin): Figure out a way around this. | 67 // TODO(devlin): Figure out a way around this. |
70 if (content::WorkerThread::GetCurrentId() == 0) { | 68 if (content::WorkerThread::GetCurrentId() == 0) { |
71 ScriptContext* script_context = | 69 ScriptContext* script_context = |
72 ScriptContextSet::GetContextByV8Context(context); | 70 ScriptContextSet::GetContextByV8Context(context); |
73 v8::Local<v8::String> feature_name_string = | 71 v8::Local<v8::String> feature_name_string = |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 v8::Local<v8::Object> obj, | 221 v8::Local<v8::Object> obj, |
224 const char* key) { | 222 const char* key) { |
225 obj->DeletePrivate(context, | 223 obj->DeletePrivate(context, |
226 v8::Private::ForApi( | 224 v8::Private::ForApi( |
227 context->GetIsolate(), | 225 context->GetIsolate(), |
228 v8::String::NewFromUtf8(context->GetIsolate(), key))) | 226 v8::String::NewFromUtf8(context->GetIsolate(), key))) |
229 .FromJust(); | 227 .FromJust(); |
230 } | 228 } |
231 | 229 |
232 } // namespace extensions | 230 } // namespace extensions |
OLD | NEW |