WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
UNCONFIRMED
29365
Background images not freed when changing CSS classes
https://bugs.webkit.org/show_bug.cgi?id=29365
Summary
Background images not freed when changing CSS classes
Joe Edwards
Reported
2009-09-18 02:46:09 PDT
If css is defined as follows: .bg1 { background-image: url(img1.jpg); } .bg2 { background-image: url(img2.jpg); } And then you change the background on an element using: document.getElementById('pagebg').className = "bg1"; or document.getElementById('pagebg').className = "bg2"; The "old" image reference is not freed up. (Use of cache has been disabled) If I change the image background using document.getElementById('pagebg').style.backgroundImage = 'url(img1.jpg)'; or document.getElementById('pagebg').style.backgroundImage = 'url(img2.jpg)'; The old image reference is correctly freed up. I have put up pages to illustrate this behaviour: The first use case (which caches the image) is at:
http://www.joelebeau.co.uk/testcssbg/index.htm
The 2nd use case is at:
http://www.joelebeau.co.uk/testcssbg/index2.htm
(In both pages the image loads/transitions are triggered by a key press)
Attachments
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2009-09-18 11:30:56 PDT
I'm not sure what the difference in behavior between the two linked tests is. What do you mean by "freed up"? Is this a memory leak, and if it is, how did you confirm it?
Joe Edwards
Comment 2
2009-09-18 11:47:19 PDT
Essentially i looked at the web server logs in both cases... In the first case I could see each image only being requested once. In the 2nd case each image was re-requested before each change. From adding debug it seems that there is still a reference (client) to the CachedImage by CSSImageValue
Simon Fraser (smfr)
Comment 3
2011-01-08 21:31:24 PST
We used to load all images referenced by matched selectors, but that was fixed by
bug 49204
. Does this still reproduce?
Alexey Proskuryakov
Comment 4
2011-01-09 12:23:22 PST
Simon, did you mean to reference
bug 24223
?
Simon Fraser (smfr)
Comment 5
2011-01-09 17:53:33 PST
(In reply to
comment #4
)
> Simon, did you mean to reference
bug 24223
?
I did, yes.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug