RESOLVED FIXED 3473
Preloaded Image objects .src field is not a fully resolved path
https://bugs.webkit.org/show_bug.cgi?id=3473
Summary Preloaded Image objects .src field is not a fully resolved path
Stuart Morgan
Reported 2005-06-12 13:04:11 PDT
* SUMMARY Non-safari browser will replace the relative path value of an image.src with the fully resolved path after the image is loaded. safari appears to preload however the path remains relative. for example images preloaded via: var anImage = new image(x,y); anImage.src = "images/safari.jpg" should have a fully resolved src value alert(anImage.src); should display "http://pathtome.com/images/safari.jpg" * RESULTS all non-safari browsers will update the image object src with the full path. Safari leaves the src value unchanged Apple Bug: rdar://3787988
Attachments
Bug fix (588 bytes, patch)
2005-06-20 07:07 PDT, Derek Poon
darin: review-
test case that still fails with this patch (172 bytes, text/html)
2005-07-29 13:32 PDT, Vicki Murley
no flags
A patch to fix this matching WinIE's behavior. (2.79 KB, patch)
2005-11-10 11:54 PST, Eric Seidel (no email)
ggaren: review+
separated test case (1.71 KB, text/html)
2005-11-10 12:52 PST, Eric Seidel (no email)
no flags
Derek Poon
Comment 1 2005-06-20 02:35:16 PDT
All non-Safari browsers except Konqueror, that is. =) Konqueror 3.3.1 has the same bug. It breaks image toggle scripts.
Derek Poon
Comment 2 2005-06-20 07:07:51 PDT
Created attachment 2501 [details] Bug fix This fix works for me. Would somebody please double check the memory management, and explain when doc would ever be NULL?
Darin Adler
Comment 3 2005-07-29 10:57:21 PDT
Comment on attachment 2501 [details] Bug fix In the future, please attach patches as unified format diffs (the "-u") option to diff. We want to use stick to our coding style guidelines for new code, which means it should say "(str)" instead of "( str )". The reason we have to null-check the document is that the image object might outlast the document; you can hold a reference to the image forever even if the window is closed. We also need a layout test to check in along with the bug fix. But the logic of the fix looks great, r=me on that.
Vicki Murley
Comment 4 2005-07-29 13:32:24 PDT
Created attachment 3149 [details] test case that still fails with this patch
Vicki Murley
Comment 5 2005-07-29 13:34:10 PDT
This test case still fails with this patch (works in ffx): <html> <body> <script type="text/javascript"> var anImage = new Image(76,103); anImage.src = "editing/abe.jpg"; document.write(anImage.src); </script> </body> </html> Derek, could you attach the test case that you used?
Darin Adler
Comment 6 2005-08-06 16:35:03 PDT
There's a good change that the fix for bug 3869 also fixes this bug.
Darin Adler
Comment 7 2005-08-06 16:35:28 PDT
(chance, not change)
Eric Seidel (no email)
Comment 8 2005-11-10 11:54:15 PST
Created attachment 4660 [details] A patch to fix this matching WinIE's behavior.
Eric Seidel (no email)
Comment 9 2005-11-10 11:54:36 PST
Comment on attachment 4660 [details] A patch to fix this matching WinIE's behavior. Make sure you view this patch as source, otherwise Safari gets confused.
Eric Seidel (no email)
Comment 10 2005-11-10 12:52:18 PST
Created attachment 4661 [details] separated test case
Geoffrey Garen
Comment 11 2005-11-10 14:41:49 PST
Comment on attachment 4660 [details] A patch to fix this matching WinIE's behavior. eric and i talked about this. r=me.
Note You need to log in before you can comment on or make changes to this bug.