From 94de4e266e49b458cb3c6e1e67be755cbd63ea5c Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 17 Mar 2024 09:36:39 -0400 Subject: [PATCH] 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 --- src/js/popup-fenix.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/js/popup-fenix.js b/src/js/popup-fenix.js index 6f5bcfb9d..9f2af084d 100644 --- a/src/js/popup-fenix.js +++ b/src/js/popup-fenix.js @@ -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 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) { @@ -88,7 +91,7 @@ const cachePopupData = function(data) { return popupData; } for ( const hostname in hostnameDict ) { - if ( hostnameDict.hasOwnProperty(hostname) === false ) { continue; } + if ( hasOwnProperty(hostnameDict, hostname) === false ) { continue; } let domain = hostnameDict[hostname].domain; let prefix = hostname.slice(0, 0 - domain.length - 1); // Prefix with space char for 1st-party hostnames: this ensure these @@ -160,7 +163,7 @@ const formatNumber = function(count) { }); if ( intl.resolvedOptions instanceof Function && - intl.resolvedOptions().hasOwnProperty('notation') + hasOwnProperty(intl.resolvedOptions(), 'notation') ) { intlNumberFormat = intl; } @@ -545,7 +548,7 @@ const renderPrivacyExposure = function() { if ( des === '*' || desHostnameDone.has(des) ) { continue; } const hnDetails = hostnameDict[des]; const { domain, counts } = hnDetails; - if ( allDomains.hasOwnProperty(domain) === false ) { + if ( hasOwnProperty(allDomains, domain) === false ) { allDomains[domain] = false; allDomainCount += 1; } @@ -1469,11 +1472,13 @@ const getPopupData = async function(tabId, first = false) { return; } if ( selfURL.searchParams.get('portrait') !== null ) { + dom.cl.remove(dom.root, 'desktop'); dom.cl.add(dom.root, 'portrait'); return; } if ( popupData.popupPanelOrientation === 'landscape' ) { return; } if ( popupData.popupPanelOrientation === 'portrait' ) { + dom.cl.remove(dom.root, 'desktop'); dom.cl.add(dom.root, 'portrait'); return; }