summaryrefslogtreecommitdiffstats
path: root/WebCore/plugins
diff options
context:
space:
mode:
authorLeon Clarke <leonclarke@google.com>2010-03-11 15:48:11 +0000
committerLeon Clarke <leonclarke@google.com>2010-03-11 17:04:53 +0000
commitb1a00fc64e549f9037c272fc59635e94c40f031f (patch)
tree77ecec2b6b65ac3998b66a733c82d7625fc8cba6 /WebCore/plugins
parent97b32052a8fac878b49ace180ef5cf30f667c355 (diff)
downloadexternal_webkit-b1a00fc64e549f9037c272fc59635e94c40f031f.zip
external_webkit-b1a00fc64e549f9037c272fc59635e94c40f031f.tar.gz
external_webkit-b1a00fc64e549f9037c272fc59635e94c40f031f.tar.bz2
Actually call the script when plugins try to invoke scripts from v8
http://b/issue?id=2506729
Diffstat (limited to 'WebCore/plugins')
-rw-r--r--WebCore/plugins/PluginView.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp
index a0ae79f..a6a0cf7 100644
--- a/WebCore/plugins/PluginView.cpp
+++ b/WebCore/plugins/PluginView.cpp
@@ -494,24 +494,32 @@ void PluginView::performRequest(PluginRequest* request)
// Targeted JavaScript requests are only allowed on the frame that contains the JavaScript plugin
// and this has been made sure in ::load.
ASSERT(targetFrameName.isEmpty() || m_parentFrame->tree()->find(targetFrameName) == m_parentFrame);
-
-#if USE(JSC)
+
// Executing a script can cause the plugin view to be destroyed, so we keep a reference to the parent frame.
RefPtr<Frame> parentFrame = m_parentFrame;
- JSValue result = m_parentFrame->script()->executeScript(jsString, request->shouldAllowPopups()).jsValue();
+ ScriptValue result = m_parentFrame->script()->executeScript(jsString, request->shouldAllowPopups());
if (targetFrameName.isNull()) {
String resultString;
CString cstr;
- if (getString(parentFrame->script(), result, resultString))
+#if USE(JSC)
+ if (getString(parentFrame->script(), result.jsValue(), resultString))
cstr = resultString.utf8();
+#elif USE(V8)
+ // #if PLATFORM(ANDROID)
+ // TODO. When upstreaming this, we could re-visit whether the JSC getString function in this file
+ // could be removed, and this code re-factored to call ScriptValue::getString(ScriptState* scriptState, String& result)
+ // in both cases, thus getting rid of the #ifs
+ // #endif
+ if (result.getString(resultString))
+ cstr = resultString.utf8();
+#endif
RefPtr<PluginStream> stream = PluginStream::create(this, m_parentFrame.get(), request->frameLoadRequest().resourceRequest(), request->sendNotification(), request->notifyData(), plugin()->pluginFuncs(), instance(), m_plugin->quirks());
m_streams.add(stream);
stream->sendJavaScriptStream(requestURL, cstr);
}
-#endif
}
void PluginView::requestTimerFired(Timer<PluginView>* timer)