Просмотр исходного кода

fixed arraybuffer support for GM_xmlhttpRequest

Gerald 11 лет назад
Родитель
Сommit
2a7a84065e
2 измененных файлов с 6 добавлено и 3 удалено
  1. 5 2
      injected.js
  2. 1 1
      manifest.json

+ 5 - 2
injected.js

@@ -222,8 +222,9 @@ var comm={
 										if(details.responseType=='blob') {
 											this.data.push(new Blob([b],{type:m[1]}));
 										} else {	// arraybuffer
-											this.data.push(m=new Uint8Array(b.length));
+											m=new Uint8Array(b.length);
 											for(i=0;i<b.length;i++) m[i]=b.charCodeAt(i);
+											this.data.push(m.buffer);
 										}
 									}
 								} else if(details.responseType=='json')	// json
@@ -347,10 +348,12 @@ function httpRequest(details) {
 		var data={
 			readyState: req.readyState,
 			responseHeaders: req.getAllResponseHeaders(),
-			responseText: req.responseText,
 			status: req.status,
 			statusText: req.statusText
 		},r;
+		try {
+			data.responseText=req.responseText;
+		} catch(e) {}
 		if(req.response&&req.responseType=='blob') {
 			r=new FileReader();
 			r.onload=function(e){

+ 1 - 1
manifest.json

@@ -1,6 +1,6 @@
 {
 	"name": "Violent monkey",
-	"version" : "2.1.4",
+	"version" : "2.1.4.1",
 	"manifest_version" : 2,
 	"description" : "__MSG_extDescription__",
 	"developer": {"name" : "Gerald", "url" : "http://geraldl.ml"},