-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GM_xmlhttpRequest NetworkError #1172
Comments
This seems to work here pretty good using the script below. Can you please test with a new temporary profile? Tested at
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://*/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @require https://cdnjs.cloudflare.com/ajax/libs/jszip/2.6.0/jszip.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.0/FileSaver.min.js
// @grant GM_xmlhttpRequest
// @connect *
// ==/UserScript==
function urlToBlob(url, fname, zip, tablic){
return new Promise(resolve => {
GM_xmlhttpRequest({
method: "GET",
url: url,
responseType: 'arraybuffer',
onload: function(event) {
console.log(event);
var byteArray = new Uint8Array(event.response);
console.log(zip.file(fname, byteArray, {binary:true, compression: "STORE"}));
tablic[url] = fname;
resolve();
},
onerror: function(res) {
var msg = `An error occurred.
responseText: ${res.responseText}
readyState: ${res.readyState}
responseHeaders: ${res.responseHeaders}
status: ${res.status}
statusText: ${res.statusText}
finalUrl: ${res.finalUrl}
`;
console.log(msg);
resolve();
}
});
});
}
(async () => {
const zip = JSZip();
const tablic = {};
for (let e of [
[ 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==', 'empty.gif' ],
[ 'https://developer.mozilla.org/favicon144.png', 'mozilla.png' ],
[ 'https://www.tampermonkey.net/favicon.ico', 'tampermonkey.ico' ],
[ 'https://user-images.githubusercontent.com/8899307/110259506-e6953d80-7f9f-11eb-8257-2e60a04457e8.png', 'githubusercontent.png' ],
[ 'https://tampermonkey.freetls.fastly.net/images/security.png', 'security.png' ]
]) {
const [ url, name ] = e;
await urlToBlob(url, name, zip, tablic);
}
saveAs(zip.generate({ type: 'blob' }), 'out.zip');
})(); |
firefox containers is the problem here ;/ if i force noncontainer mode tab and run my or your script - it's works as expected, but changing tab to new or old container make this error /then why older TM works but new one no/ |
Tampermonkey now uses another way to forward the XHR's data to the tab. Unfortunately this way seems to be incompatible with containers. Will be fixed soon... |
my userscript stopped downloading img (and pack to zip) in latest TM version (6130)
it only displays a weird error on console and doesn't even "fire" onerror function
Expected Behavior
let it works as previous version i.e. TM 4.11.6120
Actual Behavior
console error
![obraz](https://user-images.githubusercontent.com/8899307/110259506-e6953d80-7f9f-11eb-8257-2e60a04457e8.png)
content.js:102:421 via beautifier in ff-dev:
![obraz](https://user-images.githubusercontent.com/8899307/110259353-1e4fb580-7f9f-11eb-9a69-fae5195df616.png)
i tried to download files from my "server" and i am getting normal requests in logs
(very painfull) downgrade to 6120 fix this situation
Specifications
Script
only small snippets function
zip: is JSZip blob open for writing
I added onerror later (to debug this problem) but it's never fired
The text was updated successfully, but these errors were encountered: