2009-02-13 Anders Carlsson <andersca@apple.com>
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Feb 2009 00:04:32 +0000 (00:04 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Feb 2009 00:04:32 +0000 (00:04 +0000)
commit046b8ba531224672274c51f922d064bec56e6e48
tree931a35f03f0975d0ee94253dd2c79a347e010ebe
parentefafae3a9112a157f7a281287d4a9d8b995e7f1e
2009-02-13  Anders Carlsson  <andersca@apple.com>

        Reviewed by Kevin Decker.

        <rdar://problem/6584834> ESPN radio live stream link hangs Safari

        When a plug-in invokes JavaScript code that will destroy the plug-in, we need to
        defer destruction until we're done executing the script.

        * Plugins/Hosted/NetscapePluginHostProxy.mm:
        (WebKit::PluginDestroyDeferrer::PluginDestroyDeferrer):
        (WebKit::PluginDestroyDeferrer::~PluginDestroyDeferrer):
        Add a simple RAII object for deferring destruction of the plug-in instance.

        (WKPCEvaluate):
        (WKPCInvoke):
        (WKPCInvokeDefault):
        (WKPCConstruct):
        (WKPCGetProperty):
        (WKPCSetProperty):
        (WKPCRemoveProperty):
        (WKPCHasProperty):
        (WKPCHasMethod):
        Use the PluginDestroyDeferrer.

        * Plugins/Hosted/NetscapePluginInstanceProxy.h:
        (WebKit::NetscapePluginInstanceProxy::pluginID):
        Assert that the plug-in ID is not 0 here.

        * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
        (WebKit::NetscapePluginInstanceProxy::NetscapePluginInstanceProxy):
        Initialize the call depth.

        (WebKit::NetscapePluginInstanceProxy::~NetscapePluginInstanceProxy):
        Set the plug-in ID to 0 to aid debugging.

        (WebKit::NetscapePluginInstanceProxy::willCallPluginFunction):
        Increment the call depth.

        (WebKit::NetscapePluginInstanceProxy::didCallPluginFunction):
        Decrement the call depth, if it's 0 and we should stop the plug-in, do so.

        (WebKit::NetscapePluginInstanceProxy::shouldStop):
        If we're called this with a non-zero call depth, set shouldStopSoon to true.

        * Plugins/Hosted/WebHostedNetscapePluginView.mm:
        (-[WebHostedNetscapePluginView shouldStop]):
        Call the proxy.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@40996 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKit/mac/ChangeLog
WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm