You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EDIT: further testing led me to narrow it down to Firefox's privacy.firstparty.isolate setting.
I've been periodically testing master branch for compatibility/improvements/etc. and an important function of my scripts stopped working in the latest master/RC.
With 2.12.8 RC1, I am unable to run my userscript to download all images as a zip. Here is a simplified test script which works fine in 2.12.7 stable:
// ==UserScript==// @name BlobTest// @namespace Violentmonkey Scripts// @match *://*.*/*// @grant GM_xmlhttpRequest// @grant GM_registerMenuCommand// @require https://cdn.jsdelivr.net/npm/jszip@3.3.0/dist/jszip.min.js// ==/UserScript==GM_registerMenuCommand("Download Images",()=>{constzip=newJSZip();letrequested=0,completed=0;constimages=document.querySelectorAll(`img[src*='gif'],img[src*='jpg'],img[src*='png']`);images.forEach(img=>{GM_xmlhttpRequest({method: "GET",headers: {"Referer": document.URL},url: img.src,context: ++requested,responseType: "arraybuffer",// blob should work too but throws error even in stable versiononload: response=>{constfilename=("000"+response.context).slice(-3),filexten=[["image/gif","gif"],["image/jpeg","jpg"],["image/png","png"]].find(type=>type[0]==/content-type:\s*([/\w]+)/i.exec(response.responseHeaders)?.[1]);zip.file(`${filename}.${filexten[1]}`,response.response);completed++;}});});letwaiting=setInterval(()=>{if(completed==images.length){clearInterval(waiting);zip.generateAsync({type: "blob"}).then(zipFile=>{constlink=document.createElement("a");link.href=URL.createObjectURL(zipFile);link.download="images.zip";document.body.appendChild(link);link.click();});}},1000);});
Suspecting it may be caused by another extension, I've tested it in a new profile and got the same results.
What is the problem?
Security errors are thrown in the browser console when I try to obtain image data via GM_xhr.
How to reproduce it?
Install VM 2.12.8 RC 1 & test script.
Open Browser Console (Ctrl + Shift + J) and enable Content Messages from the settings cog.
Visit any website with images and invoke the command from the VM browser action popup.
What is the expected result?
After a moment, an images.zip download prompt should appear. The zip should contain all gif, jpg, and png images from the current page.
What is the actual result?
No images downloaded and errors in Browser Console: Security Error: Content at <CURRENT URL> may not load data from blob:moz-extension://... Security Error: Content at moz-extension://... may not load data from blob:moz-extension://... TypeError: NetworkError when attempting to fetch resource.
... for each attempt to download an image.
Environment
Browser: Firefox
Browser version: 74.0 (64-bit)
Violentmonkey version: 2.12.8 Release Candidate 1
OS: Windows 10 1809
The text was updated successfully, but these errors were encountered:
This is a known bug in FF: it applies page CSP to extension content scripts.
Interestingly, there's no problem in FF 68 ESR.
I've disabled the fast internal blob transfer in FF regardless of the version: 4b2d257.
If someone doesn't like that, post a convincing use case in https://bugzil.la/1294996.
Firefox CSP strikes again! Thank you for the quick investigation and solution. Was FPI also the breaking point in your testing as well? Maybe the FF bug will get a bit more attention if that can be confirmed.
EDIT: further testing led me to narrow it down to Firefox's privacy.firstparty.isolate setting.
I've been periodically testing master branch for compatibility/improvements/etc. and an important function of my scripts stopped working in the latest master/RC.
With 2.12.8 RC1, I am unable to run my userscript to download all images as a zip. Here is a simplified test script which works fine in 2.12.7 stable:
Suspecting it may be caused by another extension, I've tested it in a new profile and got the same results.What is the problem?
Security errors are thrown in the browser console when I try to obtain image data via GM_xhr.
How to reproduce it?
What is the expected result?
After a moment, an images.zip download prompt should appear. The zip should contain all gif, jpg, and png images from the current page.
What is the actual result?
No images downloaded and errors in Browser Console:
Security Error: Content at <CURRENT URL> may not load data from blob:moz-extension://...
Security Error: Content at moz-extension://... may not load data from blob:moz-extension://...
TypeError: NetworkError when attempting to fetch resource.
... for each attempt to download an image.
Environment
The text was updated successfully, but these errors were encountered: