]> git.parisson.com Git - pdf.js.git/commitdiff
Skipping HTTP POST requests in the addon
authornotmasteryet <async.processingjs@yahoo.com>
Thu, 23 Feb 2012 03:52:29 +0000 (21:52 -0600)
committernotmasteryet <async.processingjs@yahoo.com>
Thu, 23 Feb 2012 03:52:29 +0000 (21:52 -0600)
extensions/firefox/components/PdfStreamConverter.js

index 06db4e2d3f6052d673ca6e4d442218a50dab659f..c6dab9ba70a41a9981d155f6b2c295af615f5637 100644 (file)
@@ -124,6 +124,19 @@ PdfStreamConverter.prototype = {
   asyncConvertData: function(aFromType, aToType, aListener, aCtxt) {
     if (!Services.prefs.getBoolPref('extensions.pdf.js.active'))
       throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+
+    // Ignoring HTTP POST requests -- pdf.js has to repeat the request.
+    var skipConversion = false;
+    try {
+      var request = aCtxt;
+      request.QueryInterface(Ci.nsIHttpChannel);
+      skipConversion = (request.requestMethod === 'POST');
+    } catch (e) {
+      // Non-HTTP request... continue normally.
+    }
+    if (skipConversion)
+      throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+
     // Store the listener passed to us
     this.listener = aListener;
   },