RESOLVED FIXED 38566
[WTFURL] Add a class to represent the segments of a URL
https://bugs.webkit.org/show_bug.cgi?id=38566
Summary [WTFURL] Add a class to represent the segments of a URL
Adam Barth
Reported 2010-05-05 00:07:27 PDT
[WTFURL] Add a class to represent the segments of a URL
Attachments
Patch (11.54 KB, patch)
2010-05-05 00:10 PDT, Adam Barth
no flags
Patch (9.98 KB, patch)
2010-05-05 16:36 PDT, Adam Barth
no flags
patch w/ update license block (10.09 KB, patch)
2010-05-05 18:31 PDT, Adam Barth
no flags
Adam Barth
Comment 1 2010-05-05 00:10:25 PDT
Maciej Stachowiak
Comment 2 2010-05-05 15:39:19 PDT
Comment on attachment 55090 [details] Patch JavaScriptCore/wtf/url/src/URLSegments.h:88 + // *Ref: 20 20 Perhaps "Ref" should be called "Fragment" to match the RFC naming. JavaScriptCore/wtf/url/src/URLSegments.h:108 + // Host name. This comment doesn't seem to add any value. JavaScriptCore/wtf/url/src/URLSegments.h:111 + // Port number. This comment doesn't seem to add any value. The other com,ments do convey some information, but they seem needlessly verbose. It seems like there is a common pattern of excluding delimiters from the range, and having -1 length if the delimiter character for that component is missing. Perhaps we could just say this once, instead of separately for every component. JavaScriptCore/wtf/url/src/URLSegments.h:53 + // The default constructor is sufficient for the components. This comment doesn't add any value. JavaScriptCore/wtf/url/src/URLSegments.h:41 + // Identifies different components. This comment doesn't add any value. JavaScriptCore/wtf/url/src/URLSegments.h:130 + URLComponent ref; ref should be fragment (again) Please address JavaScriptCore/wtf/url/src/URLSegments.cpp:58 + current = scheme.end() + 1; // Advance over the ':' at the end of the scheme. If this code expects to be advancing past a specific character, perhaps an ASSERT would be a better way to document that than a comment. JavaScriptCore/wtf/url/src/URLSegments.cpp:63 + current = username.end() + 1; // Advance over the '@' or ':' at the end. If this code expects to be advancing past a specific character, perhaps an ASSERT would be a better way to document that than a comment. JavaScriptCore/wtf/url/src/URLSegments.cpp:69 + current = password.end() + 1; // Advance over the '@' at the end. If this code expects to be advancing past a specific character, perhaps an ASSERT would be a better way to document that than a comment. JavaScriptCore/wtf/url/src/URLSegments.cpp:80 + return port.begin() - 1; // Back over delimiter. If this code expects to be advancing past a specific character, perhaps an ASSERT would be a better way to document that than a comment. JavaScriptCore/wtf/url/src/URLSegments.cpp:94 + return query.begin() - 1; // Back over delimiter. If this code expects to be advancing past a specific character, perhaps an ASSERT would be a better way to document that than a comment. JavaScriptCore/wtf/url/src/URLSegments.cpp:102 + return ref.begin(); // Back over delimiter. If this code expects to be advancing past a specific character, perhaps an ASSERT would be a better way to document that than a comment. JavaScriptCore/wtf/url/src/URLSegments.cpp:54 + // There will be some characters after the scheme like "://" and we don't I don't see anything in this code that seems specific to advancing pass ://, it seems to just look at all the component ranges in turn. r- for now to address the above issues. None of them are showstoppers, but it seems like there are enough different comments to warrant a new patch version.
Adam Barth
Comment 3 2010-05-05 16:32:35 PDT
> If this code expects to be advancing past a specific character, perhaps an > ASSERT would be a better way to document that than a comment. The string isn't available here (because it's stored separately from the segmentation), so we can't actually assert that here. > r- for now to address the above issues. None of them are showstoppers, but it > seems like there are enough different comments to warrant a new patch version. I've addressed the remainder. I'll be more agressive about making the comments more WebKit-like in future patches.
Adam Barth
Comment 4 2010-05-05 16:36:29 PDT
Adam Barth
Comment 5 2010-05-05 18:31:40 PDT
Created attachment 55189 [details] patch w/ update license block
Maciej Stachowiak
Comment 6 2010-05-06 01:03:07 PDT
Comment on attachment 55189 [details] patch w/ update license block r=me
Adam Barth
Comment 7 2010-05-06 01:10:29 PDT
Comment on attachment 55189 [details] patch w/ update license block Thanks!
WebKit Commit Bot
Comment 8 2010-05-06 02:31:17 PDT
Comment on attachment 55189 [details] patch w/ update license block Clearing flags on attachment: 55189 Committed r58874: <http://trac.webkit.org/changeset/58874>
WebKit Commit Bot
Comment 9 2010-05-06 02:31:23 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.