tor-browser

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

DOMMatrix-a-f-alias.html (2048B)


      1 <!DOCTYPE html>
      2 <title>Geometry Interfaces: DOMMatrix and DOMMatrixReadOnly a-f alias attributes</title>
      3 <link rel="help" href="https://drafts.fxtf.org/geometry/#DOMMatrix">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script>
      7 function defineThrowingGetter(object, attribute) {
      8   Object.defineProperty(object, attribute, {
      9     get: () => assert_unreached(`getter for ${attribute}`)
     10   });
     11 }
     12 
     13 function defineThrowingSetter(object, attribute) {
     14   Object.defineProperty(object, attribute, {
     15     set: () => assert_unreached(`setter for ${attribute}`)
     16   });
     17 }
     18 
     19 ["DOMMatrix", "DOMMatrixReadOnly"].forEach((constr) => {
     20  [
     21    ["a", "m11"],
     22    ["b", "m12"],
     23    ["c", "m21"],
     24    ["d", "m22"],
     25    ["e", "m41"],
     26    ["f", "m42"],
     27  ].forEach(([aliasAttribute, mAttribute]) => {
     28     test(() => {
     29       const matrix = new self[constr]([0, 0, 0, 0, 0, 0]);
     30       defineThrowingGetter(matrix, mAttribute);
     31       assert_equals(matrix[aliasAttribute], 0);
     32     }, `${constr} getting ${aliasAttribute} with throwing getter for ${mAttribute}`);
     33 
     34     test(() => {
     35       const matrix = new self[constr]([0, 0, 0, 0, 0, 0]);
     36       defineThrowingGetter(matrix, aliasAttribute);
     37       assert_equals(matrix[mAttribute], 0);
     38     }, `${constr} getting ${mAttribute} with throwing getter for ${aliasAttribute}`);
     39 
     40     if (constr === "DOMMatrix") {
     41       test(() => {
     42         const matrix = new self[constr]([0, 0, 0, 0, 0, 0]);
     43         defineThrowingSetter(matrix, mAttribute);
     44         matrix[aliasAttribute] = 1;
     45         assert_equals(matrix[aliasAttribute], 1);
     46       }, `${constr} setting ${aliasAttribute} with throwing setter for ${mAttribute}`);
     47 
     48       test(() => {
     49         const matrix = new self[constr]([0, 0, 0, 0, 0, 0]);
     50         defineThrowingSetter(matrix, aliasAttribute);
     51         matrix[mAttribute] = 1;
     52         assert_equals(matrix[mAttribute], 1);
     53       }, `${constr} setting ${mAttribute} with throwing setter for ${aliasAttribute}`);
     54     }
     55   });
     56 });
     57 </script>