mirror of
https://github.com/servo/servo.git
synced 2025-09-30 08:39:16 +01:00
script: Return a Result from GlobalScope::evaluate_script_on_global_with_result (#38549)
Make GlobalScope::evaluate_script_on_global_with_result return a Result instead of a boolean. This is the first step to resolve issue #37810. Testing: Should not break or fix any existing tests --------- Signed-off-by: Rodion Borovyk <rodion.borovyk@gmail.com>
This commit is contained in:
parent
86c37a380b
commit
4f8731d562
11 changed files with 45 additions and 28 deletions
|
@ -9,6 +9,7 @@ use constellation_traits::{ScriptToConstellationChan, ScriptToConstellationMessa
|
|||
use crossbeam_channel::Sender;
|
||||
use devtools_traits::ScriptToDevtoolsControlMsg;
|
||||
use dom_struct::dom_struct;
|
||||
use embedder_traits::JavaScriptEvaluationError;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use js::jsval::UndefinedValue;
|
||||
use js::rust::Runtime;
|
||||
|
@ -124,7 +125,11 @@ impl WorkletGlobalScope {
|
|||
}
|
||||
|
||||
/// Evaluate a JS script in this global.
|
||||
pub(crate) fn evaluate_js(&self, script: &str, can_gc: CanGc) -> bool {
|
||||
pub(crate) fn evaluate_js(
|
||||
&self,
|
||||
script: &str,
|
||||
can_gc: CanGc,
|
||||
) -> Result<(), JavaScriptEvaluationError> {
|
||||
debug!("Evaluating Dom in a worklet.");
|
||||
rooted!(in (*GlobalScope::get_cx()) let mut rval = UndefinedValue());
|
||||
self.globalscope.evaluate_js_on_global_with_result(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue