Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Mocking AudioContext by injecting Javascript #12409

Closed
prokls opened this issue Jul 29, 2014 · 1 comment
Closed

Mocking AudioContext by injecting Javascript #12409

prokls opened this issue Jul 29, 2014 · 1 comment
Labels

Comments

@prokls
Copy link

prokls commented Jul 29, 2014

Hi,

I have the following usecase: I want to test a software which uses the AudioContext object. I would like to mock it. Be aware that AudioContext is used in the global scope by this software ("audio = new AudioContext()"). So I want to inject Javascript when the first <script> tag was read, but none is executed yet. Now several approaches came to my mind:

  • Using an event such as onInitialized combined with injectJS to inject javascript code. I tried several approaches, but none provided the correct event.
  • Intercept the onResourceReceived event and add the javascript code to the body of the response. This does not work, because the response body is not modifiable (yet?).

I would really prefer approaches which do not require additional libraries or additional setup. Do you have any suggestions for this usecase?

@stale stale bot added the stale label Dec 27, 2019
@stale
Copy link

stale bot commented Dec 30, 2019

Due to our very limited maintenance capacity, we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed (see #15395 for more details). In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!

@stale stale bot closed this as completed Dec 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant