location.href throws error

RESOLVED INVALID

Status

()

--
major
RESOLVED INVALID
9 years ago
a year ago

People

(Reporter: bugzilla33, Unassigned)

Tracking

({html5})

1.9.2 Branch
x86
Windows 7
html5
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [urispec], URL)

Attachments

(1 attachment)

676 bytes, text/html
Details
(Reporter)

Description

9 years ago
User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; FDM)
Build Identifier: 


location.href throws error when use not registered protocol

Reproducible: Always

Steps to Reproduce:

run attachement

Actual Results:  

throws error


Expected Results:  

no error



other browsers do not throw errors
(Reporter)

Updated

9 years ago
Component: General → DOM
Product: Firefox → Core
(Reporter)

Updated

9 years ago
Version: unspecified → 1.9.2 Branch
(Reporter)

Comment 1

9 years ago
Created attachment 415815 [details]
testcase
(Reporter)

Updated

9 years ago
Duplicate of this bug: 531240
(Reporter)

Updated

9 years ago
Summary: location.href throw error → location.href throws error
(Reporter)

Comment 3

9 years ago
Link in raw HTML do not throw errors.
<a href="custom://link">custom://link</a>

Only JS location.href
<span onclick="location.href='custom://link'">custom://link</span>
QA Contact: general → general
There's no way to throw an exception from the <a href>, since that's not in script.

You presumably want the browser to silently do nothing instead.  It's not clear to me why this would be better than telling the calling script that the load is flatly not possible, but in any case it needs spec work.
Keywords: html5
The spec [1] requires raising a SYNTAX_ERR if resolving the URL is unsuccessful. However, thanks to the URI people, the resolving algorithm is useless ATM.

[1] <http://www.whatwg.org/html/#dom-location-href>
Whiteboard: [urispec]

Comment 6

5 years ago
So setting href invokes http://url.spec.whatwg.org/#dom-url-href which invokes stuff from http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#location which throws an exception. I guess the question is whether that should be caught or not.

Comment 7

a year ago
This is per the standard.
Status: UNCONFIRMED → RESOLVED
Last Resolved: a year ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.