Skip to content

Commit 5738796

Browse files
committed
Update sandbox test
1 parent dafdca8 commit 5738796

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

packages/snaps-controllers/src/services/iframe/IframeExecutionService.test.browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ describe('IframeExecutionService', () => {
164164
document.body.appendChild(testFrame);
165165

166166
expect(await message).toContain(
167-
'Failed to access document of the snap iframe: SecurityError',
167+
'Failed to access document of the snap iframe.',
168168
);
169169
});
170170

packages/snaps-controllers/src/services/iframe/test/index.html

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,12 @@
1919

2020
// We try to access the snap iframe document. If this works, it means
2121
// that the iframe is not sandboxed. Otherwise it will throw an error.
22-
snap.document;
23-
24-
window.parent.postMessage(
25-
'Same origin frames access worked which might suggest sandboxing failed.',
26-
'*',
27-
);
22+
if (snap.document === null || snap.document === undefined) {
23+
window.parent.postMessage('Failed to access document of the snap iframe.', '*');
24+
}
2825
} catch (e) {
2926
window.parent.postMessage(
30-
`Failed to access document of the snap iframe: ${e.toString()}`,
27+
`An unknown error occurred: ${e.toString()}`,
3128
'*',
3229
);
3330
}

0 commit comments

Comments
 (0)