Skip to content

Commit ba25942

Browse files
fix: Add isSecureContext endowment
1 parent 0b19875 commit ba25942

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const commonEndowments: CommonEndowmentSpecification[] = [
4242
{ endowment: Int8Array, name: 'Int8Array' },
4343
{ endowment: Int16Array, name: 'Int16Array' },
4444
{ endowment: Int32Array, name: 'Int32Array' },
45+
{ endowment: globalThis.isSecureContext, name: 'isSecureContext' },
4546
{ endowment: Uint8Array, name: 'Uint8Array' },
4647
{ endowment: Uint8ClampedArray, name: 'Uint8ClampedArray' },
4748
{ endowment: Uint16Array, name: 'Uint16Array' },

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ describe('endowments', () => {
177177
factory: () => WebAssembly,
178178
},
179179

180+
// Properties
181+
isSecureContext: {
182+
endowments: { isSecureContext: globalThis.isSecureContext },
183+
factory: () => globalThis.isSecureContext,
184+
},
185+
180186
// Functions.
181187
atob: {
182188
endowments: { atob },
@@ -345,6 +351,10 @@ describe('endowments', () => {
345351
factory: expect.any(Function),
346352
names: ['Int32Array'],
347353
},
354+
{
355+
factory: expect.any(Function),
356+
names: ['isSecureContext'],
357+
},
348358
{
349359
factory: expect.any(Function),
350360
names: ['Uint8Array'],

packages/snaps-utils/src/default-endowments.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const DEFAULT_ENDOWMENTS: readonly string[] = Object.freeze([
2323
'Int16Array',
2424
'Uint16Array',
2525
'Int32Array',
26+
'isSecureContext',
2627
'Uint32Array',
2728
'Float32Array',
2829
'Float64Array',

0 commit comments

Comments
 (0)