Bug 66058
Summary: | The url property of a beforeload event should be an absolute URL | ||
---|---|---|---|
Product: | WebKit | Reporter: | Marc Hoyois <marc.hoyois> |
Component: | New Bugs | Assignee: | Nobody <webkit-unassigned> |
Status: | UNCONFIRMED | ||
Severity: | Enhancement | CC: | ap |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Mac (Intel) | ||
OS: | OS X 10.7 |
Marc Hoyois
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
Would implementing resolveURL (bug 61097) address your use case? Please add a comment in that bug if so, describing the use case.
Marc Hoyois
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.