diff options
| author | Leon Clarke <leonclarke@google.com> | 2010-03-11 09:22:34 -0800 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-03-11 09:22:34 -0800 |
| commit | aa699fff907b14728bd8e515e3ae498620ed9afe (patch) | |
| tree | 3f97bbf2df6a37ceed93da095ccca90e65fae4cc | |
| parent | 809169357e94cdad566b951f5d05fba8246cfaa1 (diff) | |
| parent | b1a00fc64e549f9037c272fc59635e94c40f031f (diff) | |
| download | external_webkit-aa699fff907b14728bd8e515e3ae498620ed9afe.zip external_webkit-aa699fff907b14728bd8e515e3ae498620ed9afe.tar.gz external_webkit-aa699fff907b14728bd8e515e3ae498620ed9afe.tar.bz2 | |
Merge "Actually call the script when plugins try to invoke scripts from v8 http://b/issue?id=2506729"
| -rw-r--r-- | WebCore/plugins/PluginView.cpp | 18 |
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) |
