Closed Bug 1254484 Opened 9 years ago Closed 8 years ago

[Presentation WebAPI] resolve the relative URL to absolute URL

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox51 --- fixed

People

(Reporter: schien, Assigned: schien)

References

()

Details

(Whiteboard: btpp-backlog)

Attachments

(1 file, 1 obsolete file)

Need to follow the latest spec: Resolve url relative to the API base URL specified by the entry settings object, and let presentationUrl be the resulting absolute URL, if any.
Whiteboard: btpp-backlog
Assignee: nobody → schien
Attached patch resolve-relative-url.patch (obsolete) (deleted) — Splinter Review
PresentationConnection.url is implemented in bug 1197690.
Attachment #8777232 - Flags: review?(bugs)
Comment on attachment 8777232 [details] [diff] [review] resolve-relative-url.patch >+GetAbsoluteURL(const nsAString& aUrl, >+ nsIURI* aBaseUri, >+ nsAString& aAbsoluteUrl) >+{ >+ nsAutoCString charset; >+ nsresult rv = aBaseUri->GetOriginCharset(charset); I think I'd prefer if you used GetDocumentCharacterSet() from the GetExtantDoc() of the window. You can add yet another param to GetAbsoluteURL (doc or charset) or inline this all to ctor. Remember, GetExtantDoc() may return null. >+ >+ if (NS_FAILED(rv)) { >+ return rv; >+ } >+ >+ nsCOMPtr<nsIURI> uri; >+ rv = NS_NewURI(getter_AddRefs(uri), >+ aUrl, >+ charset.IsEmpty() ? nullptr : charset.get(), >+ aBaseUri, >+ nsContentUtils::GetIOService()); You don't need to pass GetIOService(). Those fixed, r+ If you're at all uncertain about some change, I could re-review.
Attachment #8777232 - Flags: review?(bugs) → review+
(In reply to Olli Pettay [:smaug] from comment #2) > Comment on attachment 8777232 [details] [diff] [review] > resolve-relative-url.patch > > >+GetAbsoluteURL(const nsAString& aUrl, > >+ nsIURI* aBaseUri, > >+ nsAString& aAbsoluteUrl) > >+{ > >+ nsAutoCString charset; > >+ nsresult rv = aBaseUri->GetOriginCharset(charset); > I think I'd prefer if you used GetDocumentCharacterSet() from the > GetExtantDoc() of the window. > You can add yet another param to GetAbsoluteURL (doc or charset) or inline > this all to ctor. > Remember, GetExtantDoc() may return null. Got it, I'll use GetDocumentCharacterSet() if document is not null, or use nullptr otherwise. > > > >+ > >+ if (NS_FAILED(rv)) { > >+ return rv; > >+ } > >+ > >+ nsCOMPtr<nsIURI> uri; > >+ rv = NS_NewURI(getter_AddRefs(uri), > >+ aUrl, > >+ charset.IsEmpty() ? nullptr : charset.get(), > >+ aBaseUri, > >+ nsContentUtils::GetIOService()); > You don't need to pass GetIOService(). Done. I did this simply because a comment in NS_NewURI says "pass in nsIIOService to optimize callers". Not sure how much performance gain it can get but PresentationRequest is probably not on the critical path. > > Those fixed, r+ > If you're at all uncertain about some change, I could re-review.
Attached patch resolve-relative-url.patch (deleted) — Splinter Review
update according to review comment, carry r+.
Attachment #8777232 - Attachment is obsolete: true
Attachment #8777691 - Flags: review+
Pushed by cbook@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/505e6acd9c29 resolve relative presentation URL. r=smaug.
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: