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

Differential Revision: https://phabricator.services.mozilla.com/D167230
This commit is contained in:
Andreas Farre
2023-01-24 15:37:49 +00:00
parent ad29180b54
commit fba7fef652
4 changed files with 22 additions and 0 deletions

View File

@@ -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: () => {

View File

@@ -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 =

View File

@@ -285,6 +285,8 @@ class ChromeUtils {
static double DateNow(GlobalObject&);
static void EnsureJSOracleStarted(GlobalObject&);
static unsigned AliveUtilityProcesses(const GlobalObject&);
};

View File

@@ -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.
*/