Skip to content

Commit 8b8c31f

Browse files
authored
feat: add btoa and atob native implementations (#227)
atob and btoa are global base64 utility methods which are useful to have included in the runtime as projects such as PlnaetScale's Serverless Driver for JavaScript make use of these methods and a native implementation should be more performant than a JavaScript implementation (a polyfill) Note: I haven't figured out how to raise an exception with a custom error class, which is required for full adherence with the specification (and to make all the web-platform-tests pass) as the function should throw InvalidCharacterError instances but we throw Error instances instead. html.spec.whatwg.org/multipage/webappapis.html#atob
1 parent a621d26 commit 8b8c31f

File tree

9 files changed

+2509
-2
lines changed

9 files changed

+2509
-2
lines changed

c-dependencies/js-compute-runtime/error-numbers.msg

+1
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,5 @@ MSG_DEF(JSMSG_OBJECT_STORE_KEY_RELATIVE, 0, JSEXN_TYPEERR,
5757
MSG_DEF(JSMSG_OBJECT_STORE_PUT_CONTENT_STREAM, 0, JSEXN_TYPEERR, "Content-provided streams are not yet supported for streaming into ObjectStore")
5858
MSG_DEF(JSMSG_OBJECT_STORE_PUT_OVER_30_MB, 0, JSEXN_TYPEERR, "ObjectStore value can not be more than 30 Megabytes in size")
5959
MSG_DEF(JSMSG_READABLE_STREAM_LOCKED_OR_DISTRUBED, 0, JSEXN_TYPEERR, "Can't use a ReadableStream that's locked or has ever been read from or canceled")
60+
MSG_DEF(JSMSG_INVALID_CHARACTER_ERROR, 0, JSEXN_ERR, "String contains an invalid character")
6061
//clang-format on

0 commit comments

Comments
 (0)