2023-11-10 00:21:15 +08:00
|
|
|
// Flags: --experimental-shadow-realm --max-old-space-size=20
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Verifying modules imported by ShadowRealm instances can be correctly
|
|
|
|
* garbage collected.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const common = require('../common');
|
|
|
|
const fixtures = require('../common/fixtures');
|
2023-11-14 23:42:36 +01:00
|
|
|
const { runAndBreathe } = require('../common/gc');
|
2023-11-10 00:21:15 +08:00
|
|
|
|
2023-11-14 23:42:36 +01:00
|
|
|
const mod = fixtures.fileURL('es-module-shadow-realm', 'state-counter.mjs');
|
2023-11-10 00:21:15 +08:00
|
|
|
|
2023-11-14 23:42:36 +01:00
|
|
|
runAndBreathe(async () => {
|
|
|
|
const realm = new ShadowRealm();
|
|
|
|
await realm.importValue(mod, 'getCounter');
|
|
|
|
}, 100).then(common.mustCall());
|