Backed out 2 changesets (bug 1515214) for hazard build bustage at CallbackObject.cpp. CLOSED TREE
authorBrindusan Cristian <cbrindusan@mozilla.com>
Fri, 08 Mar 2019 00:04:31 +0200
changeset 520905 2d48960b28162a564b1f2896bdac851a62721b44
parent 520904 101887de976288348feae904140b343a1ee2eec4
child 520906 da85432905df457597fe0be424aefbf3f9af31b8
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1515214
milestone67.0a1
backs out7c4973b0d0e80a4f6b9172454c8f709b60f9e431
9aabc3ad2470032f34bf20cafcb5c0bc2c61d64e
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 2 changesets (bug 1515214) for hazard build bustage at CallbackObject.cpp. CLOSED TREE Backed out changeset 7c4973b0d0e8 (bug 1515214) Backed out changeset 9aabc3ad2470 (bug 1515214)
dom/base/Timeout.cpp
dom/base/Timeout.h
dom/base/nsGlobalWindowInner.cpp
dom/bindings/CallbackObject.cpp
dom/bindings/CallbackObject.h
--- a/dom/base/Timeout.cpp
+++ b/dom/base/Timeout.cpp
@@ -44,23 +44,16 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(Timeout, AddRef)
 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(Timeout, Release)
 
 void Timeout::SetWhenOrTimeRemaining(const TimeStamp& aBaseTime,
                                      const TimeDuration& aDelay) {
   MOZ_DIAGNOSTIC_ASSERT(mWindow);
   mSubmitTime = aBaseTime;
 
-  mSubmitTime = aBaseTime;
-#ifdef MOZ_GECKO_PROFILER
-  if (profiler_is_active()) {
-    mCause = profiler_get_backtrace();
-  }
-#endif
-
   // If we are frozen simply set mTimeRemaining to be the "time remaining" in
   // the timeout (i.e., the interval itself).  This will be used to create a
   // new mWhen time when the window is thawed.  The end effect is that time does
   // not appear to pass for frozen windows.
   if (mWindow->IsFrozen()) {
     mWhen = TimeStamp();
     mTimeRemaining = aDelay;
     return;
--- a/dom/base/Timeout.h
+++ b/dom/base/Timeout.h
@@ -8,17 +8,16 @@
 #define mozilla_dom_timeout_h
 
 #include "mozilla/dom/PopupBlocker.h"
 #include "mozilla/LinkedList.h"
 #include "mozilla/TimeStamp.h"
 #include "nsCOMPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsITimeoutHandler.h"
-#include "GeckoProfiler.h"
 
 class nsIEventTarget;
 class nsIPrincipal;
 class nsIEventTarget;
 class nsGlobalWindowInner;
 
 namespace mozilla {
 namespace dom {
@@ -46,20 +45,16 @@ class Timeout final : public LinkedListE
   // Can only be called when not frozen.
   const TimeStamp& When() const;
 
   const TimeStamp& SubmitTime() const;
 
   // Can only be called when frozen.
   const TimeDuration& TimeRemaining() const;
 
-#ifdef MOZ_GECKO_PROFILER
-  UniqueProfilerBacktrace TakeProfilerBacktrace() { return std::move(mCause); }
-#endif
-
  private:
   // mWhen and mTimeRemaining can't be in a union, sadly, because they
   // have constructors.
   // Nominal time to run this timeout.  Use only when timeouts are not
   // frozen.
   TimeStamp mWhen;
 
   // Remaining time to wait.  Used only when timeouts are frozen.
@@ -82,20 +77,16 @@ class Timeout final : public LinkedListE
   RefPtr<nsGlobalWindowInner> mWindow;
 
   // The language-specific information about the callback.
   nsCOMPtr<nsITimeoutHandler> mScriptHandler;
 
   // Interval
   TimeDuration mInterval;
 
-#ifdef MOZ_GECKO_PROFILER
-  UniqueProfilerBacktrace mCause;
-#endif
-
   // Returned as value of setTimeout()
   uint32_t mTimeoutId;
 
   // Identifies which firing level this Timeout is being processed in
   // when sync loops trigger nested firing.
   uint32_t mFiringId;
 
 #ifdef DEBUG
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -5508,52 +5508,16 @@ int32_t nsGlobalWindowInner::SetTimeoutO
 
   int32_t result;
   aError =
       mTimeoutManager->SetTimeout(handler, aTimeout, aIsInterval,
                                   Timeout::Reason::eTimeoutOrInterval, &result);
   return result;
 }
 
-static const char* GetTimeoutReasonString(Timeout* aTimeout) {
-  switch (aTimeout->mReason) {
-    case Timeout::Reason::eTimeoutOrInterval:
-      if (aTimeout->mIsInterval) {
-        return "setInterval handler";
-      }
-      return "setTimeout handler";
-    case Timeout::Reason::eIdleCallbackTimeout:
-      return "setIdleCallback handler (timed out)";
-    default:
-      MOZ_CRASH("Unexpected enum value");
-      return "";
-  }
-}
-
-static void GetHandlerDescription(Timeout* aTimeout, nsACString& aOutString) {
-  nsCOMPtr<nsIScriptTimeoutHandler> handler(
-      do_QueryInterface(aTimeout->mScriptHandler));
-
-  if (!handler) {
-    aOutString.Append("<non-script timeout handler>");
-    return;
-  }
-
-  if (RefPtr<Function> callback = handler->GetCallback()) {
-    callback->GetDescription(aOutString);
-    return;
-  }
-
-  const char* filename = nullptr;
-  uint32_t lineNo = 0, columnNo = 0;
-  handler->GetLocation(&filename, &lineNo, &columnNo);
-  aOutString.AppendPrintf("<string handler> (%s:%d:%d)", filename, lineNo,
-                          columnNo);
-}
-
 bool nsGlobalWindowInner::RunTimeoutHandler(Timeout* aTimeout,
                                             nsIScriptContext* aScx) {
   // Hold on to the timeout in case mExpr or mFunObj releases its
   // doc.
   RefPtr<Timeout> timeout = aTimeout;
   Timeout* last_running_timeout = mTimeoutManager->BeginRunningTimeout(timeout);
   timeout->mRunning = true;
 
@@ -5569,35 +5533,22 @@ bool nsGlobalWindowInner::RunTimeoutHand
 
   bool trackNestingLevel = !timeout->mIsInterval;
   uint32_t nestingLevel;
   if (trackNestingLevel) {
     nestingLevel = TimeoutManager::GetNestingLevel();
     TimeoutManager::SetNestingLevel(timeout->mNestingLevel);
   }
 
-  const char* reason = GetTimeoutReasonString(timeout);
-
-#ifdef MOZ_GECKO_PROFILER
-  nsCOMPtr<nsIDocShell> docShell = GetDocShell();
-  nsCString str;
-  if (profiler_is_active()) {
-    TimeDuration originalInterval = timeout->When() - timeout->SubmitTime();
-    str.Append(reason);
-    str.Append(" with interval ");
-    str.AppendInt(int(originalInterval.ToMilliseconds()));
-    str.Append("ms: ");
-    nsCString handlerDescription;
-    GetHandlerDescription(timeout, handlerDescription);
-    str.Append(handlerDescription);
-  }
-  AUTO_PROFILER_TEXT_MARKER_DOCSHELL_CAUSE("setTimeout callback", str, JS,
-                                           docShell,
-                                           timeout->TakeProfilerBacktrace());
-#endif
+  const char* reason;
+  if (timeout->mIsInterval) {
+    reason = "setInterval handler";
+  } else {
+    reason = "setTimeout handler";
+  }
 
   bool abortIntervalHandler = false;
   nsCOMPtr<nsIScriptTimeoutHandler> handler(
       do_QueryInterface(timeout->mScriptHandler));
   if (handler) {
     RefPtr<Function> callback = handler->GetCallback();
 
     if (!callback) {
--- a/dom/bindings/CallbackObject.cpp
+++ b/dom/bindings/CallbackObject.cpp
@@ -121,73 +121,16 @@ JSObject* CallbackObject::Callback(JSCon
   if (!callback) {
     callback = JS_NewDeadWrapper(aCx);
   }
 
   MOZ_DIAGNOSTIC_ASSERT(callback);
   return callback;
 }
 
-void CallbackObject::GetDescription(nsACString& aOutString) {
-  JSObject* wrappedCallback = CallbackOrNull();
-  if (!wrappedCallback) {
-    aOutString.Append("<callback from a nuked compartment>");
-    return;
-  }
-
-  JSObject* unwrappedCallback = js::CheckedUnwrapStatic(wrappedCallback);
-  if (!unwrappedCallback) {
-    aOutString.Append("<not a function>");
-    return;
-  }
-
-  AutoJSAPI jsapi;
-  jsapi.Init();
-  JSContext* cx = jsapi.cx();
-
-  JS::RootedObject rootedCallback(cx, unwrappedCallback);
-  JSAutoRealm ar(cx, rootedCallback);
-
-  JS::Rooted<JSFunction*> rootedFunction(cx,
-                                         JS_GetObjectFunction(rootedCallback));
-  if (!rootedFunction) {
-    aOutString.Append("<not a function>");
-    return;
-  }
-
-  JS::Rooted<JSString*> displayId(cx, JS_GetFunctionDisplayId(rootedFunction));
-  if (displayId) {
-    nsAutoJSString funcNameStr;
-    if (funcNameStr.init(cx, displayId)) {
-      if (funcNameStr.IsEmpty()) {
-        aOutString.Append("<empty name>");
-      } else {
-        AppendUTF16toUTF8(funcNameStr, aOutString);
-      }
-    } else {
-      aOutString.Append("<function name string failed to materialize>");
-      jsapi.ClearException();
-    }
-  } else {
-    aOutString.Append("<anonymous>");
-  }
-
-  JS::Rooted<JSScript*> rootedScript(cx,
-                                     JS_GetFunctionScript(cx, rootedFunction));
-  if (!rootedScript) {
-    return;
-  }
-
-  aOutString.Append(" (");
-  aOutString.Append(JS_GetScriptFilename(rootedScript));
-  aOutString.Append(":");
-  aOutString.AppendInt(JS_GetScriptBaseLineNumber(cx, rootedScript));
-  aOutString.Append(")");
-}
-
 CallbackObject::CallSetup::CallSetup(CallbackObject* aCallback,
                                      ErrorResult& aRv,
                                      const char* aExecutionReason,
                                      ExceptionHandling aExceptionHandling,
                                      JS::Realm* aRealm,
                                      bool aIsJSImplementedWebIDL)
     : mCx(nullptr),
       mRealm(aRealm),
--- a/dom/bindings/CallbackObject.h
+++ b/dom/bindings/CallbackObject.h
@@ -153,23 +153,16 @@ class CallbackObject : public nsISupport
     // report it.
     eRethrowContentExceptions,
     // Throw exceptions to the caller code, unless the caller realm is
     // provided, the exception is not a DOMException from the caller
     // realm, and the caller realm does not subsume our unwrapped callback.
     eRethrowExceptions
   };
 
-  // Append a UTF-8 string to aOutString that describes the callback function,
-  // for use in logging or profiler markers.
-  // The string contains the function name and its source location, if
-  // available, in the following format:
-  // "<functionName> (<sourceURL>:<lineNumber>)"
-  void GetDescription(nsACString& aOutString);
-
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
     return aMallocSizeOf(this);
   }
 
  protected:
   virtual ~CallbackObject() { mozilla::DropJSObjects(this); }
 
   explicit CallbackObject(CallbackObject* aCallbackObject) {