UNCONFIRMED 66058
The url property of a beforeload event should be an absolute URL
https://bugs.webkit.org/show_bug.cgi?id=66058
Summary The url property of a beforeload event should be an absolute URL
Marc Hoyois
Reported 2011-08-11 07:33:21 PDT
Currently the url property of a beforeload event is taken directly from the HTML source, so it may be a relative URL. For all applications of beforeload that I can think of, an absolute URL is preferrable. Of course, it's easy to make the URL absolute manually using the temporary <a> tag trick, but that shouldn't be necessary.
Attachments
Alexey Proskuryakov
Comment 1 2011-08-11 11:31:10 PDT
Would implementing resolveURL (bug 61097) address your use case? Please add a comment in that bug if so, describing the use case.
Marc Hoyois
Comment 2 2011-08-11 21:04:45 PDT
Interesting, I didn't know about resolveURL. There are indeed 4 places in my ClickToPlugin extension where it is critical that URLs be resolved, so I'll check the other thread. But I think that event.url should be absolute regardless. Other URL-properties of DOM objects (e.g. anchor.href, video.mediaSrc) return absolute URLs, so it seems consistent that event.url should be absolute. The use case I have in mind is very specific to the beforeload event: when deciding whether or not to block (or do something else with) a resource, the "beginning" of the URL is usually the most relevant part, and so the URL has to be resolved using the anchor trick. If we want to sniff the MIME type of the resource, we also need an absolute URL.
Note You need to log in before you can comment on or make changes to this bug.