Open
Bug 1746935
Opened 4 years ago
Add tests to ensure that listeners keep alive MIDI port & access objects
Categories
(Core :: DOM: Device Interfaces, task)
Core
DOM: Device Interfaces
Tracking
()
NEW
People
(Reporter: gsvelto, Unassigned)
References
Details
It should be possible to test this like so (using a browser mochitest):
- Browse to a page that creates the objects
- Request access and accept the permission prompt
- Get the test input and output ports (specifically
MIDITestUtils.inputInfo
andMIDITestUtils.outputInfo
) - Set
statechange
listeners on all the objects - Register all the objects using the FinalizationRegistry. For each object we'll have a callback that checks a global flag. If the flag is true then the object should have been collected and the test passes, if it's false then the test fails.
- Set the aforementioned global flag to false
- Force a GC with
SpecialPowers.exactGC()
- Without the change in bug 1745443 this would cause the callbacks set in step 5 to fail
- Now set the global flag to true
- Browse away from the page (and maybe call
SpecialPowers.exactGC()
again) - The objects should now be collected, the callback in the
FinalizationRegistry
will all be called and the test should finish
You need to log in
before you can comment on or make changes to this bug.
Description
•