Backed out changeset c1596bee956c (bug 884279) because of build bustage
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 19 Jun 2013 21:57:57 -0400
changeset 135755 6208332c8b0430bddea134948d8068f235806f42
parent 135754 2e39187b8199a31a7b8af86b38994ef202361f76
child 135756 3a85eb8af304372852598e39f5b39627c85fdcd0
push id29804
push usereakhgari@mozilla.com
push dateThu, 20 Jun 2013 01:58:09 +0000
treeherdermozilla-inbound@6208332c8b04 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs884279
milestone24.0a1
backs outc1596bee956c700875d972f4d20bb462603cfb76
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 c1596bee956c (bug 884279) because of build bustage
b2g/app/b2g.js
dom/bindings/Bindings.conf
dom/future/Future.cpp
dom/future/Future.h
dom/future/FutureCallback.cpp
dom/future/FutureCallback.h
dom/future/FutureResolver.cpp
dom/future/FutureResolver.h
dom/future/Makefile.in
dom/future/moz.build
dom/future/tests/Makefile.in
dom/future/tests/moz.build
dom/future/tests/test_future.html
dom/future/tests/test_resolve.html
dom/moz.build
dom/promise/Makefile.in
dom/promise/Promise.cpp
dom/promise/Promise.h
dom/promise/PromiseCallback.cpp
dom/promise/PromiseCallback.h
dom/promise/PromiseResolver.cpp
dom/promise/PromiseResolver.h
dom/promise/moz.build
dom/promise/tests/Makefile.in
dom/promise/tests/moz.build
dom/promise/tests/test_promise.html
dom/promise/tests/test_resolve.html
dom/webidl/Future.webidl
dom/webidl/Promise.webidl
dom/webidl/WebIDL.mk
layout/build/Makefile.in
modules/libpref/src/init/all.js
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -728,11 +728,11 @@ pref("captivedetect.canonicalURL", "http
 pref("captivedetect.canonicalContent", "success\n");
 
 // The url of the manifest we use for ADU pings.
 pref("ping.manifestURL", "https://marketplace.firefox.com/packaged.webapp");
 
 // Enable the disk space watcher
 pref("disk_space_watcher.enabled", true);
 
-// Enable promise
-pref("dom.promise.enabled", false);
+// Enable future
+pref("dom.future.enabled", false);
 
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -398,16 +398,20 @@ DOMInterfaces = {
     'skipGen': True,
     'nativeType': 'JSObject'
 }],
 
 'FocusEvent': {
     'nativeType': 'nsDOMFocusEvent',
 },
 
+'Future': {
+    'implicitJSContext': [ 'constructor' ]
+},
+
 'GainNode': {
     'resultNotAddRefed': [ 'gain' ],
 },
 
 'Geolocation': {
     'headerFile': 'nsGeolocation.h'
 },
 
@@ -761,20 +765,16 @@ DOMInterfaces = {
 'Position': {
     'headerFile': 'nsGeoPosition.h'
 },
 
 'PositionError': {
     'headerFile': 'nsGeolocation.h'
 },
 
-'Promise': {
-    'implicitJSContext': [ 'constructor' ]
-},
-
 'PropertyNodeList': {
     'headerFile': 'HTMLPropertiesCollection.h',
     'resultNotAddRefed': [ 'item' ]
 },
 
 'Range': {
     'nativeType': 'nsRange',
     'resultNotAddRefed': [ 'startContainer', 'endContainer', 'commonAncestorContainer' ],
rename from dom/promise/Promise.cpp
rename to dom/future/Future.cpp
--- a/dom/promise/Promise.cpp
+++ b/dom/future/Future.cpp
@@ -1,257 +1,257 @@
 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "mozilla/dom/Promise.h"
-#include "mozilla/dom/PromiseBinding.h"
-#include "mozilla/dom/PromiseResolver.h"
+#include "mozilla/dom/Future.h"
+#include "mozilla/dom/FutureBinding.h"
+#include "mozilla/dom/FutureResolver.h"
 #include "mozilla/Preferences.h"
-#include "PromiseCallback.h"
+#include "FutureCallback.h"
 #include "nsContentUtils.h"
 #include "nsPIDOMWindow.h"
 
 namespace mozilla {
 namespace dom {
 
-// PromiseTask
+// FutureTask
 
-// This class processes the promise's callbacks with promise's result.
-class PromiseTask MOZ_FINAL : public nsRunnable
+// This class processes the future's callbacks with future's result.
+class FutureTask MOZ_FINAL : public nsRunnable
 {
 public:
-  PromiseTask(Promise* aPromise)
-    : mPromise(aPromise)
+  FutureTask(Future* aFuture)
+    : mFuture(aFuture)
   {
-    MOZ_ASSERT(aPromise);
-    MOZ_COUNT_CTOR(PromiseTask);
+    MOZ_ASSERT(aFuture);
+    MOZ_COUNT_CTOR(FutureTask);
   }
 
-  ~PromiseTask()
+  ~FutureTask()
   {
-    MOZ_COUNT_DTOR(PromiseTask);
+    MOZ_COUNT_DTOR(FutureTask);
   }
 
   NS_IMETHOD Run()
   {
-    mPromise->mTaskPending = false;
-    mPromise->RunTask();
+    mFuture->mTaskPending = false;
+    mFuture->RunTask();
     return NS_OK;
   }
 
 private:
-  nsRefPtr<Promise> mPromise;
+  nsRefPtr<Future> mFuture;
 };
 
-// Promise
+// Future
 
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Promise)
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Future)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mResolver)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mResolveCallbacks);
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mRejectCallbacks);
   tmp->mResult = JSVAL_VOID;
   NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Promise)
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Future)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mResolver)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mResolveCallbacks);
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mRejectCallbacks);
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
-NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(Promise)
+NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(Future)
   NS_IMPL_CYCLE_COLLECTION_TRACE_JSVAL_MEMBER_CALLBACK(mResult)
   NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
 NS_IMPL_CYCLE_COLLECTION_TRACE_END
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(Promise)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(Promise)
+NS_IMPL_CYCLE_COLLECTING_ADDREF(Future)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(Future)
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Promise)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Future)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
-Promise::Promise(nsPIDOMWindow* aWindow)
+Future::Future(nsPIDOMWindow* aWindow)
   : mWindow(aWindow)
   , mResult(JS::UndefinedValue())
   , mState(Pending)
   , mTaskPending(false)
 {
-  MOZ_COUNT_CTOR(Promise);
-  NS_HOLD_JS_OBJECTS(this, Promise);
+  MOZ_COUNT_CTOR(Future);
+  NS_HOLD_JS_OBJECTS(this, Future);
   SetIsDOMBinding();
 
-  mResolver = new PromiseResolver(this);
+  mResolver = new FutureResolver(this);
 }
 
-Promise::~Promise()
+Future::~Future()
 {
   mResult = JSVAL_VOID;
-  NS_DROP_JS_OBJECTS(this, Promise);
-  MOZ_COUNT_DTOR(Promise);
+  NS_DROP_JS_OBJECTS(this, Future);
+  MOZ_COUNT_DTOR(Future);
 }
 
 JSObject*
-Promise::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
+Future::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
 {
-  return PromiseBinding::Wrap(aCx, aScope, this);
+  return FutureBinding::Wrap(aCx, aScope, this);
 }
 
 /* static */ bool
-Promise::PrefEnabled()
+Future::PrefEnabled()
 {
-  return Preferences::GetBool("dom.promise.enabled", false);
+  return Preferences::GetBool("dom.future.enabled", false);
 }
 
-/* static */ already_AddRefed<Promise>
-Promise::Constructor(const GlobalObject& aGlobal, JSContext* aCx,
-                     PromiseInit& aInit, ErrorResult& aRv)
+/* static */ already_AddRefed<Future>
+Future::Constructor(const GlobalObject& aGlobal, JSContext* aCx,
+                    FutureInit& aInit, ErrorResult& aRv)
 {
   MOZ_ASSERT(PrefEnabled());
 
   nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.Get());
   if (!window) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return nullptr;
   }
 
-  nsRefPtr<Promise> promise = new Promise(window);
+  nsRefPtr<Future> future = new Future(window);
 
-  aInit.Call(promise, *promise->mResolver, aRv,
+  aInit.Call(future, *future->mResolver, aRv,
              CallbackObject::eRethrowExceptions);
   aRv.WouldReportJSException();
 
   if (aRv.IsJSException()) {
     Optional<JS::Handle<JS::Value> > value(aCx);
     aRv.StealJSException(aCx, &value.Value());
-    promise->mResolver->Reject(aCx, value);
+    future->mResolver->Reject(aCx, value);
   }
 
-  return promise.forget();
+  return future.forget();
 }
 
-/* static */ already_AddRefed<Promise>
-Promise::Resolve(const GlobalObject& aGlobal, JSContext* aCx,
-                 JS::Handle<JS::Value> aValue, ErrorResult& aRv)
-{
-  MOZ_ASSERT(PrefEnabled());
-
-  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.Get());
-  if (!window) {
-    aRv.Throw(NS_ERROR_UNEXPECTED);
-    return nullptr;
-  }
-
-  nsRefPtr<Promise> promise = new Promise(window);
-
-  Optional<JS::Handle<JS::Value> > value(aCx, aValue);
-  promise->mResolver->Resolve(aCx, value);
-  return promise.forget();
-}
-
-/* static */ already_AddRefed<Promise>
-Promise::Reject(const GlobalObject& aGlobal, JSContext* aCx,
+/* static */ already_AddRefed<Future>
+Future::Resolve(const GlobalObject& aGlobal, JSContext* aCx,
                 JS::Handle<JS::Value> aValue, ErrorResult& aRv)
 {
   MOZ_ASSERT(PrefEnabled());
 
   nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.Get());
   if (!window) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return nullptr;
   }
 
-  nsRefPtr<Promise> promise = new Promise(window);
+  nsRefPtr<Future> future = new Future(window);
 
   Optional<JS::Handle<JS::Value> > value(aCx, aValue);
-  promise->mResolver->Reject(aCx, value);
-  return promise.forget();
+  future->mResolver->Resolve(aCx, value);
+  return future.forget();
 }
 
-already_AddRefed<Promise>
-Promise::Then(AnyCallback* aResolveCallback, AnyCallback* aRejectCallback)
+/* static */ already_AddRefed<Future>
+Future::Reject(const GlobalObject& aGlobal, JSContext* aCx,
+               JS::Handle<JS::Value> aValue, ErrorResult& aRv)
 {
-  nsRefPtr<Promise> promise = new Promise(GetParentObject());
+  MOZ_ASSERT(PrefEnabled());
+
+  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.Get());
+  if (!window) {
+    aRv.Throw(NS_ERROR_UNEXPECTED);
+    return nullptr;
+  }
+
+  nsRefPtr<Future> future = new Future(window);
 
-  nsRefPtr<PromiseCallback> resolveCb =
-    PromiseCallback::Factory(promise->mResolver,
-                             aResolveCallback,
-                             PromiseCallback::Resolve);
+  Optional<JS::Handle<JS::Value> > value(aCx, aValue);
+  future->mResolver->Reject(aCx, value);
+  return future.forget();
+}
+
+already_AddRefed<Future>
+Future::Then(AnyCallback* aResolveCallback, AnyCallback* aRejectCallback)
+{
+  nsRefPtr<Future> future = new Future(GetParentObject());
 
-  nsRefPtr<PromiseCallback> rejectCb =
-    PromiseCallback::Factory(promise->mResolver,
-                             aRejectCallback,
-                             PromiseCallback::Reject);
+  nsRefPtr<FutureCallback> resolveCb =
+    FutureCallback::Factory(future->mResolver,
+                            aResolveCallback,
+                            FutureCallback::Resolve);
+
+  nsRefPtr<FutureCallback> rejectCb =
+    FutureCallback::Factory(future->mResolver,
+                            aRejectCallback,
+                            FutureCallback::Reject);
 
   AppendCallbacks(resolveCb, rejectCb);
 
-  return promise.forget();
+  return future.forget();
 }
 
-already_AddRefed<Promise>
-Promise::Catch(AnyCallback* aRejectCallback)
+already_AddRefed<Future>
+Future::Catch(AnyCallback* aRejectCallback)
 {
   return Then(nullptr, aRejectCallback);
 }
 
 void
-Promise::Done(AnyCallback* aResolveCallback, AnyCallback* aRejectCallback)
+Future::Done(AnyCallback* aResolveCallback, AnyCallback* aRejectCallback)
 {
   if (!aResolveCallback && !aRejectCallback) {
     return;
   }
 
-  nsRefPtr<PromiseCallback> resolveCb;
+  nsRefPtr<FutureCallback> resolveCb;
   if (aResolveCallback) {
-    resolveCb = new SimpleWrapperPromiseCallback(this, aResolveCallback);
+    resolveCb = new SimpleWrapperFutureCallback(this, aResolveCallback);
   }
 
-  nsRefPtr<PromiseCallback> rejectCb;
+  nsRefPtr<FutureCallback> rejectCb;
   if (aRejectCallback) {
-    rejectCb = new SimpleWrapperPromiseCallback(this, aRejectCallback);
+    rejectCb = new SimpleWrapperFutureCallback(this, aRejectCallback);
   }
 
   AppendCallbacks(resolveCb, rejectCb);
 }
 
 void
-Promise::AppendCallbacks(PromiseCallback* aResolveCallback,
-                         PromiseCallback* aRejectCallback)
+Future::AppendCallbacks(FutureCallback* aResolveCallback,
+                        FutureCallback* aRejectCallback)
 {
   if (aResolveCallback) {
     mResolveCallbacks.AppendElement(aResolveCallback);
   }
 
   if (aRejectCallback) {
     mRejectCallbacks.AppendElement(aRejectCallback);
   }
 
-  // If promise's state is resolved, queue a task to process promise's resolve
-  // callbacks with promise's result. If promise's state is rejected, queue a task
-  // to process promise's reject callbacks with promise's result.
+  // If future's state is resolved, queue a task to process future's resolve
+  // callbacks with future's result. If future's state is rejected, queue a task
+  // to process future's reject callbacks with future's result.
   if (mState != Pending && !mTaskPending) {
-    nsRefPtr<PromiseTask> task = new PromiseTask(this);
+    nsRefPtr<FutureTask> task = new FutureTask(this);
     NS_DispatchToCurrentThread(task);
     mTaskPending = true;
   }
 }
 
 void
-Promise::RunTask()
+Future::RunTask()
 {
   MOZ_ASSERT(mState != Pending);
 
-  nsTArray<nsRefPtr<PromiseCallback> > callbacks;
+  nsTArray<nsRefPtr<FutureCallback> > callbacks;
   callbacks.SwapElements(mState == Resolved ? mResolveCallbacks
                                             : mRejectCallbacks);
   mResolveCallbacks.Clear();
   mRejectCallbacks.Clear();
 
   Optional<JS::Handle<JS::Value> > value(nsContentUtils::GetSafeJSContext(),
                                          mResult);
 
rename from dom/promise/Promise.h
rename to dom/future/Future.h
--- a/dom/promise/Promise.h
+++ b/dom/future/Future.h
@@ -1,118 +1,118 @@
 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef mozilla_dom_Promise_h
-#define mozilla_dom_Promise_h
+#ifndef mozilla_dom_Future_h
+#define mozilla_dom_Future_h
 
 #include "mozilla/Attributes.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "nsCycleCollectionParticipant.h"
-#include "mozilla/dom/PromiseBinding.h"
+#include "mozilla/dom/FutureBinding.h"
 #include "nsWrapperCache.h"
 #include "nsAutoPtr.h"
 
 struct JSContext;
 class nsPIDOMWindow;
 
 namespace mozilla {
 namespace dom {
 
-class PromiseInit;
-class PromiseCallback;
+class FutureInit;
+class FutureCallback;
 class AnyCallback;
-class PromiseResolver;
+class FutureResolver;
 
-class Promise MOZ_FINAL : public nsISupports,
-                          public nsWrapperCache
+class Future MOZ_FINAL : public nsISupports,
+                         public nsWrapperCache
 {
-  friend class PromiseTask;
-  friend class PromiseResolver;
-  friend class PromiseResolverTask;
+  friend class FutureTask;
+  friend class FutureResolver;
+  friend class FutureResolverTask;
 
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Promise)
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Future)
 
-  Promise(nsPIDOMWindow* aWindow);
-  ~Promise();
+  Future(nsPIDOMWindow* aWindow);
+  ~Future();
 
   static bool PrefEnabled();
 
   // WebIDL
 
   nsPIDOMWindow* GetParentObject() const
   {
     return mWindow;
   }
 
   virtual JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
 
-  static already_AddRefed<Promise>
-  Constructor(const GlobalObject& aGlobal, JSContext* aCx, PromiseInit& aInit,
+  static already_AddRefed<Future>
+  Constructor(const GlobalObject& aGlobal, JSContext* aCx, FutureInit& aInit,
               ErrorResult& aRv);
 
-  static already_AddRefed<Promise>
+  static already_AddRefed<Future>
   Resolve(const GlobalObject& aGlobal, JSContext* aCx,
           JS::Handle<JS::Value> aValue, ErrorResult& aRv);
 
-  static already_AddRefed<Promise>
+  static already_AddRefed<Future>
   Reject(const GlobalObject& aGlobal, JSContext* aCx,
          JS::Handle<JS::Value> aValue, ErrorResult& aRv);
 
-  already_AddRefed<Promise>
+  already_AddRefed<Future>
   Then(AnyCallback* aResolveCallback, AnyCallback* aRejectCallback);
 
-  already_AddRefed<Promise>
+  already_AddRefed<Future>
   Catch(AnyCallback* aRejectCallback);
 
   void Done(AnyCallback* aResolveCallback, AnyCallback* aRejectCallback);
 
 private:
-  enum PromiseState {
+  enum FutureState {
     Pending,
     Resolved,
     Rejected
   };
 
-  void SetState(PromiseState aState)
+  void SetState(FutureState aState)
   {
     MOZ_ASSERT(mState == Pending);
     MOZ_ASSERT(aState != Pending);
     mState = aState;
   }
 
   void SetResult(JS::Handle<JS::Value> aValue)
   {
     mResult = aValue;
   }
 
-  // This method processes promise's resolve/reject callbacks with promise's
+  // This method processes future's resolve/reject callbacks with future's
   // result. It's executed when the resolver.resolve() or resolver.reject() is
-  // called or when the promise already has a result and new callbacks are
+  // called or when the future already has a result and new callbacks are
   // appended by then(), catch() or done().
   void RunTask();
 
-  void AppendCallbacks(PromiseCallback* aResolveCallback,
-                       PromiseCallback* aRejectCallback);
+  void AppendCallbacks(FutureCallback* aResolveCallback,
+                       FutureCallback* aRejectCallback);
 
   nsRefPtr<nsPIDOMWindow> mWindow;
 
-  nsRefPtr<PromiseResolver> mResolver;
+  nsRefPtr<FutureResolver> mResolver;
 
-  nsTArray<nsRefPtr<PromiseCallback> > mResolveCallbacks;
-  nsTArray<nsRefPtr<PromiseCallback> > mRejectCallbacks;
+  nsTArray<nsRefPtr<FutureCallback> > mResolveCallbacks;
+  nsTArray<nsRefPtr<FutureCallback> > mRejectCallbacks;
 
   JS::Heap<JS::Value> mResult;
-  PromiseState mState;
+  FutureState mState;
   bool mTaskPending;
 };
 
 } // namespace dom
 } // namespace mozilla
 
-#endif // mozilla_dom_Promise_h
+#endif // mozilla_dom_Future_h
rename from dom/promise/PromiseCallback.cpp
rename to dom/future/FutureCallback.cpp
--- a/dom/promise/PromiseCallback.cpp
+++ b/dom/future/FutureCallback.cpp
@@ -1,150 +1,150 @@
 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "PromiseCallback.h"
-#include "mozilla/dom/Promise.h"
-#include "mozilla/dom/PromiseResolver.h"
+#include "FutureCallback.h"
+#include "mozilla/dom/Future.h"
+#include "mozilla/dom/FutureResolver.h"
 
 namespace mozilla {
 namespace dom {
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(PromiseCallback)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(PromiseCallback)
+NS_IMPL_CYCLE_COLLECTING_ADDREF(FutureCallback)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(FutureCallback)
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PromiseCallback)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FutureCallback)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(PromiseCallback)
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FutureCallback)
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(PromiseCallback)
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(FutureCallback)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
-PromiseCallback::PromiseCallback()
+FutureCallback::FutureCallback()
 {
-  MOZ_COUNT_CTOR(PromiseCallback);
+  MOZ_COUNT_CTOR(FutureCallback);
 }
 
-PromiseCallback::~PromiseCallback()
+FutureCallback::~FutureCallback()
 {
-  MOZ_COUNT_DTOR(PromiseCallback);
+  MOZ_COUNT_DTOR(FutureCallback);
 }
 
-// ResolvePromiseCallback
+// ResolveFutureCallback
 
-NS_IMPL_CYCLE_COLLECTION_INHERITED_1(ResolvePromiseCallback,
-                                     PromiseCallback,
+NS_IMPL_CYCLE_COLLECTION_INHERITED_1(ResolveFutureCallback,
+                                     FutureCallback,
                                      mResolver)
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(ResolvePromiseCallback)
-NS_INTERFACE_MAP_END_INHERITING(PromiseCallback)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(ResolveFutureCallback)
+NS_INTERFACE_MAP_END_INHERITING(FutureCallback)
 
-NS_IMPL_ADDREF_INHERITED(ResolvePromiseCallback, PromiseCallback)
-NS_IMPL_RELEASE_INHERITED(ResolvePromiseCallback, PromiseCallback)
+NS_IMPL_ADDREF_INHERITED(ResolveFutureCallback, FutureCallback)
+NS_IMPL_RELEASE_INHERITED(ResolveFutureCallback, FutureCallback)
 
-ResolvePromiseCallback::ResolvePromiseCallback(PromiseResolver* aResolver)
+ResolveFutureCallback::ResolveFutureCallback(FutureResolver* aResolver)
   : mResolver(aResolver)
 {
   MOZ_ASSERT(aResolver);
-  MOZ_COUNT_CTOR(ResolvePromiseCallback);
+  MOZ_COUNT_CTOR(ResolveFutureCallback);
 }
 
-ResolvePromiseCallback::~ResolvePromiseCallback()
+ResolveFutureCallback::~ResolveFutureCallback()
 {
-  MOZ_COUNT_DTOR(ResolvePromiseCallback);
+  MOZ_COUNT_DTOR(ResolveFutureCallback);
 }
 
 void
-ResolvePromiseCallback::Call(const Optional<JS::Handle<JS::Value> >& aValue)
+ResolveFutureCallback::Call(const Optional<JS::Handle<JS::Value> >& aValue)
 {
   // Run resolver's algorithm with value and the synchronous flag set.
   AutoJSContext cx;
   // FIXME Bug 878849
   Maybe<JSAutoCompartment> ac;
   if (aValue.WasPassed() && aValue.Value().isObject()) {
     JS::Rooted<JSObject*> rooted(cx, &aValue.Value().toObject());
     ac.construct(cx, rooted);
   }
 
-  mResolver->ResolveInternal(cx, aValue, PromiseResolver::SyncTask);
+  mResolver->ResolveInternal(cx, aValue, FutureResolver::SyncTask);
 }
 
-// RejectPromiseCallback
+// RejectFutureCallback
 
-NS_IMPL_CYCLE_COLLECTION_INHERITED_1(RejectPromiseCallback,
-                                     PromiseCallback,
+NS_IMPL_CYCLE_COLLECTION_INHERITED_1(RejectFutureCallback,
+                                     FutureCallback,
                                      mResolver)
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(RejectPromiseCallback)
-NS_INTERFACE_MAP_END_INHERITING(PromiseCallback)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(RejectFutureCallback)
+NS_INTERFACE_MAP_END_INHERITING(FutureCallback)
 
-NS_IMPL_ADDREF_INHERITED(RejectPromiseCallback, PromiseCallback)
-NS_IMPL_RELEASE_INHERITED(RejectPromiseCallback, PromiseCallback)
+NS_IMPL_ADDREF_INHERITED(RejectFutureCallback, FutureCallback)
+NS_IMPL_RELEASE_INHERITED(RejectFutureCallback, FutureCallback)
 
-RejectPromiseCallback::RejectPromiseCallback(PromiseResolver* aResolver)
+RejectFutureCallback::RejectFutureCallback(FutureResolver* aResolver)
   : mResolver(aResolver)
 {
   MOZ_ASSERT(aResolver);
-  MOZ_COUNT_CTOR(RejectPromiseCallback);
+  MOZ_COUNT_CTOR(RejectFutureCallback);
 }
 
-RejectPromiseCallback::~RejectPromiseCallback()
+RejectFutureCallback::~RejectFutureCallback()
 {
-  MOZ_COUNT_DTOR(RejectPromiseCallback);
+  MOZ_COUNT_DTOR(RejectFutureCallback);
 }
 
 void
-RejectPromiseCallback::Call(const Optional<JS::Handle<JS::Value> >& aValue)
+RejectFutureCallback::Call(const Optional<JS::Handle<JS::Value> >& aValue)
 {
   // Run resolver's algorithm with value and the synchronous flag set.
   AutoJSContext cx;
   // FIXME Bug 878849
   Maybe<JSAutoCompartment> ac;
   if (aValue.WasPassed() && aValue.Value().isObject()) {
     JS::Rooted<JSObject*> rooted(cx, &aValue.Value().toObject());
     ac.construct(cx, rooted);
   }
 
-  mResolver->RejectInternal(cx, aValue, PromiseResolver::SyncTask);
+  mResolver->RejectInternal(cx, aValue, FutureResolver::SyncTask);
 }
 
-// WrapperPromiseCallback
+// WrapperFutureCallback
 
-NS_IMPL_CYCLE_COLLECTION_INHERITED_2(WrapperPromiseCallback,
-                                     PromiseCallback,
+NS_IMPL_CYCLE_COLLECTION_INHERITED_2(WrapperFutureCallback,
+                                     FutureCallback,
                                      mNextResolver, mCallback)
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(WrapperPromiseCallback)
-NS_INTERFACE_MAP_END_INHERITING(PromiseCallback)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(WrapperFutureCallback)
+NS_INTERFACE_MAP_END_INHERITING(FutureCallback)
 
-NS_IMPL_ADDREF_INHERITED(WrapperPromiseCallback, PromiseCallback)
-NS_IMPL_RELEASE_INHERITED(WrapperPromiseCallback, PromiseCallback)
+NS_IMPL_ADDREF_INHERITED(WrapperFutureCallback, FutureCallback)
+NS_IMPL_RELEASE_INHERITED(WrapperFutureCallback, FutureCallback)
 
-WrapperPromiseCallback::WrapperPromiseCallback(PromiseResolver* aNextResolver,
-                                               AnyCallback* aCallback)
+WrapperFutureCallback::WrapperFutureCallback(FutureResolver* aNextResolver,
+                                             AnyCallback* aCallback)
   : mNextResolver(aNextResolver)
   , mCallback(aCallback)
 {
   MOZ_ASSERT(aNextResolver);
-  MOZ_COUNT_CTOR(WrapperPromiseCallback);
+  MOZ_COUNT_CTOR(WrapperFutureCallback);
 }
 
-WrapperPromiseCallback::~WrapperPromiseCallback()
+WrapperFutureCallback::~WrapperFutureCallback()
 {
-  MOZ_COUNT_DTOR(WrapperPromiseCallback);
+  MOZ_COUNT_DTOR(WrapperFutureCallback);
 }
 
 void
-WrapperPromiseCallback::Call(const Optional<JS::Handle<JS::Value> >& aValue)
+WrapperFutureCallback::Call(const Optional<JS::Handle<JS::Value> >& aValue)
 {
   AutoJSContext cx;
   // FIXME Bug 878849
   Maybe<JSAutoCompartment> ac;
   if (aValue.WasPassed() && aValue.Value().isObject()) {
     JS::Rooted<JSObject*> rooted(cx, &aValue.Value().toObject());
     ac.construct(cx, rooted);
   }
@@ -157,76 +157,76 @@ WrapperPromiseCallback::Call(const Optio
     mCallback->Call(mNextResolver->GetParentObject(), aValue, rv,
                     CallbackObject::eRethrowExceptions));
 
   rv.WouldReportJSException();
 
   if (rv.Failed() && rv.IsJSException()) {
     Optional<JS::Handle<JS::Value> > value(cx);
     rv.StealJSException(cx, &value.Value());
-    mNextResolver->RejectInternal(cx, value, PromiseResolver::SyncTask);
+    mNextResolver->RejectInternal(cx, value, FutureResolver::SyncTask);
     return;
   }
 
   // Otherwise, run resolver's resolve with value and the synchronous flag
   // set.
-  mNextResolver->ResolveInternal(cx, value, PromiseResolver::SyncTask);
+  mNextResolver->ResolveInternal(cx, value, FutureResolver::SyncTask);
 }
 
-// SimpleWrapperPromiseCallback
+// SimpleWrapperFutureCallback
 
-NS_IMPL_CYCLE_COLLECTION_INHERITED_2(SimpleWrapperPromiseCallback,
-                                     PromiseCallback,
-                                     mPromise, mCallback)
+NS_IMPL_CYCLE_COLLECTION_INHERITED_2(SimpleWrapperFutureCallback,
+                                     FutureCallback,
+                                     mFuture, mCallback)
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(SimpleWrapperPromiseCallback)
-NS_INTERFACE_MAP_END_INHERITING(PromiseCallback)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(SimpleWrapperFutureCallback)
+NS_INTERFACE_MAP_END_INHERITING(FutureCallback)
 
-NS_IMPL_ADDREF_INHERITED(SimpleWrapperPromiseCallback, PromiseCallback)
-NS_IMPL_RELEASE_INHERITED(SimpleWrapperPromiseCallback, PromiseCallback)
+NS_IMPL_ADDREF_INHERITED(SimpleWrapperFutureCallback, FutureCallback)
+NS_IMPL_RELEASE_INHERITED(SimpleWrapperFutureCallback, FutureCallback)
 
-SimpleWrapperPromiseCallback::SimpleWrapperPromiseCallback(Promise* aPromise,
-                                                           AnyCallback* aCallback)
-  : mPromise(aPromise)
+SimpleWrapperFutureCallback::SimpleWrapperFutureCallback(Future* aFuture,
+                                                         AnyCallback* aCallback)
+  : mFuture(aFuture)
   , mCallback(aCallback)
 {
-  MOZ_ASSERT(aPromise);
-  MOZ_COUNT_CTOR(SimpleWrapperPromiseCallback);
+  MOZ_ASSERT(aFuture);
+  MOZ_COUNT_CTOR(SimpleWrapperFutureCallback);
 }
 
-SimpleWrapperPromiseCallback::~SimpleWrapperPromiseCallback()
+SimpleWrapperFutureCallback::~SimpleWrapperFutureCallback()
 {
-  MOZ_COUNT_DTOR(SimpleWrapperPromiseCallback);
+  MOZ_COUNT_DTOR(SimpleWrapperFutureCallback);
 }
 
 void
-SimpleWrapperPromiseCallback::Call(const Optional<JS::Handle<JS::Value> >& aValue)
+SimpleWrapperFutureCallback::Call(const Optional<JS::Handle<JS::Value> >& aValue)
 {
   ErrorResult rv;
-  mCallback->Call(mPromise, aValue, rv);
+  mCallback->Call(mFuture, aValue, rv);
 }
 
-/* static */ PromiseCallback*
-PromiseCallback::Factory(PromiseResolver* aNextResolver,
-                         AnyCallback* aCallback, Task aTask)
+/* static */ FutureCallback*
+FutureCallback::Factory(FutureResolver* aNextResolver,
+                        AnyCallback* aCallback, Task aTask)
 {
   MOZ_ASSERT(aNextResolver);
 
   // If we have a callback and a next resolver, we have to exec the callback and
   // then propagate the return value to the next resolver->resolve().
   if (aCallback) {
-    return new WrapperPromiseCallback(aNextResolver, aCallback);
+    return new WrapperFutureCallback(aNextResolver, aCallback);
   }
 
   if (aTask == Resolve) {
-    return new ResolvePromiseCallback(aNextResolver);
+    return new ResolveFutureCallback(aNextResolver);
   }
 
   if (aTask == Reject) {
-    return new RejectPromiseCallback(aNextResolver);
+    return new RejectFutureCallback(aNextResolver);
   }
 
   MOZ_ASSERT(false, "This should not happen");
   return nullptr;
 }
 
 } // namespace dom
 } // namespace mozilla
rename from dom/promise/PromiseCallback.h
rename to dom/future/FutureCallback.h
--- a/dom/promise/PromiseCallback.h
+++ b/dom/future/FutureCallback.h
@@ -1,121 +1,121 @@
 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef mozilla_dom_PromiseCallback_h
-#define mozilla_dom_PromiseCallback_h
+#ifndef mozilla_dom_FutureCallback_h
+#define mozilla_dom_FutureCallback_h
 
-#include "mozilla/dom/Promise.h"
+#include "mozilla/dom/Future.h"
 #include "nsCycleCollectionParticipant.h"
 
 namespace mozilla {
 namespace dom {
 
-class PromiseResolver;
+class FutureResolver;
 
-// This is the base class for any PromiseCallback.
-// It's a logical step in the promise chain of callbacks.
-class PromiseCallback : public nsISupports
+// This is the base class for any FutureCallback.
+// It's a logical step in the future chain of callbacks.
+class FutureCallback : public nsISupports
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_CLASS(PromiseCallback)
+  NS_DECL_CYCLE_COLLECTION_CLASS(FutureCallback)
 
-  PromiseCallback();
-  virtual ~PromiseCallback();
+  FutureCallback();
+  virtual ~FutureCallback();
 
   virtual void Call(const Optional<JS::Handle<JS::Value> >& aValue) = 0;
 
   enum Task {
     Resolve,
     Reject
   };
 
-  // This factory returns a PromiseCallback object with refcount of 0.
-  static PromiseCallback*
-  Factory(PromiseResolver* aNextResolver, AnyCallback* aCallback,
+  // This factory returns a FutureCallback object with refcount of 0.
+  static FutureCallback*
+  Factory(FutureResolver* aNextResolver, AnyCallback* aCallback,
           Task aTask);
 };
 
-// WrapperPromiseCallback execs a JS Callback with a value, and then the return
+// WrapperFutureCallback execs a JS Callback with a value, and then the return
 // value is sent to the aNextResolver->resolve() or to aNextResolver->Reject()
 // if the JS Callback throws.
-class WrapperPromiseCallback MOZ_FINAL : public PromiseCallback
+class WrapperFutureCallback MOZ_FINAL : public FutureCallback
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(WrapperPromiseCallback,
-                                           PromiseCallback)
+  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(WrapperFutureCallback,
+                                           FutureCallback)
 
   void Call(const Optional<JS::Handle<JS::Value> >& aValue) MOZ_OVERRIDE;
 
-  WrapperPromiseCallback(PromiseResolver* aNextResolver,
-                         AnyCallback* aCallback);
-  ~WrapperPromiseCallback();
+  WrapperFutureCallback(FutureResolver* aNextResolver,
+                        AnyCallback* aCallback);
+  ~WrapperFutureCallback();
 
 private:
-  nsRefPtr<PromiseResolver> mNextResolver;
+  nsRefPtr<FutureResolver> mNextResolver;
   nsRefPtr<AnyCallback> mCallback;
 };
 
-// SimpleWrapperPromiseCallback execs a JS Callback with a value.
-class SimpleWrapperPromiseCallback MOZ_FINAL : public PromiseCallback
+// SimpleWrapperFutureCallback execs a JS Callback with a value.
+class SimpleWrapperFutureCallback MOZ_FINAL : public FutureCallback
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SimpleWrapperPromiseCallback,
-                                           PromiseCallback)
+  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SimpleWrapperFutureCallback,
+                                           FutureCallback)
 
   void Call(const Optional<JS::Handle<JS::Value> >& aValue) MOZ_OVERRIDE;
 
-  SimpleWrapperPromiseCallback(Promise* aPromise,
-                               AnyCallback* aCallback);
-  ~SimpleWrapperPromiseCallback();
+  SimpleWrapperFutureCallback(Future* aFuture,
+                              AnyCallback* aCallback);
+  ~SimpleWrapperFutureCallback();
 
 private:
-  nsRefPtr<Promise> mPromise;
+  nsRefPtr<Future> mFuture;
   nsRefPtr<AnyCallback> mCallback;
 };
 
-// ResolvePromiseCallback calls aResolver->Resolve() with the value received by
+// ResolveFutureCallback calls aResolver->Resolve() with the value received by
 // Call().
-class ResolvePromiseCallback MOZ_FINAL : public PromiseCallback
+class ResolveFutureCallback MOZ_FINAL : public FutureCallback
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ResolvePromiseCallback,
-                                           PromiseCallback)
+  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ResolveFutureCallback,
+                                           FutureCallback)
 
   void Call(const Optional<JS::Handle<JS::Value> >& aValue) MOZ_OVERRIDE;
 
-  ResolvePromiseCallback(PromiseResolver* aResolver);
-  ~ResolvePromiseCallback();
+  ResolveFutureCallback(FutureResolver* aResolver);
+  ~ResolveFutureCallback();
 
 private:
-  nsRefPtr<PromiseResolver> mResolver;
+  nsRefPtr<FutureResolver> mResolver;
 };
 
-// RejectPromiseCallback calls aResolver->Reject() with the value received by
+// RejectFutureCallback calls aResolver->Reject() with the value received by
 // Call().
-class RejectPromiseCallback MOZ_FINAL : public PromiseCallback
+class RejectFutureCallback MOZ_FINAL : public FutureCallback
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RejectPromiseCallback,
-                                           PromiseCallback)
+  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RejectFutureCallback,
+                                           FutureCallback)
 
   void Call(const Optional<JS::Handle<JS::Value> >& aValue) MOZ_OVERRIDE;
 
-  RejectPromiseCallback(PromiseResolver* aResolver);
-  ~RejectPromiseCallback();
+  RejectFutureCallback(FutureResolver* aResolver);
+  ~RejectFutureCallback();
 
 private:
-  nsRefPtr<PromiseResolver> mResolver;
+  nsRefPtr<FutureResolver> mResolver;
 };
 
 } // namespace dom
 } // namespace mozilla
 
-#endif // mozilla_dom_PromiseCallback_h
+#endif // mozilla_dom_FutureCallback_h
rename from dom/promise/PromiseResolver.cpp
rename to dom/future/FutureResolver.cpp
--- a/dom/promise/PromiseResolver.cpp
+++ b/dom/future/FutureResolver.cpp
@@ -1,171 +1,171 @@
 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "mozilla/dom/PromiseResolver.h"
-#include "mozilla/dom/PromiseBinding.h"
-#include "mozilla/dom/Promise.h"
-#include "PromiseCallback.h"
+#include "mozilla/dom/FutureResolver.h"
+#include "mozilla/dom/FutureBinding.h"
+#include "mozilla/dom/Future.h"
+#include "FutureCallback.h"
 
 namespace mozilla {
 namespace dom {
 
-// PromiseResolverTask
+// FutureResolverTask
 
-// This class processes the promise's callbacks with promise's result.
-class PromiseResolverTask MOZ_FINAL : public nsRunnable
+// This class processes the future's callbacks with future's result.
+class FutureResolverTask MOZ_FINAL : public nsRunnable
 {
 public:
-  PromiseResolverTask(PromiseResolver* aResolver,
-                      const JS::Handle<JS::Value> aValue,
-                      Promise::PromiseState aState)
+  FutureResolverTask(FutureResolver* aResolver,
+                     const JS::Handle<JS::Value> aValue,
+                     Future::FutureState aState)
     : mResolver(aResolver)
     , mValue(aValue)
     , mState(aState)
   {
     MOZ_ASSERT(aResolver);
-    MOZ_ASSERT(mState != Promise::Pending);
-    MOZ_COUNT_CTOR(PromiseResolverTask);
+    MOZ_ASSERT(mState != Future::Pending);
+    MOZ_COUNT_CTOR(FutureResolverTask);
 
     JSContext* cx = nsContentUtils::GetSafeJSContext();
     JS_AddNamedValueRootRT(JS_GetRuntime(cx), &mValue,
-                           "PromiseResolverTask.mValue");
+                           "FutureResolverTask.mValue");
   }
 
-  ~PromiseResolverTask()
+  ~FutureResolverTask()
   {
-    MOZ_COUNT_DTOR(PromiseResolverTask);
+    MOZ_COUNT_DTOR(FutureResolverTask);
 
     JSContext* cx = nsContentUtils::GetSafeJSContext();
     JS_RemoveValueRootRT(JS_GetRuntime(cx), &mValue);
   }
 
   NS_IMETHOD Run()
   {
     mResolver->RunTask(JS::Handle<JS::Value>::fromMarkedLocation(&mValue),
-                       mState, PromiseResolver::SyncTask);
+                       mState, FutureResolver::SyncTask);
     return NS_OK;
   }
 
 private:
-  nsRefPtr<PromiseResolver> mResolver;
+  nsRefPtr<FutureResolver> mResolver;
   JS::Value mValue;
-  Promise::PromiseState mState;
+  Future::FutureState mState;
 };
 
-// PromiseResolver
+// FutureResolver
 
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(PromiseResolver, mPromise)
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(FutureResolver, mFuture)
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(PromiseResolver)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(PromiseResolver)
+NS_IMPL_CYCLE_COLLECTING_ADDREF(FutureResolver)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(FutureResolver)
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PromiseResolver)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FutureResolver)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
-PromiseResolver::PromiseResolver(Promise* aPromise)
-  : mPromise(aPromise)
+FutureResolver::FutureResolver(Future* aFuture)
+  : mFuture(aFuture)
   , mResolvePending(false)
 {
   SetIsDOMBinding();
 }
 
 JSObject*
-PromiseResolver::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
+FutureResolver::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
 {
-  return PromiseResolverBinding::Wrap(aCx, aScope, this);
+  return FutureResolverBinding::Wrap(aCx, aScope, this);
 }
 
 void
-PromiseResolver::Resolve(JSContext* aCx,
-                         const Optional<JS::Handle<JS::Value> >& aValue,
-                         PromiseTaskSync aAsynchronous)
+FutureResolver::Resolve(JSContext* aCx,
+                        const Optional<JS::Handle<JS::Value> >& aValue,
+                        FutureTaskSync aAsynchronous)
 {
   if (mResolvePending) {
     return;
   }
 
   ResolveInternal(aCx, aValue, aAsynchronous);
 }
 
 void
-PromiseResolver::ResolveInternal(JSContext* aCx,
-                                 const Optional<JS::Handle<JS::Value> >& aValue,
-                                 PromiseTaskSync aAsynchronous)
+FutureResolver::ResolveInternal(JSContext* aCx,
+                                const Optional<JS::Handle<JS::Value> >& aValue,
+                                FutureTaskSync aAsynchronous)
 {
   mResolvePending = true;
 
   // TODO: Bug 879245 - Then-able objects
   if (aValue.WasPassed() && aValue.Value().isObject()) {
     JS::Rooted<JSObject*> valueObj(aCx, &aValue.Value().toObject());
-    Promise* nextPromise;
-    nsresult rv = UnwrapObject<Promise>(aCx, valueObj, nextPromise);
+    Future* nextFuture;
+    nsresult rv = UnwrapObject<Future>(aCx, valueObj, nextFuture);
 
     if (NS_SUCCEEDED(rv)) {
-      nsRefPtr<PromiseCallback> resolveCb = new ResolvePromiseCallback(this);
-      nsRefPtr<PromiseCallback> rejectCb = new RejectPromiseCallback(this);
-      nextPromise->AppendCallbacks(resolveCb, rejectCb);
+      nsRefPtr<FutureCallback> resolveCb = new ResolveFutureCallback(this);
+      nsRefPtr<FutureCallback> rejectCb = new RejectFutureCallback(this);
+      nextFuture->AppendCallbacks(resolveCb, rejectCb);
       return;
     }
   }
 
-  // If the synchronous flag is set, process promise's resolve callbacks with
+  // If the synchronous flag is set, process future's resolve callbacks with
   // value. Otherwise, the synchronous flag is unset, queue a task to process
-  // promise's resolve callbacks with value. Otherwise, the synchronous flag is
-  // unset, queue a task to process promise's resolve callbacks with value.
+  // future's resolve callbacks with value. Otherwise, the synchronous flag is
+  // unset, queue a task to process future's resolve callbacks with value.
   RunTask(aValue.WasPassed() ? aValue.Value() : JS::UndefinedHandleValue,
-          Promise::Resolved, aAsynchronous);
+          Future::Resolved, aAsynchronous);
 }
 
 void
-PromiseResolver::Reject(JSContext* aCx,
-                        const Optional<JS::Handle<JS::Value> >& aValue,
-                        PromiseTaskSync aAsynchronous)
+FutureResolver::Reject(JSContext* aCx,
+                       const Optional<JS::Handle<JS::Value> >& aValue,
+                       FutureTaskSync aAsynchronous)
 {
   if (mResolvePending) {
     return;
   }
 
   RejectInternal(aCx, aValue, aAsynchronous);
 }
 
 void
-PromiseResolver::RejectInternal(JSContext* aCx,
-                                const Optional<JS::Handle<JS::Value> >& aValue,
-                                PromiseTaskSync aAsynchronous)
+FutureResolver::RejectInternal(JSContext* aCx,
+                               const Optional<JS::Handle<JS::Value> >& aValue,
+                               FutureTaskSync aAsynchronous)
 {
   mResolvePending = true;
 
-  // If the synchronous flag is set, process promise's reject callbacks with
+  // If the synchronous flag is set, process future's reject callbacks with
   // value. Otherwise, the synchronous flag is unset, queue a task to process
-  // promise's reject callbacks with value.
+  // future's reject callbacks with value.
   RunTask(aValue.WasPassed() ? aValue.Value() : JS::UndefinedHandleValue,
-          Promise::Rejected, aAsynchronous);
+          Future::Rejected, aAsynchronous);
 }
 
 void
-PromiseResolver::RunTask(JS::Handle<JS::Value> aValue,
-                         Promise::PromiseState aState,
-                         PromiseTaskSync aAsynchronous)
+FutureResolver::RunTask(JS::Handle<JS::Value> aValue,
+                        Future::FutureState aState,
+                        FutureTaskSync aAsynchronous)
 {
-  // If the synchronous flag is unset, queue a task to process promise's
+  // If the synchronous flag is unset, queue a task to process future's
   // accept callbacks with value.
   if (aAsynchronous == AsyncTask) {
-    nsRefPtr<PromiseResolverTask> task =
-      new PromiseResolverTask(this, aValue, aState);
+    nsRefPtr<FutureResolverTask> task =
+      new FutureResolverTask(this, aValue, aState);
     NS_DispatchToCurrentThread(task);
     return;
   }
 
-  mPromise->SetResult(aValue);
-  mPromise->SetState(aState);
-  mPromise->RunTask();
-  mPromise = nullptr;
+  mFuture->SetResult(aValue);
+  mFuture->SetState(aState);
+  mFuture->RunTask();
+  mFuture = nullptr;
 }
 
 } // namespace dom
 } // namespace mozilla
rename from dom/promise/PromiseResolver.h
rename to dom/future/FutureResolver.h
--- a/dom/promise/PromiseResolver.h
+++ b/dom/future/FutureResolver.h
@@ -1,75 +1,75 @@
 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef mozilla_dom_PromiseResolver_h
-#define mozilla_dom_PromiseResolver_h
+#ifndef mozilla_dom_FutureResolver_h
+#define mozilla_dom_FutureResolver_h
 
-#include "mozilla/dom/Promise.h"
+#include "mozilla/dom/Future.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsWrapperCache.h"
 
 struct JSContext;
 
 namespace mozilla {
 namespace dom {
 
-class PromiseResolver MOZ_FINAL : public nsISupports,
-                                  public nsWrapperCache
+class FutureResolver MOZ_FINAL : public nsISupports,
+                                 public nsWrapperCache
 {
-  friend class PromiseResolverTask;
-  friend class WrapperPromiseCallback;
-  friend class ResolvePromiseCallback;
-  friend class RejectPromiseCallback;
+  friend class FutureResolverTask;
+  friend class WrapperFutureCallback;
+  friend class ResolveFutureCallback;
+  friend class RejectFutureCallback;
 
 private:
-  enum PromiseTaskSync {
+  enum FutureTaskSync {
     SyncTask,
     AsyncTask
   };
 
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PromiseResolver)
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(FutureResolver)
 
-  PromiseResolver(Promise* aPromise);
+  FutureResolver(Future* aFuture);
 
-  Promise* GetParentObject() const
+  Future* GetParentObject() const
   {
-    return mPromise;
+    return mFuture;
   }
 
   virtual JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
 
   void Resolve(JSContext* aCx, const Optional<JS::Handle<JS::Value> >& aValue,
-               PromiseTaskSync aSync = AsyncTask);
+               FutureTaskSync aSync = AsyncTask);
 
   void Reject(JSContext* aCx, const Optional<JS::Handle<JS::Value> >& aValue,
-              PromiseTaskSync aSync = AsyncTask);
+              FutureTaskSync aSync = AsyncTask);
 
 private:
   void ResolveInternal(JSContext* aCx,
                        const Optional<JS::Handle<JS::Value> >& aValue,
-                       PromiseTaskSync aSync = AsyncTask);
+                       FutureTaskSync aSync = AsyncTask);
 
   void RejectInternal(JSContext* aCx,
                       const Optional<JS::Handle<JS::Value> >& aValue,
-                      PromiseTaskSync aSync = AsyncTask);
+                      FutureTaskSync aSync = AsyncTask);
 
   void RunTask(JS::Handle<JS::Value> aValue,
-               Promise::PromiseState aState, PromiseTaskSync aSync);
+               Future::FutureState aState, FutureTaskSync aSync);
 
-  nsRefPtr<Promise> mPromise;
+  nsRefPtr<Future> mFuture;
 
   bool mResolvePending;
 };
 
 } // namespace dom
 } // namespace mozilla
 
-#endif // mozilla_dom_PromiseResolver_h
+#endif // mozilla_dom_FutureResolver_h
rename from dom/promise/Makefile.in
rename to dom/future/Makefile.in
--- a/dom/promise/Makefile.in
+++ b/dom/future/Makefile.in
@@ -4,15 +4,15 @@
 
 DEPTH            = @DEPTH@
 topsrcdir        = @top_srcdir@
 srcdir           = @srcdir@
 VPATH            = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-LIBRARY_NAME     = dompromise_s
+LIBRARY_NAME     = domfuture_s
 LIBXUL_LIBRARY = 1
 FORCE_STATIC_LIB = 1
 FAIL_ON_WARNINGS := 1
 
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/config/rules.mk
rename from dom/promise/moz.build
rename to dom/future/moz.build
--- a/dom/promise/moz.build
+++ b/dom/future/moz.build
@@ -1,22 +1,22 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 TEST_DIRS += ['tests']
 
-XPIDL_MODULE = 'dom_promise'
+XPIDL_MODULE = 'dom_future'
 
 MODULE = 'dom'
 
 EXPORTS.mozilla.dom += [
-    'Promise.h',
-    'PromiseResolver.h',
+    'Future.h',
+    'FutureResolver.h',
 ]
 
 CPP_SOURCES += [
-    'Promise.cpp',
-    'PromiseResolver.cpp',
-    'PromiseCallback.cpp',
+    'Future.cpp',
+    'FutureResolver.cpp',
+    'FutureCallback.cpp',
 ]
rename from dom/promise/tests/Makefile.in
rename to dom/future/tests/Makefile.in
--- a/dom/promise/tests/Makefile.in
+++ b/dom/future/tests/Makefile.in
@@ -7,13 +7,13 @@ topsrcdir        = @top_srcdir@
 srcdir           = @srcdir@
 VPATH            = @srcdir@
 
 relativesrcdir   = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_FILES = \
-  test_promise.html \
+  test_future.html \
   test_resolve.html \
   $(NULL)
 
 include $(topsrcdir)/config/rules.mk
rename from dom/promise/tests/moz.build
rename to dom/future/tests/moz.build
rename from dom/promise/tests/test_promise.html
rename to dom/future/tests/test_future.html
--- a/dom/promise/tests/test_promise.html
+++ b/dom/future/tests/test_future.html
@@ -1,252 +1,252 @@
 <!--
   Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/
 -->
 <html>
 <head>
-  <title>Basic Promise Test</title>
+  <title>Basic Future Test</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script type="application/javascript"><!--
 
-function promiseResolve() {
-  ok(Promise, "Promise object should exist");
+function futureResolve() {
+  ok(Future, "Future object should exist");
 
-  var promise = new Promise(function(resolver) {
-    ok(resolver, "PromiseResolver exists");
-    ok("reject" in resolver, "PromiseResolver.reject exists");
-    ok("resolve" in resolver, "PromiseResolver.resolve exists");
+  var future = new Future(function(resolver) {
+    ok(resolver, "FutureResolver exists");
+    ok("reject" in resolver, "FutureResolver.reject exists");
+    ok("resolve" in resolver, "FutureResolver.resolve exists");
 
     resolver.resolve(42);
   }).done(function(what) {
     ok(true, "Done - resolveCb has been called");
     is(what, 42, "ResolveCb received 42");
     runTest();
   }, function() {
     ok(false, "Done - rejectCb has been called");
     runTest();
   });
 }
 
-function promiseReject() {
-  var promise = new Promise(function(resolver) {
+function futureReject() {
+  var future = new Future(function(resolver) {
     resolver.reject(42);
   }).done(function(what) {
     ok(false, "Done - resolveCb has been called");
     runTest();
   }, function(what) {
     ok(true, "Done - rejectCb has been called");
     is(what, 42, "RejectCb received 42");
     runTest();
   });
 }
 
-function promiseException() {
-  var promise = new Promise(function(resolver) {
+function futureException() {
+  var future = new Future(function(resolver) {
     throw 42;
   }).done(function(what) {
     ok(false, "Done - resolveCb has been called");
     runTest();
   }, function(what) {
     ok(true, "Done - rejectCb has been called");
     is(what, 42, "RejectCb received 42");
     runTest();
   });
 }
 
-function promiseGC() {
+function futureGC() {
   var resolver;
-  var promise = new Promise(function(r) {
+  var future = new Future(function(r) {
     resolver = r;
   }).done(function(what) {
-    ok(true, "Done - promise is still alive");
+    ok(true, "Done - future is still alive");
     runTest();
   });
 
-  promise = null;
+  future = null;
 
   SpecialPowers.gc();
   SpecialPowers.forceGC();
   SpecialPowers.forceCC();
 
   resolver.resolve(42);
 }
 
-function promiseAsync() {
+function futureAsync() {
   var global = "foo";
-  var f = new Promise(function(r) {
+  var f = new Future(function(r) {
     is(global, "foo", "Global should be foo");
     r.resolve(42);
     is(global, "foo", "Global should still be foo");
     setTimeout(function() {
       is(global, "bar", "Global should still be bar!");
       runTest();
     }, 0);
   }).done(function() {
     global = "bar";
   });
   is(global, "foo", "Global should still be foo (2)");
 }
 
-function promiseDoubleDone() {
+function futureDoubleDone() {
   var steps = 0;
-  var promise = new Promise(function(resolver) {
+  var future = new Future(function(resolver) {
     resolver.resolve(42);
   });
 
-  promise.done(function(what) {
+  future.done(function(what) {
     ok(true, "Done.resolve has been called");
     is(what, 42, "Value == 42");
     steps++;
   }, function(what) {
     ok(false, "Done.reject has been called");
   });
 
-  promise.done(function(what) {
+  future.done(function(what) {
     ok(true, "Done.resolve has been called");
     is(steps, 1, "Done.resolve - step == 1");
     is(what, 42, "Value == 42");
     runTest();
   }, function(what) {
     ok(false, "Done.reject has been called");
   });
 }
 
-function promiseDoneException() {
-  var promise = new Promise(function(resolver) {
+function futureDoneException() {
+  var future = new Future(function(resolver) {
     resolver.resolve(42);
   });
 
   onErrorCb = window.onerror;
   window.onerror = function(e) {
     ok(true, "window.onerror has been called!");
     window.onerror = onErrorCb;
     runTest();
   };
 
-  promise.done(function(what) {
+  future.done(function(what) {
     ok(true, "Done.resolve has been called");
     throw "booh";
   });
 }
 
-function promiseThenCatchDone() {
-  var promise = new Promise(function(resolver) {
+function futureThenCatchDone() {
+  var future = new Future(function(resolver) {
     resolver.resolve(42);
   });
 
-  var promise2 = promise.then(function(what) {
+  var future2 = future.then(function(what) {
     ok(true, "Then.resolve has been called");
     is(what, 42, "Value == 42");
     return what + 1;
   }, function(what) {
     ok(false, "Then.reject has been called");
   });
 
-  isnot(promise, promise2, "These 2 promise objs are different");
+  isnot(future, future2, "These 2 future objs are different");
 
-  promise2.then(function(what) {
+  future2.then(function(what) {
     ok(true, "Then.resolve has been called");
     is(what, 43, "Value == 43");
     return what + 1;
   }, function(what) {
     ok(false, "Then.reject has been called");
   }).catch(function() {
     ok(false, "Catch has been called");
   }).done(function(what) {
     ok(true, "Done.resolve has been called");
     is(what, 44, "Value == 44");
     runTest();
   }, function(what) {
     ok(false, "Done.reject has been called");
   });
 }
 
-function promiseRejectThenCatchDone() {
-  var promise = new Promise(function(resolver) {
+function futureRejectThenCatchDone() {
+  var future = new Future(function(resolver) {
     resolver.reject(42);
   });
 
-  var promise2 = promise.then(function(what) {
+  var future2 = future.then(function(what) {
     ok(false, "Then.resolve has been called");
   }, function(what) {
     ok(true, "Then.reject has been called");
     is(what, 42, "Value == 42");
     return what + 1;
   });
 
-  isnot(promise, promise2, "These 2 promise objs are different");
+  isnot(future, future2, "These 2 future objs are different");
 
-  promise2.then(function(what) {
+  future2.then(function(what) {
     ok(true, "Then.resolve has been called");
     is(what, 43, "Value == 43");
     return what+1;
   }).catch(function(what) {
     ok(false, "Catch has been called");
   }).done(function(what) {
     ok(true, "Then.resolve has been called");
     is(what, 44, "Value == 44");
     runTest();
   });
 }
 
-function promiseRejectThenCatchDone2() {
-  var promise = new Promise(function(resolver) {
+function futureRejectThenCatchDone2() {
+  var future = new Future(function(resolver) {
     resolver.reject(42);
   });
 
-  promise.then(function(what) {
+  future.then(function(what) {
     ok(true, "Then.resolve has been called");
     is(what, 42, "Value == 42");
     return what+1;
   }).catch(function(what) {
     is(what, 42, "Value == 42");
     ok(true, "Catch has been called");
     return what+1;
   }).done(function(what) {
     ok(true, "Then.resolve has been called");
     is(what, 43, "Value == 43");
     runTest();
   });
 }
 
-function promiseRejectThenCatchExceptionDone() {
-  var promise = new Promise(function(resolver) {
+function futureRejectThenCatchExceptionDone() {
+  var future = new Future(function(resolver) {
     resolver.reject(42);
   });
 
-  promise.then(function(what) {
+  future.then(function(what) {
     ok(false, "Then.resolve has been called");
   }, function(what) {
     ok(true, "Then.reject has been called");
     is(what, 42, "Value == 42");
     throw(what + 1);
   }).catch(function(what) {
     ok(true, "Catch has been called");
     is(what, 43, "Value == 43");
     return what + 1;
   }).done(function(what) {
     ok(true, "Then.resolve has been called");
     is(what, 44, "Value == 44");
     runTest();
   });
 }
 
-function promiseThenCatchOrderingResolve() {
+function futureThenCatchOrderingResolve() {
   var global = 0;
-  var f = new Promise(function(r) {
+  var f = new Future(function(r) {
     r.resolve(42);
   });
 
   f.done(function() {
     f.then(function() {
       global++;
     });
     f.catch(function() {
@@ -257,19 +257,19 @@ function promiseThenCatchOrderingResolve
     });
     setTimeout(function() {
       is(global, 2, "Many steps... should return 2");
       runTest();
     }, 0);
   });
 }
 
-function promiseThenCatchOrderingReject() {
+function futureThenCatchOrderingReject() {
   var global = 0;
-  var f = new Promise(function(r) {
+  var f = new Future(function(r) {
     r.reject(42);
   })
 
   f.done(function() {}, function() {
     f.then(function() {
       global++;
     });
     f.catch(function() {
@@ -280,133 +280,133 @@ function promiseThenCatchOrderingReject(
     });
     setTimeout(function() {
       is(global, 2, "Many steps... should return 2");
       runTest();
     }, 0);
   });
 }
 
-function promiseNestedPromise() {
-  new Promise(function(resolver) {
-    resolver.resolve(new Promise(function(r) {
-      ok(true, "Nested promise is executed");
+function futureNestedFuture() {
+  new Future(function(resolver) {
+    resolver.resolve(new Future(function(r) {
+      ok(true, "Nested future is executed");
       r.resolve(42);
     }));
   }).then(function(value) {
-    is(value, 42, "Nested promise is executed and then == 42");
+    is(value, 42, "Nested future is executed and then == 42");
     runTest();
   });
 }
 
-function promiseNestedNestedPromise() {
-  new Promise(function(resolver) {
-    resolver.resolve(new Promise(function(r) {
-      ok(true, "Nested promise is executed");
+function futureNestedNestedFuture() {
+  new Future(function(resolver) {
+    resolver.resolve(new Future(function(r) {
+      ok(true, "Nested future is executed");
       r.resolve(42);
     }).then(function(what) { return what+1; }));
   }).then(function(value) {
-    is(value, 43, "Nested promise is executed and then == 43");
+    is(value, 43, "Nested future is executed and then == 43");
     runTest();
   });
 }
 
-function promiseWrongNestedPromise() {
-  new Promise(function(resolver) {
-    resolver.resolve(new Promise(function(r) {
-      ok(true, "Nested promise is executed");
+function futureWrongNestedFuture() {
+  new Future(function(resolver) {
+    resolver.resolve(new Future(function(r) {
+      ok(true, "Nested future is executed");
       r.resolve(42);
     }));
     resolver.reject(42);
   }).then(function(value) {
-    is(value, 42, "Nested promise is executed and then == 42");
+    is(value, 42, "Nested future is executed and then == 42");
     runTest();
   }, function(value) {
      ok(false, "This is wrong");
   });
 }
 
-function promiseLoop() {
-  new Promise(function(resolver) {
-    resolver.resolve(new Promise(function(r) {
-      ok(true, "Nested promise is executed");
-      r.resolve(new Promise(function(r) {
-        ok(true, "Nested nested promise is executed");
+function futureLoop() {
+  new Future(function(resolver) {
+    resolver.resolve(new Future(function(r) {
+      ok(true, "Nested future is executed");
+      r.resolve(new Future(function(r) {
+        ok(true, "Nested nested future is executed");
         r.resolve(42);
       }));
     }));
   }).then(function(value) {
-    is(value, 42, "Nested nested promise is executed and then == 42");
+    is(value, 42, "Nested nested future is executed and then == 42");
     runTest();
   }, function(value) {
      ok(false, "This is wrong");
   });
 }
 
-function promiseReject() {
-  var promise = Promise.reject(42).done(function(what) {
+function futureReject() {
+  var future = Future.reject(42).done(function(what) {
     ok(false, "This should not be called");
   }, function(what) {
     is(what, 42, "Value == 42");
     runTest();
   });
 }
 
-function promiseResolve() {
-  var promise = Promise.resolve(42).done(function(what) {
+function futureResolve() {
+  var future = Future.resolve(42).done(function(what) {
     is(what, 42, "Value == 42");
     runTest();
   }, function() {
     ok(false, "This should not be called");
   });
 }
 
-function promiseResolveNestedPromise() {
-  var promise = Promise.resolve(new Promise(function(r) {
-    ok(true, "Nested promise is executed");
+function futureResolveNestedFuture() {
+  var future = Future.resolve(new Future(function(r) {
+    ok(true, "Nested future is executed");
     r.resolve(42);
   }, function() {
     ok(false, "This should not be called");
   })).done(function(what) {
     is(what, 42, "Value == 42");
     runTest();
   }, function() {
     ok(false, "This should not be called");
   });
 }
 
-var tests = [ promiseResolve, promiseReject,
-              promiseException, promiseGC, promiseAsync,
-              promiseDoubleDone, promiseDoneException,
-              promiseThenCatchDone, promiseRejectThenCatchDone,
-              promiseRejectThenCatchDone2,
-              promiseRejectThenCatchExceptionDone,
-              promiseThenCatchOrderingResolve,
-              promiseThenCatchOrderingReject,
-              promiseNestedPromise, promiseNestedNestedPromise,
-              promiseWrongNestedPromise, promiseLoop,
-              promiseReject, promiseResolve,
-              promiseResolveNestedPromise,
+var tests = [ futureResolve, futureReject,
+              futureException, futureGC, futureAsync,
+              futureDoubleDone, futureDoneException,
+              futureThenCatchDone, futureRejectThenCatchDone,
+              futureRejectThenCatchDone2,
+              futureRejectThenCatchExceptionDone,
+              futureThenCatchOrderingResolve,
+              futureThenCatchOrderingReject,
+              futureNestedFuture, futureNestedNestedFuture,
+              futureWrongNestedFuture, futureLoop,
+              futureReject, futureResolve,
+              futureResolveNestedFuture,
             ];
 
 function runTest() {
   if (!tests.length) {
     SimpleTest.finish();
     return;
   }
 
   var test = tests.shift();
   test();
 }
 
-var p = SpecialPowers.getBoolPref("dom.promise.enabled");
-SpecialPowers.setBoolPref("dom.promise.enabled", false);
-ok(!("Promise" in window), "Promise object should not exist if disabled by pref");
-SpecialPowers.setBoolPref("dom.promise.enabled", p);
+var p = SpecialPowers.getBoolPref("dom.future.enabled");
+SpecialPowers.setBoolPref("dom.future.enabled", false);
+ok(!("Future" in window), "Future object should not exist if disabled by pref");
+SpecialPowers.setBoolPref("dom.future.enabled", p);
 
 SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true]]}, runTest);
+SpecialPowers.pushPrefEnv({"set": [["dom.future.enabled", true]]}, runTest);
 // -->
 </script>
 </pre>
 </body>
 </html>
 
rename from dom/promise/tests/test_resolve.html
rename to dom/future/tests/test_resolve.html
--- a/dom/promise/tests/test_resolve.html
+++ b/dom/future/tests/test_resolve.html
@@ -1,15 +1,15 @@
 <!--
   Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/
 -->
 <html>
 <head>
-  <title>Promise.resolve(anything) Test</title>
+  <title>Future.resolve(anything) Test</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
@@ -39,29 +39,29 @@ function cbError() {
 function runTest() {
   if (!tests.length) {
     SimpleTest.finish();
     return;
   }
 
   var test = tests.pop();
 
-  new Promise(function(resolver) {
+  new Future(function(resolver) {
     resolver.resolve(test);
   }).then(function(what) {
     ok(test === what, "What is: " + what);
   }, cbError).done(function() {
-    new Promise(function(resolver) {
+    new Future(function(resolver) {
       resolver.reject(test)
     }).then(cbError, function(what) {
       ok(test === what, "What is: " + what);
     }).done(runTest, cbError);
   });
 }
 
 SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true]]}, runTest);
+SpecialPowers.pushPrefEnv({"set": [["dom.future.enabled", true]]}, runTest);
 // -->
 </script>
 </pre>
 </body>
 </html>
 
--- a/dom/moz.build
+++ b/dom/moz.build
@@ -66,17 +66,17 @@ PARALLEL_DIRS += [
     'plugins/ipc',
     'indexedDB',
     'system',
     'ipc',
     'identity',
     'workers',
     'camera',
     'audiochannel',
-    'promise',
+    'future',
     'wappush'
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     PARALLEL_DIRS += ['plugins/ipc/hangui']
 
 if CONFIG['MOZ_B2G_RIL']:
     PARALLEL_DIRS += [
rename from dom/webidl/Promise.webidl
rename to dom/webidl/Future.webidl
--- a/dom/webidl/Promise.webidl
+++ b/dom/webidl/Future.webidl
@@ -1,36 +1,36 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  *
  * The origin of this IDL file is
- * http://dom.spec.whatwg.org/#promises
+ * http://dom.spec.whatwg.org/#futures
  */
 
-interface PromiseResolver {
+interface FutureResolver {
   void resolve(optional any value);
   void reject(optional any value);
 };
 
-callback PromiseInit = void (PromiseResolver resolver);
+callback FutureInit = void (FutureResolver resolver);
 callback AnyCallback = any (optional any value);
 
-[PrefControlled, Constructor(PromiseInit init)]
-interface Promise {
+[PrefControlled, Constructor(FutureInit init)]
+interface Future {
   // TODO: update this interface - bug 875289
 
   [Creator, Throws]
-  static Promise resolve(any value); // same as any(value)
+  static Future resolve(any value); // same as any(value)
   [Creator, Throws]
-  static Promise reject(any value);
+  static Future reject(any value);
 
   [Creator]
-  Promise then(optional AnyCallback? resolveCallback = null,
-               optional AnyCallback? rejectCallback = null);
+  Future then(optional AnyCallback? resolveCallback = null,
+              optional AnyCallback? rejectCallback = null);
 
   [Creator]
-  Promise catch(optional AnyCallback? rejectCallback = null);
+  Future catch(optional AnyCallback? rejectCallback = null);
 
   void done(optional AnyCallback? resolveCallback = null,
             optional AnyCallback? rejectCallback = null);
 };
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -81,16 +81,17 @@ webidl_files = \
   FileList.webidl \
   FileMode.webidl \
   FileReader.webidl \
   FileReaderSync.webidl \
   FileRequest.webidl \
   FocusEvent.webidl \
   FormData.webidl \
   Function.webidl \
+  Future.webidl \
   GainNode.webidl \
   Geolocation.webidl \
   HTMLAnchorElement.webidl \
   HTMLAppletElement.webidl \
   HTMLAreaElement.webidl \
   HTMLAudioElement.webidl \
   HTMLBaseElement.webidl \
   HTMLBodyElement.webidl \
@@ -201,17 +202,16 @@ webidl_files = \
   PannerNode.webidl \
   Performance.webidl \
   PerformanceNavigation.webidl \
   PerformanceTiming.webidl \
   PeriodicWave.webidl \
   Position.webidl \
   PositionError.webidl \
   ProcessingInstruction.webidl \
-  Promise.webidl \
   Range.webidl \
   Rect.webidl \
   RGBColor.webidl \
   RTCConfiguration.webidl \
   RTCDataChannelEvent.webidl \
   RTCIceCandidate.webidl \
   RTCPeerConnection.webidl \
   RTCPeerConnectionIceEvent.webidl \
--- a/layout/build/Makefile.in
+++ b/layout/build/Makefile.in
@@ -66,17 +66,17 @@ SHARED_LIBRARY_LIBS = \
 	$(DEPTH)/dom/mobilemessage/src/$(LIB_PREFIX)dom_mobilemessage_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/events/$(LIB_PREFIX)jsdomevents_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/json/$(LIB_PREFIX)json_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/jsurl/$(LIB_PREFIX)jsurl_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/storage/$(LIB_PREFIX)jsdomstorage_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/offline/$(LIB_PREFIX)jsdomoffline_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/geolocation/$(LIB_PREFIX)jsdomgeolocation_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/audiochannel/$(LIB_PREFIX)domaudiochannel_s.$(LIB_SUFFIX) \
-	$(DEPTH)/dom/promise/$(LIB_PREFIX)dompromise_s.$(LIB_SUFFIX) \
+	$(DEPTH)/dom/future/$(LIB_PREFIX)domfuture_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/notification/$(LIB_PREFIX)jsdomnotification_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/system/$(LIB_PREFIX)domsystem_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/workers/$(LIB_PREFIX)domworkers_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/indexedDB/$(LIB_PREFIX)dom_indexeddb_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/indexedDB/ipc/$(LIB_PREFIX)dom_indexeddb_ipc_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/browser-element/$(LIB_PREFIX)dom_browserelement_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/time/$(LIB_PREFIX)dom_time_s.$(LIB_SUFFIX) \
 	$(DEPTH)/editor/libeditor/text/$(LIB_PREFIX)texteditor_s.$(LIB_SUFFIX) \
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -1827,21 +1827,21 @@ pref("editor.resizing.preserve_ratio",  
 pref("editor.positioning.offset",            0);
 
 pref("dom.max_chrome_script_run_time", 20);
 pref("dom.max_script_run_time", 10);
 
 // If true, ArchiveReader will be enabled
 pref("dom.archivereader.enabled", false);
 
-// If true, Promise will be enabled
+// If true, Future will be enabled
 #ifdef RELEASE_BUILD
-pref("dom.promise.enabled", false);
+pref("dom.future.enabled", false);
 #else
-pref("dom.promise.enabled", true);
+pref("dom.future.enabled", true);
 #endif
 
 // Hang monitor timeout after which we kill the browser, in seconds
 // (0 is disabled)
 // Disabled on all platforms per bug 705748 until the found issues are
 // resolved.
 pref("hangmonitor.timeout", 0);