aboutsummaryrefslogtreecommitdiffstats
path: root/components/net/tests/main.rs
diff options
context:
space:
mode:
authorzhuhaichao518 <zhuhaichao518@gmail.com>2025-01-16 15:44:16 +0800
committerGitHub <noreply@github.com>2025-01-16 07:44:16 +0000
commita1326a7cf65f0890a926223bce4d687f73c8dd9e (patch)
treeea3d4f0d7754adddc084ca92d1ea42f7f219ea74 /components/net/tests/main.rs
parent725659059905b993ba8f230f7bcd30e514110ab0 (diff)
downloadservo-a1326a7cf65f0890a926223bce4d687f73c8dd9e.tar.gz
servo-a1326a7cf65f0890a926223bce4d687f73c8dd9e.zip
Implement WebResourceRequested Event. (#34961)
* Implement WebResourceRequested Event on the Embedder Layer Signed-off-by: zhuhaichao518 <zhuhaichao518@gmail.com> * fix and add test Signed-off-by: zhuhaichao518 <zhuhaichao518@gmail.com> * resolve comments Signed-off-by: zhuhaichao518 <zhuhaichao518@gmail.com> * remove sample code in webview Signed-off-by: zhuhaichao518 <zhuhaichao518@gmail.com> * remove typo Signed-off-by: zhuhaichao518 <zhuhaichao518@gmail.com> * ./mach format Signed-off-by: zhuhaichao518 <zhuhaichao518@gmail.com> * fix test fail caused by interception message Signed-off-by: zhuhaichao518 <zhuhaichao518@gmail.com> * update impl for is_for_main_frame Signed-off-by: zhuhaichao518 <zhuhaichao518@gmail.com> --------- Signed-off-by: zhuhaichao518 <zhuhaichao518@gmail.com>
Diffstat (limited to 'components/net/tests/main.rs')
-rw-r--r--components/net/tests/main.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/components/net/tests/main.rs b/components/net/tests/main.rs
index 12440e3cc47..a897d5d5bfa 100644
--- a/components/net/tests/main.rs
+++ b/components/net/tests/main.rs
@@ -42,6 +42,7 @@ use net::fetch::cors_cache::CorsCache;
use net::fetch::methods::{self, FetchContext};
use net::filemanager_thread::FileManager;
use net::protocols::ProtocolRegistry;
+use net::request_intercepter::RequestIntercepter;
use net::resource_thread::CoreResourceThreadPool;
use net::test::HttpState;
use net_traits::filemanager_thread::FileTokenCheck;
@@ -128,7 +129,7 @@ fn receive_credential_prompt_msgs(
username: Option<String>,
password: Option<String>,
) -> std::thread::JoinHandle<()> {
- std::thread::spawn(move || {
+ std::thread::spawn(move || loop {
let (_browser_context_id, embedder_msg) = embedder_receiver.recv_embedder_msg();
match embedder_msg {
embedder_traits::EmbedderMsg::Prompt(prompt_definition, _prompt_origin) => {
@@ -140,7 +141,9 @@ fn receive_credential_prompt_msgs(
},
_ => unreachable!(),
}
+ break;
},
+ embedder_traits::EmbedderMsg::WebResourceRequested(_, _) => {},
_ => unreachable!(),
}
})
@@ -179,10 +182,11 @@ fn new_fetch_context(
user_agent: DEFAULT_USER_AGENT.into(),
devtools_chan: dc.map(|dc| Arc::new(Mutex::new(dc))),
filemanager: Arc::new(Mutex::new(FileManager::new(
- sender,
+ sender.clone(),
pool_handle.unwrap_or_else(|| Weak::new()),
))),
file_token: FileTokenCheck::NotRequired,
+ request_intercepter: Arc::new(Mutex::new(RequestIntercepter::new(sender))),
cancellation_listener: Arc::new(Default::default()),
timing: ServoArc::new(Mutex::new(ResourceFetchTiming::new(
ResourceTimingType::Navigation,