mirror of
https://github.com/servo/servo.git
synced 2025-09-27 15:20:09 +01:00
Change BrowingContextId from WebViewId explicitly (#39095)
There were still some accesses to the inner BrowsingContextId from the WebViewId. This changes it to completely rely on the From trait for these methods. This also means we can make the field private. For testing we add a way to create arbitrary WebViewIds. Testing: Does not change functionality. Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
parent
4ea714e6d2
commit
b73c81630a
8 changed files with 19 additions and 13 deletions
|
@ -470,7 +470,7 @@ pub fn send_response_values_to_devtools(
|
|||
request.pipeline_id,
|
||||
request.target_webview_id,
|
||||
) {
|
||||
let browsing_context_id = webview_id.0;
|
||||
let browsing_context_id = webview_id.into();
|
||||
|
||||
let devtoolsresponse = DevtoolsHttpResponse {
|
||||
headers,
|
||||
|
@ -494,7 +494,7 @@ pub fn send_response_values_to_devtools(
|
|||
pub fn send_early_httprequest_to_devtools(request: &Request, context: &FetchContext) {
|
||||
if let (Some(devtools_chan), Some(browsing_context_id), Some(pipeline_id)) = (
|
||||
context.devtools_chan.as_ref(),
|
||||
request.target_webview_id.map(|id| id.0),
|
||||
request.target_webview_id.map(|id| id.into()),
|
||||
request.pipeline_id,
|
||||
) {
|
||||
// Build the partial DevtoolsHttpRequest
|
||||
|
@ -1965,7 +1965,7 @@ async fn http_network_fetch(
|
|||
let _ = fetch_terminated_sender.send(false);
|
||||
}
|
||||
|
||||
let browsing_context_id = request.target_webview_id.map(|id| id.0);
|
||||
let browsing_context_id = request.target_webview_id.map(Into::into);
|
||||
|
||||
let response_future = obtain_response(
|
||||
&context.state.client,
|
||||
|
|
|
@ -1342,7 +1342,7 @@ fn test_fetch_with_devtools() {
|
|||
send_time: devhttprequests.1.send_time,
|
||||
destination: Destination::None,
|
||||
is_xhr: true,
|
||||
browsing_context_id: TEST_WEBVIEW_ID.0,
|
||||
browsing_context_id: TEST_WEBVIEW_ID.into(),
|
||||
};
|
||||
|
||||
let content = "Yay!";
|
||||
|
@ -1359,7 +1359,7 @@ fn test_fetch_with_devtools() {
|
|||
status: HttpStatus::default(),
|
||||
body: Some(content.as_bytes().to_vec()),
|
||||
pipeline_id: TEST_PIPELINE_ID,
|
||||
browsing_context_id: TEST_WEBVIEW_ID.0,
|
||||
browsing_context_id: TEST_WEBVIEW_ID.into(),
|
||||
};
|
||||
|
||||
assert_eq!(devhttprequests.1, httprequest);
|
||||
|
|
|
@ -402,7 +402,7 @@ fn test_request_and_response_data_with_network_messages() {
|
|||
send_time: devhttprequests.1.send_time,
|
||||
destination: Destination::Document,
|
||||
is_xhr: false,
|
||||
browsing_context_id: TEST_WEBVIEW_ID.0,
|
||||
browsing_context_id: TEST_WEBVIEW_ID.into(),
|
||||
};
|
||||
|
||||
let content = "Yay!";
|
||||
|
@ -424,7 +424,7 @@ fn test_request_and_response_data_with_network_messages() {
|
|||
status: HttpStatus::default(),
|
||||
body: Some(content.as_bytes().to_vec()),
|
||||
pipeline_id: TEST_PIPELINE_ID,
|
||||
browsing_context_id: TEST_WEBVIEW_ID.0,
|
||||
browsing_context_id: TEST_WEBVIEW_ID.into(),
|
||||
};
|
||||
|
||||
assert_eq!(devhttprequests.1, httprequest);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue