styleSectionsEqual() order of sections should be identical
Thus we account for the case of multiple sections matching the same URL because the order of rules is part of cascading
This commit is contained in:
parent
3c08342e98
commit
9503acc2bf
|
@ -586,13 +586,9 @@ function styleSectionsEqual({sections: a}, {sections: b}) {
|
||||||
if (a.length !== b.length) {
|
if (a.length !== b.length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const checkedInB = [];
|
// order of sections should be identical to account for the case of multiple
|
||||||
return a.every(sectionA => b.some(sectionB => {
|
// sections matching the same URL because the order of rules is part of cascading
|
||||||
if (!checkedInB.includes(sectionB) && propertiesEqual(sectionA, sectionB)) {
|
return a.every((sectionA, index) => propertiesEqual(sectionA, b[index]));
|
||||||
checkedInB.push(sectionB);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
function propertiesEqual(secA, secB) {
|
function propertiesEqual(secA, secB) {
|
||||||
for (const name of ['urlPrefixes', 'urls', 'domains', 'regexps']) {
|
for (const name of ['urlPrefixes', 'urls', 'domains', 'regexps']) {
|
||||||
|
@ -613,17 +609,10 @@ function styleSectionsEqual({sections: a}, {sections: b}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function arrayMirrors(array1, array2) {
|
function arrayMirrors(array1, array2) {
|
||||||
for (const el of array1) {
|
return (
|
||||||
if (array2.indexOf(el) < 0) {
|
array1.every(el => array2.includes(el)) &&
|
||||||
return false;
|
array2.every(el => array1.includes(el))
|
||||||
}
|
);
|
||||||
}
|
|
||||||
for (const el of array2) {
|
|
||||||
if (array1.indexOf(el) < 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -285,13 +285,9 @@ function styleSectionsEqual({sections: a}, {sections: b}) {
|
||||||
if (a.length !== b.length) {
|
if (a.length !== b.length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const checkedInB = [];
|
// order of sections should be identical to account for the case of multiple
|
||||||
return a.every(sectionA => b.some(sectionB => {
|
// sections matching the same URL because the order of rules is part of cascading
|
||||||
if (!checkedInB.includes(sectionB) && propertiesEqual(sectionA, sectionB)) {
|
return a.every((sectionA, index) => propertiesEqual(sectionA, b[index]));
|
||||||
checkedInB.push(sectionB);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
function propertiesEqual(secA, secB) {
|
function propertiesEqual(secA, secB) {
|
||||||
for (const name of ['urlPrefixes', 'urls', 'domains', 'regexps']) {
|
for (const name of ['urlPrefixes', 'urls', 'domains', 'regexps']) {
|
||||||
|
@ -312,17 +308,10 @@ function styleSectionsEqual({sections: a}, {sections: b}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function arrayMirrors(array1, array2) {
|
function arrayMirrors(array1, array2) {
|
||||||
for (const el of array1) {
|
return (
|
||||||
if (array2.indexOf(el) < 0) {
|
array1.every(el => array2.includes(el)) &&
|
||||||
return false;
|
array2.every(el => array1.includes(el))
|
||||||
}
|
);
|
||||||
}
|
|
||||||
for (const el of array2) {
|
|
||||||
if (array1.indexOf(el) < 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user