Title: [142314] trunk/Source/WebKit2
- Revision
- 142314
- Author
- [email protected]
- Date
- 2013-02-08 12:46:26 -0800 (Fri, 08 Feb 2013)
Log Message
Work around a bug in Flash where NSException objects can be released too early
https://bugs.webkit.org/show_bug.cgi?id=109242
<rdar://problem/13003470>
Reviewed by Darin Adler.
* Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
(WebKit::NetscapePluginModule::determineQuirks):
Set the new plug-in quirk.
* Shared/Plugins/PluginQuirks.h:
Add a new plug-in quirk.
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::initialize):
Call platformPreInitialize.
* WebProcess/Plugins/Netscape/NetscapePlugin.h:
(NetscapePlugin):
Add platformPreInitialize.
* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
(WebKit::NSException_release):
Add new empty function.
(WebKit::NetscapePlugin::platformPreInitialize):
Patch -[NSException release] to be a no-op.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (142313 => 142314)
--- trunk/Source/WebKit2/ChangeLog 2013-02-08 20:45:43 UTC (rev 142313)
+++ trunk/Source/WebKit2/ChangeLog 2013-02-08 20:46:26 UTC (rev 142314)
@@ -1,3 +1,33 @@
+2013-02-07 Anders Carlsson <[email protected]>
+
+ Work around a bug in Flash where NSException objects can be released too early
+ https://bugs.webkit.org/show_bug.cgi?id=109242
+ <rdar://problem/13003470>
+
+ Reviewed by Darin Adler.
+
+ * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
+ (WebKit::NetscapePluginModule::determineQuirks):
+ Set the new plug-in quirk.
+
+ * Shared/Plugins/PluginQuirks.h:
+ Add a new plug-in quirk.
+
+ * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+ (WebKit::NetscapePlugin::initialize):
+ Call platformPreInitialize.
+
+ * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+ (NetscapePlugin):
+ Add platformPreInitialize.
+
+ * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+ (WebKit::NSException_release):
+ Add new empty function.
+
+ (WebKit::NetscapePlugin::platformPreInitialize):
+ Patch -[NSException release] to be a no-op.
+
2013-02-08 Dean Jackson <[email protected]>
Do not register autostart for plugins from file:// (or nowhere)
Modified: trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm (142313 => 142314)
--- trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm 2013-02-08 20:45:43 UTC (rev 142313)
+++ trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm 2013-02-08 20:46:26 UTC (rev 142314)
@@ -481,6 +481,9 @@
// Flash returns a retained Core Animation layer.
m_pluginQuirks.add(PluginQuirks::ReturnsRetainedCoreAnimationLayer);
+
+ // Flash has a bug where NSExceptions can be released too early.
+ m_pluginQuirks.add(PluginQuirks::LeakAllThrownNSExceptions);
}
if (plugin.bundleIdentifier == "com.microsoft.SilverlightPlugin") {
Modified: trunk/Source/WebKit2/Shared/Plugins/PluginQuirks.h (142313 => 142314)
--- trunk/Source/WebKit2/Shared/Plugins/PluginQuirks.h 2013-02-08 20:45:43 UTC (rev 142313)
+++ trunk/Source/WebKit2/Shared/Plugins/PluginQuirks.h 2013-02-08 20:46:26 UTC (rev 142314)
@@ -68,6 +68,10 @@
// which is enabled if it doesn't find Version/3 in the user-agent.
AppendVersion3UserAgent,
+ // Whether all thrown NSExceptions should be leaked.
+ // <rdar://problem/13003470> Adobe Flash has a bug where exceptions are released too early.
+ LeakAllThrownNSExceptions,
+
#ifndef NP_NO_QUICKDRAW
// Allow the plug-in to use the QuickDraw drawing model, since we know that the plug-in
// will never paint or receive events. Used by the AppleConnect plug-in.
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (142313 => 142314)
--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp 2013-02-08 20:45:43 UTC (rev 142313)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp 2013-02-08 20:46:26 UTC (rev 142314)
@@ -630,6 +630,8 @@
m_layerHostingMode = parameters.layerHostingMode;
#endif
+ platformPreInitialize();
+
NetscapePlugin* previousNPPNewPlugin = currentNPPNewPlugin;
m_inNPPNew = true;
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (142313 => 142314)
--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h 2013-02-08 20:45:43 UTC (rev 142313)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h 2013-02-08 20:46:26 UTC (rev 142314)
@@ -152,6 +152,7 @@
const char* userAgent();
+ void platformPreInitialize();
bool platformPostInitialize();
void platformDestroy();
bool platformInvalidate(const WebCore::IntRect&);
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm (142313 => 142314)
--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm 2013-02-08 20:45:43 UTC (rev 142313)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm 2013-02-08 20:46:26 UTC (rev 142314)
@@ -189,6 +189,24 @@
}
#endif
+static void NSException_release(id, SEL)
+{
+ // Do nothing.
+}
+
+void NetscapePlugin::platformPreInitialize()
+{
+ if (m_pluginModule->pluginQuirks().contains(PluginQuirks::LeakAllThrownNSExceptions)) {
+ // Patch -[NSException release] to not release the object.
+ static dispatch_once_t once;
+ dispatch_once(&once, ^{
+ Class exceptionClass = [NSException class];
+ Method exceptionReleaseMethod = class_getInstanceMethod(exceptionClass, @selector(release));
+ class_replaceMethod(exceptionClass, @selector(release), reinterpret_cast<IMP>(NSException_release), method_getTypeEncoding(exceptionReleaseMethod));
+ });
+ }
+}
+
bool NetscapePlugin::platformPostInitialize()
{
if (m_drawingModel == static_cast<NPDrawingModel>(-1)) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes