* 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
All non-Safari browsers except Konqueror, that is. =) Konqueror 3.3.1 has the same bug. It breaks image toggle scripts.
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?
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.
Created attachment 3149 [details] test case that still fails with this patch
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?
There's a good change that the fix for bug 3869 also fixes this bug.
(chance, not change)
Created attachment 4660 [details] A patch to fix this matching WinIE's behavior.
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.
Created attachment 4661 [details] separated test case
Comment on attachment 4660 [details] A patch to fix this matching WinIE's behavior. eric and i talked about this. r=me.