Browse Source

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
commit
0190fdaf3d
No known key found for this signature in database GPG Key ID: 25E1490B761470C2
  1. 6
      src/js/tab.js
  2. 12
      src/js/uritools.js

6
src/js/tab.js

@ -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.

12
src/js/uritools.js

@ -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,12 +240,12 @@ URI.isNetworkScheme = function(scheme) {
/******************************************************************************/
const reSecureScheme = /^(?:http|ws|ftp)s\b/;
URI.isSecureScheme = function(scheme) {
return this.reSecureScheme.test(scheme);
return reSecureScheme.test(scheme);
};
URI.reSecureScheme = /^(?:https|wss|ftps)\b/;
/******************************************************************************/
URI.hostnameFromURI = vAPI.hostnameFromURI;

Loading…
Cancel
Save