Commit c71e5fdf authored by Andreas Farre's avatar Andreas Farre
Browse files

Bug 1812035 - Fix broken about:memory tests. r=smaug

Tests for about:memory doesn't know about utility processes. Make sure
to hide the utility process reporter when needed, and count the number
of living processes, also when needed.

Differential Revision: https://phabricator.services.mozilla.com/D167662
parent 5c4015fd
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1762,4 +1762,10 @@ bool ChromeUtils::IsDarkBackground(GlobalObject&, Element& aElement) {

double ChromeUtils::DateNow(GlobalObject&) { return JS_Now() / 1000.0; }

/* static */
unsigned ChromeUtils::AliveUtilityProcesses(const GlobalObject&) {
  const auto& utilityProcessManager =
      mozilla::ipc::UtilityProcessManager::GetIfExists();
  return utilityProcessManager ? utilityProcessManager->AliveProcesses() : 0;
}
}  // namespace mozilla::dom
+2 −0
Original line number Diff line number Diff line
@@ -284,6 +284,8 @@ class ChromeUtils {
  static bool IsDarkBackground(GlobalObject&, Element&);

  static double DateNow(GlobalObject&);

  static unsigned AliveUtilityProcesses(const GlobalObject&);
};

}  // namespace dom
+6 −0
Original line number Diff line number Diff line
@@ -653,6 +653,12 @@ partial namespace ChromeUtils {
   * Returns whether the background of the element is dark.
   */
  boolean isDarkBackground(Element element);

  /**
   * The number of currently alive utility processes.
   */
  [ChromeOnly]
  readonly attribute unsigned long aliveUtilityProcesses;
};

/*
+2 −1
Original line number Diff line number Diff line
@@ -130,6 +130,8 @@ class UtilityProcessManager final : public UtilityProcessHost::Listener {
  // Shutdown all utility processes
  void CleanShutdownAllProcesses();

  uint16_t AliveProcesses();

 private:
  ~UtilityProcessManager();

@@ -196,7 +198,6 @@ class UtilityProcessManager final : public UtilityProcessHost::Listener {

  RefPtr<ProcessFields> GetProcess(SandboxingKind);
  bool NoMoreProcesses();
  uint16_t AliveProcesses();
};

}  // namespace ipc
+1 −1
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@
            socketProcessRunning = 1;
          }

          let m2 = (vsizes.length == (4 + socketProcessRunning) &&
          let m2 = (vsizes.length == (4 + socketProcessRunning + ChromeUtils.aliveUtilityProcesses) &&
                    endOfBrowsers.length == 3);
          ok(m2, "three content processes present in loaded data");
          good = good && !!m2;
Loading