tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

2d.canvas.context.invalid.args.worker.js (1316B)


      1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
      2 // OffscreenCanvas test in a worker:2d.canvas.context.invalid.args
      3 // Description:Calling getContext with invalid arguments.
      4 // Note:
      5 
      6 importScripts("/resources/testharness.js");
      7 importScripts("/html/canvas/resources/canvas-tests.js");
      8 
      9 var t = async_test("Calling getContext with invalid arguments.");
     10 var t_pass = t.done.bind(t);
     11 var t_fail = t.step_func(function(reason) {
     12    throw reason;
     13 });
     14 t.step(function() {
     15 
     16  var canvas = new OffscreenCanvas(100, 50);
     17  var ctx = canvas.getContext('2d');
     18 
     19  assert_throws_js(TypeError, function() { canvas.getContext(''); });
     20  assert_throws_js(TypeError, function() { canvas.getContext('This is not an implemented context in any real browser'); });
     21  assert_throws_js(TypeError, function() { canvas.getContext('2d#'); });
     22  assert_throws_js(TypeError, function() { canvas.getContext('2d\0'); });
     23  assert_throws_js(TypeError, function() { canvas.getContext('2\uFF44'); });
     24  assert_throws_js(TypeError, function() { canvas.getContext('2D'); });
     25  assert_throws_js(TypeError, function() { canvas.getContext(); });
     26  assert_throws_js(TypeError, function() { canvas.getContext('null'); });
     27  assert_throws_js(TypeError, function() { canvas.getContext('undefined'); });
     28  t.done();
     29 });
     30 done();