Diff
Modified: trunk/Source/WebKit2/ChangeLog (111821 => 111822)
--- trunk/Source/WebKit2/ChangeLog 2012-03-23 03:49:33 UTC (rev 111821)
+++ trunk/Source/WebKit2/ChangeLog 2012-03-23 04:04:08 UTC (rev 111822)
@@ -1,3 +1,45 @@
+2012-03-22 Anders Carlsson <ander...@apple.com>
+
+ Remove the Flash NPRuntime short-circuit hacks
+ https://bugs.webkit.org/show_bug.cgi?id=81997
+ <rdar://problem/10409289>
+
+ Reviewed by Sam Weinig.
+
+ This code was added to help speed up Flash plug-in instantiation by reducing the number of
+ synchronous API calls from the plug-in process to the web process during instantiation.
+ However, there was no real indication that this actually improved performance.
+
+ Furthermore, it seems to have introduced crashers when misbehaving plug-ins would make NPRuntime calls
+ after a plug-in had been destroyed. Since Flash is now 64-bit like the rest of WebKit launch time has
+ improved since we don't have to bring in all of the 32-bit system frameworks, so the time has come to
+ rip out this egregious hack.
+
+ * PluginProcess/PluginControllerProxy.cpp:
+ (WebKit::PluginControllerProxy::evaluate):
+ * PluginProcess/PluginControllerProxy.h:
+ (PluginControllerProxy):
+ * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
+ (WebKit::NetscapePluginModule::determineQuirks):
+ * Shared/Plugins/PluginQuirks.h:
+ * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
+ (WebKit::NPN_Invoke):
+ * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+ * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+ (NetscapePlugin):
+ * WebProcess/Plugins/Plugin.cpp:
+ (WebKit::Plugin::Parameters::encode):
+ (WebKit::Plugin::Parameters::decode):
+ * WebProcess/Plugins/Plugin.h:
+ (Parameters):
+ * WebProcess/Plugins/PluginController.h:
+ (PluginController):
+ * WebProcess/Plugins/PluginView.cpp:
+ * WebProcess/Plugins/PluginView.h:
+ (PluginView):
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::createPlugin):
+
2012-03-22 Raphael Kubo da Costa <rak...@freebsd.org>
[CMake] Unreviewed build fix after r111778.
Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp (111821 => 111822)
--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp 2012-03-23 03:49:33 UTC (rev 111821)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp 2012-03-23 04:04:08 UTC (rev 111822)
@@ -269,9 +269,6 @@
bool PluginControllerProxy::evaluate(NPObject* npObject, const String& scriptString, NPVariant* result, bool allowPopups)
{
- if (tryToShortCircuitEvaluate(npObject, scriptString, result))
- return true;
-
PluginDestructionProtector protector(this);
NPVariant npObjectAsNPVariant;
@@ -293,58 +290,6 @@
return true;
}
-bool PluginControllerProxy::tryToShortCircuitInvoke(NPObject* npObject, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, bool& returnValue, NPVariant& result)
-{
- // Only try to short circuit evaluate for plug-ins that have the quirk specified.
-#if PLUGIN_ARCHITECTURE(MAC)
- if (!PluginProcess::shared().netscapePluginModule()->pluginQuirks().contains(PluginQuirks::CanShortCircuitSomeNPRuntimeCallsDuringInitialization))
- return false;
-#else
- return false;
-#endif
-
- // And only when we're in initialize.
- if (!inInitialize())
- return false;
-
- // And only when the NPObject is the window NPObject.
- if (npObject != m_windowNPObject)
- return false;
-
- // And only when we don't have any arguments.
- if (argumentCount)
- return false;
-
- IdentifierRep* methodNameRep = static_cast<IdentifierRep*>(methodName);
- if (!methodNameRep->isString())
- return false;
-
- if (!strcmp(methodNameRep->string(), "__flash_getWindowLocation")) {
- result.type = NPVariantType_String;
- result.value.stringValue = createNPString(m_pluginCreationParameters->parameters.documentURL.utf8());
- returnValue = true;
- return true;
- }
-
- if (!strcmp(methodNameRep->string(), "__flash_getTopLocation")) {
- if (m_pluginCreationParameters->parameters.toplevelDocumentURL.isNull()) {
- // If the toplevel document is URL it means that the frame that the plug-in is in doesn't have access to the toplevel document.
- // In this case, just pass the string "[object]" to Flash.
- result.type = NPVariantType_String;
- result.value.stringValue = createNPString("[object]");
- returnValue = true;
- return true;
- }
-
- result.type = NPVariantType_String;
- result.value.stringValue = createNPString(m_pluginCreationParameters->parameters.toplevelDocumentURL.utf8());
- returnValue = true;
- return true;
- }
-
- return false;
-}
-
void PluginControllerProxy::setStatusbarText(const String& statusbarText)
{
m_connection->connection()->send(Messages::PluginProxy::SetStatusbarText(statusbarText), m_pluginInstanceID);
@@ -598,33 +543,6 @@
returnValue = m_plugin->getFormValue(formValue);
}
-bool PluginControllerProxy::tryToShortCircuitEvaluate(NPObject* npObject, const String& scriptString, NPVariant* result)
-{
- // Only try to short circuit evaluate for plug-ins that have the quirk specified.
-#if PLUGIN_ARCHITECTURE(MAC)
- if (!PluginProcess::shared().netscapePluginModule()->pluginQuirks().contains(PluginQuirks::CanShortCircuitSomeNPRuntimeCallsDuringInitialization))
- return false;
-#else
- return false;
-#endif
-
- // And only when we're in initialize.
- if (!inInitialize())
- return false;
-
- // And only when the NPObject is the window NPObject.
- if (npObject != m_windowNPObject)
- return false;
-
- // Now, check for the right strings.
- if (scriptString != "function __flash_getWindowLocation() { return window.location; }"
- && scriptString != "function __flash_getTopLocation() { return top.location; }")
- return false;
-
- VOID_TO_NPVARIANT(*result);
- return true;
-}
-
} // namespace WebKit
#endif // ENABLE(PLUGIN_PROCESS)
Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h (111821 => 111822)
--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h 2012-03-23 03:49:33 UTC (rev 111821)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h 2012-03-23 04:04:08 UTC (rev 111822)
@@ -84,7 +84,6 @@
virtual NPObject* windowScriptNPObject();
virtual NPObject* pluginElementNPObject();
virtual bool evaluate(NPObject*, const String& scriptString, NPVariant* result, bool allowPopups);
- virtual bool tryToShortCircuitInvoke(NPObject*, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, bool& returnValue, NPVariant& result);
virtual void setStatusbarText(const String&);
virtual bool isAcceleratedCompositingEnabled();
virtual void pluginProcessCrashed();
@@ -139,8 +138,6 @@
void privateBrowsingStateChanged(bool);
void getFormValue(bool& returnValue, String& formValue);
- bool tryToShortCircuitEvaluate(NPObject*, const String& scriptString, NPVariant* result);
-
bool inInitialize() const { return m_pluginCreationParameters; }
void platformInitialize();
Modified: trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm (111821 => 111822)
--- trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm 2012-03-23 03:49:33 UTC (rev 111821)
+++ trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm 2012-03-23 04:04:08 UTC (rev 111822)
@@ -469,9 +469,6 @@
// Flash supports snapshotting.
m_pluginQuirks.add(PluginQuirks::SupportsSnapshotting);
- // We can short circuit some NPRuntime calls during initialization.
- m_pluginQuirks.add(PluginQuirks::CanShortCircuitSomeNPRuntimeCallsDuringInitialization);
-
// Flash returns a retained Core Animation layer.
m_pluginQuirks.add(PluginQuirks::ReturnsRetainedCoreAnimationLayer);
}
Modified: trunk/Source/WebKit2/Shared/Plugins/PluginQuirks.h (111821 => 111822)
--- trunk/Source/WebKit2/Shared/Plugins/PluginQuirks.h 2012-03-23 03:49:33 UTC (rev 111821)
+++ trunk/Source/WebKit2/Shared/Plugins/PluginQuirks.h 2012-03-23 04:04:08 UTC (rev 111822)
@@ -48,12 +48,6 @@
// transparent.
MakeTransparentIfBackgroundAttributeExists,
- // Whether we can short circuit some NPRuntime calls during plug-in initialization.
- // The Flash plug-in uses NPRuntime to figure out the URL of the frame it is in, as well
- // as the URL of the main frame. Since we know the exact NPRuntime calls the plug-in makes,
- // we can return the right values without having to do sync IPC back into the web process.
- CanShortCircuitSomeNPRuntimeCallsDuringInitialization,
-
// Whether calling NPP_GetValue with NPPVpluginCoreAnimationLayer returns a retained Core Animation
// layer or not. According to the NPAPI specifications, plug-in shouldn't return a retained layer but
// WebKit1 expects a retained plug-in layer. We use this for Flash to avoid leaking OpenGL layers.
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp (111821 => 111822)
--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp 2012-03-23 03:49:33 UTC (rev 111821)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp 2012-03-23 04:04:08 UTC (rev 111822)
@@ -706,12 +706,6 @@
static bool NPN_Invoke(NPP npp, NPObject *npObject, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
{
- if (RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp)) {
- bool returnValue;
- if (plugin->tryToShortCircuitInvoke(npObject, methodName, arguments, argumentCount, returnValue, *result))
- return returnValue;
- }
-
if (npObject->_class->invoke)
return npObject->_class->invoke(npObject, methodName, arguments, argumentCount, result);
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (111821 => 111822)
--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp 2012-03-23 03:49:33 UTC (rev 111821)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp 2012-03-23 04:04:08 UTC (rev 111822)
@@ -257,11 +257,6 @@
return controller()->pluginElementNPObject();
}
-bool NetscapePlugin::tryToShortCircuitInvoke(NPObject* npObject, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, bool& returnValue, NPVariant& result)
-{
- return controller()->tryToShortCircuitInvoke(npObject, methodName, arguments, argumentCount, returnValue, result);
-}
-
void NetscapePlugin::cancelStreamLoad(NetscapePluginStream* pluginStream)
{
if (pluginStream == m_manualStream) {
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (111821 => 111822)
--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h 2012-03-23 03:49:33 UTC (rev 111821)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h 2012-03-23 04:04:08 UTC (rev 111822)
@@ -101,8 +101,6 @@
NPObject* windowScriptNPObject();
NPObject* pluginElementNPObject();
- bool tryToShortCircuitInvoke(NPObject*, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, bool& returnValue, NPVariant& result);
-
void cancelStreamLoad(NetscapePluginStream*);
void removePluginStream(NetscapePluginStream*);
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Plugin.cpp (111821 => 111822)
--- trunk/Source/WebKit2/WebProcess/Plugins/Plugin.cpp 2012-03-23 03:49:33 UTC (rev 111821)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Plugin.cpp 2012-03-23 04:04:08 UTC (rev 111822)
@@ -39,8 +39,6 @@
encoder->encode(values);
encoder->encode(mimeType);
encoder->encode(loadManually);
- encoder->encode(documentURL);
- encoder->encode(toplevelDocumentURL);
}
bool Plugin::Parameters::decode(CoreIPC::ArgumentDecoder* decoder, Parameters& parameters)
@@ -59,10 +57,6 @@
return false;
if (!decoder->decode(parameters.loadManually))
return false;
- if (!decoder->decode(parameters.documentURL))
- return false;
- if (!decoder->decode(parameters.toplevelDocumentURL))
- return false;
if (parameters.names.size() != parameters.values.size()) {
decoder->markInvalid();
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h (111821 => 111822)
--- trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h 2012-03-23 03:49:33 UTC (rev 111821)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h 2012-03-23 04:04:08 UTC (rev 111822)
@@ -66,13 +66,6 @@
String mimeType;
bool loadManually;
- // The URL of the document that the plug-in is in.
- String documentURL;
-
- // The URL of the document in the main frame. Will be null if the document the plug-in
- // doesn't have access to the main frame document.
- String toplevelDocumentURL;
-
void encode(CoreIPC::ArgumentEncoder*) const;
static bool decode(CoreIPC::ArgumentDecoder*, Parameters&);
};
Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginController.h (111821 => 111822)
--- trunk/Source/WebKit2/WebProcess/Plugins/PluginController.h 2012-03-23 03:49:33 UTC (rev 111821)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginController.h 2012-03-23 04:04:08 UTC (rev 111822)
@@ -85,9 +85,6 @@
// Evaluates the given script string in the context of the given NPObject.
virtual bool evaluate(NPObject*, const String& scriptString, NPVariant* result, bool allowPopups) = 0;
- // Tries to short circuit the NPN_Invoke call with the given parameters. Returns true on success.
- virtual bool tryToShortCircuitInvoke(NPObject*, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, bool& returnValue, NPVariant& result) = 0;
-
// Set the statusbar text.
virtual void setStatusbarText(const String&) = 0;
Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (111821 => 111822)
--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp 2012-03-23 03:49:33 UTC (rev 111821)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp 2012-03-23 04:04:08 UTC (rev 111822)
@@ -1063,12 +1063,6 @@
return m_npRuntimeObjectMap.evaluate(npObject, scriptString, result);
}
-bool PluginView::tryToShortCircuitInvoke(NPObject*, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, bool& returnValue, NPVariant& result)
-{
- // Never try to short-circuit invoke in the web process.
- return false;
-}
-
void PluginView::setStatusbarText(const String& statusbarText)
{
if (!frame())
Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h (111821 => 111822)
--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h 2012-03-23 03:49:33 UTC (rev 111821)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h 2012-03-23 04:04:08 UTC (rev 111822)
@@ -141,7 +141,6 @@
virtual NPObject* windowScriptNPObject();
virtual NPObject* pluginElementNPObject();
virtual bool evaluate(NPObject*, const String&scriptString, NPVariant* result, bool allowPopups);
- virtual bool tryToShortCircuitInvoke(NPObject*, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, bool& returnValue, NPVariant& result);
virtual void setStatusbarText(const String&);
virtual bool isAcceleratedCompositingEnabled();
virtual void pluginProcessCrashed();
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (111821 => 111822)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2012-03-23 03:49:33 UTC (rev 111821)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2012-03-23 04:04:08 UTC (rev 111822)
@@ -1267,16 +1267,7 @@
parameters.values = paramValues;
parameters.mimeType = mimeType;
parameters.loadManually = loadManually;
- parameters.documentURL = m_frame->coreFrame()->document()->url().string();
- Frame* mainFrame = webPage->mainWebFrame()->coreFrame();
- if (m_frame->coreFrame() == mainFrame)
- parameters.toplevelDocumentURL = parameters.documentURL;
- else if (m_frame->coreFrame()->document()->securityOrigin()->canAccess(mainFrame->document()->securityOrigin())) {
- // We only want to set the toplevel document URL if the plug-in has access to it.
- parameters.toplevelDocumentURL = mainFrame->document()->url().string();
- }
-
#if PLUGIN_ARCHITECTURE(X11)
// FIXME: This should really be X11-specific plug-in quirks.
if (equalIgnoringCase(mimeType, "application/x-shockwave-flash")) {