tor-browser

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

parsing-scope-keys.json (5028B)


      1 {
      2  "importMapBaseURL": "https://base.example/path1/path2/path3",
      3  "tests": {
      4    "Relative URL scope keys should work with no prefix": {
      5      "importMap": {
      6        "scopes": {
      7          "foo": {}
      8        }
      9      },
     10      "expectedParsedImportMap": {
     11        "imports": {},
     12        "scopes": {
     13          "https://base.example/path1/path2/foo": {}
     14        }
     15      }
     16    },
     17    "Relative URL scope keys should work with ./, ../, and / prefixes": {
     18      "importMap": {
     19        "scopes": {
     20          "./foo": {},
     21          "../foo": {},
     22          "/foo": {}
     23        }
     24      },
     25      "expectedParsedImportMap": {
     26        "imports": {},
     27        "scopes": {
     28          "https://base.example/path1/path2/foo": {},
     29          "https://base.example/path1/foo": {},
     30          "https://base.example/foo": {}
     31        }
     32      }
     33    },
     34    "Absolute URL scope keys should ignore relative URL scope keys when the base URL is a data: URL": {
     35      "importMap": {
     36        "scopes": {
     37          "./foo": {},
     38          "../foo": {},
     39          "/foo": {}
     40        }
     41      },
     42      "importMapBaseURL": "data:text/html,test",
     43      "expectedParsedImportMap": {
     44        "imports": {},
     45        "scopes": {}
     46      }
     47    },
     48    "Relative URL scope keys should work with ./, ../, or / with no suffix": {
     49      "importMap": {
     50        "scopes": {
     51          "./": {},
     52          "../": {},
     53          "/": {}
     54        }
     55      },
     56      "expectedParsedImportMap": {
     57        "imports": {},
     58        "scopes": {
     59          "https://base.example/path1/path2/": {},
     60          "https://base.example/path1/": {},
     61          "https://base.example/": {}
     62        }
     63      }
     64    },
     65    "Relative URL scope keys should work with /s, ?s, and #s": {
     66      "importMap": {
     67        "scopes": {
     68          "foo/bar?baz#qux": {}
     69        }
     70      },
     71      "expectedParsedImportMap": {
     72        "imports": {},
     73        "scopes": {
     74          "https://base.example/path1/path2/foo/bar?baz#qux": {}
     75        }
     76      }
     77    },
     78    "Relative URL scope keys should work with an empty string scope key": {
     79      "importMap": {
     80        "scopes": {
     81          "": {}
     82        }
     83      },
     84      "expectedParsedImportMap": {
     85        "imports": {},
     86        "scopes": {
     87          "https://base.example/path1/path2/path3": {}
     88        }
     89      }
     90    },
     91    "Relative URL scope keys should work with / suffixes": {
     92      "importMap": {
     93        "scopes": {
     94          "foo/": {},
     95          "./foo/": {},
     96          "../foo/": {},
     97          "/foo/": {},
     98          "/foo//": {}
     99        }
    100      },
    101      "expectedParsedImportMap": {
    102        "imports": {},
    103        "scopes": {
    104          "https://base.example/path1/path2/foo/": {},
    105          "https://base.example/path1/foo/": {},
    106          "https://base.example/foo/": {},
    107          "https://base.example/foo//": {}
    108        }
    109      }
    110    },
    111    "Relative URL scope keys should deduplicate based on URL parsing rules": {
    112      "importMap": {
    113        "scopes": {
    114          "foo/\\": {
    115            "1": "./a"
    116          },
    117          "foo//": {
    118            "2": "./b"
    119          },
    120          "foo\\\\": {
    121            "3": "./c"
    122          }
    123        }
    124      },
    125      "expectedParsedImportMap": {
    126        "imports": {},
    127        "scopes": {
    128          "https://base.example/path1/path2/foo//": {
    129            "3": "https://base.example/path1/path2/c"
    130          }
    131        }
    132      }
    133    },
    134    "Absolute URL scope keys should accept all absolute URL scope keys, with or without fetch schemes": {
    135      "importMap": {
    136        "scopes": {
    137          "about:good": {},
    138          "blob:good": {},
    139          "data:good": {},
    140          "file:///good": {},
    141          "filesystem:http://example.com/good/": {},
    142          "http://good/": {},
    143          "https://good/": {},
    144          "ftp://good/": {},
    145          "import:bad": {},
    146          "mailto:bad": {},
    147          "javascript:bad": {},
    148          "wss:ba": {}
    149        }
    150      },
    151      "expectedParsedImportMap": {
    152        "imports": {},
    153        "scopes": {
    154          "about:good": {},
    155          "blob:good": {},
    156          "data:good": {},
    157          "file:///good": {},
    158          "filesystem:http://example.com/good/": {},
    159          "http://good/": {},
    160          "https://good/": {},
    161          "ftp://good/": {},
    162          "import:bad": {},
    163          "mailto:bad": {},
    164          "javascript:bad": {},
    165          "wss://ba/": {}
    166        }
    167      }
    168    },
    169    "Absolute URL scope keys should parse absolute URL scope keys, ignoring unparseable ones": {
    170      "importMap": {
    171        "scopes": {
    172          "https://example.com:demo": {},
    173          "http://[www.example.com]/": {},
    174          "https:example.org": {},
    175          "https://///example.com///": {},
    176          "https://example.net": {},
    177          "https://ex%41mple.com/foo/": {}
    178        }
    179      },
    180      "expectedParsedImportMap": {
    181        "imports": {},
    182        "scopes": {
    183          "https://base.example/path1/path2/example.org": {},
    184          "https://example.com///": {},
    185          "https://example.net/": {},
    186          "https://example.com/foo/": {}
    187        }
    188      }
    189    }
    190  }
    191 }