Changeset 142314 in webkit


Ignore:
Timestamp:
Feb 8, 2013 12:46:26 PM (11 years ago)
Author:
andersca@apple.com
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.

Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r142310 r142314  
     12013-02-07  Anders Carlsson  <andersca@apple.com>
     2
     3        Work around a bug in Flash where NSException objects can be released too early
     4        https://bugs.webkit.org/show_bug.cgi?id=109242
     5        <rdar://problem/13003470>
     6
     7        Reviewed by Darin Adler.
     8
     9        * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
     10        (WebKit::NetscapePluginModule::determineQuirks):
     11        Set the new plug-in quirk.
     12
     13        * Shared/Plugins/PluginQuirks.h:
     14        Add a new plug-in quirk.
     15
     16        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
     17        (WebKit::NetscapePlugin::initialize):
     18        Call platformPreInitialize.
     19
     20        * WebProcess/Plugins/Netscape/NetscapePlugin.h:
     21        (NetscapePlugin):
     22        Add platformPreInitialize.
     23
     24        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
     25        (WebKit::NSException_release):
     26        Add new empty function.
     27
     28        (WebKit::NetscapePlugin::platformPreInitialize):
     29        Patch -[NSException release] to be a no-op.
     30
    1312013-02-08  Dean Jackson  <dino@apple.com>
    232
  • trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm

    r138635 r142314  
    482482        // Flash returns a retained Core Animation layer.
    483483        m_pluginQuirks.add(PluginQuirks::ReturnsRetainedCoreAnimationLayer);
     484
     485        // Flash has a bug where NSExceptions can be released too early.
     486        m_pluginQuirks.add(PluginQuirks::LeakAllThrownNSExceptions);
    484487    }
    485488
  • trunk/Source/WebKit2/Shared/Plugins/PluginQuirks.h

    r125081 r142314  
    6969        AppendVersion3UserAgent,
    7070
     71        // Whether all thrown NSExceptions should be leaked.
     72        // <rdar://problem/13003470> Adobe Flash has a bug where exceptions are released too early.
     73        LeakAllThrownNSExceptions,
     74
    7175#ifndef NP_NO_QUICKDRAW
    7276        // Allow the plug-in to use the QuickDraw drawing model, since we know that the plug-in
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp

    r138461 r142314  
    631631#endif
    632632
     633    platformPreInitialize();
     634
    633635    NetscapePlugin* previousNPPNewPlugin = currentNPPNewPlugin;
    634636   
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h

    r141372 r142314  
    153153    const char* userAgent();
    154154
     155    void platformPreInitialize();
    155156    bool platformPostInitialize();
    156157    void platformDestroy();
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm

    r127047 r142314  
    190190#endif
    191191
     192static void NSException_release(id, SEL)
     193{
     194    // Do nothing.
     195}
     196
     197void NetscapePlugin::platformPreInitialize()
     198{
     199    if (m_pluginModule->pluginQuirks().contains(PluginQuirks::LeakAllThrownNSExceptions)) {
     200        // Patch -[NSException release] to not release the object.
     201        static dispatch_once_t once;
     202        dispatch_once(&once, ^{
     203            Class exceptionClass = [NSException class];
     204            Method exceptionReleaseMethod = class_getInstanceMethod(exceptionClass, @selector(release));
     205            class_replaceMethod(exceptionClass, @selector(release), reinterpret_cast<IMP>(NSException_release), method_getTypeEncoding(exceptionReleaseMethod));
     206        });
     207    }
     208}
     209
    192210bool NetscapePlugin::platformPostInitialize()
    193211{
Note: See TracChangeset for help on using the changeset viewer.