Relanding(r111754): HTMLPluginElement is not destroyed on reload or navigation if getNPObject is called
https://bugs.webkit.org/show_bug.cgi?id=80428
.:
Patch by Dave Michael <dmichael@chromium.org> on 2012-03-23
Source/WebCore:
Patch by Dave Michael <dmichael@chromium.org> on 2012-03-23
Reviewed by Eric Seidel and Ryosuke Niwa.
Make HTMLPluginElement release its m_NPObject in detach() to break a
reference-counting cycle that happens on reload or navigation. With this
change, HTMLPlugInElement::removedFromDocument is unnecessary, so it
was removed. Note that Releasing m_NPObject does not result in a call to
the plugin; it simply releases a reference count on the wrapper object
for this HTMLPlugInElement. (The plugin's NPP_Deallocate is invoked
when the render tree is destroyed, when PluginView calls
PluginPackage::unload.) Thus, it is safe to release m_NPObject in
detach, because it can not result in layout or style changes.
Also added numberOfLiveNodes() and numberOfLiveDocuments() to
window.internals to enable testing.
Test: plugins/netscape-dom-access-and-reload.html
* WebCore.exp.in:
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::detach):
* html/HTMLPlugInElement.h:
(HTMLPlugInElement):
* testing/Internals.cpp:
(WebCore):
(WebCore::Internals::numberOfLiveNodes):
(WebCore::Internals::numberOfLiveDocuments):
* testing/Internals.h:
(Internals):
* testing/Internals.idl:
Source/WebKit2:
Patch by Dave Michael <dmichael@chromium.org> on 2012-03-23
Reviewed by Eric Seidel and Ryosuke Niwa.
* win/WebKit2.def: Export a symbol for InspectorCounters::counterValue
* win/WebKit2CFLite.def: Export a symbol for InspectorCounters::counterValue
LayoutTests:
Patch by Dave Michael <dmichael@chromium.org> on 2012-03-23
Reviewed by Eric Seidel and Ryosuke Niwa.
Due to unfortunate copy/paste laziness, the new test was using the same
window.sessionStorage as plugins/reloadplugins-and-pages.html, so that
if the tests were run in the same session, reloadplugins-and-pages.html
would *not* reload as it was supposed to, causing a text mismatch. This
patch uses a more appropriate and unique name so that these two tests
won't affect each other.
* plugins/netscape-dom-access-and-reload-expected.txt: Added.
* plugins/netscape-dom-access-and-reload.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111890
268f45cc-cd09-0410-ab3c-
d52691b4dbfc