Some Java plugin instances can deadlock with the WebProcess on NPP_Destroy.
<rdar://problem/14286390> and https://bugs.webkit.org/show_bug.cgi?id=118535

Reviewed by Alexey Proskuryakov.

* Shared/Plugins/NPObjectProxy.cpp:
(WebKit::NPObjectProxy::~NPObjectProxy): ASSERT this is the main thread.
(WebKit::NPObjectProxy::NP_Deallocate): If this isn't the main thread, call it again on the main thread.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152539 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix a bug in MediaStreamDescriptor::removeVideoComponent
https://bugs.webkit.org/show_bug.cgi?id=118446

Patch by Nick Diego Yamane <nick.yamane@openbossa.org> on 2013-07-10
Reviewed by Eric Carlson.

MediaStreamDescriptor::removeVideoComponent is currently trying to
remove the 'videoComponent' from the wrong vector.

* platform/mediastream/MediaStreamDescriptor.h:
(WebCore::MediaStreamDescriptor::removeVideoComponent):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152540 268f45cc-cd09-0410-ab3c-d52691b4dbfc
HTMLPluginElement's state should be Playing before firing mouse click event.
https://bugs.webkit.org/show_bug.cgi?id=118398.
<rdar://problem/14262126>

Reviewed by Dean Jackson.

Test: plugins/snapshotting/plugin-receives-click-event.html

* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::simulatedMouseClickTimerFired):
The defaultEventHandler returns early if the state is not Playing.
This is because we only want the plugin to deal with user interaction normally if the
plugin is actually enabled (not being snapshotted).
When we click on the snapshotted plugin to start it, we mimic what would happen to the plugin
normally by dispatching another click event on top of where we just clicked.
However, we were sending the click event before setting the state to Playing which meant that our
simulated click was not being handled. 
We should be setting this state before sending the click, not after.
* platform/mac-wk2/plugins/snapshotting/plugin-receives-click-event-expected.txt: Added.
* plugins/snapshotting/plugin-receives-click-event.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152541 268f45cc-cd09-0410-ab3c-d52691b4dbfc