зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1585307 - Prevent URLs from being duplicated in Network Panel's request blocking r=Honza
Differential Revision: https://phabricator.services.mozilla.com/D48920 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
75688d1f71
Коммит
24ff5a9aa6
|
@ -72,13 +72,18 @@ function removeBlockedUrl(state, action) {
|
|||
|
||||
function updateBlockedUrl(state, action) {
|
||||
const { oldUrl, newUrl } = action;
|
||||
let { blockedUrls } = state;
|
||||
|
||||
const blockedUrls = state.blockedUrls.map(item => {
|
||||
if (item.url === oldUrl) {
|
||||
return { ...item, url: newUrl };
|
||||
}
|
||||
return item;
|
||||
});
|
||||
if (!blockedUrls.find(item => item.url === newUrl)) {
|
||||
blockedUrls = blockedUrls.map(item => {
|
||||
if (item.url === oldUrl) {
|
||||
return { ...item, url: newUrl };
|
||||
}
|
||||
return item;
|
||||
});
|
||||
} else {
|
||||
blockedUrls = blockedUrls.filter(item => item.url != oldUrl);
|
||||
}
|
||||
|
||||
return {
|
||||
...state,
|
||||
|
|
Загрузка…
Ссылка в новой задаче