[Pkg-mozext-commits] [greasemonkey] 35/45: Restore the responseType feature for GM_xhr

David Prévot taffit at moszumanska.debian.org
Mon Nov 3 20:59:21 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 63db53b7022653ff1e3da2d0409da380a6816085
Author: Anthony Lieuallen <arantius at gmail.com>
Date:   Thu Oct 16 10:05:52 2014 -0400

    Restore the responseType feature for GM_xhr
    
    Broken by 59f07764b8c975cc3cef451743e3f2754fc95f45 .
    
    Fixes #2032
---
 modules/xmlhttprequester.js | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/modules/xmlhttprequester.js b/modules/xmlhttprequester.js
index 76c3558..92a2b23 100644
--- a/modules/xmlhttprequester.js
+++ b/modules/xmlhttprequester.js
@@ -99,6 +99,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;
@@ -205,10 +208,16 @@ function(wrappedContentWin, req, event, details) {
       // .response).  Ignore.
     }
 
-    if (req.responseXML) {
+    var responseXML = null;
+    try {
+      responseXML = req.responseXML;
+    } catch (e) {
+      // Ignore failure.  At least in responseType blob case, this access fails.
+    }
+    if (responseXML) {
       // Clone the XML object into a content-window-scoped document.
       var xmlDoc = new wrappedContentWin.Document();
-      var clone = xmlDoc.importNode(req.responseXML.documentElement, true);
+      var clone = xmlDoc.importNode(responseXML.documentElement, true);
       xmlDoc.appendChild(clone);
       responseState.responseXML = xmlDoc;
     }

-- 
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