Fix: limit the scope of styleViaAPI

This commit is contained in:
eight 2020-02-01 05:28:16 +08:00
parent a026ccfb0b
commit 323103f55a

View File

@ -202,18 +202,20 @@ const APPLY = (() => {
}
function applyOnMessage(request) {
if (request.method === 'ping') {
return true;
}
if (STYLE_VIA_API) {
if (request.method === 'urlChanged') {
request.method = 'styleReplaceAll';
}
API.styleViaAPI(request);
return;
if (/^(style|updateCount)/.test(request.method)) {
API.styleViaAPI(request);
return;
}
}
switch (request.method) {
case 'ping':
return true;
case 'styleDeleted':
styleInjector.remove(request.style.id);
break;