Sfoglia il codice sorgente

Use tabs api to open the options page in firefox

simov 7 anni fa
parent
commit
b45e999209
1 ha cambiato i file con 9 aggiunte e 1 eliminazioni
  1. 9 1
      background/messages.js

+ 9 - 1
background/messages.js

@@ -61,7 +61,15 @@ md.messages = ({storage: {defaults, state, set}, compilers, mathjax, headers}) =
       sendResponse()
     }
     else if (req.message === 'popup.advanced') {
-      chrome.runtime.openOptionsPage()
+      // ff: opens up about:addons with openOptionsPage
+      if (/Firefox/.test(navigator.userAgent)) {
+        chrome.management.getSelf((extension) => {
+          chrome.tabs.create({url: extension.optionsUrl})
+        })
+      }
+      else {
+        chrome.runtime.openOptionsPage()
+      }
       sendResponse()
     }