mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:18:11 +00:00
SpreadSheet: Fix that non first sheets could not access global functions
Because we declare the functions in runtime.js we need the correct global object to be setup otherwise they cannot be accessed when switching to the SheetGlobalObject.
This commit is contained in:
parent
146aaec129
commit
0f5fe3b70e
1 changed files with 3 additions and 0 deletions
|
@ -45,6 +45,9 @@ Sheet::Sheet(Workbook& workbook)
|
|||
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.
|
||||
|
||||
// Note: We have to set the global object here otherwise the functions in runtime.js are not registered correctly.
|
||||
interpreter().realm().set_global_object(global_object(), &global_object());
|
||||
|
||||
// Sadly, these have to be evaluated once per sheet.
|
||||
auto file_or_error = Core::File::open("/res/js/Spreadsheet/runtime.js", Core::OpenMode::ReadOnly);
|
||||
if (!file_or_error.is_error()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue