RESOLVED FIXED Bug 113630
HTMLLinkElement should resolve resource URLs when resources will be fetched
https://bugs.webkit.org/show_bug.cgi?id=113630
Summary HTMLLinkElement should resolve resource URLs when resources will be fetched
Rafael Weinstein
Reported 2013-03-29 17:15:28 PDT
Currently it resolves urls when the href attribute is processed (either during parse or setAttribute). This will result in an erroneous url if a) the document's base URL has changed since the href attribute was processed b) the link was adopted from another document
Attachments
Patch (4.87 KB, patch)
2013-03-29 17:19 PDT, Rafael Weinstein
no flags
Patch (8.35 KB, patch)
2013-03-29 17:24 PDT, Rafael Weinstein
no flags
Patch (8.34 KB, patch)
2013-03-30 12:35 PDT, Rafael Weinstein
no flags
Patch (7.82 KB, patch)
2013-03-30 13:20 PDT, Rafael Weinstein
no flags
Patch for landing (7.82 KB, patch)
2013-03-30 13:21 PDT, Rafael Weinstein
no flags
Patch for landing (7.82 KB, patch)
2013-03-30 17:28 PDT, Rafael Weinstein
no flags
Rafael Weinstein
Comment 1 2013-03-29 17:19:24 PDT
Rafael Weinstein
Comment 2 2013-03-29 17:24:27 PDT
Rafael Weinstein
Comment 3 2013-03-29 17:24:51 PDT
this time with layout test attached.
Eric Seidel (no email)
Comment 4 2013-03-29 17:49:18 PDT
Comment on attachment 195825 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=195825&action=review > Source/WebCore/ChangeLog:6 > + HTMLLinkElement was resolving its URL when the href attribute was processed and caching it without ever Extra space. > Source/WebCore/html/HTMLLinkElement.cpp:138 > + String url = stripLeadingAndTrailingHTMLSpaces(href); > + return url.isEmpty() ? KURL() : document()->completeURL(url); I'm surprised we need this ternary? Since I would expect other palces to treat empty urls as urls to the document? I guess this si so the later isValid() check works? > Source/WebCore/html/HTMLLinkElement.h:108 > + KURL getURL() const; I believe webkit style is to avoid using "get" in getters.
Rafael Weinstein
Comment 5 2013-03-30 12:35:32 PDT
Eric Seidel (no email)
Comment 6 2013-03-30 12:45:24 PDT
Comment on attachment 195865 [details] Patch I believe WebKIt style would have you rename "URL()" to "url()". Otherwise this LGTM.
Rafael Weinstein
Comment 7 2013-03-30 13:20:18 PDT
Rafael Weinstein
Comment 8 2013-03-30 13:21:20 PDT
Created attachment 195868 [details] Patch for landing
Rafael Weinstein
Comment 9 2013-03-30 13:21:59 PDT
just noticed getNonEmptyURLAttribute() on Element.cpp. using that instead.
Adam Barth
Comment 10 2013-03-30 14:24:04 PDT
Comment on attachment 195868 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=195868&action=review > Source/WebCore/html/HTMLLinkElement.cpp:180 > + KURL url = getNonEmptyURLAttribute(hrefAttr); You've got an extra space after the = on this line.
Rafael Weinstein
Comment 11 2013-03-30 17:28:15 PDT
Created attachment 195878 [details] Patch for landing
Rafael Weinstein
Comment 12 2013-03-30 17:28:44 PDT
Comment on attachment 195868 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=195868&action=review >> Source/WebCore/html/HTMLLinkElement.cpp:180 >> + KURL url = getNonEmptyURLAttribute(hrefAttr); > > You've got an extra space after the = on this line. fixed.
WebKit Review Bot
Comment 13 2013-03-31 16:25:55 PDT
Comment on attachment 195878 [details] Patch for landing Clearing flags on attachment: 195878 Committed r147291: <http://trac.webkit.org/changeset/147291>
WebKit Review Bot
Comment 14 2013-03-31 16:25:59 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.