mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Add webdriver deletecookies function
This commit is contained in:
parent
04c93c511b
commit
64961cc9c1
8 changed files with 60 additions and 1 deletions
|
@ -34,7 +34,7 @@ use js::rust::HandleValue;
|
|||
use msg::constellation_msg::BrowsingContextId;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use net_traits::CookieSource::{NonHTTP, HTTP};
|
||||
use net_traits::CoreResourceMsg::{GetCookiesDataForUrl, SetCookieForUrl};
|
||||
use net_traits::CoreResourceMsg::{DeleteCookies, GetCookiesDataForUrl, SetCookieForUrl};
|
||||
use net_traits::IpcSend;
|
||||
use script_traits::webdriver_msg::WebDriverCookieError;
|
||||
use script_traits::webdriver_msg::{
|
||||
|
@ -356,6 +356,27 @@ pub fn handle_add_cookie(
|
|||
.unwrap();
|
||||
}
|
||||
|
||||
pub fn handle_delete_cookies(
|
||||
documents: &Documents,
|
||||
pipeline: PipelineId,
|
||||
reply: IpcSender<Result<(), ()>>,
|
||||
) {
|
||||
let document = match documents.find_document(pipeline) {
|
||||
Some(document) => document,
|
||||
None => {
|
||||
return reply.send(Err(())).unwrap();
|
||||
},
|
||||
};
|
||||
let url = document.url();
|
||||
document
|
||||
.window()
|
||||
.upcast::<GlobalScope>()
|
||||
.resource_threads()
|
||||
.send(DeleteCookies(url))
|
||||
.unwrap();
|
||||
let _ = reply.send(Ok(()));
|
||||
}
|
||||
|
||||
pub fn handle_get_title(documents: &Documents, pipeline: PipelineId, reply: IpcSender<String>) {
|
||||
// TODO: Return an error if the pipeline doesn't exist.
|
||||
let title = documents
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue