Commit 89a7e7fe authored by Andreas Farre's avatar Andreas Farre
Browse files

Bug 1806501 - Start the JS Oracle process early. r=smaug

parent c71e5fdf
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -2855,6 +2855,14 @@ BrowserGlue.prototype = {
        },
      },

      {
        // Starts the JSOracle process for ORB JavaScript validation, if it hasn't started already.
        name: "start-orb-javascript-oracle",
        task: () => {
          ChromeUtils.ensureJSOracleStarted();
        },
      },

      {
        name: "browser-startup-idle-tasks-finished",
        task: () => {
+7 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@

#include "ChromeUtils.h"

#include "JSOracleParent.h"
#include "js/CharacterEncoding.h"
#include "js/Object.h"              // JS::GetClass
#include "js/PropertyAndElement.h"  // JS_DefineProperty, JS_DefinePropertyById, JS_Enumerate, JS_GetProperty, JS_GetPropertyById, JS_SetProperty, JS_SetPropertyById, JS::IdVector
@@ -1762,6 +1763,12 @@ bool ChromeUtils::IsDarkBackground(GlobalObject&, Element& aElement) {

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

/* static */
void ChromeUtils::EnsureJSOracleStarted(GlobalObject&) {
  JSOracleParent::WithJSOracle(
      [](JSOracleParent* aParent) { MOZ_DIAGNOSTIC_ASSERT(aParent); });
}

/* static */
unsigned ChromeUtils::AliveUtilityProcesses(const GlobalObject&) {
  const auto& utilityProcessManager =
+2 −0
Original line number Diff line number Diff line
@@ -285,6 +285,8 @@ class ChromeUtils {

  static double DateNow(GlobalObject&);

  static void EnsureJSOracleStarted(GlobalObject&);

  static unsigned AliveUtilityProcesses(const GlobalObject&);
};

+5 −0
Original line number Diff line number Diff line
@@ -654,6 +654,11 @@ partial namespace ChromeUtils {
   */
  boolean isDarkBackground(Element element);

  /**
   * Starts the JSOracle process for ORB JavaScript validation, if it hasn't started already.
   */
  undefined ensureJSOracleStarted();

  /**
   * The number of currently alive utility processes.
   */