| Index: LayoutTests/netinfo/unregister-during-event.html
|
| diff --git a/LayoutTests/netinfo/unregister-during-event.html b/LayoutTests/netinfo/unregister-during-event.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..50e0c61fcd3303129c94ab3edfaf61efb00917e5
|
| --- /dev/null
|
| +++ b/LayoutTests/netinfo/unregister-during-event.html
|
| @@ -0,0 +1,30 @@
|
| +<html>
|
| +<head>
|
| +<script src="../resources/js-test.js"></script>
|
| +<script src="resources/netinfo_common.js"></script>
|
| +</head>
|
| +<body>
|
| +<script>
|
| +
|
| +description("Tests that it's okay to unregister the event listener while handling the event.");
|
| +
|
| +var otherHandler = function(e) {
|
| + if (connection.type != initialType)
|
| + testFailed("The connection type did not revert.");
|
| + finishJSTest();
|
| +};
|
| +
|
| +var handler = function(e) {
|
| + if (connection.type != newConnectionType)
|
| + testFailed("The connection type did not change.");
|
| + connection.removeEventListener('typechange', handler);
|
| + connection.addEventListener('typechange', otherHandler);
|
| + internals.setNetworkConnectionInfo(initialType);
|
| +};
|
| +
|
| +connection.addEventListener('typechange', handler);
|
| +internals.setNetworkConnectionInfo(newConnectionType);
|
| +
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|