1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-06 09:37:12 +02:00

Fix popup panel when embedded in logger

Regression from commit:
https://github.com/gorhill/uBlock/commit/0d77ccded7

Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2419#discussioncomment-8759449
This commit is contained in:
Raymond Hill 2024-03-17 09:36:39 -04:00
parent 3f7374c1f1
commit 94de4e266e
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -70,6 +70,9 @@ let cachedPopupHash = '';
const reCyrillicNonAmbiguous = /[\u0400-\u042b\u042d-\u042f\u0431\u0432\u0434\u0436-\u043d\u0442\u0444\u0446-\u0449\u044b-\u0454\u0457\u0459-\u0460\u0462-\u0474\u0476-\u04ba\u04bc\u04be-\u04ce\u04d0-\u0500\u0502-\u051a\u051c\u051e-\u052f]/; const reCyrillicNonAmbiguous = /[\u0400-\u042b\u042d-\u042f\u0431\u0432\u0434\u0436-\u043d\u0442\u0444\u0446-\u0449\u044b-\u0454\u0457\u0459-\u0460\u0462-\u0474\u0476-\u04ba\u04bc\u04be-\u04ce\u04d0-\u0500\u0502-\u051a\u051c\u051e-\u052f]/;
const reCyrillicAmbiguous = /[\u042c\u0430\u0433\u0435\u043e\u043f\u0440\u0441\u0443\u0445\u044a\u0455\u0456\u0458\u0461\u0475\u04bb\u04bd\u04cf\u0501\u051b\u051d]/; const reCyrillicAmbiguous = /[\u042c\u0430\u0433\u0435\u043e\u043f\u0440\u0441\u0443\u0445\u044a\u0455\u0456\u0458\u0461\u0475\u04bb\u04bd\u04cf\u0501\u051b\u051d]/;
const hasOwnProperty = (o, p) =>
Object.prototype.hasOwnProperty.call(o, p);
/******************************************************************************/ /******************************************************************************/
const cachePopupData = function(data) { const cachePopupData = function(data) {
@ -88,7 +91,7 @@ const cachePopupData = function(data) {
return popupData; return popupData;
} }
for ( const hostname in hostnameDict ) { for ( const hostname in hostnameDict ) {
if ( hostnameDict.hasOwnProperty(hostname) === false ) { continue; } if ( hasOwnProperty(hostnameDict, hostname) === false ) { continue; }
let domain = hostnameDict[hostname].domain; let domain = hostnameDict[hostname].domain;
let prefix = hostname.slice(0, 0 - domain.length - 1); let prefix = hostname.slice(0, 0 - domain.length - 1);
// Prefix with space char for 1st-party hostnames: this ensure these // Prefix with space char for 1st-party hostnames: this ensure these
@ -160,7 +163,7 @@ const formatNumber = function(count) {
}); });
if ( if (
intl.resolvedOptions instanceof Function && intl.resolvedOptions instanceof Function &&
intl.resolvedOptions().hasOwnProperty('notation') hasOwnProperty(intl.resolvedOptions(), 'notation')
) { ) {
intlNumberFormat = intl; intlNumberFormat = intl;
} }
@ -545,7 +548,7 @@ const renderPrivacyExposure = function() {
if ( des === '*' || desHostnameDone.has(des) ) { continue; } if ( des === '*' || desHostnameDone.has(des) ) { continue; }
const hnDetails = hostnameDict[des]; const hnDetails = hostnameDict[des];
const { domain, counts } = hnDetails; const { domain, counts } = hnDetails;
if ( allDomains.hasOwnProperty(domain) === false ) { if ( hasOwnProperty(allDomains, domain) === false ) {
allDomains[domain] = false; allDomains[domain] = false;
allDomainCount += 1; allDomainCount += 1;
} }
@ -1469,11 +1472,13 @@ const getPopupData = async function(tabId, first = false) {
return; return;
} }
if ( selfURL.searchParams.get('portrait') !== null ) { if ( selfURL.searchParams.get('portrait') !== null ) {
dom.cl.remove(dom.root, 'desktop');
dom.cl.add(dom.root, 'portrait'); dom.cl.add(dom.root, 'portrait');
return; return;
} }
if ( popupData.popupPanelOrientation === 'landscape' ) { return; } if ( popupData.popupPanelOrientation === 'landscape' ) { return; }
if ( popupData.popupPanelOrientation === 'portrait' ) { if ( popupData.popupPanelOrientation === 'portrait' ) {
dom.cl.remove(dom.root, 'desktop');
dom.cl.add(dom.root, 'portrait'); dom.cl.add(dom.root, 'portrait');
return; return;
} }