summaryrefslogtreecommitdiff
path: root/ext/webidl/00_webidl.js
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@gmail.com>2021-09-29 18:06:29 +0200
committerGitHub <noreply@github.com>2021-09-29 18:06:29 +0200
commitc896ba2e1949047ce9a46f1aca27f30632911eb4 (patch)
tree6d2f2b9db2017f5cd4e8c370f58b6f46c154ff02 /ext/webidl/00_webidl.js
parentcd913e51ef2a63f8cc55710373d7874ffd3853bb (diff)
perf(webidl/DOMString): don't wrap string primitives (#12266)
Diffstat (limited to 'ext/webidl/00_webidl.js')
-rw-r--r--ext/webidl/00_webidl.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/webidl/00_webidl.js b/ext/webidl/00_webidl.js
index 88384406a..d5bad4f15 100644
--- a/ext/webidl/00_webidl.js
+++ b/ext/webidl/00_webidl.js
@@ -359,11 +359,11 @@
};
converters.DOMString = function (V, opts = {}) {
- if (opts.treatNullAsEmptyString && V === null) {
+ if (typeof V === "string") {
+ return V;
+ } else if (V === null && opts.treatNullAsEmptyString) {
return "";
- }
-
- if (typeof V === "symbol") {
+ } else if (typeof V === "symbol") {
throw makeException(
TypeError,
"is a symbol, which cannot be converted to a string",