url module documentation should explain URL::toString()

RESOLVED FIXED in 0.8

Status

Add-on SDK
General
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: atul, Assigned: Hrishikesh Kale)

Tracking

unspecified

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

7 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.

Comment 1

7 years ago
(In reply to comment #0)
> Can we document this?

Yes.
(Assignee)

Comment 2

7 years ago
Created attachment 475850 [details] [diff] [review]
documentation for toString
(Assignee)

Comment 3

7 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 5

7 years ago
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+
(Reporter)

Comment 6

7 years ago
Hrishikesh, thanks for contributing this patch, it's really helpful!

Comment 7

7 years ago
Committed here:

http://hg.mozilla.org/labs/jetpack-sdk/rev/3b1d39ca8e76
Assignee: nobody → kalehrishi
Status: NEW → RESOLVED
Last Resolved: 7 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.