Skip to content

Commit

Permalink
fix: webidl.brandcheck non strict should throw
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak committed Feb 1, 2024
1 parent 0808a72 commit 678f0f4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/fetch/webidl.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ webidl.errors.invalidArgument = function (context) {

// https://webidl.spec.whatwg.org/#implements
webidl.brandCheck = function (V, I, opts = undefined) {
if (opts?.strict !== false && !(V instanceof I)) {
throw new TypeError('Illegal invocation')
if (opts?.strict !== false) {
if (!(V instanceof I)) {
throw new TypeError('Illegal invocation')
}
} else {
return V?.[Symbol.toStringTag] === I.prototype[Symbol.toStringTag]
if (V?.[Symbol.toStringTag] !== I.prototype[Symbol.toStringTag]) {
throw new TypeError('Illegal invocation')
}
}
}

Expand Down

0 comments on commit 678f0f4

Please sign in to comment.