mirror of
https://forge.fsky.io/oneflux/omegafox.git
synced 2026-02-10 03:22:05 -08:00
Backwards compatibility with <0.3.0
Change ALL webgl keys to webGl. This keeps backwards compatibility with <0.3.0 versions of the Python library.
This commit is contained in:
parent
0ff90fc750
commit
711b5b4550
4 changed files with 45 additions and 45 deletions
28
README.md
28
README.md
|
|
@ -361,20 +361,20 @@ Camoufox supports spoofing WebGL parameters, supported extensions, context attri
|
|||
|
||||
| Property | Description | Example |
|
||||
| ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
|
||||
| webgl:renderer | Spoofs the name of the unmasked WebGL renderer. | `"NVIDIA GeForce GTX 980, or similar"` |
|
||||
| webgl:vendor | Spoofs the name of the unmasked WebGL vendor. | `"NVIDIA Corporation"` |
|
||||
| webgl:supportedExtensions | An array of supported WebGL extensions ([full list](https://registry.khronos.org/webgl/extensions/)). | `["ANGLE_instanced_arrays", "EXT_color_buffer_float", "EXT_disjoint_timer_query", ...]` |
|
||||
| webgl2:supportedExtensions | The same as `webgl:supportedExtensions`, but for WebGL2. | `["ANGLE_instanced_arrays", "EXT_color_buffer_float", "EXT_disjoint_timer_query", ...]` |
|
||||
| webgl:contextAttributes | A dictionary of WebGL context attributes. | `{"alpha": true, "antialias": true, "depth": true, ...}` |
|
||||
| webgl2:contextAttributes | The same as `webgl:contextAttributes`, but for WebGL2. | `{"alpha": true, "antialias": true, "depth": true, ...}` |
|
||||
| webgl:parameters | A dictionary of WebGL parameters. Keys must be GL enums, and values are the values to spoof them as. | `{"2849": 1, "2884": false, "2928": [0, 1], ...}` |
|
||||
| webgl2:parameters | The same as `webgl:parameters`, but for WebGL2. | `{"2849": 1, "2884": false, "2928": [0, 1], ...}` |
|
||||
| webgl:parameters:blockIfNotDefined | If set to `true`, only the parameters in `webgl:parameters` will be allowed. Can be dangerous if not used correctly. | `true`/`false` |
|
||||
| webgl2:parameters:blockIfNotDefined | If set to `true`, only the parameters in `webgl2:parameters` will be allowed. Can be dangerous if not used correctly. | `true`/`false` |
|
||||
| webgl:shaderPrecisionFormats | A dictionary of WebGL shader precision formats. Keys are formatted as `"<shaderType>,<precisionType>"`. | `{"35633,36336": {"rangeMin": 127, "rangeMax": 127, "precision": 23}, ...}` |
|
||||
| webgl2:shaderPrecisionFormats | The same as `webGL:shaderPrecisionFormats`, but for WebGL2. | `{"35633,36336": {"rangeMin": 127, "rangeMax": 127, "precision": 23}, ...}` |
|
||||
| webgl:shaderPrecisionFormats:blockIfNotDefined | If set to `true`, only the shader percisions in `webgl:shaderPrecisionFormats` will be allowed. | `true`/`false` |
|
||||
| webgl2:shaderPrecisionFormats:blockIfNotDefined | If set to `true`, only the shader percisions in `webgl2:shaderPrecisionFormats` will be allowed. | `true`/`false` |
|
||||
| webGl:renderer | Spoofs the name of the unmasked WebGL renderer. | `"NVIDIA GeForce GTX 980, or similar"` |
|
||||
| webGl:vendor | Spoofs the name of the unmasked WebGL vendor. | `"NVIDIA Corporation"` |
|
||||
| webGl:supportedExtensions | An array of supported WebGL extensions ([full list](https://registry.khronos.org/webgl/extensions/)). | `["ANGLE_instanced_arrays", "EXT_color_buffer_float", "EXT_disjoint_timer_query", ...]` |
|
||||
| webGl2:supportedExtensions | The same as `webGl:supportedExtensions`, but for WebGL2. | `["ANGLE_instanced_arrays", "EXT_color_buffer_float", "EXT_disjoint_timer_query", ...]` |
|
||||
| webGl:contextAttributes | A dictionary of WebGL context attributes. | `{"alpha": true, "antialias": true, "depth": true, ...}` |
|
||||
| webGl2:contextAttributes | The same as `webGl:contextAttributes`, but for WebGL2. | `{"alpha": true, "antialias": true, "depth": true, ...}` |
|
||||
| webGl:parameters | A dictionary of WebGL parameters. Keys must be GL enums, and values are the values to spoof them as. | `{"2849": 1, "2884": false, "2928": [0, 1], ...}` |
|
||||
| webGl2:parameters | The same as `webGl:parameters`, but for WebGL2. | `{"2849": 1, "2884": false, "2928": [0, 1], ...}` |
|
||||
| webGl:parameters:blockIfNotDefined | If set to `true`, only the parameters in `webGl:parameters` will be allowed. Can be dangerous if not used correctly. | `true`/`false` |
|
||||
| webGl2:parameters:blockIfNotDefined | If set to `true`, only the parameters in `webGl2:parameters` will be allowed. Can be dangerous if not used correctly. | `true`/`false` |
|
||||
| webGl:shaderPrecisionFormats | A dictionary of WebGL shader precision formats. Keys are formatted as `"<shaderType>,<precisionType>"`. | `{"35633,36336": {"rangeMin": 127, "rangeMax": 127, "precision": 23}, ...}` |
|
||||
| webGl2:shaderPrecisionFormats | The same as `webGL:shaderPrecisionFormats`, but for WebGL2. | `{"35633,36336": {"rangeMin": 127, "rangeMax": 127, "precision": 23}, ...}` |
|
||||
| webGl:shaderPrecisionFormats:blockIfNotDefined | If set to `true`, only the shader percisions in `webGl:shaderPrecisionFormats` will be allowed. | `true`/`false` |
|
||||
| webGl2:shaderPrecisionFormats:blockIfNotDefined | If set to `true`, only the shader percisions in `webGl2:shaderPrecisionFormats` will be allowed. | `true`/`false` |
|
||||
|
||||
</details>
|
||||
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ inline std::optional<nlohmann::json> GetNested(const std::string& domain,
|
|||
template <typename T>
|
||||
inline std::optional<T> GetAttribute(const std::string attrib, bool isWebGL2) {
|
||||
auto value = MaskConfig::GetNested(
|
||||
isWebGL2 ? "webgl2:contextAttributes" : "webgl:contextAttributes",
|
||||
isWebGL2 ? "webGl2:contextAttributes" : "webGl:contextAttributes",
|
||||
attrib);
|
||||
if (!value) return std::nullopt;
|
||||
return value.value().get<T>();
|
||||
|
|
@ -222,7 +222,7 @@ inline std::optional<
|
|||
std::variant<int64_t, bool, double, std::string, std::nullptr_t>>
|
||||
GLParam(uint32_t pname, bool isWebGL2) {
|
||||
auto value =
|
||||
MaskConfig::GetNested(isWebGL2 ? "webgl2:parameters" : "webgl:parameters",
|
||||
MaskConfig::GetNested(isWebGL2 ? "webGl2:parameters" : "webGl:parameters",
|
||||
std::to_string(pname));
|
||||
if (!value) return std::nullopt;
|
||||
auto data = value.value();
|
||||
|
|
@ -237,7 +237,7 @@ GLParam(uint32_t pname, bool isWebGL2) {
|
|||
template <typename T>
|
||||
inline T MParamGL(uint32_t pname, T defaultValue, bool isWebGL2) {
|
||||
if (auto value = MaskConfig::GetNested(
|
||||
isWebGL2 ? "webgl2:parameters" : "webgl:parameters",
|
||||
isWebGL2 ? "webGl2:parameters" : "webGl:parameters",
|
||||
std::to_string(pname));
|
||||
value.has_value()) {
|
||||
return value.value().get<T>();
|
||||
|
|
@ -250,7 +250,7 @@ inline std::vector<T> MParamGLVector(uint32_t pname,
|
|||
std::vector<T> defaultValue,
|
||||
bool isWebGL2) {
|
||||
if (auto value = MaskConfig::GetNested(
|
||||
isWebGL2 ? "webgl2:parameters" : "webgl:parameters",
|
||||
isWebGL2 ? "webGl2:parameters" : "webGl:parameters",
|
||||
std::to_string(pname));
|
||||
value.has_value()) {
|
||||
if (value.value().is_array()) {
|
||||
|
|
@ -266,8 +266,8 @@ inline std::optional<std::array<int32_t, 3UL>> MShaderData(
|
|||
std::string valueName =
|
||||
std::to_string(shaderType) + "," + std::to_string(precisionType);
|
||||
if (auto value =
|
||||
MaskConfig::GetNested(isWebGL2 ? "webgl2:shaderPrecisionFormats"
|
||||
: "webgl:shaderPrecisionFormats",
|
||||
MaskConfig::GetNested(isWebGL2 ? "webGl2:shaderPrecisionFormats"
|
||||
: "webGl:shaderPrecisionFormats",
|
||||
valueName)) {
|
||||
// Convert {rangeMin: int, rangeMax: int, precision: int} to array
|
||||
auto data = value.value();
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ index db60868f65..7361f0fc9c 100644
|
|||
+ result.mStencil = MBoolVal("stencil", options.stencil);
|
||||
+ result.mAntialias.Construct(MBoolVal("antialias", options.antialias));
|
||||
+ result.mPremultipliedAlpha = MBoolVal(
|
||||
+ "webgl:contextAttributes.premultipliedAlpha", options.premultipliedAlpha);
|
||||
+ "webGl:contextAttributes.premultipliedAlpha", options.premultipliedAlpha);
|
||||
+ result.mPreserveDrawingBuffer =
|
||||
+ MBoolVal("preserveDrawingBuffer", options.preserveDrawingBuffer);
|
||||
+ result.mFailIfMajorPerformanceCaveat = MBoolVal(
|
||||
|
|
@ -161,8 +161,8 @@ index db60868f65..7361f0fc9c 100644
|
|||
+ case dom::WEBGL_debug_renderer_info_Binding::UNMASKED_VENDOR_WEBGL:
|
||||
+ break;
|
||||
+ default:
|
||||
+ if (MaskConfig::GetBool(mIsWebGL2 ? "webgl2:parameters:blockIfNotDefined"
|
||||
+ : "webgl:parameters:blockIfNotDefined")) {
|
||||
+ if (MaskConfig::GetBool(mIsWebGL2 ? "webGl2:parameters:blockIfNotDefined"
|
||||
+ : "webGl:parameters:blockIfNotDefined")) {
|
||||
+ retval.set(JS::NullValue());
|
||||
+ return;
|
||||
+ }
|
||||
|
|
@ -272,7 +272,7 @@ index db60868f65..7361f0fc9c 100644
|
|||
|
||||
switch (pname) {
|
||||
case dom::WEBGL_debug_renderer_info_Binding::UNMASKED_RENDERER_WEBGL:
|
||||
+ if (auto value = MaskConfig::GetString("webgl:renderer")) {
|
||||
+ if (auto value = MaskConfig::GetString("webGl:renderer")) {
|
||||
+ ret = Some(value.value());
|
||||
+ break;
|
||||
+ }
|
||||
|
|
@ -283,7 +283,7 @@ index db60868f65..7361f0fc9c 100644
|
|||
break;
|
||||
|
||||
case dom::WEBGL_debug_renderer_info_Binding::UNMASKED_VENDOR_WEBGL:
|
||||
+ if (auto value = MaskConfig::GetString("webgl:vendor")) {
|
||||
+ if (auto value = MaskConfig::GetString("webGl:vendor")) {
|
||||
+ ret = Some(value.value());
|
||||
+ break;
|
||||
+ }
|
||||
|
|
@ -317,8 +317,8 @@ index db60868f65..7361f0fc9c 100644
|
|||
+ }
|
||||
+ // Check if block if not defined is on
|
||||
+ if (MaskConfig::GetBool(
|
||||
+ mIsWebGL2 ? "webgl2:shaderPrecisionFormats:blockIfNotDefined"
|
||||
+ : "webgl:shaderPrecisionFormats:blockIfNotDefined")) {
|
||||
+ mIsWebGL2 ? "webGl2:shaderPrecisionFormats:blockIfNotDefined"
|
||||
+ : "webGl:shaderPrecisionFormats:blockIfNotDefined")) {
|
||||
+ Maybe<webgl::ShaderPrecisionFormat> ret;
|
||||
+ return ret;
|
||||
+ }
|
||||
|
|
@ -331,8 +331,8 @@ index db60868f65..7361f0fc9c 100644
|
|||
}
|
||||
|
||||
+ if (std::vector<std::string> maskValues =
|
||||
+ MaskConfig::GetStringList(mIsWebGL2 ? "webgl2:supportedExtensions"
|
||||
+ : "webgl:supportedExtensions");
|
||||
+ MaskConfig::GetStringList(mIsWebGL2 ? "webGl2:supportedExtensions"
|
||||
+ : "webGl:supportedExtensions");
|
||||
+ !maskValues.empty()) {
|
||||
+ if (std::find(maskValues.begin(), maskValues.end(),
|
||||
+ GetExtensionName(ext)) != maskValues.end()) {
|
||||
|
|
@ -351,8 +351,8 @@ index db60868f65..7361f0fc9c 100644
|
|||
+
|
||||
+ // Implement separately to prevent O(n^2) timing
|
||||
+ if (std::vector<std::string> maskValues =
|
||||
+ MaskConfig::GetStringList(mIsWebGL2 ? "webgl2:supportedExtensions"
|
||||
+ : "webgl:supportedExtensions");
|
||||
+ MaskConfig::GetStringList(mIsWebGL2 ? "webGl2:supportedExtensions"
|
||||
+ : "webGl:supportedExtensions");
|
||||
+ !maskValues.empty()) {
|
||||
+ for (const auto& ext : maskValues) {
|
||||
+ retarr.AppendElement(NS_ConvertUTF8toUTF16(ext));
|
||||
|
|
|
|||
|
|
@ -68,19 +68,19 @@
|
|||
{ "property": "AudioContext:sampleRate", "type": "uint" },
|
||||
{ "property": "AudioContext:outputLatency", "type": "double" },
|
||||
{ "property": "AudioContext:maxChannelCount", "type": "uint" },
|
||||
{ "property": "webgl:renderer", "type": "str" },
|
||||
{ "property": "webgl:vendor", "type": "str" },
|
||||
{ "property": "webgl:supportedExtensions", "type": "array" },
|
||||
{ "property": "webgl2:supportedExtensions", "type": "array" },
|
||||
{ "property": "webgl:parameters", "type": "dict" },
|
||||
{ "property": "webgl:parameters:blockIfNotDefined", "type": "bool" },
|
||||
{ "property": "webgl2:parameters", "type": "dict" },
|
||||
{ "property": "webgl2:parameters:blockIfNotDefined", "type": "bool" },
|
||||
{ "property": "webgl:shaderPrecisionFormats", "type": "dict" },
|
||||
{ "property": "webgl:shaderPrecisionFormats:blockIfNotDefined", "type": "bool" },
|
||||
{ "property": "webgl2:shaderPrecisionFormats", "type": "dict" },
|
||||
{ "property": "webgl2:shaderPrecisionFormats:blockIfNotDefined", "type": "bool" },
|
||||
{ "property": "webgl:contextAttributes", "type": "dict" },
|
||||
{ "property": "webgl2:contextAttributes", "type": "dict" },
|
||||
{ "property": "webGl:renderer", "type": "str" },
|
||||
{ "property": "webGl:vendor", "type": "str" },
|
||||
{ "property": "webGl:supportedExtensions", "type": "array" },
|
||||
{ "property": "webGl2:supportedExtensions", "type": "array" },
|
||||
{ "property": "webGl:parameters", "type": "dict" },
|
||||
{ "property": "webGl:parameters:blockIfNotDefined", "type": "bool" },
|
||||
{ "property": "webGl2:parameters", "type": "dict" },
|
||||
{ "property": "webGl2:parameters:blockIfNotDefined", "type": "bool" },
|
||||
{ "property": "webGl:shaderPrecisionFormats", "type": "dict" },
|
||||
{ "property": "webGl:shaderPrecisionFormats:blockIfNotDefined", "type": "bool" },
|
||||
{ "property": "webGl2:shaderPrecisionFormats", "type": "dict" },
|
||||
{ "property": "webGl2:shaderPrecisionFormats:blockIfNotDefined", "type": "bool" },
|
||||
{ "property": "webGl:contextAttributes", "type": "dict" },
|
||||
{ "property": "webGl2:contextAttributes", "type": "dict" },
|
||||
{ "property": "debug", "type": "bool" }
|
||||
]
|
||||
Loading…
Add table
Reference in a new issue