-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
97fe6aa
commit fad120f
Showing
3 changed files
with
568 additions
and
556 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,7 +157,11 @@ impl Guest for SpidermonkeyEmbeddingSplicerComponent { | |
let maybe_run = engine_resolve.worlds[engine_world] | ||
.exports | ||
.iter() | ||
.find(|(key, _)| engine_resolve.name_world_key(key) == "wasi:cli/[email protected]") | ||
.find(|(key, _)| { | ||
engine_resolve | ||
.name_world_key(key) | ||
.starts_with("wasi:cli/[email protected]") | ||
}) | ||
.map(|(key, _)| key.clone()); | ||
if let Some(run) = maybe_run { | ||
engine_resolve.worlds[engine_world] | ||
|
@@ -169,7 +173,9 @@ impl Guest for SpidermonkeyEmbeddingSplicerComponent { | |
.exports | ||
.iter() | ||
.find(|(key, _)| { | ||
engine_resolve.name_world_key(key) == "wasi:http/[email protected]" | ||
engine_resolve | ||
.name_world_key(key) | ||
.starts_with("wasi:http/[email protected]") | ||
}) | ||
.map(|(key, _)| key.clone()); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ use wasmparser::Operator; | |
|
||
use crate::*; | ||
|
||
const WASI_VERSIONS: [&str; 3] = ["0.2.0", "0.2.1", "0.2.2"]; | ||
|
||
// | ||
// Parses the Spidermonkey binary into section data for reserialization | ||
// into an output binary, and in the process: | ||
|
@@ -44,31 +46,25 @@ pub fn splice( | |
|
||
// since StarlingMonkey implements CLI Run and incoming handler, | ||
// we override them only if the guest content exports those functions | ||
if exports | ||
.iter() | ||
.any(|(name, _)| name == "wasi:cli/[email protected]#run") | ||
{ | ||
if let Some(run) = module | ||
.exports | ||
.get_func_by_name("wasi:cli/[email protected]#run".to_string()) | ||
{ | ||
let expt = module.exports.get_func_by_id(run).unwrap(); | ||
module.exports.delete(expt); | ||
module.delete_func(run); // TODO: Look at the intended behaviour here. Need to pass function ID to delete from functions. Was Previously passing Exports ID | ||
for wasi_version in WASI_VERSIONS { | ||
let import = format!("wasi:cli/run@{wasi_version}#run"); | ||
if exports.iter().any(|(name, _)| *name == import) { | ||
if let Some(run) = module.exports.get_func_by_name(import) { | ||
let expt = module.exports.get_func_by_id(run).unwrap(); | ||
module.exports.delete(expt); | ||
module.delete_func(run); // TODO: Look at the intended behaviour here. Need to pass function ID to delete from functions. Was Previously passing Exports ID | ||
} | ||
} | ||
} | ||
|
||
if exports | ||
.iter() | ||
.any(|(name, _)| name == "wasi:http/[email protected]#handle") | ||
{ | ||
if let Some(serve) = module | ||
.exports | ||
.get_func_by_name("wasi:http/[email protected]#handle".to_string()) | ||
{ | ||
let expt = module.exports.get_func_by_id(serve).unwrap(); | ||
module.exports.delete(expt); | ||
module.delete_func(serve); // TODO: Look at the intended behaviour here. Same as above comment | ||
for wasi_version in WASI_VERSIONS { | ||
let import = format!("wasi:http/incoming-handler@{wasi_version}#handle"); | ||
if exports.iter().any(|(name, _)| *name == import) { | ||
if let Some(serve) = module.exports.get_func_by_name(import) { | ||
let expt = module.exports.get_func_by_id(serve).unwrap(); | ||
module.exports.delete(expt); | ||
module.delete_func(serve); // TODO: Look at the intended behaviour here. Same as above comment | ||
} | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.