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

Unified Diff: Source/bindings/core/v8/ScriptController.cpp

Issue 230813002: Make it possible to have <object>'s scriptableObject as a v8 object instead of NPObject. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed broken layout tests. Created 6 years, 4 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
Index: Source/bindings/core/v8/ScriptController.cpp
diff --git a/Source/bindings/core/v8/ScriptController.cpp b/Source/bindings/core/v8/ScriptController.cpp
index e2fb2110effb04272e11cf2740cffc82dd3b7341..030844e666df852f371b16e802c0d34231b14f79 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
@@ -289,8 +290,10 @@ 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)->scriptableObject(m_isolate);
+
+ if (scriptableObject.IsEmpty())
return nullptr;
// LocalFrame Memory Management for NPObjects
@@ -317,12 +320,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)
« no previous file with comments | « Source/bindings/core/v8/NPV8Object.cpp ('k') | Source/bindings/core/v8/custom/V8HTMLPlugInElementCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698