Bug 229303

Summary: Setting window.location.href to an invalid URL should throw a TypeError
Product: WebKit Reporter: Alex Christensen <achristensen>
Component: New BugsAssignee: Alex Christensen <achristensen>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=229447
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

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>