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

198
Visualizações
XMLHttpRequest working on chrome but not in firefox

I'm currently working on an extension to integrate two systems at my work, The chrome extension is running just fine and working well, but my team also asked for a firefox version, in firefox I'm having trouble with the xmlhttprequest(),

the function that calls the request is this one:

function getModelList(API_KEY)
{
  return new Promise(resolve => {
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.open( "POST", 'http://10.255.12.128/api/get_models/', true );
    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttp.onload = function(e) {
      resolve(xmlHttp.response);
    };
    xmlHttp.onerror = function (e) {
      resolve(undefined);
      console.error("** An error occurred during the XMLHttpRequest");

    };
    xmlHttp.send( 'API_KEY='+API_KEY );
  })
}

(I know it not secure to send the API_KEY in the POST, but it only runs in our localnetwork so its probably fine for now)

When I run it, it goes direcly to onerror, It is faster then the timeout, and don't show in the network tab on inspection, I think I need to give it some permissions or something in firefox so it can run?

also, the manifest for the extension is this one(maybe the problem is here?):

{
    "name" : "Zabbix-Bitrix Integration",
    "version": "0.0.4",
    "manifest_version": 2,
    "description" : "Insere funções extras ao zabbix",
    
    "options_ui": {
        "page": "options.html",
        "open_in_tab": false,
        "browser_style": true,
        "chrome_style": true
    },

    "content_scripts" : [
        {
            "js" : ["init.js"],
            "css": ["styles.css"],
            "matches" : ["*://zabbix.monitor.redeunifique.com.br/zabbix.php?action=problem.view*"]
        }
    ],
    "permissions": ["storage","webRequest"]
}

@edit, after some digging, found an error message: Error: Got a request http://10.255.12.128/api/get_models/ without a browsingContextID set

The function that calls the error has this comment:

// Ensure that we have a browsing context ID for all requests when debugging a tab (=`browserId` is defined).
// Only privileged requests debugged via the Browser Toolbox (=`browserId` null) can be unrelated to any browsing context.
if (!this._browsingContextID && this._networkEventWatcher.browserId) {
  throw new Error(
    `Got a request ${this._request.url} without a browsingContextID set`
  );
}

How and where do I set this Context ID ?

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