Bug 229303 - Setting window.location.href to an invalid URL should throw a TypeError
Summary: Setting window.location.href to an invalid URL should throw a TypeError
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-08-19 12:49 PDT by Alex Christensen
Modified: 2021-08-24 10:53 PDT (History)
2 users (show)

See Also:


Attachments
Patch (36.46 KB, patch)
2021-08-19 12:50 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (41.90 KB, patch)
2021-08-21 09:40 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (46.06 KB, patch)
2021-08-23 12:20 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (47.37 KB, patch)
2021-08-23 14:10 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2021-08-19 12:49:14 PDT
Setting window.location.href to an invalid URL should throw a TypeError
Comment 1 Alex Christensen 2021-08-19 12:50:01 PDT
Created attachment 435895 [details]
Patch
Comment 2 Alex Christensen 2021-08-21 09:40:13 PDT
Created attachment 436075 [details]
Patch
Comment 3 Chris Dumez 2021-08-23 07:43:18 PDT
red bubbles.
Comment 4 Alex Christensen 2021-08-23 12:20:32 PDT
Created attachment 436223 [details]
Patch
Comment 5 Chris Dumez 2021-08-23 13:18:17 PDT
Comment on attachment 436223 [details]
Patch

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

> Source/WebCore/ChangeLog:8
> +        This matches Firefox and the specification

Looks like Chrome does throw an exception, right? Just not the right exception type?

If so, the compatibility risk does seem low.

> Source/WebCore/page/Location.cpp:281
> +        return Exception { TypeError, "Invalid URL" };

nit: "Invalid URL"_s
Comment 6 Alex Christensen 2021-08-23 14:10:12 PDT
Created attachment 436235 [details]
Patch
Comment 7 Alex Christensen 2021-08-23 14:10:41 PDT
(In reply to Chris Dumez from comment #5)
> > Source/WebCore/ChangeLog:8
> > +        This matches Firefox and the specification
> 
> Looks like Chrome does throw an exception, right? Just not the right
> exception type?
Correct.  I added this to the ChangeLog.
Comment 8 EWS 2021-08-23 14:39:45 PDT
Committed r281472 (240851@main): <https://commits.webkit.org/240851@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 436235 [details].
Comment 9 Radar WebKit Bug Importer 2021-08-23 14:42:32 PDT
<rdar://problem/82262275>