clean up trajectory code

This commit is contained in:
oneflux 2025-04-23 00:50:06 -07:00
parent c7ce5a9a30
commit f70c1e0c11
2 changed files with 6 additions and 24 deletions

View file

@ -2,6 +2,7 @@
ac_add_options --enable-application=browser
ac_add_options --enable-jxl
ac_add_options --enable-release
mk_add_options MOZ_MAKE_FLAGS="-j$(nproc)"
export CC=clang
export CXX=clang++

View file

@ -35,7 +35,7 @@ index 52f0af76ec..2a7a9ae4fc 100644
double ChromeUtils::DateNow(GlobalObject&) { return JS_Now() / 1000.0; }
/* static */
@@ -2141,6 +2161,77 @@ void ChromeUtils::GetAllPossibleUtilityActorNames(GlobalObject& aGlobal,
@@ -2141,6 +2161,66 @@ void ChromeUtils::GetAllPossibleUtilityActorNames(GlobalObject& aGlobal,
}
}
@ -98,18 +98,7 @@ index 52f0af76ec..2a7a9ae4fc 100644
+ aRetVal.Clear();
+}
+
+/* static */
+void ChromeUtils::CamouGetMouseTrajectory(GlobalObject& aGlobal, long aFromX,
+ long aFromY, long aToX, long aToY,
+ nsTArray<int32_t>& aPoints) {
+ HumanizeMouseTrajectory trajectory(std::make_pair(aFromX, aFromY),
+ std::make_pair(aToX, aToY));
+ std::vector<int> flattenedPoints = trajectory.getPoints();
+
+ aPoints.Clear();
+ aPoints.AppendElements(flattenedPoints.data(), flattenedPoints.size());
+}
+
/* static */
bool ChromeUtils::ShouldResistFingerprinting(
GlobalObject& aGlobal, JSRFPTarget aTarget,
@ -128,7 +117,7 @@ index 138b9c3f80..c7c7ce74bf 100644
static double DateNow(GlobalObject&);
static void EnsureJSOracleStarted(GlobalObject&);
@@ -314,6 +318,24 @@ class ChromeUtils {
@@ -314,6 +318,20 @@ class ChromeUtils {
static void GetAllPossibleUtilityActorNames(GlobalObject& aGlobal,
nsTArray<nsCString>& aNames);
@ -146,10 +135,7 @@ index 138b9c3f80..c7c7ce74bf 100644
+ static void CamouGetStringList(GlobalObject& aGlobal, const nsAString& aVarName,
+ nsTArray<nsString>& aRetVal);
+
+ static void CamouGetMouseTrajectory(GlobalObject& aGlobal, long aFromX,
+ long aFromY, long aToX, long aToY,
+ nsTArray<int32_t>& aPoints);
+
static bool ShouldResistFingerprinting(
GlobalObject& aGlobal, JSRFPTarget aTarget,
const Nullable<uint64_t>& aOverriddenFingerprintingSettings);
@ -171,7 +157,7 @@ index 6a99703db1..82415eba19 100644
/**
* Starts the JSOracle process for ORB JavaScript validation, if it hasn't started already.
*/
@@ -761,6 +768,36 @@ partial namespace ChromeUtils {
@@ -761,6 +768,31 @@ partial namespace ChromeUtils {
[ChromeOnly]
readonly attribute unsigned long aliveUtilityProcesses;
@ -199,11 +185,6 @@ index 6a99703db1..82415eba19 100644
+ * Get a list of strings from Omegafox MaskConfig.
+ */
+ sequence<DOMString> camouGetStringList(DOMString varName);
+
+ /**
+ * Calculate a human-like mouse trajectory between two points.
+ */
+ sequence<long> camouGetMouseTrajectory(long fromX, long fromY, long toX, long toY);
+
/**
* Get a list of all possible Utility process Actor Names ; mostly useful to