summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/websockets/interfaces/WebSocket/constants/003.html
blob: 4a86af8b1c1b473cbd7eb452c1a2ea452d7ac1c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!doctype html>
<title>WebSockets: deleting constants</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=../../../constants.sub.js></script>
<meta name="variant" content="?default">
<meta name="variant" content="?wss">
<div id=log></div>
<script>
var constants = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];
for (var i = 0; i < constants.length; ++i) {
  test(function(){
    var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/');
    delete WebSocket[constants[i]]; // should be ignored, has { DontDelete }
    delete WebSocket.prototype[constants[i]]; // should be ignored, has { DontDelete }
    delete ws[constants[i]]; // should be ignored, there is no such property on the object
    assert_equals(WebSocket[constants[i]], i, 'WebSocket.'+constants[i]);
    assert_equals(WebSocket.prototype[constants[i]], i, 'WebSocket.prototype.'+constants[i]);
    assert_equals(ws[constants[i]], i, 'ws.'+constants[i]);
  })
};
</script>