Bug 1146059 - Remove Response.finalURL. r=ehsan
authorNikhil Marathe <nsm.nikhil@gmail.com>
Sat, 21 Mar 2015 17:49:29 -0700
changeset 235131 f55f24f650e1c898501e2f5a5abb62302be48b05
parent 235130 734541f861ceea74d3138b09c2e0e4e1cc1ec4de
child 235132 6a639c5517e34f0df0b4a7c6b7137a7ddf636ad6
push id57349
push usernsm.nikhil@gmail.com
push dateMon, 23 Mar 2015 21:45:43 +0000
treeherdermozilla-inbound@2e4fa9ce9708 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1146059
milestone39.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 1146059 - Remove Response.finalURL. r=ehsan
dom/fetch/Response.cpp
dom/fetch/Response.h
dom/tests/mochitest/fetch/test_response.js
dom/webidl/Response.webidl
--- a/dom/fetch/Response.cpp
+++ b/dom/fetch/Response.cpp
@@ -223,23 +223,10 @@ Headers*
 Response::Headers_()
 {
   if (!mHeaders) {
     mHeaders = new Headers(mOwner, mInternalResponse->Headers());
   }
 
   return mHeaders;
 }
-
-void
-Response::SetFinalURL(bool aFinalURL, ErrorResult& aRv)
-{
-  nsCString url;
-  mInternalResponse->GetUrl(url);
-  if (url.IsEmpty()) {
-    aRv.ThrowTypeError(MSG_RESPONSE_URL_IS_NULL);
-    return;
-  }
-
-  mInternalResponse->SetFinalURL(aFinalURL);
-}
 } // namespace dom
 } // namespace mozilla
--- a/dom/fetch/Response.h
+++ b/dom/fetch/Response.h
@@ -51,25 +51,16 @@ public:
   void
   GetUrl(DOMString& aUrl) const
   {
     nsCString url;
     mInternalResponse->GetUrl(url);
     aUrl.AsAString() = NS_ConvertUTF8toUTF16(url);
   }
 
-  bool
-  GetFinalURL(ErrorResult& aRv) const
-  {
-    return mInternalResponse->FinalURL();
-  }
-
-  void
-  SetFinalURL(bool aFinalURL, ErrorResult& aRv);
-
   uint16_t
   Status() const
   {
     return mInternalResponse->GetStatus();
   }
 
   bool
   Ok() const
--- a/dom/tests/mochitest/fetch/test_response.js
+++ b/dom/tests/mochitest/fetch/test_response.js
@@ -116,35 +116,16 @@ function testOk() {
 
   var r3 = new Response("", { status: 299});
   ok(r3.ok, "Response with status 299 should have ok true");
 
   var r4 = new Response("", { status: 302});
   ok(!r4.ok, "Response with status 302 should have ok false");
 }
 
-// It is not possible to test setting finalURL until we have ServiceWorker
-// interception. This is because synthetic Responses do not have a url, the url
-// is set based on the request, so a SW could initiate a fetch() on behalf of
-// a client and set the resulting Response's finalURL before returning it to
-// the client, in which case the "set response's url to request's url" from the
-// client's point of view would not happen. A test for this will be added by
-// Bug 1134352.
-function testFinalURL() {
-  var r1 = new Response();
-  ok(!r1.finalURL, "Response.finalURL is false by default.");
-
-  try {
-    r1.finalURL = true;
-    ok(false, "Setting Response.finalURL of Response with null url should fail.");
-  } catch(e) {
-    ok(true, "Setting Response.finalURL of Response with null url should fail.");
-  }
-}
-
 function testBodyUsed() {
   var res = new Response("Sample body");
   ok(!res.bodyUsed, "bodyUsed is initially false.");
   return res.text().then((v) => {
     is(v, "Sample body", "Body should match");
     ok(res.bodyUsed, "After reading body, bodyUsed should be true.");
   }).then(() => {
     return res.blob().then((v) => {
@@ -221,17 +202,16 @@ function testBodyExtraction() {
   })
 }
 
 function runTest() {
   testDefaultCtor();
   testError();
   testRedirect();
   testOk();
-  testFinalURL();
 
   return Promise.resolve()
     .then(testBodyCreation)
     .then(testBodyUsed)
     .then(testBodyExtraction)
     .then(testClone)
     // Put more promise based tests here.
 }
--- a/dom/webidl/Response.webidl
+++ b/dom/webidl/Response.webidl
@@ -12,18 +12,16 @@
 interface Response {
   [NewObject] static Response error();
   [Throws,
    NewObject] static Response redirect(USVString url, optional unsigned short status = 302);
 
   readonly attribute ResponseType type;
 
   readonly attribute USVString url;
-  [Throws]
-           attribute boolean finalURL;
   readonly attribute unsigned short status;
   readonly attribute boolean ok;
   readonly attribute ByteString statusText;
   [SameObject] readonly attribute Headers headers;
 
   [Throws,
    NewObject] Response clone();
 };