Closed Bug 726779 Opened 13 years ago Closed 6 years ago

document.location.protocol setter raising errors when protocol has a trailing ':'

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: chanian, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.11 Safari/535.19

Steps to reproduce:

Try changing the document protocol via:
document.location.protocol = 'https:';


Actual results:

The following error is raised:
Error: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIDOMLocation.protocol]


Expected results:

The page should redirect to the changed protocol [if a protocol change has occurred]
I noticed this only started happening as of Feb 10, 2012, perhaps related to the 10.1 release, but it could be unrelated.
*10.0.1 release

(In reply to Ian Chan from comment #1)
> I noticed this only started happening as of Feb 10, 2012, perhaps related to
> the 10.1 release, but it could be unrelated.
Component: Untriaged → DOM
Product: Firefox → Core
QA Contact: untriaged → general
I see the same behavior in at least Firefox 9, Firefox 4, and Firefox 3.6.  So this is certainly not related to 10.0.1 release.

Using "https" (note no trailing ':') works fine.  The part about stripping ':' if present is new-ish in the spec.  I guess we should do that.  Jonas, who was working on the URI decomposition stuff?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: document.location.protocol setter raising errors → document.location.protocol setter raising errors when protocol has a trailing ':'
I don't know that anyone is working on that right now
A script like

var anchor = document.createElement("a");
anchor.href = "http://www.mozilla.org/";
anchor.protocol = "https:fooooooooooo";
alert(anchor.href);

seems to work as expected. Probably |location.protocol| should use the same URI parser/filter, rather than implement a new one.

http://hg.mozilla.org/mozilla-central/annotate/93439ef24979/content/base/src/Link.cpp#l144
However, bug 668680 seems the actual blocker rather than bug 676049.
Depends on: 676049
OS: Mac OS X → All
Hardware: x86 → All
Version: 10 Branch → Trunk
Reproduced in FF Developer Edition 51.0a2, with `location.protocol = location.protocol`.

I sent a bug report to WHATWG HTML in order to get some statements clarified[1], confirming that the URI parser gets the blame.
  [1]: https://github.com/whatwg/html/issues/2118#issuecomment-263805414
See Also: → 1328894
Going to get fixed in bug 1328894.l
Depends on: 1328894
@Boris: did it get fixed? Does this bug need to remain open? If no, please resolve.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: