Navigating to a javascript URL does not override the document's URL

RESOLVED DUPLICATE of bug 836567

Status

()

P2
normal
RESOLVED DUPLICATE of bug 836567
3 years ago
2 years ago

People

(Reporter: dominicc, Assigned: jdai)

Tracking

47 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0
Build ID: 20160606114208

Steps to reproduce:

1. Open the following URL:
   data:text/html,<a href="javascript:`<button onclick='alert(document.location)'>X`">W
2. Click on W
3. Click on X


Actual results:

There's an alert containing javascript:...


Expected results:

The URL in the alert dialog should start with data:text/html,...

The document's URL should have been overridden and match the original URL; see step 14.10 of <https://html.spec.whatwg.org/multipage/browsers.html#navigate>

A user reported a difference in Firefox and Chrome navigation behavior with javascript URLs in <https://crbug.com/398761>. I think this may be related to that.

Updated

3 years ago

Updated

3 years ago
Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
Hi John, could you please take a look? Thanks!
Flags: needinfo?(jdai)
(Assignee)

Updated

3 years ago
Assignee: nobody → jdai
Flags: needinfo?(jdai)
Hmm, the spec is surprising here. I filed https://github.com/whatwg/html/issues/1565
Would be good to test what Edge and Safari do here.
(Edge may not run data:urls from location bar so would need to modify the test a bit)
(Assignee)

Comment 4

3 years ago
I was following reporter's link [1],
OS  : Mac OS X
Url : http://weather.edition.cnn.com/weather/intl/forecast.jsp?celcius=true&locCode=UKXX0085&zipCode=336736767676
Reproduce step: Click Celsius sign (C) on the page.

Edge 11 and Safari 9.1.1 (11601.6.17) are working fine.

[1] https://crbug.com/398761
Well, that chromium bug is old, so sure the page has changed.
But how do other browsers deal with javascript: urls?
Flags: needinfo?(jdai)
(Assignee)

Comment 6

3 years ago
Created attachment 8772324 [details]
test.html

OS  : Mac OS X and Windows 10
File: As attachment
Reproduce step: 
1. Open test.html
2. Click on W
3. Click on X
Result:
Firefox 47: 
There's an alert containing javascript:...
Edge 11: 
The URL in the alert dialog which has file://.../test.html
Chrome 51.0.2704.106: 
The URL in the alert dialog which has file://.../test.html
Safari 9.1.1 (11601.6.17):
Can’t get response after click on a link W.
Flags: needinfo?(jdai)
thanks. Ok sounds like we should then follow the current spec.
Just not yet clear to me how.
If you have a different opinion, please feel free to modify the priority, John and Olli.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P2
I believe this is duplicate to bug 836567. Feel free to reopen it if you have concern.
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 836567
You need to log in before you can comment on or make changes to this bug.