aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/URI.js/utils/sld.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-04-20 03:09:25 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-04-24 16:14:29 +0200
commit82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8 (patch)
tree965f6eb89b84d65a62b49008fd972c004832ccd1 /thirdparty/URI.js/utils/sld.js
parente6e0cbc387c2a77b48e4065c229daa65bf1aa0fa (diff)
Reorganize module loading.
We now use webpack instead of SystemJS, effectively bundling modules into one file (plus commons chunks) for every entry point. This results in a much smaller extension size (almost half). Furthermore we use yarn/npm even for extension run-time dependencies. This relieves us from manually vendoring and building dependencies. It's also easier to understand for new developers familiar with node.
Diffstat (limited to 'thirdparty/URI.js/utils/sld.js')
-rw-r--r--thirdparty/URI.js/utils/sld.js101
1 files changed, 0 insertions, 101 deletions
diff --git a/thirdparty/URI.js/utils/sld.js b/thirdparty/URI.js/utils/sld.js
deleted file mode 100644
index b0c95db06..000000000
--- a/thirdparty/URI.js/utils/sld.js
+++ /dev/null
@@ -1,101 +0,0 @@
-var fs = require('fs');
-var url = require('url');
-var http = require('http');
-var domains = {};
-
-/*
- Problem with PublicSuffix:
- The list not only contains TLDs/SLDs, but also domains like "dyndns.org".
- While this may be useful for Cookie-Origin-Policy, these domains are possibly
- being handled by URI.js, considering URI("//dyndns.org").tld("com").
- The list does not distinguish "official" TLDs from such domains.
- (At least I have problems with treating "cc.ga.us" as a SLD)
-*/
-
-http.get("http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1", function(res) {
- res.on('data', function(data) {
- data.toString().replace(/\r/g, "").split("\n").forEach(function(line) {
- // skip empty lines, comments and TLDs
- if (!line || (line[0] === "/" && line[1] === "/") || line.indexOf('.') === -1) {
- return;
- }
-
- var parts = line.split('.');
- var sld = parts.slice(0, -1).join('.');
- var tld = parts.slice(-1);
-
- if (parts.length < 2) {
- return;
- }
-
- if (!domains[tld]) {
- domains[tld] = [];
- }
-
- domains[tld].push(sld);
- });
- }).on('end', function() {
- //file.end();
- for (var tld in domains) {
- domains[tld].sort();
-
- // ! and * are sorted to the top
- if (domains[tld][0][0] == '!') {
- // we have wildcards and exclusions
- } else if (domains[tld][0][0] == '*') {
- // we have wildcards
- } else {
- // simple list
- }
- }
-
- console.log(JSON.stringify(domains, null, 2));
- //console.log(domains.jp);
- });
-});
-
-/*
-
-
-// https://github.com/oncletom/tld.js
-// generates a 430KB file, which is inacceptible for the web
-
-build a regex pattern from this -- http://publicsuffix.org/list/
-"!exclusion"
-"*" wildcard
-
-uk: [ '!bl',
- '!british-library',
- '!jet',
- '!mod',
- '!national-library-scotland',
- '!nel',
- '!nic',
- '!nls',
- '!parliament',
- '*',
- '*.nhs',
- '*.police',
- '*.sch',
- 'blogspot.co' ]
-
-jp: [ '!city.kawasaki',
- '!city.kitakyushu',
- '!city.kobe',
- '!city.nagoya',
- '!city.sapporo',
- '!city.sendai',
- '!city.yokohama',
- '*.kawasaki',
- '*.kitakyushu',
- '*.kobe',
- '*.nagoya',
- '*.sapporo',
- '*.sendai',
- '*.yokohama',
- 'abashiri.hokkaido',
- 'abeno.osaka',
- 'abiko.chiba',
- … ]
-
-*/