|
61 | 61 | super();
|
62 | 62 | this.pendingRequests = [];
|
63 | 63 | this.cnames = new Map([ [ '', '' ] ]);
|
64 |
| - this.cnameAliasList = null; |
65 | 64 | this.cnameIgnoreList = null;
|
66 | 65 | this.cnameIgnore1stParty = true;
|
| 66 | + this.cnameIgnoreExceptions = true; |
67 | 67 | this.cnameIgnoreRootDocument = true;
|
68 | 68 | this.cnameMaxTTL = 60;
|
69 | 69 | this.cnameReplayFullURL = false;
|
70 | 70 | this.cnameTimer = undefined;
|
| 71 | + this.cnameUncloak = true; |
71 | 72 | }
|
72 | 73 | setOptions(options) {
|
73 | 74 | super.setOptions(options);
|
74 |
| - this.cnameAliasList = this.regexFromStrList(options.cnameAliasList); |
| 75 | + this.cnameUncloak = options.cnameUncloak !== false; |
75 | 76 | this.cnameIgnoreList = this.regexFromStrList(options.cnameIgnoreList);
|
76 | 77 | this.cnameIgnore1stParty = options.cnameIgnore1stParty !== false;
|
| 78 | + this.cnameIgnoreExceptions = options.cnameIgnoreExceptions !== false; |
77 | 79 | this.cnameIgnoreRootDocument = options.cnameIgnoreRootDocument !== false;
|
78 | 80 | this.cnameMaxTTL = options.cnameMaxTTL || 120;
|
79 | 81 | this.cnameReplayFullURL = options.cnameReplayFullURL === true;
|
|
199 | 201 | );
|
200 | 202 | }
|
201 | 203 | onBeforeSuspendableRequest(details) {
|
202 |
| - let r = super.onBeforeSuspendableRequest(details); |
203 |
| - if ( r !== undefined ) { return r; } |
204 |
| - if ( this.cnameAliasList === null ) { return; } |
205 |
| - if ( details.type === 'main_frame' && this.cnameIgnoreRootDocument ) { |
| 204 | + const r = super.onBeforeSuspendableRequest(details); |
| 205 | + if ( r !== undefined ) { |
| 206 | + if ( |
| 207 | + r.cancel === true || |
| 208 | + r.redirectUrl !== undefined || |
| 209 | + this.cnameIgnoreExceptions |
| 210 | + ) { |
| 211 | + return r; |
| 212 | + } |
| 213 | + } |
| 214 | + if ( |
| 215 | + details.type === 'main_frame' && |
| 216 | + this.cnameIgnoreRootDocument |
| 217 | + ) { |
206 | 218 | return;
|
207 | 219 | }
|
| 220 | + if ( this.cnameUncloak === false ) { return; } |
208 | 221 | const hn = vAPI.hostnameFromNetworkURL(details.url);
|
209 | 222 | let cname = this.cnames.get(hn);
|
210 | 223 | if ( cname === '' ) { return; }
|
211 | 224 | if ( cname !== undefined ) {
|
212 | 225 | return this.processCanonicalName(hn, cname, details);
|
213 | 226 | }
|
214 |
| - if ( this.cnameAliasList.test(hn) === false ) { |
215 |
| - this.cnames.set(hn, ''); |
216 |
| - return; |
217 |
| - } |
218 | 227 | return browser.dns.resolve(hn, [ 'canonical_name' ]).then(
|
219 | 228 | rec => {
|
220 | 229 | const cname = this.recordCanonicalName(hn, rec);
|
|
0 commit comments