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

NEW
Unassigned

Status

()

Core
DOM
6 years ago
8 months ago

People

(Reporter: Ian Chan, Unassigned)

Tracking

(Depends on: 1 bug)

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
Created attachment 596786 [details]
Screen shot 2012-02-13 at 2.06.20 PM.png

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]
(Reporter)

Comment 1

6 years ago
I noticed this only started happening as of Feb 10, 2012, perhaps related to the 10.1 release, but it could be unrelated.
(Reporter)

Comment 2

6 years ago
*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

Comment 7

11 months ago
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

Updated

10 months ago
See Also: → bug 1328894
Going to get fixed in bug 1328894.l
Depends on: 1328894
You need to log in before you can comment on or make changes to this bug.