Open Bug 1627511 Opened 5 years ago Updated 2 years ago

"String contains an invalid character" even though all characters are valid

Categories

(Core :: DOM: Core & HTML, enhancement)

74 Branch
enhancement

Tracking

()

Tracking Status
firefox75 --- affected
firefox76 --- affected
firefox77 --- affected

People

(Reporter: florine, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0

Steps to reproduce:

Run atob("+") in the console.

Actual results:

I receive the error "InvalidCharacterError: String contains an invalid character". This is confusing because all characters in the string are valid base 64.

Expected results:

I should receive an error saying that the string is incorrectly encoded.

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0

Hi,

I have manage to reproduced this using the Release version 75 and latest Nightly build 77.0a1.
In Chrome following the same steps the error received is:
"Uncaught DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded."

I will move this over to a component so developers can take a look over it. If this is not the correct component please feel free to change it to an appropriate one.

Thanks for the suggestion.

Status: UNCONFIRMED → NEW
Component: Untriaged → JavaScript Engine
Ever confirmed: true
Product: Firefox → Core

Moving to "DOM: Core & HTML", because atob is an HTML function.

Component: JavaScript Engine → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.