Bug 1087633 - Filter out XPConnect wrapped input streams. r=bz, a=lmandel
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Sun, 02 Nov 2014 22:01:55 +0200
changeset 225919 72938afdf993
parent 225918 a02835abdd00
child 225920 8e198451a01a
child 225922 3d4fae4b0e99
child 225924 cdd31f8931ae
push id4067
push userryanvm@gmail.com
push date2014-11-03 16:24 +0000
treeherdermozilla-beta@72938afdf993 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, lmandel
bugs1087633
milestone34.0
Bug 1087633 - Filter out XPConnect wrapped input streams. r=bz, a=lmandel
content/base/src/nsXMLHttpRequest.h
--- a/content/base/src/nsXMLHttpRequest.h
+++ b/content/base/src/nsXMLHttpRequest.h
@@ -22,17 +22,18 @@
 #include "nsIHttpHeaderVisitor.h"
 #include "nsIProgressEventSink.h"
 #include "nsJSUtils.h"
 #include "nsTArray.h"
 #include "nsITimer.h"
 #include "nsIPrincipal.h"
 #include "nsIScriptObjectPrincipal.h"
 #include "nsISizeOfEventTarget.h"
-
+#include "nsIXPConnect.h"
+#include "nsIInputStream.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/DOMEventTargetHelper.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/dom/TypedArray.h"
 #include "mozilla/dom/XMLHttpRequestBinding.h"
 
 #ifdef Status
 /* Xlib headers insist on this for some reason... Nuke it because
@@ -460,16 +461,21 @@ public:
   }
   void Send(nsFormData& aFormData, ErrorResult& aRv)
   {
     aRv = Send(RequestBody(aFormData));
   }
   void Send(nsIInputStream* aStream, ErrorResult& aRv)
   {
     NS_ASSERTION(aStream, "Null should go to string version");
+    nsCOMPtr<nsIXPConnectWrappedJS> wjs = do_QueryInterface(aStream);
+    if (wjs) {
+      aRv.Throw(NS_ERROR_DOM_TYPE_ERR);
+      return;
+    }
     aRv = Send(RequestBody(aStream));
   }
   void SendAsBinary(const nsAString& aBody, ErrorResult& aRv);
 
   void Abort();
 
   // response
   void GetResponseURL(nsAString& aUrl);