Bug 5306

Summary: KHTMLPart::requestObject doesn't destroy old plugin content
Product: WebKit Reporter: mitz
Component: Layout and RenderingAssignee: Vicki Murley <vicki>
Severity: Normal    
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Description Flags
testcase (uses external resource)
detach() to destroy old plugin mjs: review+

Description mitz 2005-10-09 11:08:17 PDT
Summary: Changes to an OBJECT node's children can trigger a new request for the object content. When 
this happens, the old child frame with the old plugin view doesn't get destroyed and in fact keeps 

To reproduce:
1) You need the Flash plugin
2) Open Activity Monitor or use 'top' to measure Safari's CPU usage
3) Open the testcase
4) Click the "Click to test" link and wait until "Running..." changes back to the link
5) Repeat step 4 two or three times if Safari's CPU usage does not appear to change

Expected: Safari's CPU usage to not change

Actual: Safari's CPU usage increases to close to 100% of what's available

Analysis: A change to the OBJECT node's children triggers updateWidget on the RenderPartObject, which 
calls KHTMLPart::requestObject, which does not discard the old child frame (and associated plugin view) 
but instead just adds a new one. The increase in CPU usage is a result of multiple instances of the 
plugin running simultaneously. As far as I can see, only one of them is discarded when the Safari 
window is closed, so I also suspect a memory leak.
Comment 1 mitz 2005-10-09 11:10:21 PDT
Created attachment 4266 [details]
testcase (uses external resource)
Comment 2 mitz 2005-10-10 10:39:25 PDT
Created attachment 4291 [details]
detach() to destroy old plugin
Comment 3 Maciej Stachowiak 2005-10-14 00:35:03 PDT
Looks good to me. Is there any chance of makng a test case that works without a remote resource and can 
work as a layout test? I'm guessing no, so I guess it's ok to add the current one as a manual test.
Comment 4 Vicki Murley 2005-10-24 12:00:58 PDT
I'll commit this.