I need to extend the Audio object to provide a stop function. Normally this code would work:
Audio.prototype.stop = function() {
this.pause();
this.currentTime = 0;
}
However, I need this to happen from within a content script of a Chrome Extension, and as the contexts are separate the change does not propagate to the other context.
I have tried using this unsafeWindow
hack to attempt to break out of the isolated environment, with no success, as well as attempting to use Object.create and set the constructor
property.