Bug 250618 - window.atob() returns wrong value when given a string container only white spaces
Summary: window.atob() returns wrong value when given a string container only white sp...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-14 04:55 PST by Ahmad Saleem
Modified: 2023-01-19 21:18 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmad Saleem 2023-01-14 04:55:21 PST
Hi Team,

While going through Blink's commit, I came across another failing test:

Blink Commit - https://chromium.googlesource.com/chromium/blink/+/4a9564e53be4b85ac10a463b3dac03f59b7cba18

WebKit Source - https://searchfox.org/wubkat/source/Source/WTF/wtf/text/Base64.cpp#192

Just wanted to raise so if needed, we can fix it. Will tag others to get input.

Thanks!
Comment 1 Ahmad Saleem 2023-01-19 05:32:54 PST
Test - https://jsfiddle.net/2q73Lwf4/show

Failing (in STP161 & Firefox Nightly 111):

FAIL window.btoa() should throw TypeError: Failed to execute 'btoa' on 'Window': 1 argument required, but only 0 present.. Threw exception TypeError: Not enough arguments.

FAIL window.atob() should throw TypeError: Failed to execute 'atob' on 'Window': 1 argument required, but only 0 present.. Threw exception TypeError: Not enough arguments.

______

Chrome Canary 111 passes all.
Comment 2 Karl Dubost 2023-01-19 21:18:02 PST
All the tests pass in https://wpt.fyi/results/html/webappapis/atob/base64.any.html?label=experimental&label=master&aligned

The Fiddle test is wrong. It is trying to test the full error message.
https://jsfiddle.net/2q73Lwf4/show


Safari TP 161
typeerror: Not enough arguments

Firefox Nightly 110
Uncaught TypeError: Window.atob: At least 1 argument required, but only 0 passed

Chrome Canary 111
Uncaught TypeError: Failed to execute 'atob' on 'Window': 1 argument required, but only 0 present.


They all throw with TypeError with window.atob()

and they all return the empty string '' for window.atob("            ")