mirror of
https://github.com/servo/servo.git
synced 2025-06-21 07:38:59 +01:00
Auto merge of #6726 - samfoo:int32-panic, r=Ms2ger
Eval'ing int32's in devtools panic'd Eval'ing int32 in devconsole panics. Resolves #6725 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6726) <!-- Reviewable:end -->
This commit is contained in:
commit
cdcecaef04
1 changed files with 10 additions and 3 deletions
|
@ -25,7 +25,12 @@ use std::sync::mpsc::Sender;
|
|||
use std::rc::Rc;
|
||||
|
||||
|
||||
pub fn handle_evaluate_js(page: &Rc<Page>, pipeline: PipelineId, eval: String, reply: Sender<EvaluateJSReply>){
|
||||
pub fn handle_evaluate_js(
|
||||
page: &Rc<Page>,
|
||||
pipeline: PipelineId,
|
||||
eval: String,
|
||||
reply: Sender<EvaluateJSReply>
|
||||
) {
|
||||
let page = get_page(&*page, pipeline);
|
||||
let window = page.window();
|
||||
let cx = window.r().get_cx();
|
||||
|
@ -36,8 +41,10 @@ pub fn handle_evaluate_js(page: &Rc<Page>, pipeline: PipelineId, eval: String, r
|
|||
EvaluateJSReply::VoidValue
|
||||
} else if rval.ptr.is_boolean() {
|
||||
EvaluateJSReply::BooleanValue(rval.ptr.to_boolean())
|
||||
} else if rval.ptr.is_double() {
|
||||
EvaluateJSReply::NumberValue(FromJSValConvertible::from_jsval(cx, rval.handle(), ()).unwrap())
|
||||
} else if rval.ptr.is_double() || rval.ptr.is_int32() {
|
||||
EvaluateJSReply::NumberValue(
|
||||
FromJSValConvertible::from_jsval(cx, rval.handle(), ()).unwrap()
|
||||
)
|
||||
} else if rval.ptr.is_string() {
|
||||
//FIXME: use jsstring_to_str when jsval grows to_jsstring
|
||||
EvaluateJSReply::StringValue(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue