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

Report cosmetic filters as popup panel property

This commit is contained in:
Raymond Hill 2023-04-04 13:20:58 -04:00
parent 8c376d7791
commit 620a96531c
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 4 additions and 12 deletions

View File

@ -615,9 +615,6 @@ const onMessage = function(request, sender, callback) {
if ( vAPI.net.hasUnprocessedRequest(request.tabId) ) {
request.popupPanel.hasUnprocessedRequest = true;
}
const supportURL = new URL(vAPI.getURL('support.html'));
supportURL.searchParams.set('pageURL', request.pageURL);
supportURL.searchParams.set('popupPanel', JSON.stringify(request.popupPanel));
vAPI.tabs.executeScript(request.tabId, {
allFrames: true,
file: '/js/scriptlets/cosmetic-report.js',
@ -628,8 +625,11 @@ const onMessage = function(request, sender, callback) {
return a;
}, []);
if ( filters.length !== 0 ) {
supportURL.searchParams.set('cosmetic', JSON.stringify(filters));
request.popupPanel.cosmetic = filters;
}
const supportURL = new URL(vAPI.getURL('support.html'));
supportURL.searchParams.set('pageURL', request.pageURL);
supportURL.searchParams.set('popupPanel', JSON.stringify(request.popupPanel));
µb.openNewTab({ url: supportURL.href, select: true, index: -1 });
});
return;

View File

@ -151,9 +151,6 @@ function showData() {
}
if ( reportedPage !== null ) {
shownData.popupPanel = reportedPage.popupPanel;
if ( reportedPage.cosmeticFilters ) {
shownData.cosmeticFilters = reportedPage.cosmeticFilters;
}
}
const text = JSON.stringify(shownData, null, 2)
.split('\n')
@ -200,14 +197,9 @@ const reportedPage = (( ) => {
select.append(option);
}
dom.cl.add(dom.body, 'filterIssue');
let cosmeticFilters;
if ( url.searchParams.has('cosmetic') ) {
cosmeticFilters = JSON.parse(url.searchParams.get('cosmetic'));
}
return {
hostname: parsedURL.hostname.replace(/^(m|mobile|www)\./, ''),
popupPanel: JSON.parse(url.searchParams.get('popupPanel')),
cosmeticFilters,
};
} catch(ex) {
}