Back out bug 1019248 due to test failures.
authorKyle Huey <khuey@kylehuey.com>
Mon, 02 Jun 2014 20:18:17 -0700
changeset 205457 ff08d9bb2da1ac743e1a7c6b0ab5e75cf6050030
parent 205456 a0b233afc099b2d34f1e431f6b416794018e067c
child 205458 29d2b976dcb5cf015c30665a7206d4a6797e76bf
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1019248
milestone32.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
Back out bug 1019248 due to test failures.
content/base/src/FileIOObject.cpp
content/base/src/nsXMLHttpRequest.cpp
content/html/content/src/HTMLInputElement.cpp
content/html/content/src/HTMLVideoElement.cpp
dom/filehandle/FileRequest.cpp
dom/interfaces/events/nsIDOMEvent.idl
dom/webidl/ProgressEvent.webidl
dom/webidl/moz.build
dom/workers/XMLHttpRequest.cpp
js/xpconnect/src/event_impl_gen.conf.in
--- a/content/base/src/FileIOObject.cpp
+++ b/content/base/src/FileIOObject.cpp
@@ -3,17 +3,17 @@
  * 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 "FileIOObject.h"
 #include "mozilla/EventDispatcher.h"
 #include "nsDOMFile.h"
 #include "nsError.h"
 #include "nsIDOMEvent.h"
-#include "mozilla/dom/ProgressEvent.h"
+#include "nsIDOMProgressEvent.h"
 #include "nsComponentManagerUtils.h"
 
 #define ERROR_STR "error"
 #define ABORT_STR "abort"
 #define PROGRESS_STR "progress"
 
 namespace mozilla {
 namespace dom {
@@ -100,31 +100,37 @@ FileIOObject::DispatchError(nsresult rv,
   // Dispatch error event to signify load failure
   DispatchProgressEvent(NS_LITERAL_STRING(ERROR_STR));
   DispatchProgressEvent(finalEvent);
 }
 
 nsresult
 FileIOObject::DispatchProgressEvent(const nsAString& aType)
 {
-  ProgressEventInit init;
-  init.mBubbles = false;
-  init.mCancelable = false;
-  init.mLoaded = mTransferred;
+  nsCOMPtr<nsIDOMEvent> event;
+  nsresult rv = NS_NewDOMProgressEvent(getter_AddRefs(event), this,
+                                       nullptr, nullptr);
+  NS_ENSURE_SUCCESS(rv, rv);
 
+  event->SetTrusted(true);
+  nsCOMPtr<nsIDOMProgressEvent> progress = do_QueryInterface(event);
+  NS_ENSURE_TRUE(progress, NS_ERROR_UNEXPECTED);
+
+  bool known;
+  uint64_t size;
   if (mTotal != kUnknownSize) {
-    init.mLengthComputable = true;
-    init.mTotal = mTotal;
+    known = true;
+    size = mTotal;
   } else {
-    init.mLengthComputable = false;
-    init.mTotal = 0;
+    known = false;
+    size = 0;
   }
-  nsRefPtr<ProgressEvent> event =
-    ProgressEvent::Constructor(this, aType, init);
-  event->SetTrusted(true);
+  rv = progress->InitProgressEvent(aType, false, false, known,
+                                   mTransferred, size);
+  NS_ENSURE_SUCCESS(rv, rv);
 
   return DispatchDOMEvent(nullptr, event, nullptr, nullptr);
 }
 
 // nsITimerCallback
 NS_IMETHODIMP
 FileIOObject::Notify(nsITimer* aTimer)
 {
--- a/content/base/src/nsXMLHttpRequest.cpp
+++ b/content/base/src/nsXMLHttpRequest.cpp
@@ -11,17 +11,17 @@
 #endif
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/dom/XMLHttpRequestUploadBinding.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/MemoryReporting.h"
 #include "nsDOMBlobBuilder.h"
 #include "nsIDOMDocument.h"
-#include "mozilla/dom/ProgressEvent.h"
+#include "nsIDOMProgressEvent.h"
 #include "nsIJARChannel.h"
 #include "nsIJARURI.h"
 #include "nsLayoutCID.h"
 #include "nsReadableUtils.h"
 
 #include "nsIURI.h"
 #include "nsILoadGroup.h"
 #include "nsNetUtil.h"
@@ -1460,25 +1460,31 @@ nsXMLHttpRequest::DispatchProgressEvent(
     return;
   }
 
   bool dispatchLoadend = aType.EqualsLiteral(LOAD_STR) ||
                          aType.EqualsLiteral(ERROR_STR) ||
                          aType.EqualsLiteral(TIMEOUT_STR) ||
                          aType.EqualsLiteral(ABORT_STR);
 
-  ProgressEventInit init;
-  init.mBubbles = false;
-  init.mCancelable = false;
-  init.mLengthComputable = aLengthComputable;
-  init.mLoaded = aLoaded;
-  init.mTotal = (aTotal == UINT64_MAX) ? 0 : aTotal;
-
-  nsRefPtr<ProgressEvent> event =
-    ProgressEvent::Constructor(aTarget, aType, init);
+  nsCOMPtr<nsIDOMEvent> event;
+  nsresult rv = NS_NewDOMProgressEvent(getter_AddRefs(event), this,
+                                       nullptr, nullptr);
+  if (NS_FAILED(rv)) {
+    return;
+  }
+
+  nsCOMPtr<nsIDOMProgressEvent> progress = do_QueryInterface(event);
+  if (!progress) {
+    return;
+  }
+
+  progress->InitProgressEvent(aType, false, false, aLengthComputable,
+                              aLoaded, (aTotal == UINT64_MAX) ? 0 : aTotal);
+
   event->SetTrusted(true);
 
   aTarget->DispatchDOMEvent(nullptr, event, nullptr, nullptr);
 
   if (dispatchLoadend) {
     DispatchProgressEvent(aTarget, NS_LITERAL_STRING(LOADEND_STR),
                           aLengthComputable, aLoaded, aTotal);
   }
--- a/content/html/content/src/HTMLInputElement.cpp
+++ b/content/html/content/src/HTMLInputElement.cpp
@@ -22,17 +22,17 @@
 #include "nsFocusManager.h"
 #include "nsColorControlFrame.h"
 #include "nsNumberControlFrame.h"
 #include "nsPIDOMWindow.h"
 #include "nsRepeatService.h"
 #include "nsContentCID.h"
 #include "nsIComponentManager.h"
 #include "nsIDOMHTMLFormElement.h"
-#include "mozilla/dom/ProgressEvent.h"
+#include "nsIDOMProgressEvent.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsMappedAttributes.h"
 #include "nsIFormControl.h"
 #include "nsIForm.h"
 #include "nsFormSubmission.h"
 #include "nsFormSubmissionConstants.h"
@@ -2720,29 +2720,35 @@ HTMLInputElement::MaybeDispatchProgressE
 
 void
 HTMLInputElement::DispatchProgressEvent(const nsAString& aType,
                                         bool aLengthComputable,
                                         uint64_t aLoaded, uint64_t aTotal)
 {
   NS_ASSERTION(!aType.IsEmpty(), "missing event type");
 
-  ProgressEventInit init;
-  init.mBubbles = false;
-  init.mCancelable = true; // XXXkhuey why?
-  init.mLengthComputable = aLengthComputable;
-  init.mLoaded = aLoaded;
-  init.mTotal = (aTotal == UINT64_MAX) ? 0 : aTotal;
-
-  nsRefPtr<ProgressEvent> event =
-    ProgressEvent::Constructor(this, aType, init);
+  nsCOMPtr<nsIDOMEvent> event;
+  nsresult rv = NS_NewDOMProgressEvent(getter_AddRefs(event), this,
+                                       nullptr, nullptr);
+  if (NS_FAILED(rv)) {
+    return;
+  }
+
+  nsCOMPtr<nsIDOMProgressEvent> progress = do_QueryInterface(event);
+  if (!progress) {
+    return;
+  }
+
+  progress->InitProgressEvent(aType, false, true, aLengthComputable,
+                              aLoaded, (aTotal == UINT64_MAX) ? 0 : aTotal);
+
   event->SetTrusted(true);
 
   bool doDefaultAction;
-  nsresult rv = DispatchEvent(event, &doDefaultAction);
+  rv = DispatchEvent(event, &doDefaultAction);
   if (NS_SUCCEEDED(rv) && !doDefaultAction) {
     CancelDirectoryPickerScanIfRunning();
   }
 }
 
 nsresult
 HTMLInputElement::UpdateFileList()
 {
--- a/content/html/content/src/HTMLVideoElement.cpp
+++ b/content/html/content/src/HTMLVideoElement.cpp
@@ -20,16 +20,17 @@
 #include "nsThreadUtils.h"
 #include "ImageContainer.h"
 
 #include "nsIScriptSecurityManager.h"
 #include "nsIXPConnect.h"
 
 #include "nsITimer.h"
 
+#include "nsIDOMProgressEvent.h"
 #include "MediaError.h"
 #include "MediaDecoder.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/WakeLock.h"
 #include "mozilla/dom/power/PowerManagerService.h"
 #include "nsPerformance.h"
 #include "mozilla/dom/VideoPlaybackQuality.h"
 
--- a/dom/filehandle/FileRequest.cpp
+++ b/dom/filehandle/FileRequest.cpp
@@ -13,17 +13,17 @@
 #include "MainThreadUtils.h"
 #include "mozilla/dom/FileRequestBinding.h"
 #include "mozilla/EventDispatcher.h"
 #include "nsCOMPtr.h"
 #include "nsCxPusher.h"
 #include "nsDebug.h"
 #include "nsError.h"
 #include "nsIDOMEvent.h"
-#include "mozilla/dom/ProgressEvent.h"
+#include "nsIDOMProgressEvent.h"
 #include "nsIScriptContext.h"
 #include "nsLiteralString.h"
 
 namespace mozilla {
 namespace dom {
 
 FileRequest::FileRequest(nsPIDOMWindow* aWindow)
   : DOMRequest(aWindow), mWrapAsDOMRequest(false)
@@ -130,22 +130,28 @@ FileRequest::GetLockedFile() const
 
 void
 FileRequest::FireProgressEvent(uint64_t aLoaded, uint64_t aTotal)
 {
   if (NS_FAILED(CheckInnerWindowCorrectness())) {
     return;
   }
 
-  ProgressEventInit init;
-  init.mBubbles = false;
-  init.mCancelable = false;
-  init.mLengthComputable = false;
-  init.mLoaded = aLoaded;
-  init.mTotal = aTotal;
+  nsCOMPtr<nsIDOMEvent> event;
+  nsresult rv = NS_NewDOMProgressEvent(getter_AddRefs(event), this,
+                                       nullptr, nullptr);
+  if (NS_FAILED(rv)) {
+    return;
+  }
 
-  nsRefPtr<ProgressEvent> event =
-    ProgressEvent::Constructor(this, NS_LITERAL_STRING("progress"), init);
+  nsCOMPtr<nsIDOMProgressEvent> progress = do_QueryInterface(event);
+  MOZ_ASSERT(progress);
+  rv = progress->InitProgressEvent(NS_LITERAL_STRING("progress"), false, false,
+                                   false, aLoaded, aTotal);
+  if (NS_FAILED(rv)) {
+    return;
+  }
+
   DispatchTrustedEvent(event);
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/interfaces/events/nsIDOMEvent.idl
+++ b/dom/interfaces/events/nsIDOMEvent.idl
@@ -322,16 +322,21 @@ NS_NewDOMCommandEvent(nsIDOMEvent** aIns
                       mozilla::dom::EventTarget* aOwner,
                       nsPresContext* aPresContext,
                       mozilla::WidgetCommandEvent* aEvent);
 nsresult
 NS_NewDOMMessageEvent(nsIDOMEvent** aInstancePtrResult,
                       mozilla::dom::EventTarget* aOwner,
                       nsPresContext* aPresContext,
                       mozilla::WidgetEvent* aEvent);
+nsresult
+NS_NewDOMProgressEvent(nsIDOMEvent** aInstancePtrResult,
+                       mozilla::dom::EventTarget* aOwner,
+                       nsPresContext* aPresContext,
+                       mozilla::WidgetEvent* aEvent);
 // This empties aInvalidateRequests.
 nsresult
 NS_NewDOMNotifyPaintEvent(nsIDOMEvent** aResult,
                           mozilla::dom::EventTarget* aOwner,
                           nsPresContext* aPresContext,
                           mozilla::WidgetEvent* aEvent,
                           uint32_t aEventType = 0,
                           nsInvalidateRequestList* aInvalidateRequests = nullptr);
--- a/dom/webidl/ProgressEvent.webidl
+++ b/dom/webidl/ProgressEvent.webidl
@@ -1,15 +1,15 @@
 /* -*- 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/.
  */
 
-[Constructor(DOMString type, optional ProgressEventInit eventInitDict)]
+[Constructor(DOMString type, optional ProgressEventInit eventInitDict), HeaderFile="GeneratedEventClasses.h"]
 interface ProgressEvent : Event
 {
   readonly attribute boolean lengthComputable;
   readonly attribute unsigned long long loaded;
   readonly attribute unsigned long long total;
 };
 
 dictionary ProgressEventInit : EventInit
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -636,17 +636,16 @@ GENERATED_EVENTS_WEBIDL_FILES = [
     'IccChangeEvent.webidl',
     'MediaStreamEvent.webidl',
     'MozClirModeEvent.webidl',
     'MozContactChangeEvent.webidl',
     'MozEmergencyCbModeEvent.webidl',
     'MozInterAppMessageEvent.webidl',
     'MozOtaStatusEvent.webidl',
     'MozStkCommandEvent.webidl',
-    'ProgressEvent.webidl',
     'RTCDataChannelEvent.webidl',
     'RTCPeerConnectionIceEvent.webidl',
     'RTCPeerConnectionIdentityErrorEvent.webidl',
     'RTCPeerConnectionIdentityEvent.webidl',
     'TrackEvent.webidl',
     'UserProximityEvent.webidl',
     'USSDReceivedEvent.webidl',
 ]
--- a/dom/workers/XMLHttpRequest.cpp
+++ b/dom/workers/XMLHttpRequest.cpp
@@ -11,17 +11,16 @@
 #include "nsIRunnable.h"
 #include "nsIVariant.h"
 #include "nsIXMLHttpRequest.h"
 #include "nsIXPConnect.h"
 
 #include "jsfriendapi.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/dom/Exceptions.h"
-#include "mozilla/dom/ProgressEvent.h"
 #include "nsComponentManagerUtils.h"
 #include "nsContentUtils.h"
 #include "nsCxPusher.h"
 #include "nsJSUtils.h"
 #include "nsThreadUtils.h"
 
 #include "File.h"
 #include "RuntimeService.h"
@@ -1339,24 +1338,23 @@ EventRunnable::WorkerRun(JSContext* aCx,
   else {
     target = xhr;
   }
 
   MOZ_ASSERT(target);
 
   nsCOMPtr<nsIDOMEvent> event;
   if (mProgressEvent) {
-    ProgressEventInit init;
-    init.mBubbles = false;
-    init.mCancelable = false;
-    init.mLengthComputable = mLengthComputable;
-    init.mLoaded = mLoaded;
-    init.mTotal = mTotal;
-
-    event = ProgressEvent::Constructor(target, mType, init);
+    NS_NewDOMProgressEvent(getter_AddRefs(event), target, nullptr, nullptr);
+    nsCOMPtr<nsIDOMProgressEvent> progress = do_QueryInterface(event);
+
+    if (progress) {
+      progress->InitProgressEvent(mType, false, false, mLengthComputable,
+                                  mLoaded, mTotal);
+    }
   }
   else {
     NS_NewDOMEvent(getter_AddRefs(event), target, nullptr, nullptr);
 
     if (event) {
       event->InitEvent(mType, false, false);
     }
   }
@@ -1736,30 +1734,33 @@ XMLHttpRequest::DispatchPrematureAbortEv
   if (aEventType.EqualsLiteral("readystatechange")) {
     NS_NewDOMEvent(getter_AddRefs(event), aTarget, nullptr, nullptr);
 
     if (event) {
       event->InitEvent(aEventType, false, false);
     }
   }
   else {
-    ProgressEventInit init;
-    init.mBubbles = false;
-    init.mCancelable = false;
-    if (aUploadTarget) {
-      init.mLengthComputable = mProxy->mLastUploadLengthComputable;
-      init.mLoaded = mProxy->mLastUploadLoaded;
-      init.mTotal = mProxy->mLastUploadTotal;
+    NS_NewDOMProgressEvent(getter_AddRefs(event), aTarget, nullptr, nullptr);
+
+    nsCOMPtr<nsIDOMProgressEvent> progress = do_QueryInterface(event);
+    if (progress) {
+      if (aUploadTarget) {
+        progress->InitProgressEvent(aEventType, false, false,
+                                    mProxy->mLastUploadLengthComputable,
+                                    mProxy->mLastUploadLoaded,
+                                    mProxy->mLastUploadTotal);
+      }
+      else {
+        progress->InitProgressEvent(aEventType, false, false,
+                                    mProxy->mLastLengthComputable,
+                                    mProxy->mLastLoaded,
+                                    mProxy->mLastTotal);
+      }
     }
-    else {
-      init.mLengthComputable = mProxy->mLastLengthComputable;
-      init.mLoaded = mProxy->mLastLoaded;
-      init.mTotal = mProxy->mLastTotal;
-    }
-    event = ProgressEvent::Constructor(aTarget, aEventType, init);
   }
 
   if (!event) {
     aRv.Throw(NS_ERROR_FAILURE);
     return;
   }
 
   event->SetTrusted(true);
--- a/js/xpconnect/src/event_impl_gen.conf.in
+++ b/js/xpconnect/src/event_impl_gen.conf.in
@@ -3,16 +3,17 @@
  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 name of the event which real interface should have nsIDOM-prefix,
  and should be in nsIDOM<name>.idl file and which should have
  <name>Init dictionary for the event constructor. """
 
 simple_events = [
+    'ProgressEvent',
     'MozSettingsEvent',
     'CustomEvent',
     'PageTransitionEvent',
     'DOMTransactionEvent',
     'PopStateEvent',
     'HashChangeEvent',
     'CloseEvent',
     'DeviceOrientationEvent',