From 084b183bafe9e8e5636ed353110cf95be8566f23 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Tue, 11 May 2010 14:22:42 +0100 Subject: Update Android to reflect upstreaming of PluginView JSC guards in WebKit change 59826 See http://trac.webkit.org/changeset/59826 Change-Id: Ia1e16f7fa71fe8b5740610e3caa4bfbf05391a0f --- WebCore/plugins/PluginView.cpp | 42 +++++++++--------------------------------- WebCore/plugins/PluginView.h | 6 +++--- 2 files changed, 12 insertions(+), 36 deletions(-) (limited to 'WebCore') diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp index fe24109..73ac220 100644 --- a/WebCore/plugins/PluginView.cpp +++ b/WebCore/plugins/PluginView.cpp @@ -69,8 +69,6 @@ #include "TouchEvent.h" #endif -// ANDROID -// TODO: Upstream to webkit.org #if USE(JSC) #include "JSDOMBinding.h" #include "JSDOMWindow.h" @@ -233,7 +231,6 @@ bool PluginView::startOrAddToUnstartedList() return start(); } - bool PluginView::start() { if (m_isStarted) @@ -249,7 +246,7 @@ bool PluginView::start() NPError npErr; { PluginView::setCurrentPluginView(this); -#if USE(JSC) +#if USE(JSC) JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); #endif setCallingPlugin(true); @@ -362,6 +359,7 @@ void PluginView::stop() ASSERT(m_streams.isEmpty()); m_isStarted = false; + #if USE(JSC) JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); #endif @@ -447,22 +445,6 @@ static char* createUTF8String(const String& str) return result; } -#if USE(JSC) -static bool getString(ScriptController* proxy, JSValue result, String& string) -{ - if (!proxy || !result || result.isUndefined()) - return false; - JSLock lock(JSC::SilenceAssertionsOnly); - - ExecState* exec = proxy->globalObject(pluginWorld())->globalExec(); - UString ustring = result.toString(exec); - exec->clearException(); - - string = ustringToString(ustring); - return true; -} -#endif - void PluginView::performRequest(PluginRequest* request) { if (!m_isStarted) @@ -495,7 +477,7 @@ void PluginView::performRequest(PluginRequest* request) // FIXME: This should be sent when the document has finished loading if (request->sendNotification()) { PluginView::setCurrentPluginView(this); -#if USE(JSC) +#if USE(JSC) JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly); #endif setCallingPlugin(true); @@ -510,7 +492,7 @@ 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); - + // Executing a script can cause the plugin view to be destroyed, so we keep a reference to the parent frame. RefPtr parentFrame = m_parentFrame; ScriptValue result = m_parentFrame->script()->executeScript(jsString, request->shouldAllowPopups()); @@ -518,19 +500,14 @@ void PluginView::performRequest(PluginRequest* request) if (targetFrameName.isNull()) { String resultString; - CString cstr; #if USE(JSC) - if (getString(parentFrame->script(), result.jsValue(), resultString)) - cstr = resultString.utf8(); + ScriptState* scriptState = parentFrame->script()->globalObject(pluginWorld())->globalExec(); #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(); + ScriptState* scriptState = 0; // Not used with V8 #endif + CString cstr; + if (result.getString(scriptState, resultString)) + cstr = resultString.utf8(); 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); @@ -787,7 +764,6 @@ void PluginView::setJavaScriptPaused(bool paused) m_requestTimer.startOneShot(0); } - #if USE(JSC) PassRefPtr PluginView::bindingInstance() { diff --git a/WebCore/plugins/PluginView.h b/WebCore/plugins/PluginView.h index 88136e3..b685bbf 100644 --- a/WebCore/plugins/PluginView.h +++ b/WebCore/plugins/PluginView.h @@ -1,4 +1,3 @@ - /* * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2008 Collabora Ltd. All rights reserved. @@ -140,8 +139,6 @@ namespace WebCore { #if USE(JSC) PassRefPtr bindingInstance(); -#elif USE(V8) - NPObject* getNPObject(); #endif PluginStatus status() const { return m_status; } @@ -175,6 +172,9 @@ namespace WebCore { void (*timerFunc)(NPP, uint32_t timerID)); void unscheduleTimer(NPP, uint32_t timerID); #endif +#if USE(V8) + NPObject* getNPObject(); +#endif virtual void invalidateRect(const IntRect&); -- cgit v1.1