Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
Hold HTTP request with chrome.webRequest until some async function is resolved

Basically I need to stop an HTTP request, send it to an app to determine weather or not it should be blocked and then take the appropriate action. A simplified version of the code would look something like:

chrome.webRequest.onBeforeSendHeaders.addListener( async details => {
        let policy = await getPolicy(details); 
        return {cancel: result}
    },
    {urls: ["<all_urls>"]},
    ["requestHeaders", "blocking"]
);

with the getPolicy function sending the info to a policy server to determine weather or not to block the request and then return a boolean result. The problem boils down to while I am waiting for a policy result the listener doesn't continue to hold the request but just allows all request through before a result is returned. I based this current code off of the similar question here: https://stackoverflow.com/a/57301607/16531716 That answer however doesn't seem to actually work. (I am using Manifest V2 because that is the only way I can use the blocking permission. MV2 doesn't normally support async operations but I'm also using the Mozilla polyfill module to add them so that isn't the issue)

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda