浏览代码

Improve origin detection

simov 7 年之前
父节点
当前提交
4ad44b15ef
共有 1 个文件被更改,包括 2 次插入8 次删除
  1. 2 8
      background/detect.js

+ 2 - 8
background/detect.js

@@ -55,17 +55,11 @@ md.detect = ({storage: {state}, inject}) => {
 
     var origin =
       state.origins[location.origin] ||
+      state.origins[location.protocol + '//' + location.hostname] ||
       state.origins['*://' + location.host] ||
+      state.origins['*://' + location.hostname] ||
       state.origins['*://*']
 
-    // ff: webRequest bug - does not match on `hostname:port`
-    if (!origin && /Firefox/.test(navigator.userAgent)) {
-      var origin =
-        state.origins[location.protocol + '//' + location.hostname] ||
-        state.origins['*://' + location.hostname] ||
-        state.origins['*://*']
-    }
-
     if (origin && origin.match && new RegExp(origin.match).test(location.href)) {
       return origin
     }