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

193
Vistas
DevToolsProtocol, Runtime.evaluate against worker execution context

In the console of chrome devtools there is a dropdown at the top to select the execution context.

Here is an example when on www.google.com

enter image description here

Changing the execution context changes the available global variables and what any console invoked .js can access

I'm trying to run some javascript via ChromeDevtools Protocol using the Runtime.evaluate function and I need to run it in the worker context.

Checking the CDP docs, I see that Runtime.evaluate takes a parameter ExecutionContextId. I initially made the assumption that the execution contexts via the DevTools window dropdown would be the same as this parameter. The only way I've worked out how to get a list of the the current ExecutionContextId's is to subscribe to the Runtime.executionContextCreated event then do a Runtime.disable followed by a Runtime.enable which causes an ExecutionContextDiscription to be received by the eventhandler for each loaded context.

However after looking though the ExecutionContextDescription's returned, some match those in the dropdown, but an execution context describing the worker is never returned.

How does one execute js in a worker execution context via CDP, as is trivially done in ChromeDevtools window ?

about 4 years ago · Santiago Trujillo
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