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

Unified Diff: third_party/WebKit/WebCore/bindings/js/ScriptController.cpp

Issue 20076: WebKit merge 40500:40539 [WebKit side] (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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: third_party/WebKit/WebCore/bindings/js/ScriptController.cpp
===================================================================
--- third_party/WebKit/WebCore/bindings/js/ScriptController.cpp (revision 9118)
+++ third_party/WebKit/WebCore/bindings/js/ScriptController.cpp (working copy)
@@ -318,21 +318,30 @@
NPObject* ScriptController::createScriptObjectForPluginElement(HTMLPlugInElement* plugin)
{
- // Can't create NPObjects when JavaScript is disabled
- if (!isEnabled())
+ JSObject* object = jsObjectForPluginElement(plugin);
+ if (!object)
return _NPN_CreateNoScriptObject();
+ // Wrap the JSObject in an NPObject
+ return _NPN_CreateScriptObject(0, object, bindingRootObject());
+}
+#endif
+
+JSObject* ScriptController::jsObjectForPluginElement(HTMLPlugInElement* plugin)
+{
+ // Can't create JSObjects when JavaScript is disabled
+ if (!isEnabled())
+ return 0;
+
// Create a JSObject bound to this element
JSLock lock(false);
ExecState* exec = globalObject()->globalExec();
JSValuePtr jsElementValue = toJS(exec, plugin);
if (!jsElementValue || !jsElementValue.isObject())
- return _NPN_CreateNoScriptObject();
-
- // Wrap the JSObject in an NPObject
- return _NPN_CreateScriptObject(0, jsElementValue.getObject(), bindingRootObject());
+ return 0;
+
+ return jsElementValue.getObject();
}
-#endif
#if !PLATFORM(MAC)
void ScriptController::updatePlatformScriptObjects()
« no previous file with comments | « third_party/WebKit/WebCore/bindings/js/ScriptController.h ('k') | third_party/WebKit/WebCore/bridge/qt/qt_runtime.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698