From 782cdaeccffbb7e88a55770d7441493e4a82cb6d Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Fri, 17 Mar 2023 16:23:47 +0000 Subject: [PATCH] LibWeb: Give generated constructor functions a name Required by code that brand checks native constructors. For example, Wistia brand checks XMLHttpRequest by doing: ``` XMLHttpRequest.prototype.constructor.toString() ``` It then checks if it matches either one of: ``` function XMLHttpRequest() { [native code] } ``` ``` [object XMLHttpRequestConstructor] ``` If neither matches, it disables HLS playback and prints: "The XMLHttpRequest constructor has been tampered with. Because this affects CORS/Range XHR requests, HLS playback has been disabled. To enable HLS playback and other important features, please remove code that changes the definition of window.XMLHttpRequest." We hit this path due to not giving generated constructors a name, as we would provide `function () { [native code] }`. --- .../CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index 7c83581a959..06beba8b8c8 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -2990,7 +2990,7 @@ using namespace Web::WebIDL; namespace Web::Bindings { @constructor_class@::@constructor_class@(JS::Realm& realm) - : NativeFunction(*realm.intrinsics().function_prototype()) + : NativeFunction("@name@"sv, *realm.intrinsics().function_prototype()) { }