tor-browser

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

DOMMatrix-css-string.worker.js (1367B)


      1 // https://drafts.fxtf.org/geometry/#DOMMatrix
      2 
      3 importScripts("/resources/testharness.js");
      4 
      5 ['DOMMatrix', 'DOMMatrixReadOnly'].forEach(constr => {
      6  test(() => {
      7    assert_true(constr in self, `${constr} should exist`);
      8    assert_throws_js(TypeError, () => new self[constr]('matrix(1,0,0,1,0,0)') );
      9  }, `${constr} constructor with string argument in worker`);
     10 
     11  test(() => {
     12    assert_true(constr in self, `${constr} should exist`);
     13    assert_throws_js(TypeError, () => new self[constr]('') );
     14  }, `${constr} constructor with empty string argument in worker`);
     15 
     16  test(() => {
     17    const matrix = new self[constr]();
     18    assert_equals(String(matrix), `[object ${constr}]`);
     19  }, `${constr} stringifier in worker (2d identity)`);
     20 
     21  test(() => {
     22    const matrix = self[constr].fromMatrix({is2D: false});
     23    assert_equals(String(matrix), `[object ${constr}]`);
     24  }, `${constr} stringifier in worker (3d identity)`);
     25 
     26  test(() => {
     27    const matrix = new self[constr]([1, 0, 0, NaN, Infinity, -Infinity]);
     28    assert_equals(String(matrix), `[object ${constr}]`);
     29  }, `${constr} stringifier in worker (non-finite values)`);
     30 });
     31 
     32 test(() => {
     33  assert_false('setMatrixValue' in DOMMatrix.prototype, 'on prototype');
     34  const matrix = new DOMMatrix();
     35  assert_false('setMatrixValue' in matrix, 'on instance');
     36 }, 'DOMMatrix setMatrixValue in worker');
     37 
     38 done();