mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Auto merge of #12277 - ConnorGBrewster:network_listener_cancellable, r=Manishearth
Make network listener runnable cancellable <!-- Please describe your changes on the following line: --> This keeps scripts from executing after its script thread has been shut down. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [x] These changes fix (maybe) #12048 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12277) <!-- Reviewable:end -->
This commit is contained in:
commit
12260b24d0
11 changed files with 60 additions and 7 deletions
|
@ -226,6 +226,7 @@ impl HTMLLinkElement {
|
|||
let listener = NetworkListener {
|
||||
context: context,
|
||||
script_chan: document.window().networking_task_source(),
|
||||
wrapper: Some(document.window().get_runnable_wrapper()),
|
||||
};
|
||||
let response_target = AsyncResponseTarget {
|
||||
sender: action_sender,
|
||||
|
|
|
@ -473,10 +473,12 @@ impl HTMLMediaElement {
|
|||
// 4.2
|
||||
let context = Arc::new(Mutex::new(HTMLMediaElementContext::new(self, url.clone())));
|
||||
let (action_sender, action_receiver) = ipc::channel().unwrap();
|
||||
let script_chan = window_from_node(self).networking_task_source();
|
||||
let window = window_from_node(self);
|
||||
let script_chan = window.networking_task_source();
|
||||
let listener = box NetworkListener {
|
||||
context: context,
|
||||
script_chan: script_chan,
|
||||
wrapper: Some(window.get_runnable_wrapper()),
|
||||
};
|
||||
|
||||
let response_target = AsyncResponseTarget {
|
||||
|
|
|
@ -308,6 +308,7 @@ impl HTMLScriptElement {
|
|||
let listener = NetworkListener {
|
||||
context: context,
|
||||
script_chan: doc.window().networking_task_source(),
|
||||
wrapper: Some(doc.window().get_runnable_wrapper()),
|
||||
};
|
||||
let response_target = AsyncResponseTarget {
|
||||
sender: action_sender,
|
||||
|
|
|
@ -949,7 +949,7 @@ impl Window {
|
|||
self.current_state.set(WindowState::Zombie);
|
||||
*self.js_runtime.borrow_mut() = None;
|
||||
self.browsing_context.set(None);
|
||||
self.ignore_further_async_events.store(true, Ordering::Relaxed);
|
||||
self.ignore_further_async_events.store(true, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/cssom-view/#dom-window-scroll
|
||||
|
|
|
@ -258,6 +258,7 @@ impl XMLHttpRequest {
|
|||
let listener = NetworkListener {
|
||||
context: context,
|
||||
script_chan: script_chan,
|
||||
wrapper: None,
|
||||
};
|
||||
ROUTER.add_route(action_receiver.to_opaque(), box move |message| {
|
||||
listener.notify_fetch(message.to().unwrap());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue