From e6de213a13d6118a30ae5e90a91ccf81653677a7 Mon Sep 17 00:00:00 2001 From: OJ Kwon Date: Sat, 24 Mar 2018 08:56:53 -0700 Subject: [PATCH] refactor(consume_body): json stored in roottraceablebox --- components/script/body.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/script/body.rs b/components/script/body.rs index 43bd0fb5c18..35ee2dae2c6 100644 --- a/components/script/body.rs +++ b/components/script/body.rs @@ -38,7 +38,7 @@ pub enum BodyType { pub enum FetchedData { Text(String), - Json(JSValue), + Json(RootedTraceableBox>), BlobData(DomRoot), FormData(DomRoot), ArrayBuffer(RootedTraceableBox>), @@ -137,7 +137,8 @@ fn run_json_data_algorithm(cx: *mut JSContext, // TODO: See issue #13464. Exception should be thrown instead of cleared. return Err(Error::Type("Failed to parse JSON".to_string())); } - Ok(FetchedData::Json(rval.get())) + let rooted_heap = RootedTraceableBox::from_box(Heap::boxed(rval.get())); + Ok(FetchedData::Json(rooted_heap)) } }