mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #9731 - paulrouget:mozbrowserRootPipelineOnly, r=jdm
allow mozbrowser only for top level windows <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9731) <!-- Reviewable:end -->
This commit is contained in:
commit
3212d3a91e
1 changed files with 11 additions and 4 deletions
|
@ -360,7 +360,8 @@ pub fn Navigate(iframe: &HTMLIFrameElement, direction: NavigationDirection) -> F
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
debug!("this frame is not mozbrowser (or experimental_enabled is false)");
|
debug!("this frame is not mozbrowser: mozbrowser attribute missing, or not a top
|
||||||
|
level window, or mozbrowser preference not set (use --pref dom.mozbrowser.enabled)");
|
||||||
Err(Error::NotSupported)
|
Err(Error::NotSupported)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -425,7 +426,9 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement {
|
||||||
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-mozbrowser
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-mozbrowser
|
||||||
fn Mozbrowser(&self) -> bool {
|
fn Mozbrowser(&self) -> bool {
|
||||||
if mozbrowser_enabled() {
|
// We don't want to allow mozbrowser iframes within iframes
|
||||||
|
let is_root_pipeline = window_from_node(self).parent_info().is_none();
|
||||||
|
if mozbrowser_enabled() && is_root_pipeline {
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
element.has_attribute(&atom!("mozbrowser"))
|
element.has_attribute(&atom!("mozbrowser"))
|
||||||
} else {
|
} else {
|
||||||
|
@ -454,12 +457,16 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement {
|
||||||
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/reload
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/reload
|
||||||
fn Reload(&self, _hardReload: bool) -> Fallible<()> {
|
fn Reload(&self, _hardReload: bool) -> Fallible<()> {
|
||||||
if mozbrowser_enabled() {
|
if self.Mozbrowser() {
|
||||||
if self.upcast::<Node>().is_in_doc() {
|
if self.upcast::<Node>().is_in_doc() {
|
||||||
self.navigate_or_reload_child_browsing_context(None);
|
self.navigate_or_reload_child_browsing_context(None);
|
||||||
}
|
}
|
||||||
|
Ok(())
|
||||||
|
} else {
|
||||||
|
debug!("this frame is not mozbrowser: mozbrowser attribute missing, or not a top
|
||||||
|
level window, or mozbrowser preference not set (use --pref dom.mozbrowser.enabled)");
|
||||||
|
Err(Error::NotSupported)
|
||||||
}
|
}
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/stop
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/stop
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue