Bug 920377 part.12 Get rid of nsScriptErrorEvent r=roc
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 27 Sep 2013 15:20:56 +0900
changeset 162771 45f2e3fce2c1141daac7e878197462ce8d234c17
parent 162770 299f2671ffc5a085d5c68609460337e52fcb209e
child 162772 fe2419c32ee75250a3342c08040c462cd5fb2ccc
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs920377
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 920377 part.12 Get rid of nsScriptErrorEvent r=roc
content/events/src/nsDOMEvent.cpp
dom/base/nsIScriptGlobalObject.h
dom/base/nsJSEnvironment.cpp
dom/indexedDB/IDBRequest.cpp
dom/indexedDB/IDBRequest.h
dom/indexedDB/IndexedDatabaseManager.cpp
dom/src/events/nsJSEventListener.cpp
dom/workers/WorkerPrivate.cpp
widget/ContentEvents.h
widget/EventForwards.h
--- a/content/events/src/nsDOMEvent.cpp
+++ b/content/events/src/nsDOMEvent.cpp
@@ -569,19 +569,20 @@ nsDOMEvent::DuplicatePrivateData()
       InternalClipboardEvent* clipboardEvent =
         new InternalClipboardEvent(false, msg);
       clipboardEvent->AssignClipboardEventData(*oldClipboardEvent, true);
       newEvent = clipboardEvent;
       break;
     }
     case NS_SCRIPT_ERROR_EVENT:
     {
-      nsScriptErrorEvent* oldScriptErrorEvent =
-        static_cast<nsScriptErrorEvent*>(mEvent);
-      nsScriptErrorEvent* scriptErrorEvent = new nsScriptErrorEvent(false, msg);
+      InternalScriptErrorEvent* oldScriptErrorEvent =
+        static_cast<InternalScriptErrorEvent*>(mEvent);
+      InternalScriptErrorEvent* scriptErrorEvent =
+        new InternalScriptErrorEvent(false, msg);
       scriptErrorEvent->AssignScriptErrorEventData(*oldScriptErrorEvent, true);
       newEvent = scriptErrorEvent;
       break;
     }
     case NS_TEXT_EVENT:
     {
       nsTextEvent* oldTextEvent = static_cast<nsTextEvent*>(mEvent);
       nsTextEvent* textEvent = new nsTextEvent(false, msg, nullptr);
--- a/dom/base/nsIScriptGlobalObject.h
+++ b/dom/base/nsIScriptGlobalObject.h
@@ -17,17 +17,17 @@ class nsIScriptGlobalObject;
 
 // A helper function for nsIScriptGlobalObject implementations to use
 // when handling a script error.  Generally called by the global when a context
 // notifies it of an error via nsIScriptGlobalObject::HandleScriptError.
 // Returns true if HandleDOMEvent was actually called, in which case
 // aStatus will be filled in with the status.
 bool
 NS_HandleScriptError(nsIScriptGlobalObject *aScriptGlobal,
-                     nsScriptErrorEvent *aErrorEvent,
+                     mozilla::InternalScriptErrorEvent *aErrorEvent,
                      nsEventStatus *aStatus);
 
 
 #define NS_ISCRIPTGLOBALOBJECT_IID \
 { 0x214fa2f6, 0xcc0c, 0x42cf, \
   { 0x98, 0x4b, 0x45, 0xf5, 0x73, 0x9c, 0x6b, 0x73 } }
 
 /**
@@ -73,18 +73,19 @@ public:
   /**
    * Called to enable/disable scripts.
    */
   virtual void SetScriptsEnabled(bool aEnabled, bool aFireTimeouts) = 0;
 
   /**
    * Handle a script error.  Generally called by a script context.
    */
-  virtual nsresult HandleScriptError(nsScriptErrorEvent *aErrorEvent,
-                                     nsEventStatus *aEventStatus) {
+  virtual nsresult HandleScriptError(
+                     mozilla::InternalScriptErrorEvent *aErrorEvent,
+                     nsEventStatus *aEventStatus) {
     NS_ENSURE_STATE(NS_HandleScriptError(this, aErrorEvent, aEventStatus));
     return NS_OK;
   }
 
   virtual bool IsBlackForCC() { return false; }
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptGlobalObject,
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -301,17 +301,17 @@ private:
 };
 
 // A utility function for script languages to call.  Although it looks small,
 // the use of nsIDocShell and nsPresContext triggers a huge number of
 // dependencies that most languages would not otherwise need.
 // XXXmarkh - This function is mis-placed!
 bool
 NS_HandleScriptError(nsIScriptGlobalObject *aScriptGlobal,
-                     nsScriptErrorEvent *aErrorEvent,
+                     InternalScriptErrorEvent *aErrorEvent,
                      nsEventStatus *aStatus)
 {
   bool called = false;
   nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(aScriptGlobal));
   nsIDocShell *docShell = win ? win->GetDocShell() : nullptr;
   if (docShell) {
     nsRefPtr<nsPresContext> presContext;
     docShell->GetPresContext(getter_AddRefs(presContext));
@@ -439,17 +439,17 @@ public:
           !JSREPORT_IS_WARNING(mFlags) &&
           !sHandlingScriptError) {
         sHandlingScriptError = true; // Recursion prevention
 
         nsRefPtr<nsPresContext> presContext;
         docShell->GetPresContext(getter_AddRefs(presContext));
 
         if (presContext) {
-          nsScriptErrorEvent errorevent(true, NS_LOAD_ERROR);
+          InternalScriptErrorEvent errorevent(true, NS_LOAD_ERROR);
 
           errorevent.fileName = mFileName.get();
 
           nsCOMPtr<nsIScriptObjectPrincipal> sop(do_QueryInterface(win));
           NS_ENSURE_STATE(sop);
           nsIPrincipal* p = sop->GetPrincipal();
           NS_ENSURE_STATE(p);
 
--- a/dom/indexedDB/IDBRequest.cpp
+++ b/dom/indexedDB/IDBRequest.cpp
@@ -36,16 +36,17 @@ namespace {
 #ifdef MOZ_ENABLE_PROFILER_SPS
 uint64_t gNextSerialNumber = 1;
 #endif
 
 } // anonymous namespace
 
 USING_INDEXEDDB_NAMESPACE
 using mozilla::dom::OwningIDBObjectStoreOrIDBIndexOrIDBCursor;
+using namespace mozilla;
 
 IDBRequest::IDBRequest()
 : mResultVal(JSVAL_VOID),
   mActorParent(nullptr),
 #ifdef MOZ_ENABLE_PROFILER_SPS
   mSerialNumber(gNextSerialNumber++),
 #endif
   mErrorCode(NS_OK),
@@ -294,17 +295,17 @@ IDBRequest::CaptureCaller()
     return;
   }
 
   mFilename.Assign(NS_ConvertUTF8toUTF16(filename));
   mLineNo = lineNo;
 }
 
 void
-IDBRequest::FillScriptErrorEvent(nsScriptErrorEvent* aEvent) const
+IDBRequest::FillScriptErrorEvent(InternalScriptErrorEvent* aEvent) const
 {
   aEvent->lineNr = mLineNo;
   aEvent->fileName = mFilename.get();
 }
 
 mozilla::dom::IDBRequestReadyState
 IDBRequest::ReadyState() const
 {
--- a/dom/indexedDB/IDBRequest.h
+++ b/dom/indexedDB/IDBRequest.h
@@ -100,17 +100,17 @@ public:
   IndexedDBRequestParentBase*
   GetActorParent() const
   {
     return mActorParent;
   }
 
   void CaptureCaller();
 
-  void FillScriptErrorEvent(nsScriptErrorEvent* aEvent) const;
+  void FillScriptErrorEvent(mozilla::InternalScriptErrorEvent* aEvent) const;
 
   bool
   IsPending() const
   {
     return !mHaveResultOrErrorCode;
   }
 
 #ifdef MOZ_ENABLE_PROFILER_SPS
--- a/dom/indexedDB/IndexedDatabaseManager.cpp
+++ b/dom/indexedDB/IndexedDatabaseManager.cpp
@@ -358,17 +358,17 @@ IndexedDatabaseManager::FireWindowOnErro
     return ret.ErrorCode();
   }
 
   nsString errorName;
   if (error) {
     error->GetName(errorName);
   }
 
-  nsScriptErrorEvent event(true, NS_LOAD_ERROR);
+  mozilla::InternalScriptErrorEvent event(true, NS_LOAD_ERROR);
   request->FillScriptErrorEvent(&event);
   NS_ABORT_IF_FALSE(event.fileName,
                     "FillScriptErrorEvent should give us a non-null string "
                     "for our error's fileName");
 
   event.errorMsg = errorName.get();
 
   nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryInterface(aOwner));
--- a/dom/src/events/nsJSEventListener.cpp
+++ b/dom/src/events/nsJSEventListener.cpp
@@ -174,18 +174,18 @@ nsJSEventListener::HandleEvent(nsIDOMEve
     Optional<nsAString> fileName;
     Optional<uint32_t> lineNumber;
     Optional<uint32_t> columnNumber;
 
     NS_ENSURE_TRUE(aEvent, NS_ERROR_UNEXPECTED);
     nsEvent* event = aEvent->GetInternalNSEvent();
     if (event->message == NS_LOAD_ERROR &&
         event->eventStructType == NS_SCRIPT_ERROR_EVENT) {
-      nsScriptErrorEvent *scriptEvent =
-        static_cast<nsScriptErrorEvent*>(event);
+      InternalScriptErrorEvent *scriptEvent =
+        static_cast<InternalScriptErrorEvent*>(event);
       errorMsg = scriptEvent->errorMsg;
       msgOrEvent.SetAsString() = static_cast<nsAString*>(&errorMsg);
 
       file = scriptEvent->fileName;
       fileName = &file;
 
       lineNumber.Construct();
       lineNumber.Value() = scriptEvent->lineNr;
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -66,16 +66,17 @@
 #include "WorkerScope.h"
 
 // GC will run once every thirty seconds during normal execution.
 #define NORMAL_GC_TIMER_DELAY_MS 30000
 
 // GC will run five seconds after the last event is processed.
 #define IDLE_GC_TIMER_DELAY_MS 5000
 
+using mozilla::InternalScriptErrorEvent;
 using mozilla::MutexAutoLock;
 using mozilla::TimeDuration;
 using mozilla::TimeStamp;
 using mozilla::dom::Throw;
 using mozilla::AutoPushJSContext;
 using mozilla::AutoSafeJSContext;
 
 USING_WORKERS_NAMESPACE
@@ -1053,18 +1054,18 @@ public:
           }
 
           if (!DispatchEventToTarget(aCx, aTarget, event,
                                      &preventDefaultCalled)) {
             return false;
           }
         }
         else {
-          // Icky, we have to fire an nsScriptErrorEvent...
-          nsScriptErrorEvent event(true, NS_LOAD_ERROR);
+          // Icky, we have to fire an InternalScriptErrorEvent...
+          InternalScriptErrorEvent event(true, NS_LOAD_ERROR);
           event.lineNr = aLineNumber;
           event.errorMsg = aMessage.get();
           event.fileName = aFilename.get();
 
           nsEventStatus status = nsEventStatus_eIgnore;
           if (NS_FAILED(sgo->HandleScriptError(&event, &status))) {
             NS_WARNING("Failed to dispatch main thread error event!");
             status = nsEventStatus_eIgnore;
--- a/widget/ContentEvents.h
+++ b/widget/ContentEvents.h
@@ -242,12 +242,9 @@ public:
 
     // animationName, elapsedTime and pseudoElement must have been initialized
     // with the constructor.
   }
 };
 
 } // namespace mozilla
 
-// TODO: Remove following typedefs
-typedef mozilla::InternalScriptErrorEvent nsScriptErrorEvent;
-
 #endif // mozilla_ContentEvents_h__
--- a/widget/EventForwards.h
+++ b/widget/EventForwards.h
@@ -123,11 +123,10 @@ typedef mozilla::WidgetMouseScrollEvent 
 
 namespace mozilla {
 typedef WidgetWheelEvent                   WheelEvent;
 }
 
 typedef mozilla::WidgetGestureNotifyEvent  nsGestureNotifyEvent;
 typedef mozilla::WidgetSimpleGestureEvent  nsSimpleGestureEvent;
 typedef mozilla::WidgetTouchEvent          nsTouchEvent;
-typedef mozilla::InternalScriptErrorEvent  nsScriptErrorEvent;
 
 #endif // mozilla_EventForwards_h__