// background 虽然天然可以跨域,然而既然是后台就没有 cookie 的概念,即使 fetch 设置了 credentials, cookie 依然不会被保存 // http://stackoverflow.com/questions/29251842/why-new-js-fetch-standard-forbid-response-header-name-as-set-cookie-1-2 // const { createFFmpeg, fetchFile } = FFmpeg; // async function test(){ // const ffmpeg = createFFmpeg({log: true}); // await ffmpeg.load(); // console.log(ffmpeg); // }; // test(); const videos = {}; window.videos = videos; /** * data: fr.result, size: blobData.size, mimeType: blobData.type, name: document.title, action: 'data' */ chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => { // console.log("Received %o from %o, frame", msg, sender.tab, sender.frameId); sendResponse("Gotcha!"); if(msg.action === 'end'){ return download(sender.documentId); } if(!msg.data || msg.size !== msg.data.length){ return console.warn('data received error: ', msg.name); } const blobAsBinString = msg.data; const bytes = new Uint8Array(blobAsBinString.length); for(let i=0,len=blobAsBinString.length; i { delete videos[id]; }); }; // chrome.webNavigation.onCompleted chrome.webNavigation.onBeforeNavigate.addListener(frame => { // chrome.webNavigation.getFrame({ // frameId: frame.frameId, // tabId: frame.tabId // }, details => { // alert(JSON.stringify(details)); // }); }); // chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { // chrome.webNavigation.getAllFrames({tabId: tabId}, function(details) { // details.forEach(function(frame) { // console.log(tabId); // // chrome.tabs.sendMessage( // // tabId, // // {text: 'hey_cs'}, // // {frameId: frame.frameId}, // // function(response) { console.log(response) } // // ); // }); // }); // });