diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-07-20 04:41:34 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-20 04:41:34 -0500 |
commit | b6c0ed9a44b076928ea816ca529702eec25d0029 (patch) | |
tree | 444708b0079756882b70600ddd02beb7f2a4341c /components/script/script_thread.rs | |
parent | 2d01d41a506bcbc7f26a2284b9f42390d6ef96ab (diff) | |
parent | 72aa4f2f6243242a7490b789c24644aec49d8f9b (diff) | |
download | servo-b6c0ed9a44b076928ea816ca529702eec25d0029.tar.gz servo-b6c0ed9a44b076928ea816ca529702eec25d0029.zip |
Auto merge of #12426 - asajeffrey:mozbrowser-event-targets, r=SimonSapin
Allow window elements as well as iframes to the the target of mozbrowser events
<!-- Please describe your changes on the following line: -->
Allow mozbrowser events, in particular mozbrowsererror events, to target a window. Needed for https://github.com/browserhtml/browserhtml/issues/1182
---
<!-- 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 #12420
- [X] These changes do not require tests because we're not testing our issue reporting system, which this is intended for.
<!-- 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/12426)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 57bd85ec1ec..ec2401d6f61 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -1355,17 +1355,17 @@ impl ScriptThread { /// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserloadstart fn handle_mozbrowser_event_msg(&self, parent_pipeline_id: PipelineId, - subpage_id: SubpageId, + subpage_id: Option<SubpageId>, event: MozBrowserEvent) { - let borrowed_context = self.root_browsing_context(); - - let frame_element = borrowed_context.find(parent_pipeline_id).and_then(|context| { - let doc = context.active_document(); - doc.find_iframe(subpage_id) - }); - - if let Some(ref frame_element) = frame_element { - frame_element.dispatch_mozbrowser_event(event); + match self.root_browsing_context().find(parent_pipeline_id) { + None => warn!("Mozbrowser event after pipeline {:?} closed.", parent_pipeline_id), + Some(context) => match subpage_id { + None => context.active_window().dispatch_mozbrowser_event(event), + Some(subpage_id) => match context.active_document().find_iframe(subpage_id) { + None => warn!("Mozbrowser event after iframe {:?}/{:?} closed.", parent_pipeline_id, subpage_id), + Some(frame_element) => frame_element.dispatch_mozbrowser_event(event), + }, + }, } } |