From b1a00fc64e549f9037c272fc59635e94c40f031f Mon Sep 17 00:00:00 2001 From: Leon Clarke Date: Thu, 11 Mar 2010 15:48:11 +0000 Subject: Actually call the script when plugins try to invoke scripts from v8 http://b/issue?id=2506729 --- WebCore/plugins/PluginView.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'WebCore/plugins') 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 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 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* timer) -- cgit v1.1