1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use crate::plumbing::nativepointer::NativePointer;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = Frida)]
pub static version: String;
#[wasm_bindgen(js_namespace = Frida, js_name = heapSize)]
pub static heap_size: usize;
#[wasm_bindgen(js_name = hexdump)]
pub fn hexdump(target: &NativePointer) -> String;
#[wasm_bindgen(js_name = hexdump)]
pub fn hexdump_arraybuffer(target: &ArrayBuffer) -> String;
#[wasm_bindgen(js_name = send)]
pub fn send(message: &JsValue, data: &JsValue);
#[wasm_bindgen(js_name = recv)]
pub fn recv(callback: &js_sys::Function);
#[wasm_bindgen(js_name = recv)]
pub fn recv_with_type(type_filter: &str, callback: &js_sys::Function);
#[wasm_bindgen]
#[derive(Debug)]
pub type RecvMessage;
#[wasm_bindgen(js_name = ArrayBuffer)]
#[derive(Debug)]
pub type ArrayBuffer;
#[wasm_bindgen(method, js_name = unwrap)]
pub fn unwrap(this: &ArrayBuffer) -> NativePointer;
}
impl RecvMessage {
pub fn into_serde<T>(self) -> serde_json::Result<T>
where
T: for<'a> serde::de::Deserialize<'a>,
{
let s = JsValue::unchecked_from_js_ref(&self);
s.into_serde()
}
}