Backed out changeset 62b55b1f9b7e for wrong bug number ON CLOSED TREE
authorNikhil Marathe <nsm.nikhil@gmail.com>
Fri, 20 Mar 2015 08:43:59 -0700
changeset 263613 8deee34f9ea2bbe1b241345e0f21f62b72694a88
parent 263612 f33123f726b6a127aa3065fa049823c25d58a36c
child 263614 0f7f9fc972cf8f1b33ea6b9bded9b9329762fe33
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone39.0a1
backs out62b55b1f9b7e19be8a69d45076c391bc57439561
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
Backed out changeset 62b55b1f9b7e for wrong bug number ON CLOSED TREE
dom/webidl/FetchEvent.webidl
dom/workers/ServiceWorkerEvents.cpp
dom/workers/ServiceWorkerEvents.h
dom/workers/test/serviceworkers/fetch/fetch_tests.js
dom/workers/test/serviceworkers/fetch_event_worker.js
--- a/dom/webidl/FetchEvent.webidl
+++ b/dom/webidl/FetchEvent.webidl
@@ -13,16 +13,15 @@
 interface FetchEvent : Event {
   readonly attribute Request request;
 
   // https://github.com/slightlyoff/ServiceWorker/issues/631
   readonly attribute Client? client; // The window issuing the request.
   readonly attribute boolean isReload;
 
   [Throws] void respondWith(Promise<Response> r);
-  [Throws] void respondWith(Response r);
 };
 
 dictionary FetchEventInit : EventInit {
   Request request;
   Client client;
   boolean isReload;
 };
--- a/dom/workers/ServiceWorkerEvents.cpp
+++ b/dom/workers/ServiceWorkerEvents.cpp
@@ -18,18 +18,16 @@
 
 #include "mozilla/dom/FetchEventBinding.h"
 #include "mozilla/dom/PromiseNativeHandler.h"
 #include "mozilla/dom/Request.h"
 #include "mozilla/dom/Response.h"
 #include "mozilla/dom/WorkerScope.h"
 #include "mozilla/dom/workers/bindings/ServiceWorker.h"
 
-#include "WorkerPrivate.h"
-
 using namespace mozilla::dom;
 
 BEGIN_WORKERS_NAMESPACE
 
 FetchEvent::FetchEvent(EventTarget* aOwner)
 : Event(aOwner, nullptr, nullptr)
 , mIsReload(false)
 , mWaitToRespond(false)
@@ -280,36 +278,16 @@ FetchEvent::RespondWith(Promise& aPromis
     return;
   }
 
   mWaitToRespond = true;
   nsRefPtr<RespondWithHandler> handler = new RespondWithHandler(mChannel, mServiceWorker);
   aPromise.AppendNativeHandler(handler);
 }
 
-void
-FetchEvent::RespondWith(Response& aResponse, ErrorResult& aRv)
-{
-  if (mWaitToRespond) {
-    aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
-    return;
-  }
-
-  WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
-  MOZ_ASSERT(worker);
-  worker->AssertIsOnWorkerThread();
-  nsRefPtr<Promise> promise = Promise::Create(worker->GlobalScope(), aRv);
-  if (NS_WARN_IF(aRv.Failed())) {
-    return;
-  }
-  promise->MaybeResolve(&aResponse);
-
-  RespondWith(*promise, aRv);
-}
-
 already_AddRefed<ServiceWorkerClient>
 FetchEvent::GetClient()
 {
   if (!mClient) {
     if (!mClientInfo) {
       return nullptr;
     }
 
--- a/dom/workers/ServiceWorkerEvents.h
+++ b/dom/workers/ServiceWorkerEvents.h
@@ -6,17 +6,16 @@
 #ifndef mozilla_dom_workers_serviceworkerevents_h__
 #define mozilla_dom_workers_serviceworkerevents_h__
 
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/ExtendableEventBinding.h"
 #include "mozilla/dom/FetchEventBinding.h"
 #include "mozilla/dom/InstallEventBinding.h"
 #include "mozilla/dom/Promise.h"
-#include "mozilla/dom/Response.h"
 #include "nsProxyRelease.h"
 
 class nsIInterceptedChannel;
 
 namespace mozilla {
 namespace dom {
   class Request;
 } // namespace dom
@@ -79,19 +78,16 @@ public:
   IsReload() const
   {
     return mIsReload;
   }
 
   void
   RespondWith(Promise& aPromise, ErrorResult& aRv);
 
-  void
-  RespondWith(Response& aResponse, ErrorResult& aRv);
-
   already_AddRefed<Promise>
   ForwardTo(const nsAString& aUrl);
 
   already_AddRefed<Promise>
   Default();
 };
 
 class ExtendableEvent : public Event
--- a/dom/workers/test/serviceworkers/fetch/fetch_tests.js
+++ b/dom/workers/test/serviceworkers/fetch/fetch_tests.js
@@ -22,22 +22,16 @@ function fetch(name, onload, onerror, he
 }
 
 fetch('synthesized.txt', function(xhr) {
   my_ok(xhr.status == 200, "load should be successful");
   my_ok(xhr.responseText == "synthesized response body", "load should have synthesized response");
   finish();
 });
 
-fetch('test-respondwith-response.txt', function(xhr) {
-  my_ok(xhr.status == 200, "test-respondwith-response load should be successful");
-  my_ok(xhr.responseText == "test-respondwith-response response body", "load should have response");
-  finish();
-});
-
 fetch('synthesized-404.txt', function(xhr) {
   my_ok(xhr.status == 404, "load should 404");
   my_ok(xhr.responseText == "synthesized response body", "404 load should have synthesized response");
   finish();
 });
 
 fetch('synthesized-headers.txt', function(xhr) {
   my_ok(xhr.status == 200, "load should be successful");
--- a/dom/workers/test/serviceworkers/fetch_event_worker.js
+++ b/dom/workers/test/serviceworkers/fetch_event_worker.js
@@ -16,20 +16,16 @@ onfetch = function(ev) {
       new Response("synthesized response body", {
         headers: {
           "X-Custom-Greeting": "Hello"
         }
       })
     ));
   }
 
-  else if (ev.request.url.contains("test-respondwith-response.txt")) {
-    ev.respondWith(new Response("test-respondwith-response response body", {}));
-  }
-
   else if (ev.request.url.contains("ignored.txt")) {
   }
 
   else if (ev.request.url.contains("rejected.txt")) {
     ev.respondWith(Promise.reject());
   }
 
   else if (ev.request.url.contains("nonresponse.txt")) {