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

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: Rebased to current ToT (by raymes - fetched from https://codereview.chromium.org/426853002/) Created 6 years, 5 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..60fb48040540309c2d8e4d48e37ada6a66ac4d8d 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);
abarth-chromium 2014/07/29 17:34:21 Why is this handle scope needed?
Krzysztof Olczyk 2014/07/30 08:40:30 Hmm. It happened to appear in raymes' rebase. Have
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)

Powered by Google App Engine
This is Rietveld 408576698