add Network.getResponseBody support
This commit is contained in:
1 parent
af2f89a03e
commit
570ca1544c
6 files changed
+276
-8
No files matched your search
@@ -10,7 +10,7 @@ use obscura_dom::DomTree;
|
||||
pub use deno_core::v8::IsolateHandle;
|
||||
|
||||
use crate::module_loader::ObscuraModuleLoader;
|
||||
use crate::ops::{build_extension, ObscuraState};
|
||||
use crate::ops::{build_extension, ObscuraState, StoredNetworkResponseBody};
|
||||
|
||||
static SNAPSHOT: &[u8] = include_bytes!(env!("OBSCURA_SNAPSHOT_PATH"));
|
||||
|
||||
@@ -184,6 +184,16 @@ impl ObscuraJsRuntime {
|
||||
std::mem::take(&mut self.state.borrow_mut().pending_binding_calls)
|
||||
}
|
||||
|
||||
pub fn get_network_response_body(&self, request_id: &str) -> Option<StoredNetworkResponseBody> {
|
||||
self.state.borrow().network_response_bodies.get(request_id).cloned()
|
||||
}
|
||||
|
||||
pub fn clear_network_response_bodies(&self) {
|
||||
let mut state = self.state.borrow_mut();
|
||||
state.network_response_bodies.clear();
|
||||
state.network_response_body_order.clear();
|
||||
}
|
||||
|
||||
/// Wire up the interception channel without enabling interception.
|
||||
/// Use set_intercept_enabled separately. The two were entangled before
|
||||
/// and every navigation auto-enabled interception, which made
|
||||
|
||||
Reference in new issue
Block a user