Bug 1367110 - Expose XHRMT's ErrorCode to chrome JS. r=baku
authorChris H-C <chutten@mozilla.com>
Wed, 24 May 2017 08:52:15 -0400
changeset 409743 35d360dce251045e0a9b719fca742772641bbd1b
parent 409742 d632ed767b41d03a42204f303afd07434b4d4ebe
child 409744 91a308b8cbbe6487ae10b980bd8d4ccca2dd003f
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1367110, 1368540
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1367110 - Expose XHRMT's ErrorCode to chrome JS. r=baku This is presently only relevant for XHRMT, so XHRWorker will just report that everything's a-ok for now. As noted inline, the permanence of this measure is to be evaluated in Firefox 60 in bug 1368540. MozReview-Commit-ID: 6gkTyZO388g
dom/webidl/XMLHttpRequest.webidl
dom/xhr/XMLHttpRequest.h
dom/xhr/XMLHttpRequestMainThread.h
dom/xhr/XMLHttpRequestWorker.h
--- a/dom/webidl/XMLHttpRequest.webidl
+++ b/dom/webidl/XMLHttpRequest.webidl
@@ -150,11 +150,16 @@ interface XMLHttpRequest : XMLHttpReques
   attribute ByteString? networkInterfaceId;
 
   [Throws, ChromeOnly, Exposed=Window]
   any getInterface(IID iid);
 
   [ChromeOnly, Exposed=Window]
   void setOriginAttributes(optional OriginAttributesDictionary originAttributes);
 
+  // Only works on MainThread.
+  // Its permanence is to be evaluated in bug 1368540 for Firefox 60.
+  [ChromeOnly]
+  readonly attribute unsigned short errorCode;
+
   readonly attribute boolean mozAnon;
   readonly attribute boolean mozSystem;
 };
--- a/dom/xhr/XMLHttpRequest.h
+++ b/dom/xhr/XMLHttpRequest.h
@@ -163,16 +163,19 @@ public:
   virtual void
   GetInterface(JSContext* aCx, nsIJSID* aIID,
                JS::MutableHandle<JS::Value> aRetval,
                ErrorResult& aRv) = 0;
 
   virtual void
   SetOriginAttributes(const mozilla::dom::OriginAttributesDictionary& aAttrs) = 0;
 
+  virtual uint16_t
+  ErrorCode() const = 0;
+
   virtual bool
   MozAnon() const = 0;
 
   virtual bool
   MozSystem() const = 0;
 
   virtual JSObject*
   WrapObject(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override
--- a/dom/xhr/XMLHttpRequestMainThread.h
+++ b/dom/xhr/XMLHttpRequestMainThread.h
@@ -474,16 +474,22 @@ public:
   GetResponseXML(ErrorResult& aRv) override;
 
   virtual bool
   MozBackgroundRequest() const override;
 
   virtual void
   SetMozBackgroundRequest(bool aMozBackgroundRequest, ErrorResult& aRv) override;
 
+  virtual uint16_t
+  ErrorCode() const override
+  {
+    return static_cast<uint16_t>(mErrorLoad);
+  }
+
   virtual bool
   MozAnon() const override;
 
   virtual bool
   MozSystem() const override;
 
   virtual nsIChannel*
   GetChannel() const override
--- a/dom/xhr/XMLHttpRequestWorker.h
+++ b/dom/xhr/XMLHttpRequestWorker.h
@@ -280,16 +280,21 @@ public:
 
   void
   NullResponseText()
   {
     mStateData.mResponseText.SetVoid();
     mStateData.mResponse.setNull();
   }
 
+  virtual uint16_t ErrorCode() const override
+  {
+    return 0; // eOK
+  }
+
   virtual bool MozAnon() const override
   {
     return mMozAnon;
   }
 
   virtual bool MozSystem() const override
   {
     return mMozSystem;