Skip to content

Commit

Permalink
Properly resolve paths in SimpleModuleLoader and add path to Referrer…
Browse files Browse the repository at this point in the history
…::Script (#3791)

* Properly resolve paths in SimpleModuleLoader and add path to Referrer::Script

* Add missing example

* Carry active runnable on frame push

* Duplicate the tests with proper paths for Windows/Unix

* Use the right root for absolute referrers

* ugh cargo fmt

* Limit doctest to unix

* Limit doctest to unix, for real

* cargo fmt

---------

Co-authored-by: jedel1043 <[email protected]>
  • Loading branch information
hansl and jedel1043 authored Apr 5, 2024
1 parent 0b3df57 commit 958045c
Show file tree
Hide file tree
Showing 11 changed files with 302 additions and 82 deletions.
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@
],
"sourceLanguages": ["rust"],
"preLaunchTask": "Cargo Build boa_cli"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug Boa (Tester)",
"windows": {
"program": "${workspaceFolder}/target/debug/boa_tester.exe"
},
"program": "${workspaceFolder}/target/debug/boa_tester",
"args": ["run", "-s", "${input:testPath}", "-vvv"],
"sourceLanguages": ["rust"],
"preLaunchTask": "Cargo Build boa_tester"
}
],
"inputs": [
Expand All @@ -47,6 +59,11 @@
"description": "Relative path to the module root directory",
"default": "debug",
"type": "promptString"
},
{
"id": "testPath",
"description": "Relative path to the test from the test262 directory",
"type": "promptString"
}
]
}
10 changes: 10 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@
"clear": true
}
},
{
"type": "process",
"label": "Cargo Build boa_tester",
"command": "cargo",
"args": ["build", "-p", "boa_tester"],
"group": "build",
"presentation": {
"clear": true
}
},
{
"type": "process",
"label": "Run JS file",
Expand Down
34 changes: 34 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions core/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ js = ["dep:web-time"]

[dependencies]
boa_interner.workspace = true
boa_gc = { workspace = true, features = [ "thin-vec" ] }
boa_gc = { workspace = true, features = ["thin-vec"] }
boa_profiler.workspace = true
boa_macros.workspace = true
boa_ast.workspace = true
Expand Down Expand Up @@ -106,7 +106,7 @@ time.workspace = true
hashbrown.workspace = true

# intl deps
boa_icu_provider = {workspace = true, features = ["std"], optional = true }
boa_icu_provider = { workspace = true, features = ["std"], optional = true }
sys-locale = { version = "0.3.1", optional = true }
icu_provider = { workspace = true, optional = true }
icu_locid = { workspace = true, features = ["serde"], optional = true }
Expand All @@ -116,7 +116,7 @@ icu_calendar = { workspace = true, default-features = false, optional = true }
icu_collator = { workspace = true, default-features = false, features = ["serde"], optional = true }
icu_plurals = { workspace = true, default-features = false, features = ["serde", "experimental"], optional = true }
icu_list = { workspace = true, default-features = false, features = ["serde"], optional = true }
icu_casemap = { workspace = true, default-features = false, features = ["serde"], optional = true}
icu_casemap = { workspace = true, default-features = false, features = ["serde"], optional = true }
icu_segmenter = { workspace = true, default-features = false, features = ["auto", "serde"], optional = true }
icu_decimal = { workspace = true, default-features = false, features = ["serde"], optional = true }
writeable = { workspace = true, optional = true }
Expand All @@ -137,6 +137,7 @@ float-cmp = "0.9.0"
indoc.workspace = true
textwrap.workspace = true
futures-lite = "2.3.0"
test-case = "3.3.1"

[target.x86_64-unknown-linux-gnu.dev-dependencies]
jemallocator = "0.5.4"
Expand Down
23 changes: 10 additions & 13 deletions core/engine/src/context/mod.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
//! The ECMAScript context.
mod hooks;
#[cfg(feature = "intl")]
pub(crate) mod icu;
pub mod intrinsics;
use std::{cell::Cell, path::Path, rc::Rc};

use boa_ast::StatementList;
use boa_interner::Interner;
use boa_parser::source::ReadChar;
use boa_profiler::Profiler;
pub use hooks::{DefaultHooks, HostHooks};

#[cfg(feature = "intl")]
pub use icu::IcuError;

use intrinsics::Intrinsics;

use std::{cell::Cell, path::Path, rc::Rc};

use crate::vm::RuntimeLimits;
use crate::{
builtins,
class::{Class, ClassBuilder},
Expand All @@ -30,14 +27,14 @@ use crate::{
vm::{ActiveRunnable, CallFrame, Vm},
JsNativeError, JsResult, JsString, JsValue, Source,
};
use boa_ast::StatementList;
use boa_interner::Interner;
use boa_profiler::Profiler;

use crate::vm::RuntimeLimits;

use self::intrinsics::StandardConstructor;

mod hooks;
#[cfg(feature = "intl")]
pub(crate) mod icu;
pub mod intrinsics;

thread_local! {
static CANNOT_BLOCK_COUNTER: Cell<u64> = const { Cell::new(0) };
}
Expand Down
Loading

0 comments on commit 958045c

Please sign in to comment.