forked from Satsuoni/widevine-l3-guesser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
content_script.js
34 lines (31 loc) · 1.08 KB
/
content_script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
window.addEventListener("PassToBackground", function(evt) {
chrome.runtime.sendMessage(evt.detail.item,response => {
var val=response.value;
if (!val) val=null;
var event = new CustomEvent("BackgroundReply_"+evt.detail.id, {detail: val});
window.dispatchEvent(event);}
);
}, false);
injectScripts();
async function injectScripts()
{
await injectScript('lib/pbf.3.0.5.min.js');
await injectScript('lib/cryptojs-aes_0.2.0.min.js');
await injectScript('protobuf-generated/license_protocol.proto.js');
// await injectScript('wasm/wasm_gsr.js');
await injectScript('content_key_decryption.js');
await injectScript('eme_interception.js');
}
function injectScript(scriptName)
{
return new Promise(function(resolve, reject)
{
var s = document.createElement('script');
s.src = chrome.extension.getURL(scriptName);
s.onload = function() {
this.parentNode.removeChild(this);
resolve(true);
};
(document.head||document.documentElement).appendChild(s);
});
}