1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-02 00:42:45 +01:00

probably fix #2053

This commit is contained in:
gorhill 2016-10-29 11:15:04 -04:00
parent 50889da226
commit b2193a2b54
2 changed files with 25 additions and 2 deletions

View File

@ -309,6 +309,17 @@ var popupDataFromTabId = function(tabId, tabTitle) {
var pageStore = µb.pageStoreFromTabId(tabId); var pageStore = µb.pageStoreFromTabId(tabId);
if ( pageStore ) { if ( pageStore ) {
// https://github.com/gorhill/uBlock/issues/2105
// Be sure to always include the current page's hostname -- it might
// not be present when the page itself is pulled from the browser's
// short-term memory cache. This needs to be done before calling
// getHostnameDict().
if (
pageStore.hostnameToCountMap.has(rootHostname) === false &&
µb.URI.isNetworkURI(tabContext.rawURL)
) {
pageStore.hostnameToCountMap.set(rootHostname, 0);
}
r.pageBlockedRequestCount = pageStore.perLoadBlockedRequestCount; r.pageBlockedRequestCount = pageStore.perLoadBlockedRequestCount;
r.pageAllowedRequestCount = pageStore.perLoadAllowedRequestCount; r.pageAllowedRequestCount = pageStore.perLoadAllowedRequestCount;
r.netFilteringSwitch = pageStore.getNetFilteringSwitch(); r.netFilteringSwitch = pageStore.getNetFilteringSwitch();

View File

@ -21,6 +21,8 @@
/* global publicSuffixList */ /* global publicSuffixList */
'use strict';
/******************************************************************************* /*******************************************************************************
RFC 3986 as reference: http://tools.ietf.org/html/rfc3986#appendix-A RFC 3986 as reference: http://tools.ietf.org/html/rfc3986#appendix-A
@ -33,8 +35,6 @@ Naming convention from https://en.wikipedia.org/wiki/URI_scheme#Examples
µBlock.URI = (function() { µBlock.URI = (function() {
'use strict';
/******************************************************************************/ /******************************************************************************/
// Favorite regex tool: http://regex101.com/ // Favorite regex tool: http://regex101.com/
@ -402,6 +402,18 @@ URI.domainFromURI = function(uri) {
/******************************************************************************/ /******************************************************************************/
URI.isNetworkURI = function(uri) {
return /^(?:ftps?|https?|wss?):\/\//.test(uri);
};
/******************************************************************************/
URI.isNetworkScheme = function(scheme) {
return /^(?:ftps?|https?|wss?)$/.test(scheme);
};
/******************************************************************************/
// Normalize the way µBlock expects it // Normalize the way µBlock expects it
URI.normalizedURI = function() { URI.normalizedURI = function() {