diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp index f783b1e5ae..099b21d9c7 100644 --- a/Userland/Libraries/LibJS/AST.cpp +++ b/Userland/Libraries/LibJS/AST.cpp @@ -621,7 +621,7 @@ Completion WithStatement::execute(Interpreter& interpreter) const auto* old_environment = vm.running_execution_context().lexical_environment; // 4. Let newEnv be NewObjectEnvironment(obj, true, oldEnv). - auto* new_environment = new_object_environment(*object, true, old_environment); + auto new_environment = new_object_environment(*object, true, old_environment); // 5. Set the running execution context's LexicalEnvironment to newEnv. vm.running_execution_context().lexical_environment = new_environment; diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp index 072727c739..088ca82ba9 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp @@ -394,7 +394,7 @@ NonnullGCPtr new_declarative_environment(Environment& en } // 9.1.2.3 NewObjectEnvironment ( O, W, E ), https://tc39.es/ecma262/#sec-newobjectenvironment -ObjectEnvironment* new_object_environment(Object& object, bool is_with_environment, Environment* environment) +NonnullGCPtr new_object_environment(Object& object, bool is_with_environment, Environment* environment) { auto& heap = object.heap(); diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.h b/Userland/Libraries/LibJS/Runtime/AbstractOperations.h index b9bc01661a..8c4be9617b 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.h +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.h @@ -20,7 +20,7 @@ namespace JS { NonnullGCPtr new_declarative_environment(Environment&); -ObjectEnvironment* new_object_environment(Object&, bool is_with_environment, Environment*); +NonnullGCPtr new_object_environment(Object&, bool is_with_environment, Environment*); FunctionEnvironment* new_function_environment(ECMAScriptFunctionObject&, Object* new_target); PrivateEnvironment* new_private_environment(VM& vm, PrivateEnvironment* outer); Environment& get_this_environment(VM&); diff --git a/Userland/Libraries/LibWeb/DOM/EventTarget.cpp b/Userland/Libraries/LibWeb/DOM/EventTarget.cpp index 6eb41e5bc3..45a7fea65b 100644 --- a/Userland/Libraries/LibWeb/DOM/EventTarget.cpp +++ b/Userland/Libraries/LibWeb/DOM/EventTarget.cpp @@ -437,7 +437,7 @@ WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(FlyString auto& realm = settings_object.realm(); // 2. Let scope be realm.[[GlobalEnv]]. - JS::Environment* scope = &realm.global_environment(); + auto scope = JS::NonnullGCPtr { realm.global_environment() }; // 3. If eventHandler is an element's event handler, then set scope to NewObjectEnvironment(document, true, scope). // (Otherwise, eventHandler is a Window object's event handler.) diff --git a/Userland/Services/WebContent/WebContentConsoleClient.cpp b/Userland/Services/WebContent/WebContentConsoleClient.cpp index e88bee4df8..268723d7ab 100644 --- a/Userland/Services/WebContent/WebContentConsoleClient.cpp +++ b/Userland/Services/WebContent/WebContentConsoleClient.cpp @@ -36,7 +36,7 @@ void WebContentConsoleClient::handle_input(DeprecatedString const& js_source) auto& settings = Web::HTML::relevant_settings_object(*m_console_global_environment_extensions); auto script = Web::HTML::ClassicScript::create("(console)", js_source, settings, settings.api_base_url()); - JS::Environment* with_scope = JS::new_object_environment(*m_console_global_environment_extensions, true, &settings.realm().global_environment()); + JS::NonnullGCPtr with_scope = JS::new_object_environment(*m_console_global_environment_extensions, true, &settings.realm().global_environment()); // FIXME: Add parse error printouts back once ClassicScript can report parse errors. auto result = script->run(Web::HTML::ClassicScript::RethrowErrors::No, with_scope);