mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
[mv3] Avoid pointless messaging when no changes at beforeunload
This commit is contained in:
parent
6c84ae7aba
commit
b4aea4ab27
3 changed files with 12 additions and 6 deletions
|
|
@ -36,3 +36,9 @@ dom.on('#dashboard-nav', 'click', '.tabButton', ev => {
|
|||
});
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
export function hashFromIterable(iter) {
|
||||
return Array.from(iter).sort().join('\n');
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
import { dom, qs$, qsa$ } from './dom.js';
|
||||
import { i18n, i18n$ } from './i18n.js';
|
||||
import { localRead, localWrite, sendMessage } from './ext.js';
|
||||
import { hashFromIterable } from './dashboard.js';
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
|
@ -403,6 +404,10 @@ const applyEnabledRulesets = (( ) => {
|
|||
|
||||
dom.cl.remove('#lists .listEntry.toggled', 'toggled');
|
||||
|
||||
const unmodified = hashFromIterable(enabledRulesets) ===
|
||||
hashFromIterable(cachedRulesetData.enabledRulesets);
|
||||
if ( unmodified ) { return; }
|
||||
|
||||
await sendMessage({
|
||||
what: 'applyRulesets',
|
||||
enabledRulesets,
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
import { browser, sendMessage } from './ext.js';
|
||||
import { dom, qs$ } from './dom.js';
|
||||
import { hashFromIterable } from './dashboard.js';
|
||||
import punycode from './punycode.js';
|
||||
import { renderFilterLists } from './filter-lists.js';
|
||||
|
||||
|
|
@ -30,12 +31,6 @@ let cachedRulesetData = {};
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
function hashFromIterable(iter) {
|
||||
return Array.from(iter).sort().join('\n');
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
function renderAdminRules() {
|
||||
const { disabledFeatures: forbid = [] } = cachedRulesetData;
|
||||
if ( forbid.length === 0 ) { return; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue