1
0
Fork 0
mirror of https://github.com/gorhill/uMatrix.git synced 2024-06-02 02:14:52 +12:00

various fixes re. behind-the-scene scope

This commit is contained in:
gorhill 2015-04-30 19:37:55 -04:00
parent b01964db9b
commit 37331b1ef2
3 changed files with 22 additions and 8 deletions

View file

@ -120,10 +120,10 @@ return {
userAgentReplaceStrBirth: 0,
// record what chromium is doing behind the scene
behindTheSceneURL: 'http://chromium-behind-the-scene/',
behindTheSceneURL: 'http://behind-the-scene/',
behindTheSceneTabId: vAPI.noTabId,
behindTheSceneMaxReq: 250,
behindTheSceneScope: 'chromium-behind-the-scene',
behindTheSceneScope: 'behind-the-scene',
// Commonly encountered strings
chromeExtensionURLPrefix: 'chrome-extension://',

View file

@ -748,6 +748,12 @@ Matrix.prototype.fromString = function(text, append) {
continue;
}
// Backward compatibility:
// `chromium-behind-the-scene` is now `behind-the-scene`
if ( srcHostname === 'chromium-behind-the-scene' ) {
srcHostname = 'behind-the-scene';
}
matrix.setSwitch(switchName, srcHostname, nameToSwitchStateMap[fieldVal]);
continue;
}
@ -801,6 +807,12 @@ Matrix.prototype.fromString = function(text, append) {
state = 2;
}
// Backward compatibility:
// `chromium-behind-the-scene` is now `behind-the-scene`
if ( srcHostname === 'chromium-behind-the-scene' ) {
srcHostname = 'behind-the-scene';
}
matrix.setCell(srcHostname, desHostname, type, state);
}

View file

@ -37,7 +37,7 @@ var µm = µMatrix;
// Any scheme other than 'http' and 'https' is remapped into a fake
// URL which trick the rest of µMatrix into being able to process an
// otherwise unmanageable scheme. µMatrix needs web page to have a proper
// hostname to work properly, so just like the 'chromium-behind-the-scene'
// hostname to work properly, so just like the 'behind-the-scene'
// fake domain name, we map unknown schemes into a fake '{scheme}-scheme'
// hostname. This way, for a specific scheme you can create scope with
// rules which will apply only to that scheme.
@ -55,13 +55,15 @@ var µm = µMatrix;
return uri.normalizedURI();
}
var url = scheme + '-scheme';
var fakeHostname = scheme + '-scheme';
if ( uri.hostname !== '' ) {
url = uri.hostname + '.' + url;
fakeHostname = uri.hostname + '.' + fakeHostname;
} else if ( scheme === 'about' ) {
fakeHostname = uri.path + '.' + fakeHostname;
}
return 'http://' + url + '/';
return 'http://' + fakeHostname + '/';
};
/******************************************************************************/
@ -326,7 +328,7 @@ housekeep itself.
entry.rawURL = '';
entry.normalURL = µm.normalizePageURL(entry.tabId);
entry.rootHostname = µm.URI.hostnameFromURI(entry.normalURL);
entry.rootDomain = µm.URI.domainFromHostname(entry.rootHostname);
entry.rootDomain = µm.URI.domainFromHostname(entry.rootHostname) || entry.rootHostname;
})();
// Context object, typically to be used to feed filtering engines.
@ -442,7 +444,7 @@ vAPI.tabs.registerListeners();
throw new Error('Unmanaged tab id: ' + tabId);
}
// rhill 2013-11-24: Never ever rebind chromium-behind-the-scene
// rhill 2013-11-24: Never ever rebind behind-the-scene
// virtual tab.
// https://github.com/gorhill/httpswitchboard/issues/67
if ( vAPI.isBehindTheSceneTabId(tabId) ) {