Bug 153121

Summary: window.location.replace with invalid URL should throw
Product: WebKit Reporter: Adrian <kileras>
Component: HistoryAssignee: Rob Buis <rbuis>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, clopez, darin, esprehn+autocc, ews-watchlist, kondapallykalyan, rbuis, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Safari 9   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Description Adrian 2016-01-15 04:15:35 PST
Steps to reproduce
Go to any site
Open the console
Type window.location.replace('//')

What should happen?
As per spec https://www.w3.org/TR/html5/browsers.html#dom-location-replace it should throw an exception

What actually happen?
It shows a error html page saying "Safari can't open the page "https:whatever/" because the page's address is invalid" and doesn't throw at all.
Comment 1 Rob Buis 2020-06-28 08:29:01 PDT
Created attachment 402997 [details]
Patch
Comment 2 EWS Watchlist 2020-06-28 08:29:40 PDT
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 3 Rob Buis 2020-06-28 08:40:15 PDT
Created attachment 402998 [details]
Patch
Comment 4 Rob Buis 2020-06-28 11:03:31 PDT
Created attachment 403002 [details]
Patch
Comment 5 Rob Buis 2020-06-28 11:04:03 PDT
WPT test is exported as https://github.com/web-platform-tests/wpt/pull/24374.
Comment 6 Darin Adler 2020-06-28 13:11:19 PDT
Comment on attachment 403002 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=403002&action=review

> Source/WebCore/page/Location.cpp:232
> +    if (completedURL.isNull() || !completedURL.isValid())

I wonder if null URLs can ever be valid. If not, then the isNull check is not needed.
Comment 7 Rob Buis 2020-06-28 23:59:04 PDT
Created attachment 403032 [details]
Patch
Comment 8 EWS 2020-06-29 01:04:15 PDT
Committed r263647: <https://trac.webkit.org/changeset/263647>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 403032 [details].
Comment 9 Radar WebKit Bug Importer 2020-06-29 01:05:19 PDT
<rdar://problem/64879675>