diff --git a/src/js/messaging.js b/src/js/messaging.js index 6bbba4e43..0da3e533e 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -1302,16 +1302,18 @@ const getSupportData = async function() { removedListset = undefined; } + let browserFamily = (( ) => { + if ( vAPI.webextFlavor.soup.has('firefox') ) { return 'Firefox'; } + if ( vAPI.webextFlavor.soup.has('chromium') ) { return 'Chromium'; } + return 'Unknown'; + })(); + if ( vAPI.webextFlavor.soup.has('mobile') ) { + browserFamily += ' Mobile'; + } + return { - browserFlavor: Array.from(vAPI.webextFlavor.soup).join(' '), - browserVersion: vAPI.webextFlavor.major, - extensionId: vAPI.webextFlavor.soup.has('firefox') === false - ? vAPI.i18n('@@extension_id') - : undefined, - extensionName: vAPI.app.name, - extensionVersion: vAPI.app.version, - modifiedUserSettings, - modifiedHiddenSettings, + [`${vAPI.app.name}`]: `${vAPI.app.version}`, + [`${browserFamily}`]: `${vAPI.webextFlavor.major}`, 'filterset (summary)': { network: staticNetFilteringEngine.getFilterCount(), cosmetic: cosmeticFilteringEngine.getFilterCount(), @@ -1340,6 +1342,8 @@ const getSupportData = async function() { sessionURLFiltering.toArray(), [] ), + modifiedUserSettings, + modifiedHiddenSettings, }; }; diff --git a/src/js/support.js b/src/js/support.js index cc18c3e00..62c5be83a 100644 --- a/src/js/support.js +++ b/src/js/support.js @@ -132,6 +132,33 @@ function showData() { const shownData = JSON.parse(JSON.stringify(supportData)); uselessKeys.forEach(prop => { removeKey(shownData, prop); }); const redacted = document.body.classList.contains('redacted'); + // If the report is for a specific site, report per-site switches which + // are triggered on the reported site. + if ( + reportURL !== null && + shownData.switchRuleset instanceof Object && + Array.isArray(shownData.switchRuleset.added) + ) { + const hostname = reportURL.hostname; + const added = []; + const triggered = []; + for ( const rule of shownData.switchRuleset.added ) { + const match = /^[^:]+:\s+(\S+)/.exec(rule); + if ( + match[1] === '*' || + hostname === match[1] || + hostname.endsWith(`.${match[1]}`) + ) { + triggered.push(rule); + } else { + added.push(rule); + } + } + if ( triggered.length !== 0 ) { + shownData.switchRuleset.triggered = triggered; + shownData.switchRuleset.added = added; + } + } if ( redacted ) { sensitiveValues.forEach(prop => { redactValue(shownData, prop); }); sensitiveKeys.forEach(prop => { redactKeys(shownData, prop); });