Closed Bug 589227 Opened 14 years ago Closed 14 years ago

url module documentation should explain URL::toString()

Categories

(Add-on SDK Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: avarma, Assigned: kalehrishi)

Details

Attachments

(1 file)

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?

Yes.
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+
Hrishikesh, thanks for contributing this patch, it's really helpful!
Committed here:

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

Attachment

General

Created:
Updated:
Size: