3 <script src=
"../resources/js-test.js"></script>
4 <script src=
"resources/netinfo_common.js"></script>
9 description("Tests that it's okay to unregister the event listener while handling the event.");
11 shouldBe('typeof window.internals.observeGC', '"function"',
12 'this test requires window.internals');
14 var otherHandler = function(e
) {
15 shouldBe('connection.type', 'initialType');
16 shouldBe('connection.downlinkMax', 'initialDownlinkMax');
21 var handler = function(e
) {
22 shouldBe('connection.type', 'newConnectionType');
23 shouldBe('connection.downlinkMax', 'newDownlinkMax');
24 connection
.removeEventListener('change', handler
);
25 connection
.addEventListener('change', otherHandler
);
26 internals
.setNetworkConnectionInfo(initialType
, initialDownlinkMax
);
29 connection
.addEventListener('change', handler
);
30 internals
.setNetworkConnectionInfo(newConnectionType
, newDownlinkMax
);