| Index: Source/bindings/core/v8/ScriptController.cpp
|
| diff --git a/Source/bindings/core/v8/ScriptController.cpp b/Source/bindings/core/v8/ScriptController.cpp
|
| index 61cfe388805fbc8ead2ef1d4df6b85eec5e6bf70..4590664f52dd5f8a5d7a1f03b9986659c82a924b 100644
|
| --- a/Source/bindings/core/v8/ScriptController.cpp
|
| +++ b/Source/bindings/core/v8/ScriptController.cpp
|
| @@ -1,6 +1,7 @@
|
| /*
|
| * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
|
| * Copyright (C) 2009 Apple Inc. All rights reserved.
|
| + * Copyright (C) 2014 Opera Software ASA. All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions are
|
| @@ -235,6 +236,7 @@ V8WindowShell* ScriptController::windowShell(DOMWrapperWorld& world)
|
|
|
| bool ScriptController::shouldBypassMainWorldCSP()
|
| {
|
| + v8::HandleScope handleScope(m_isolate);
|
| v8::Handle<v8::Context> context = m_isolate->GetCurrentContext();
|
| if (context.IsEmpty() || !toDOMWindow(context))
|
| return false;
|
| @@ -289,8 +291,11 @@ PassRefPtr<SharedPersistent<v8::Object> > ScriptController::createPluginWrapper(
|
| if (!widget->isPluginView())
|
| return nullptr;
|
|
|
| - NPObject* npObject = toPluginView(widget)->scriptableObject();
|
| - if (!npObject)
|
| + v8::HandleScope handleScope(m_isolate);
|
| + v8::Local<v8::Object> scriptableObject;
|
| + toPluginView(widget)->getScriptableObject(m_isolate, &scriptableObject);
|
| +
|
| + if (scriptableObject.IsEmpty())
|
| return nullptr;
|
|
|
| // LocalFrame Memory Management for NPObjects
|
| @@ -317,12 +322,12 @@ PassRefPtr<SharedPersistent<v8::Object> > ScriptController::createPluginWrapper(
|
| // NPObject as part of its wrapper. However, before accessing the object
|
| // it must consult the _NPN_Registry.
|
|
|
| - v8::Local<v8::Object> wrapper = createV8ObjectForNPObject(npObject, 0, m_isolate);
|
| -
|
| - // Track the plugin object. We've been given a reference to the object.
|
| - m_pluginObjects.set(widget, npObject);
|
| + if (isWrappedNPObject(scriptableObject)) {
|
| + // Track the plugin object. We've been given a reference to the object.
|
| + m_pluginObjects.set(widget, v8ObjectToNPObject(scriptableObject));
|
| + }
|
|
|
| - return SharedPersistent<v8::Object>::create(wrapper, m_isolate);
|
| + return SharedPersistent<v8::Object>::create(scriptableObject, m_isolate);
|
| }
|
|
|
| void ScriptController::cleanupScriptObjectsForPlugin(Widget* nativeHandle)
|
|
|