Fix: move origin check to background

This commit is contained in:
eight 2020-02-01 02:55:45 +08:00
parent a976c45a3a
commit c11804b109
2 changed files with 5 additions and 4 deletions

View File

@ -28,7 +28,11 @@ window.API_METHODS = Object.assign(window.API_METHODS || {}, {
removeExclusion: styleManager.removeExclusion,
getTabUrlPrefix() {
return this.sender.tab.url.match(/^([\w-]+:\/+[^/#]+)/)[1];
const {url} = this.sender.tab;
if (url.startsWith(URLS.ownOrigin)) {
return 'stylus';
}
return url.match(/^([\w-]+:\/+[^/#]+)/)[1];
},
download(msg) {

View File

@ -270,9 +270,6 @@ const APPLY = (() => {
}
function fetchParentDomain() {
if (/-extension/.test(location.protocol)) {
parentDomain = 'stylus';
}
if (parentDomain) {
return Promise.resolve();
}