url module documentation should explain URL::toString()



9 years ago
8 years ago


(Reporter: avarma, Assigned: kalehrishi)



Firefox Tracking Flags

(Not tracked)



(1 attachment)



9 years ago
I was looking at the url module earlier today to figure out how to get the actual text of a URL object, and eventually had to look at the source code of the module to discover that the string coercion of the object yielded its full value. Can we document this?

Another alternative is to add a "href" property to the URL object which contains the value, similar to the document.location.href property on the Web.
(In reply to comment #0)
> Can we document this?


Comment 2

8 years ago
Created attachment 475850 [details] [diff] [review]
documentation for toString

Comment 3

8 years ago
if we add "href" property then it will a keep the analogy of the link intact.
I'm reluctant to document toString methods generally, since they are an implicit part of every object.  But in this case it isn't obvious that toString is the way to retrieve a string representation of the entire URL.

That suggests the URL object should have a "spec" property or the like for explicitly retrieving that representation.  But documenting toString is a reasonable fix in the meantime.  a=myk for landing this valuable low-risk fix!
Comment on attachment 475850 [details] [diff] [review]
documentation for toString

Thanks for the patch!

It failed to apply because of its line endings (they show up as ^M in Emacs), and toString() should be added to the URL Objects section, but those are small fixes that I will make.  Thanks!
Attachment #475850 - Flags: review+

Comment 6

8 years ago
Hrishikesh, thanks for contributing this patch, it's really helpful!
Committed here:

Assignee: nobody → kalehrishi
Last Resolved: 8 years ago
OS: Mac OS X → All
Hardware: x86 → All
Resolution: --- → FIXED
Target Milestone: -- → 0.8
The Add-on SDK is no longer a Mozilla Labs experiment and has become a big enough project to warrant its own Bugzilla product, so the "Add-on SDK" product has been created for it, and I am moving its bugs to that product.

To filter bugmail related to this change, filter on the word "looptid".
Component: Jetpack SDK → General
Product: Mozilla Labs → Add-on SDK
QA Contact: jetpack-sdk → general
You need to log in before you can comment on or make changes to this bug.