OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. |
3 * Copyright (C) 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2009 Apple Inc. All rights reserved. |
4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
8 * met: | 8 * met: |
9 * | 9 * |
10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 v8::Local<v8::Context> v8_context = | 175 v8::Local<v8::Context> v8_context = |
176 window_proxy_manager_->MainWorldProxyMaybeUninitialized() | 176 window_proxy_manager_->MainWorldProxyMaybeUninitialized() |
177 ->ContextIfInitialized(); | 177 ->ContextIfInitialized(); |
178 if (v8_context.IsEmpty()) | 178 if (v8_context.IsEmpty()) |
179 return; | 179 return; |
180 v8_context->AllowCodeGenerationFromStrings(false); | 180 v8_context->AllowCodeGenerationFromStrings(false); |
181 v8_context->SetErrorMessageForCodeGenerationFromStrings( | 181 v8_context->SetErrorMessageForCodeGenerationFromStrings( |
182 V8String(GetIsolate(), error_message)); | 182 V8String(GetIsolate(), error_message)); |
183 } | 183 } |
184 | 184 |
185 PassRefPtr<SharedPersistent<v8::Object>> ScriptController::CreatePluginWrapper( | |
186 PluginView& plugin) { | |
187 v8::HandleScope handle_scope(GetIsolate()); | |
188 v8::Local<v8::Object> scriptable_object = | |
189 plugin.ScriptableObject(GetIsolate()); | |
190 | |
191 if (scriptable_object.IsEmpty()) | |
192 return nullptr; | |
193 | |
194 return SharedPersistent<v8::Object>::Create(scriptable_object, GetIsolate()); | |
195 } | |
196 | |
197 V8Extensions& ScriptController::RegisteredExtensions() { | 185 V8Extensions& ScriptController::RegisteredExtensions() { |
198 DEFINE_STATIC_LOCAL(V8Extensions, extensions, ()); | 186 DEFINE_STATIC_LOCAL(V8Extensions, extensions, ()); |
199 return extensions; | 187 return extensions; |
200 } | 188 } |
201 | 189 |
202 void ScriptController::RegisterExtensionIfNeeded(v8::Extension* extension) { | 190 void ScriptController::RegisterExtensionIfNeeded(v8::Extension* extension) { |
203 const V8Extensions& extensions = RegisteredExtensions(); | 191 const V8Extensions& extensions = RegisteredExtensions(); |
204 for (size_t i = 0; i < extensions.size(); ++i) { | 192 for (size_t i = 0; i < extensions.size(); ++i) { |
205 if (extensions[i] == extension) | 193 if (extensions[i] == extension) |
206 return; | 194 return; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 for (size_t i = 0; i < result_array->Length(); ++i) { | 353 for (size_t i = 0; i < result_array->Length(); ++i) { |
366 v8::Local<v8::Value> value; | 354 v8::Local<v8::Value> value; |
367 if (!result_array->Get(context, i).ToLocal(&value)) | 355 if (!result_array->Get(context, i).ToLocal(&value)) |
368 return; | 356 return; |
369 results->push_back(value); | 357 results->push_back(value); |
370 } | 358 } |
371 } | 359 } |
372 } | 360 } |
373 | 361 |
374 } // namespace blink | 362 } // namespace blink |
OLD | NEW |