mirror of
https://github.com/servo/servo.git
synced 2025-10-01 00:59:15 +01:00
Auto merge of #22121 - gterzian:remove_constellation_block_in_navigation, r=paulrouget
Remove sync constellation -> embedder communication <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #22042 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22121) <!-- Reviewable:end -->
This commit is contained in:
commit
66223ee105
16 changed files with 265 additions and 61 deletions
|
@ -161,12 +161,15 @@ pub unsafe extern "C" fn heartbeat_servo(servo: *mut ServoInstance) {
|
|||
// Servo heartbeat goes here!
|
||||
if let Some(servo) = servo.as_mut() {
|
||||
servo.servo.handle_events(vec![]);
|
||||
for ((_browser_id, event)) in servo.servo.get_events() {
|
||||
for ((browser_id, event)) in servo.servo.get_events() {
|
||||
match event {
|
||||
// Respond to any messages with a response channel
|
||||
// to avoid deadlocking the constellation
|
||||
EmbedderMsg::AllowNavigation(_url, sender) => {
|
||||
let _ = sender.send(true);
|
||||
EmbedderMsg::AllowNavigationRequest(pipeline_id, _url) => {
|
||||
if let Some(_browser_id) = browser_id {
|
||||
let window_event = WindowEvent::AllowNavigationResponse(pipeline_id, true);
|
||||
servo.servo.handle_events(vec![window_event]);
|
||||
}
|
||||
},
|
||||
EmbedderMsg::GetSelectedBluetoothDevice(_, sender) => {
|
||||
let _ = sender.send(None);
|
||||
|
|
|
@ -388,7 +388,7 @@ impl ServoGlue {
|
|||
}
|
||||
|
||||
fn handle_servo_events(&mut self) -> Result<(), &'static str> {
|
||||
for (_browser_id, event) in self.servo.get_events() {
|
||||
for (browser_id, event) in self.servo.get_events() {
|
||||
match event {
|
||||
EmbedderMsg::ChangePageTitle(title) => {
|
||||
let fallback_title: String = if let Some(ref current_url) = self.current_url {
|
||||
|
@ -403,10 +403,11 @@ impl ServoGlue {
|
|||
let title = format!("{} - Servo", title);
|
||||
self.callbacks.host_callbacks.on_title_changed(title);
|
||||
},
|
||||
EmbedderMsg::AllowNavigation(_url, response_chan) => {
|
||||
if let Err(e) = response_chan.send(true) {
|
||||
warn!("Failed to send allow_navigation() response: {}", e);
|
||||
};
|
||||
EmbedderMsg::AllowNavigationRequest(pipeline_id, _url) => {
|
||||
if let Some(_browser_id) = browser_id {
|
||||
let window_event = WindowEvent::AllowNavigationResponse(pipeline_id, true);
|
||||
let _ = self.process_event(window_event);
|
||||
}
|
||||
},
|
||||
EmbedderMsg::HistoryChanged(entries, current) => {
|
||||
let can_go_back = current > 0;
|
||||
|
|
|
@ -290,9 +290,10 @@ impl Browser {
|
|||
.push(WindowEvent::SendError(browser_id, reason));
|
||||
}
|
||||
},
|
||||
EmbedderMsg::AllowNavigation(_url, sender) => {
|
||||
if let Err(e) = sender.send(true) {
|
||||
warn!("Failed to send AllowNavigation response: {}", e);
|
||||
EmbedderMsg::AllowNavigationRequest(pipeline_id, _url) => {
|
||||
if let Some(_browser_id) = browser_id {
|
||||
self.event_queue
|
||||
.push(WindowEvent::AllowNavigationResponse(pipeline_id, true));
|
||||
}
|
||||
},
|
||||
EmbedderMsg::AllowOpeningBrowser(response_chan) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue