Skip to content

Commit d2a506a

Browse files
Address PR comments
1 parent 45f43fd commit d2a506a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/snaps-execution-environments/src/common/endowments/endowments.test.browser.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,8 @@ describe('endowments', () => {
227227
new ResponseWrapper(
228228
new Response(),
229229
{ lastTeardown: 0 },
230-
// eslint-disable-next-line @typescript-eslint/no-empty-function
231-
async () => {},
232-
// eslint-disable-next-line @typescript-eslint/no-empty-function
233-
async () => {},
230+
async () => undefined,
231+
async () => undefined,
234232
),
235233
},
236234
};

packages/snaps-execution-environments/src/common/endowments/network.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,11 @@ export class ResponseWrapper implements Response {
145145
}
146146
}
147147

148+
// We redefine the global Response class to overwrite [Symbol.hasInstance].
149+
// This fixes problems where the response from `fetch` would not pass
150+
// instance of checks, leading to failures in WASM bindgen.
148151
class AlteredResponse extends Response {
149-
static [Symbol.hasInstance](instance: any) {
152+
static [Symbol.hasInstance](instance: unknown) {
150153
return instance instanceof Response || instance instanceof ResponseWrapper;
151154
}
152155
}

0 commit comments

Comments
 (0)