[Pkg-mozext-commits] [greasemonkey] 06/15: Add `responseType` GM_xmlhttpRequest option.

David Prévot taffit at moszumanska.debian.org
Mon Mar 31 21:59:09 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository greasemonkey.

commit ba9e9eae9f22c9afcdb9dc3d31a91ecd2909ca70
Author: Anthony Lieuallen <arantius at gmail.com>
Date:   Fri Mar 21 11:28:44 2014 -0400

    Add `responseType` GM_xmlhttpRequest option.
    
    Fixes #1834
---
 modules/xmlhttprequester.js | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/modules/xmlhttprequester.js b/modules/xmlhttprequester.js
index 1fd5e6d..e02b8d2 100644
--- a/modules/xmlhttprequester.js
+++ b/modules/xmlhttprequester.js
@@ -102,7 +102,9 @@ function(safeUrl, details, req) {
   if (details.overrideMimeType) {
     req.overrideMimeType(details.overrideMimeType);
   }
-
+  if (details.responseType) {
+    req.responseType = details.responseType;
+  }
   if (details.timeout) {
     req.timeout = details.timeout;
   }
@@ -174,6 +176,7 @@ function(wrappedContentWin, req, event, details) {
           lengthComputable: "r",
           loaded: "r",
           readyState: "r",
+          response: "r",
           responseHeaders: "r",
           responseText: "r",
           status: "r",
@@ -183,14 +186,22 @@ function(wrappedContentWin, req, event, details) {
       context: details.context || null,
       // Can't support responseXML because security won't
       // let the browser call properties on it.
-      responseText: req.responseText,
       readyState: req.readyState,
+      response: req.response,
       responseHeaders: null,
+      responseText: null,
       status: null,
       statusText: null,
       finalUrl: null
     };
 
+    try {
+      responseState.responseText = req.responseText;
+    } catch (e) {
+      // Some response types don't have .responseText (but do have e.g. blob
+      // .response).  Ignore.
+    }
+
     switch (event) {
       case "progress":
         responseState.lengthComputable = evt.lengthComputable;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/greasemonkey.git



More information about the Pkg-mozext-commits mailing list