Răsfoiți Sursa

Allow not fully qualified origins for Firefox

simov 8 ani în urmă
părinte
comite
c06de8ac6d
1 a modificat fișierele cu 9 adăugiri și 1 ștergeri
  1. 9 1
      background/background.js

+ 9 - 1
background/background.js

@@ -158,6 +158,14 @@ chrome.tabs.onUpdated.addListener((id, info, tab) => {
           state.origins['*://' + win.location.host] ||
           state.origins['*://*']
 
+        // ff: webRequest bug - does not match on `hostname:port`
+        if (!path && /Firefox/.test(navigator.userAgent)) {
+          var path =
+            state.origins[win.location.protocol + '//' + win.location.hostname] ||
+            state.origins['*://' + win.location.hostname] ||
+            state.origins['*://*']
+        }
+
         if (path && new RegExp(path).test(win.location.href)) {
           inject(id)
         }
@@ -275,7 +283,7 @@ chrome.webRequest &&
 chrome.webRequest.onHeadersReceived.addListener(({responseHeaders}) => ({
   responseHeaders: responseHeaders
     .filter(({name}) => name.toLowerCase() !== 'content-security-policy')
-    // ff only
+    // ff: markdown `content-type` is not allowed
     .map((header) => {
       if (
         /Firefox/.test(navigator.userAgent) &&