summaryrefslogtreecommitdiff
path: root/Userland/Applications/Spreadsheet
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-08-22 19:35:23 +0100
committerLinus Groh <mail@linusgroh.de>2022-08-23 13:58:30 +0100
commit275dea9d98a147e891b95f054c74c8198478a223 (patch)
tree566c86470b09ec5a15bb0760e77b1776b515796d /Userland/Applications/Spreadsheet
parentb345a0acca725d1b4e4d6df26fc602d69e97f073 (diff)
downloadserenity-275dea9d98a147e891b95f054c74c8198478a223.zip
LibJS: Remove {Bytecode::,}Interpreter::global_object()
The basic idea is that a global object cannot just come out of nowhere, it must be associated to a realm - so get it from there, if needed. This is to enforce the changes from all the previous commits by not handing out global objects unless you actually have an initialized realm (either stored somewhere, or the VM's current realm).
Diffstat (limited to 'Userland/Applications/Spreadsheet')
-rw-r--r--Userland/Applications/Spreadsheet/Spreadsheet.cpp2
-rw-r--r--Userland/Applications/Spreadsheet/Workbook.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.cpp b/Userland/Applications/Spreadsheet/Spreadsheet.cpp
index e5da87ac9b..c8e3c4ab4a 100644
--- a/Userland/Applications/Spreadsheet/Spreadsheet.cpp
+++ b/Userland/Applications/Spreadsheet/Spreadsheet.cpp
@@ -43,7 +43,7 @@ Sheet::Sheet(Workbook& workbook)
, m_interpreter(JS::Interpreter::create<SheetGlobalObject>(m_workbook.vm(), *this))
{
JS::DeferGC defer_gc(m_workbook.vm().heap());
- m_global_object = static_cast<SheetGlobalObject*>(&m_interpreter->global_object());
+ m_global_object = static_cast<SheetGlobalObject*>(&m_interpreter->realm().global_object());
global_object().define_direct_property("workbook", m_workbook.workbook_object(), JS::default_attributes);
global_object().define_direct_property("thisSheet", &global_object(), JS::default_attributes); // Self-reference is unfortunate, but required.
diff --git a/Userland/Applications/Spreadsheet/Workbook.cpp b/Userland/Applications/Spreadsheet/Workbook.cpp
index 3ebdd15c6d..30411b3521 100644
--- a/Userland/Applications/Spreadsheet/Workbook.cpp
+++ b/Userland/Applications/Spreadsheet/Workbook.cpp
@@ -30,10 +30,10 @@ Workbook::Workbook(NonnullRefPtrVector<Sheet>&& sheets, GUI::Window& parent_wind
, m_parent_window(parent_window)
{
m_workbook_object = m_vm->heap().allocate<WorkbookObject>(m_interpreter->realm(), m_interpreter->realm(), *this);
- m_interpreter->global_object().define_direct_property("workbook", workbook_object(), JS::default_attributes);
+ m_interpreter->realm().global_object().define_direct_property("workbook", workbook_object(), JS::default_attributes);
m_main_execution_context.current_node = nullptr;
- m_main_execution_context.this_value = &m_interpreter->global_object();
+ m_main_execution_context.this_value = &m_interpreter->realm().global_object();
m_main_execution_context.function_name = "(global execution context)"sv;
m_main_execution_context.lexical_environment = &m_interpreter->realm().global_environment();
m_main_execution_context.variable_environment = &m_interpreter->realm().global_environment();