mirror of https://github.com/boa-dev/boa.git
Browse Source
* added builtin globalThis * forgot to initialize globalThis in the builtin mod.rs file * changed to to match naming conventions and fixed issue with suggested edits to globalThis' initial value * updated the test for the property as suggestedpull/499/head
Ryan Fickenscher
5 years ago
committed by
GitHub
3 changed files with 23 additions and 0 deletions
@ -0,0 +1,11 @@ |
|||||||
|
#[cfg(test)] |
||||||
|
mod tests; |
||||||
|
|
||||||
|
use crate::{builtins::value::Value, BoaProfiler}; |
||||||
|
|
||||||
|
/// Initialize the `globalThis` property on the global object.
|
||||||
|
#[inline] |
||||||
|
pub fn init(global: &Value) { |
||||||
|
let _timer = BoaProfiler::global().start_event("globalThis", "init"); |
||||||
|
global.set_field("globalThis", global.clone()); |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
use crate::exec; |
||||||
|
|
||||||
|
#[test] |
||||||
|
fn global_this_exists_on_global_object_and_evaluates_to_an_object() { |
||||||
|
let scenario = r#" |
||||||
|
typeof globalThis; |
||||||
|
"#; |
||||||
|
|
||||||
|
assert_eq!(&exec(scenario), "object"); |
||||||
|
} |
Loading…
Reference in new issue