Skip to content

Commit

Permalink
feat(core): enable eval
Browse files Browse the repository at this point in the history
  • Loading branch information
johnyob committed Mar 12, 2024
1 parent 27dfe42 commit 52f46ba
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions crates/jstz_core/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ use std::{
};

use boa_engine::{
builtins::promise::PromiseState,
context::HostHooks,
job::NativeJob,
object::builtins::{JsFunction, JsPromise},
Context, JsError, JsNativeError, JsResult, JsValue, Source,
builtins::promise::PromiseState, context::HostHooks, job::NativeJob,
object::builtins::JsPromise, Context, JsError, JsNativeError, JsResult, JsValue,
Source,
};
use chrono::{DateTime, FixedOffset, LocalResult, NaiveDateTime};
use getrandom::{register_custom_getrandom, Error as RandomError};
Expand All @@ -32,23 +30,23 @@ const UTC_NOW: i64 = 1690797026;
struct Hooks;

impl HostHooks for Hooks {
fn ensure_can_compile_strings(
&self,
_realm: boa_engine::realm::Realm,
_context: &mut Context<'_>,
) -> JsResult<()> {
Err(JsNativeError::typ()
.with_message("eval calls not available")
.into())
}

fn has_source_text_available(
&self,
_function: &JsFunction,
_context: &mut Context<'_>,
) -> bool {
false
}
// fn ensure_can_compile_strings(
// &self,
// _realm: boa_engine::realm::Realm,
// _context: &mut Context<'_>,
// ) -> JsResult<()> {
// Err(JsNativeError::typ()
// .with_message("eval calls not available")
// .into())
// }

// fn has_source_text_available(
// &self,
// _function: &JsFunction,
// _context: &mut Context<'_>,
// ) -> bool {
// false
// }

fn utc_now(&self) -> NaiveDateTime {
NaiveDateTime::from_timestamp_opt(UTC_NOW, 0)
Expand Down

0 comments on commit 52f46ba

Please sign in to comment.