1
0
Fork 0
mirror of https://github.com/gorhill/uMatrix.git synced 2024-05-05 21:03:17 +12:00

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
This commit is contained in:
Raymond Hill 2019-12-25 08:44:42 -05:00
parent 0db579da97
commit 0190fdaf3d
No known key found for this signature in database
GPG key ID: 25E1490B761470C2
2 changed files with 13 additions and 7 deletions

View file

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

View file

@ -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.hostname = '';
o._ipv4 = undefined;
@ -82,7 +82,7 @@ var reset = function(o) {
return o;
};
var resetAuthority = function(o) {
const resetAuthority = function(o) {
o.hostname = '';
o._ipv4 = undefined;
o._ipv6 = undefined;
@ -240,11 +240,11 @@ URI.isNetworkScheme = function(scheme) {
/******************************************************************************/
URI.isSecureScheme = function(scheme) {
return this.reSecureScheme.test(scheme);
};
const reSecureScheme = /^(?:http|ws|ftp)s\b/;
URI.reSecureScheme = /^(?:https|wss|ftps)\b/;
URI.isSecureScheme = function(scheme) {
return reSecureScheme.test(scheme);
};
/******************************************************************************/