dom/bindings/test/test_sequence_wrapping.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/bindings/test/test_sequence_wrapping.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,59 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=775852
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="utf-8">
    1.11 +  <title>Test for Bug 775852</title>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=775852">Mozilla Bug 775852</a>
    1.17 +<p id="display"></p>
    1.18 +<div id="content" style="display: none">
    1.19 +  <canvas width="1" height="1" id="c"></canvas>
    1.20 +</div>
    1.21 +<pre id="test">
    1.22 +<script type="application/javascript">
    1.23 +
    1.24 +/** Test for Bug 775852 **/
    1.25 +function doTest() {
    1.26 +  var gl = $("c").getContext("experimental-webgl");
    1.27 +  if (!gl) {
    1.28 +    // No WebGL support on MacOS 10.5.  Just skip this test
    1.29 +    todo(false, "WebGL not supported");
    1.30 +    return;
    1.31 +  }
    1.32 +  var setterCalled = false;
    1.33 +
    1.34 +  extLength = gl.getSupportedExtensions().length;
    1.35 +  ok(extLength > 0,
    1.36 +     "This test won't work right if we have no supported extensions");
    1.37 +
    1.38 +  Object.defineProperty(Array.prototype, "0",
    1.39 +    {
    1.40 +      set: function(val) {
    1.41 +             setterCalled = true;
    1.42 +           }
    1.43 +    });
    1.44 +
    1.45 +  // Test that our property got defined correctly
    1.46 +  var arr = []
    1.47 +  arr[0] = 5;
    1.48 +  is(setterCalled, true, "Setter should be called when setting prop on array");
    1.49 +
    1.50 +  setterCalled = false;
    1.51 +
    1.52 +  is(gl.getSupportedExtensions().length, extLength,
    1.53 +     "We should still have the same number of extensions");
    1.54 +
    1.55 +  is(setterCalled, false,
    1.56 +     "Setter should not be called when getting supported extensions");
    1.57 +}
    1.58 +doTest();
    1.59 +</script>
    1.60 +</pre>
    1.61 +</body>
    1.62 +</html>

mercurial