Truly independent web browser
LibWeb: Wrap WebDriver scripts in a real function expression
Andreas Kling6ee63a05f3e5
diff --git a/Libraries/LibWeb/WebDriver/ExecuteScript.cpp b/Libraries/LibWeb/WebDriver/ExecuteScript.cppindex 0a319b31d50..5b01923a7a4 100644--- a/Libraries/LibWeb/WebDriver/ExecuteScript.cpp+++ b/Libraries/LibWeb/WebDriver/ExecuteScript.cpp@@ -53,9 +53,9 @@ static JS::ThrowCompletionOr<JS::Value> execute_a_function_body(HTML::BrowsingCo// function async, unfortunately. See: https://github.com/w3c/webdriver/issues/1436auto body_utf16 = Utf16String::from_utf8(body);auto source_text = Utf16String::formatted(- R"~~~(function() {{+ R"~~~((function() {{{}- }})~~~",+ }}))~~~",body_utf16);auto compiled_function = JS::CompiledDynamicFunction::compile(realm.vm(), source_text, Utf16String {}, body_utf16, JS::FunctionKind::Normal);