MCPcopy Create free account
hub / github.com/darkreader/darkreader / shouldIgnoreCors

Function shouldIgnoreCors

src/inject/dynamic-theme/network.ts:87–111  ·  view source on GitHub ↗
(url: URL)

Source from the content-addressed store, hash-verified

85];
86
87function shouldIgnoreCors(url: URL) {
88 if (__TEST__) {
89 return false;
90 }
91 const {host, hostname, port, protocol} = url;
92 if (!corsHosts.has(host)) {
93 corsHosts.add(host);
94 }
95 if (checkedHosts.has(host)) {
96 return false;
97 }
98 if (
99 corsHosts.size >= MAX_CORS_HOSTS ||
100 protocol !== 'https:' ||
101 port !== '' ||
102 localAliases.includes(hostname) ||
103 localSubDomains.some((sub) => hostname.endsWith(sub)) ||
104 hostname.startsWith('[') ||
105 hostname.match(ipV4RegExp)
106 ) {
107 return true;
108 }
109 checkedHosts.add(host);
110 return false;
111}

Callers 1

bgFetchFunction · 0.85

Calls 2

addMethod · 0.80
hasMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…