Bug 5306 - KHTMLPart::requestObject doesn't destroy old plugin content
Summary: KHTMLPart::requestObject doesn't destroy old plugin content
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Vicki Murley
Depends on:
Reported: 2005-10-09 11:08 PDT by mitz
Modified: 2005-10-25 01:44 PDT (History)
0 users

See Also:

testcase (uses external resource) (1.16 KB, text/html)
2005-10-09 11:10 PDT, mitz
no flags Details
detach() to destroy old plugin (952 bytes, patch)
2005-10-10 10:39 PDT, mitz
mjs: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.