Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

155
Visualizações
Chrome extension to Firefox extension

I have developed a Chrome extension On Chrome everything works as I expect

I am now trying to migrate the extension to Firefox

It tells me that the developed extension is compatible with Firefox (I used this link https://www.extensiontest.com/)

However, I have some problems I have a devtools_script ("VariableGrid.js") which sends messages to the ContentScript via chrome.tabs.query

chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
chrome.tabs.sendMessage(chrome.devtools.inspectedWindow.tabId, { from: "FromExample", message: "MessageExample" }, (response) => {
......
});
});

My ContentScript replies to the message like this

chrome.runtime.onMessage.addListener(
(request, sender, sendResponse) => {
......
});

On Firefox chrome.tabs is undefined I tried using browser.tabs but it's the same

I read that tabs can only be used on background script

Why does this work on my Chrome extension and not on Firefox?

If I tried to move that piece of code to the background script I would still have a problem:

chrome.devtools.inspectedWindow.tabId is undefined

my Manifest is like this

 {
  "browser_specific_settings": {
    "gecko": {
      "id": "addon@example.com",
      "strict_min_version": "42.0"
    }
  },
  "name": "xxxx",
  "description": "xxxx",  
  "version": "0.0.0.1",
  "browser_action": {
      "default_popup": "Popup.html"
  },
  "manifest_version": 2,
  "background": {
    "scripts":["jquery.min.js", "background.js"],
    "persistent": true
  },
  "content_scripts": [
    {
      "matches": ["<all_urls>"],
      "js": ["jquery.min.js", "Content.js"]
    }
  ],  
  "web_accessible_resources": [
    "Content.js"
  ],
  "devtools_page": "Devtools.html",
  "permissions": [
    "webRequest",
    "webRequestBlocking",
        "tabs",
        "activeTab",
        "notifications",
        "storage",
        "http://*/",
        "https://*/",
        "<all_urls>"
  ]
}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda