Browse Source

fix #992

pull/2/head
Raymond Hill 6 years ago
parent
commit
b53d1be672
No known key found for this signature in database GPG Key ID: 25E1490B761470C2
  1. 19
      src/js/tab.js

19
src/js/tab.js

@ -48,6 +48,19 @@ var µm = µMatrix;
return 'http://' + this.behindTheSceneScope + '/';
}
// https://github.com/gorhill/uMatrix/issues/992
// Firefox-specific quirk: some top documents are reported by Firefox API
// as loading from `wyciwyg://`, and this breaks uMatrix usability.
// Firefox should probably made such loading from cache seamless through
// its APIs, but since this is not the case, uMatrix inherits the duty to
// make it seamless on its side.
if ( pageURL.startsWith('wyciwyg:') ) {
let match = /^wyciwyg:\/\/\d+\//.exec(pageURL);
if ( match !== null ) {
pageURL = pageURL.slice(match[0].length);
}
}
// If the URL is that of our "blocked page" document, return the URL of
// the blocked page.
if ( pageURL.startsWith(vAPI.getURL('main-blocked.html')) ) {
@ -61,13 +74,13 @@ var µm = µMatrix;
}
}
var uri = this.URI.set(pageURL);
var scheme = uri.scheme;
let uri = this.URI.set(pageURL);
let scheme = uri.scheme;
if ( scheme === 'https' || scheme === 'http' ) {
return uri.normalizedURI();
}
var fakeHostname = scheme + '-scheme';
let fakeHostname = scheme + '-scheme';
if ( uri.hostname !== '' ) {
fakeHostname = uri.hostname + '.' + fakeHostname;

Loading…
Cancel
Save