Closed Bug 278262 Opened 20 years ago Closed 20 years ago

JAR URIs should resolve relative URIs in the base section

Categories

(Core :: Networking: File, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.8beta1

People

(Reporter: benjamin, Assigned: benjamin)

References

()

Details

Attachments

(2 files, 2 obsolete files)

When dealing with bug 246209 and my semi-annual chrome registry whacking, I found that JAR URIs cannot contain a relative path component in the "first" part of the URI: i.e. jar:../relative/path.jar!/path/inside This isn't that hard to fix, and it makes life a lot less hectic for the chrome registry. Patch forthcoming.
Attached patch semi-relative JAR URIs, rev. 1 (obsolete) — Splinter Review
Attachment #171170 - Flags: superreview?(darin)
Attachment #171170 - Flags: review?(cbiesinger)
Comment on attachment 171170 [details] [diff] [review] semi-relative JAR URIs, rev. 1 sharing the string parsing code with nsJARURI::SetSpec instead of duplicating it would be nice...
Comment on attachment 171170 [details] [diff] [review] semi-relative JAR URIs, rev. 1 biesi pointed out that nsJARURI::SetSpec has very similar logic, and to avoid codesize I should try to factor them together. nsJARURI::SetSpecWithBase forthcoming.
Attachment #171170 - Attachment is obsolete: true
Attachment #171170 - Flags: superreview?(darin)
Attachment #171170 - Flags: review?(cbiesinger)
This patch isn't quite as small as I'd like, but it duplicates less code than the last one, and it reduces string<->ns*URI round-trips several times during the parsing of a relative URI reference.
Attachment #171232 - Flags: review?(cbiesinger)
sorry for the delay, I didn't have any time for reviewing the patch this weekend, I'll try to get to it tuesday or wednesday
Comment on attachment 171232 [details] [diff] [review] semi-relative JAR URIs, rev. 2 modules/libjar/nsJARURI.cpp +nsJARURI::SetSpecWithBase - nsCOMPtr<nsIIOService> ioServ(do_GetIOService(&rv)); + nsCOMPtr<nsIIOService> ioServ (do_GetIOService()); hm, why remove the specific error code in favor of a generic one? + aBaseURL->QueryInterface(NS_GET_IID(nsJARURI), getter_AddRefs(otherJAR)); + if (!otherJAR) return NS_NOINTERFACE; NS_ERROR_INVALID_ARG maybe? doesn't matter much. + mJAREntry = do_QueryInterface(entry); + if (!mJAREntry) + return NS_NOINTERFACE; personally I'd only use an assertion here. + while (begin != end && *begin != ':') + ++begin; FindCharInReadable? guess for 4 chars that won't matter :-) + delim_end (end); hm, why do you need this var? nsJARURI::Equals(nsIURI *other, PRBool *result) { + nsresult rv; can you move it back down, to where it is first used?
Attachment #171232 - Flags: review?(cbiesinger) → review+
Comment on attachment 171232 [details] [diff] [review] semi-relative JAR URIs, rev. 2 I need delim_end because RFindInReadable modifies it's "end" iterator, and I need the real "end" iterator farther down for a dependent substring.
Attachment #171232 - Flags: superreview?(darin)
ah, sorry. I was thinking it changed the start iterator.
Comment on attachment 171232 [details] [diff] [review] semi-relative JAR URIs, rev. 2 >Index: modules/libjar/nsJARURI.cpp >+nsresult >+nsJARURI::SetSpecWithBase(const nsACString &aSpec, nsIURI* aBaseURL) > { > nsresult rv; >+ >+ nsCOMPtr<nsIIOService> ioServ (do_GetIOService()); nit: remove space between "ioServ" and "(" >+ aBaseURL->QueryInterface(NS_GET_IID(nsJARURI), getter_AddRefs(otherJAR)); >+ if (!otherJAR) return NS_NOINTERFACE; nit: use NS_ENSURE_TRUE here? warnings are good :) >+ nsCOMPtr<nsIStandardURL> entry >+ (do_CreateInstance(NS_STANDARDURL_CONTRACTID)); style nit: it all fits on one line, but mainly don't start line with "(" nsCOMPtr<nsIStandardURL> entry(do_CreateInstance(NS_STANDARDURL_CONTRACTID)); >+ if (!scheme.EqualsLiteral("jar")) > return NS_ERROR_MALFORMED_URI; nit: NS_ENSURE_TRUE? or can this even be a NS_ASSERTION?
Attachment #171232 - Flags: superreview?(darin) → superreview+
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.8beta
Blocks: 276424
Attached patch Unit test v1 (obsolete) — Splinter Review
Unit test v1
Attachment #257285 - Flags: review?(sayrer)
Attachment #257285 - Flags: review?(sayrer)
Attached patch Unit test v2Splinter Review
Unit test v2 * Better than unit test v1.
Attachment #257285 - Attachment is obsolete: true
Attachment #257292 - Flags: review?(sayrer)
Attachment #257292 - Flags: review?(sayrer) → review+
Whiteboard: [checkin needed]
Flags: in-testsuite?
Checking in test_bug278262.js; /cvsroot/mozilla/modules/libjar/test/unit/test_bug278262.js,v <-- test_bug278262.js initial revision: 1.1 done
Flags: in-testsuite? → in-testsuite+
Whiteboard: [checkin needed]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: