Summary: | preventDefault() in beforeload is not preventing image requests | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Jeff <kunklejr> | ||||
Component: | DOM | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | RESOLVED WONTFIX | ||||||
Severity: | Normal | CC: | aestes, ap, aroben, darin, fam.lam, gavinp, jberlin, koivisto, webkit-bug-importer | ||||
Priority: | P2 | Keywords: | InRadar | ||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | Mac (Intel) | ||||||
OS: | OS X 10.6 | ||||||
URL: | http://www.nearinfinity.com/blogs/jeff_kunkle/lessons_learned_building_an_ht.html | ||||||
Attachments: |
|
Description
Jeff
2011-01-17 08:10:07 PST
This sounds like a good use case to me, but starting a network load only when there's a DOM element to dispatch the beforeload event on would make resource prefetching impossible. Alexey, I'm confused: the problem Jeff's reporting is that preventDefault() in a captured beforeload doesn't work. This means extensions like the Incognito extension don't actually work as advertised, since they share cookies with the remote site and make a request with a valid Referer. Are you talking about bug 52577 instead? Created attachment 79893 [details]
Patch
Comment on attachment 79893 [details]
Patch
I had some time on a flight today, and hammered out this test. Unfortunately, it fails right now; as you can see if you run it, the request for the IMG is launched no matter what.
I poked at fixing it a bit, and there's something about how early the ImageLoader is consed up is our source of trouble: the capture isn't established the first time that ImageLoader::updateFromElement is called.
I noticed this when working on the patch for bug 45586. ImageLoader calls CachedResourceLoader::requestImage() before any beforeload work is performed. For the image case, beforeload only has the opportunity to stop a renderer from being attached to an image, not to stop the network request. This makes beforeload work differently for images than it does for other resources (e.g. beforeload can actually block the network request of an <object> or <embed>). Retitled based on my understanding of what’s going on here. But as Alexey pointed out, there’s a second issue because of preloading, so maybe my title change does not capture the entire issue here. Removing 'REGRESSION: ' from the title since I believe this bug has existed since beforeload was first implemented. Marking NTBF since this could only be resolved by disabling preload scanning for images. |