Bug 15765 - Replaceable interface
Summary: Replaceable interface
Alias: None
Product: WHATWG
Classification: Unclassified
Component: URL (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: Unsorted
Assignee: Anne
QA Contact: sideshowbarker+urlspec
Depends on:
Reported: 2012-01-28 20:46 UTC by Ms2ger
Modified: 2012-12-21 14:41 UTC (History)
9 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Ms2ger 2012-01-28 20:46:47 UTC
The URL spec [1] currently has

interface [Replaceable] URL {};

which I believe we found is required for compat. It seems we should spec such a thing.

[1] http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html#interface-url
Comment 1 Boris Zbarsky 2012-01-29 01:16:14 UTC
What does that even mean?  "Replaceable" is needed for accessor properties because otherwise assignment won't create an own property.  But doing this:

  URL = whatever

(with or without var) would work fine.  The only weird thing I can think of is if you want something like this:

    var URL;

to alert undefined.  Is that what the URL spec wants?  That runs right back into the whole "there is no way to express this in ES5 terms" issue we just had with named properties on Window.
Comment 2 Cameron McCormack 2012-01-29 23:13:16 UTC
Can you clarify what it's meant to mean?
Comment 3 Simon Pieters 2012-01-30 09:07:58 UTC
Maybe the URL spec should rename "URL" instead.
Comment 4 Ms2ger 2012-01-30 09:44:07 UTC
Boris, you fixed the bug at <https://bugzilla.mozilla.org/show_bug.cgi?id=617296>; maybe you could explain what you did? :)

(In reply to comment #3)
> Maybe the URL spec should rename "URL" instead.

With createObjectURL deployed, I'm afraid that's too late.
Comment 5 Boris Zbarsky 2012-01-30 16:48:07 UTC
> maybe you could explain what you did? :)

Sure.  As implemented right now in Gecko, there is no "URL" interface.  Instead there is a MozURLProperty interface defined as follows:

  interface MozURLProperty
    DOMString createObjectURL(Blob blob);
    void revokeObjectURL(DOMString URL);

and a property on the Window interface defined as follows:

  readonly attribute MozURLProperty URL;

The bug you linked to made this readonly property replaceable.  That's a perfectly sensible concept and all.

If we were to introduce a URL interface (which would presumably have static methods on it for createObjectURL/revokeObjectURL?) instead of having a property on the window, then we'd just remove the above readonly property and the replaceability code for it, and the site that bug was about would Just Work (well, it'd nuke window.URL with its own stuff, but work within that constraint).
Comment 6 Ms2ger 2012-01-30 17:40:32 UTC
Alright, over to URL, then.
Comment 7 Anne 2012-05-12 09:37:37 UTC
So this bug is just about removing [Replaceable] at this point, right?
Comment 8 Ms2ger 2012-05-12 09:41:07 UTC
It appears so.