test_sequence_wrapping.html (1701B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=775852 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 775852</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=775852">Mozilla Bug 775852</a> 14 <p id="display"></p> 15 <iframe id="content" style="display: none"> 16 </iframe> 17 <pre id="test"> 18 <script type="application/javascript"> 19 20 /** Test for Bug 775852 */ 21 function doTest() { 22 let win = document.getElementById("content").contentWindow; 23 let doc = win.document; 24 doc.body.innerHTML = `<canvas width="1" height="1" id="c"></canvas>`; 25 26 let gl = doc.getElementById("c").getContext("experimental-webgl"); 27 if (!gl) { 28 // No WebGL support on MacOS 10.5. Just skip this test 29 todo(false, "WebGL not supported"); 30 return; 31 } 32 var setterCalled = false; 33 34 var extLength = gl.getSupportedExtensions().length; 35 ok(extLength > 0, 36 "This test won't work right if we have no supported extensions"); 37 38 win.Object.defineProperty(win.Array.prototype, "0", 39 { 40 set() { 41 setterCalled = true; 42 }, 43 }); 44 45 // Test that our property got defined correctly 46 let arr = new win.Array(); 47 arr[0] = 5; 48 is(setterCalled, true, "Setter should be called when setting prop on array"); 49 50 setterCalled = false; 51 52 is(gl.getSupportedExtensions().length, extLength, 53 "We should still have the same number of extensions"); 54 55 is(setterCalled, false, 56 "Setter should not be called when getting supported extensions"); 57 } 58 doTest(); 59 </script> 60 </pre> 61 </body> 62 </html>