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) { function applyOnMessage(request) {
if (request.method === 'ping') {
return true;
}
if (STYLE_VIA_API) { if (STYLE_VIA_API) {
if (request.method === 'urlChanged') { if (request.method === 'urlChanged') {
request.method = 'styleReplaceAll'; request.method = 'styleReplaceAll';
} }
if (/^(style|updateCount)/.test(request.method)) {
API.styleViaAPI(request); API.styleViaAPI(request);
return; return;
} }
}
switch (request.method) { switch (request.method) {
case 'ping':
return true;
case 'styleDeleted': case 'styleDeleted':
styleInjector.remove(request.style.id); styleInjector.remove(request.style.id);
break; break;