Bug 153121 - window.location.replace with invalid URL should throw
Summary: window.location.replace with invalid URL should throw
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: History (show other bugs)
Version: Safari 9
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Rob Buis
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-01-15 04:15 PST by Adrian
Modified: 2020-06-29 01:05 PDT (History)
9 users (show)

See Also:


Attachments
Patch (6.56 KB, patch)
2020-06-28 08:29 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (6.57 KB, patch)
2020-06-28 08:40 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (6.61 KB, patch)
2020-06-28 11:03 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (6.56 KB, patch)
2020-06-28 23:59 PDT, Rob Buis
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>