tor-browser

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

non-parsable-url-getter-setter.window.js (1107B)


      1 [
      2  {
      3    "property": "origin",
      4    "set": null
      5  },
      6  {
      7    "property": "protocol",
      8    "get": ":",
      9    "set": "https"
     10  },
     11  {
     12    "property": "username"
     13  },
     14  {
     15    "property": "password"
     16  },
     17  {
     18    "property": "host"
     19  },
     20  {
     21    "property": "hostname"
     22  },
     23  {
     24    "property": "port",
     25    "set": "8000"
     26  },
     27  {
     28    "property": "pathname"
     29  },
     30  {
     31    "property": "search"
     32  },
     33  {
     34    "property": "hash"
     35  }
     36 ].forEach(({ property, get = "", set = "string" }) => {
     37  ["a", "area"].forEach(name => {
     38    test(() => {
     39      const link = document.createElement(name);
     40      link.href = "http://test:test/"; // non-parsable URL
     41      assert_equals(link[property], get);
     42    }, `<${name} href="http://test:test/">.${property} getter`);
     43 
     44    if (set !== null) {
     45      test(() => {
     46        const link = document.createElement(name);
     47        link.href = "http://test:test/"; // non-parsable URL
     48        link[property] = set;
     49        assert_equals(link[property], get);
     50        assert_equals(link.href, "http://test:test/");
     51      }, `<${name} href="http://test:test/">.${property} setter`);
     52    }
     53  });
     54 });