chore: remove test usages of createIDWeakMap (#24116)
This commit is contained in:
parent
8412aae231
commit
c0182bca15
4 changed files with 8 additions and 11 deletions
|
@ -71,15 +71,15 @@ describe('BrowserWindow module', () => {
|
|||
it('window does not get garbage collected when opened', (done) => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
// Keep a weak reference to the window.
|
||||
const map = v8Util.createIDWeakMap<Electron.BrowserWindow>();
|
||||
map.set(0, w);
|
||||
// eslint-disable-next-line no-undef
|
||||
const wr = new (globalThis as any).WeakRef(w);
|
||||
setTimeout(() => {
|
||||
// Do garbage collection, since |w| is not referenced in this closure
|
||||
// it would be gone after next call if there is no other reference.
|
||||
v8Util.requestGarbageCollectionForTesting();
|
||||
|
||||
setTimeout(() => {
|
||||
expect(map.has(0)).to.equal(true);
|
||||
expect(wr.deref()).to.not.be.undefined();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue