Add back missing tab context properties

These properties, used to detect/act on/report
unencrypted connection, were erroneously removed
when importing uBO's code en-bloc.

Related issue:
- https://github.com/uBlockOrigin/uMatrix-issues/issues/212
pull/2/head
Raymond Hill 5 years ago
parent 0db579da97
commit 0190fdaf3d
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

@ -180,9 +180,11 @@ housekeep itself.
this.stack = []; this.stack = [];
this.rawURL = this.rawURL =
this.normalURL = this.normalURL =
this.scheme =
this.origin = this.origin =
this.rootHostname = this.rootHostname =
this.rootDomain = ''; this.rootDomain = '';
this.secure = false;
this.commitTimer = null; this.commitTimer = null;
this.gcTimer = null; this.gcTimer = null;
this.onGCBarrier = false; this.onGCBarrier = false;
@ -266,19 +268,23 @@ housekeep itself.
if ( this.stack.length === 0 ) { if ( this.stack.length === 0 ) {
this.rawURL = this.rawURL =
this.normalURL = this.normalURL =
this.scheme =
this.origin = this.origin =
this.rootHostname = this.rootHostname =
this.rootDomain = ''; this.rootDomain = '';
this.secure = false;
return; return;
} }
const stackEntry = this.stack[this.stack.length - 1]; const stackEntry = this.stack[this.stack.length - 1];
this.rawURL = stackEntry.url; this.rawURL = stackEntry.url;
this.normalURL = µm.normalizePageURL(this.tabId, this.rawURL); this.normalURL = µm.normalizePageURL(this.tabId, this.rawURL);
this.scheme = µm.URI.schemeFromURI(this.rawURL);
this.origin = µm.URI.originFromURI(this.normalURL); this.origin = µm.URI.originFromURI(this.normalURL);
this.rootHostname = µm.URI.hostnameFromURI(this.origin); this.rootHostname = µm.URI.hostnameFromURI(this.origin);
this.rootDomain = this.rootDomain =
µm.URI.domainFromHostname(this.rootHostname) || µm.URI.domainFromHostname(this.rootHostname) ||
this.rootHostname; this.rootHostname;
this.secure = µm.URI.isSecureScheme(this.scheme);
}; };
// Called whenever a candidate root URL is spotted for the tab. // Called whenever a candidate root URL is spotted for the tab.

@ -31,7 +31,7 @@ Naming convention from https://en.wikipedia.org/wiki/URI_scheme#Examples
/******************************************************************************/ /******************************************************************************/
µMatrix.URI = (function() { µMatrix.URI = (( ) => {
/******************************************************************************/ /******************************************************************************/
@ -70,7 +70,7 @@ const reHostFromNakedAuthority = /^[0-9a-z._-]+[0-9a-z]$/i;
/******************************************************************************/ /******************************************************************************/
var reset = function(o) { const reset = function(o) {
o.scheme = ''; o.scheme = '';
o.hostname = ''; o.hostname = '';
o._ipv4 = undefined; o._ipv4 = undefined;
@ -82,7 +82,7 @@ var reset = function(o) {
return o; return o;
}; };
var resetAuthority = function(o) { const resetAuthority = function(o) {
o.hostname = ''; o.hostname = '';
o._ipv4 = undefined; o._ipv4 = undefined;
o._ipv6 = undefined; o._ipv6 = undefined;
@ -240,12 +240,12 @@ URI.isNetworkScheme = function(scheme) {
/******************************************************************************/ /******************************************************************************/
const reSecureScheme = /^(?:http|ws|ftp)s\b/;
URI.isSecureScheme = function(scheme) { URI.isSecureScheme = function(scheme) {
return this.reSecureScheme.test(scheme); return reSecureScheme.test(scheme);
}; };
URI.reSecureScheme = /^(?:https|wss|ftps)\b/;
/******************************************************************************/ /******************************************************************************/
URI.hostnameFromURI = vAPI.hostnameFromURI; URI.hostnameFromURI = vAPI.hostnameFromURI;

Loading…
Cancel
Save