summaryrefslogtreecommitdiff
path: root/ext/net/01_net.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-01-27 13:36:36 +0100
committerGitHub <noreply@github.com>2022-01-27 13:36:36 +0100
commit884143218fad0e18f7553aaf079d52de703f7601 (patch)
tree9b9e9d30ea647041438ef8fa974b8d4234cabf73 /ext/net/01_net.js
parentdcf8f144ab0516936bfa4e93357d71f1732d880e (diff)
refactor: update runtime code for primordial checks for "instanceof" (#13497)
Diffstat (limited to 'ext/net/01_net.js')
-rw-r--r--ext/net/01_net.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/ext/net/01_net.js b/ext/net/01_net.js
index 4a4005954..145a89b4f 100644
--- a/ext/net/01_net.js
+++ b/ext/net/01_net.js
@@ -3,8 +3,9 @@
((window) => {
const core = window.Deno.core;
- const { BadResource, Interrupted } = core;
+ const { BadResourcePrototype, InterruptedPrototype } = core;
const {
+ ObjectPrototypeIsPrototypeOf,
PromiseResolve,
SymbolAsyncIterator,
Uint8Array,
@@ -124,7 +125,10 @@
try {
conn = await this.accept();
} catch (error) {
- if (error instanceof BadResource || error instanceof Interrupted) {
+ if (
+ ObjectPrototypeIsPrototypeOf(BadResourcePrototype, error) ||
+ ObjectPrototypeIsPrototypeOf(InterruptedPrototype, error)
+ ) {
return { value: undefined, done: true };
}
throw error;
@@ -191,7 +195,10 @@
try {
yield await this.receive();
} catch (err) {
- if (err instanceof BadResource || err instanceof Interrupted) {
+ if (
+ ObjectPrototypeIsPrototypeOf(BadResourcePrototype, err) ||
+ ObjectPrototypeIsPrototypeOf(InterruptedPrototype, err)
+ ) {
break;
}
throw err;