Skip to content

Commit

Permalink
Revert "Fix regression in set-constantscriptlet"
Browse files Browse the repository at this point in the history
This reverts commit b7441bb.
  • Loading branch information
gorhill committed Dec 9, 2024
1 parent fa87e6d commit 7daa45e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
3 changes: 1 addition & 2 deletions platform/mv3/extension/js/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*/

import { dnr } from './ext.js';
import { getDynamicRules } from './ext-compat.js';

/******************************************************************************/

Expand Down Expand Up @@ -54,7 +53,7 @@ const getRuleset = async rulesetId => {
}
let rules;
if ( rulesetId === dnr.DYNAMIC_RULESET_ID ) {
rules = await getDynamicRules().catch(( ) => undefined);
rules = await dnr.getDynamicRules().catch(( ) => undefined);
} else {
const response = await fetch(`/rulesets/main/${rulesetId}.json`).catch(( ) => undefined);
if ( response === undefined ) { return; }
Expand Down
15 changes: 5 additions & 10 deletions platform/mv3/extension/js/ruleset-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ import {
runtime,
} from './ext.js';

import {
getDynamicRules,
getSessionRules,
} from './ext-compat.js';

import {
localRead, localRemove, localWrite,
sessionRead, sessionRemove, sessionWrite,
Expand Down Expand Up @@ -368,8 +363,8 @@ async function commitStrictBlockRules() {
beforePermanentRules,
beforeTemporaryRules,
] = await Promise.all([
getDynamicRules({ ruleIds: [ STRICTBLOCK_BASE_RULE_ID ] }),
getSessionRules({ ruleIds: [ STRICTBLOCK_BASE_RULE_ID ] }),
dnr.getDynamicRules({ ruleIds: [ STRICTBLOCK_BASE_RULE_ID ] }),
dnr.getSessionRules({ ruleIds: [ STRICTBLOCK_BASE_RULE_ID ] }),
]);
if ( beforePermanentRules?.length ) {
ubolLog(`Remove 1 DNR dynamic strictblock rule`);
Expand Down Expand Up @@ -427,11 +422,11 @@ async function updateDynamicRules() {
dynamicRuleIds,
sessionRuleIds,
] = await Promise.all([
getDynamicRules().then(rules =>
dnr.getDynamicRules().then(rules =>
rules.map(rule => rule.id)
.filter(id => id < TRUSTED_DIRECTIVE_BASE_RULE_ID)
),
getSessionRules().then(rules => rules.map(rule => rule.id)),
dnr.getSessionRules().then(rules => rules.map(rule => rule.id)),
updateRegexRules(dynamicRules),
updateRemoveparamRules(dynamicRules),
updateRedirectRules(dynamicRules),
Expand Down Expand Up @@ -480,7 +475,7 @@ async function updateDynamicRules() {
/******************************************************************************/

async function filteringModesToDNR(modes) {
const trustedRules = await getDynamicRules({
const trustedRules = await dnr.getDynamicRules({
ruleIds: [ TRUSTED_DIRECTIVE_BASE_RULE_ID+0 ],
});
const trustedRule = trustedRules.length !== 0 && trustedRules[0] || undefined;
Expand Down
1 change: 1 addition & 0 deletions src/js/resources/set-constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export function validateConstantFn(trusted, raw, extraArgs = {}) {
} else if ( raw.startsWith('{') && raw.endsWith('}') ) {
try { value = safe.JSON_parse(raw).value; } catch(ex) { return; }
}
return raw;
} else {
return;
}
Expand Down

0 comments on commit 7daa45e

Please sign in to comment.