diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2015-12-17 19:45:44 +0530 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2015-12-17 19:45:44 +0530 |
commit | 9570b51565c3864e76570f41a45f3b94c002e50c (patch) | |
tree | 21036322c5e5f308b8729c3b6ba1eb9c92bd919e /components/script/dom/htmliframeelement.rs | |
parent | c6ae32abdde715dbdc3097a40ab7abdbc98cf4b0 (diff) | |
parent | 2a86f9d165f2c6482fcbe093f3029f09ae2b1232 (diff) | |
download | servo-9570b51565c3864e76570f41a45f3b94c002e50c.tar.gz servo-9570b51565c3864e76570f41a45f3b94c002e50c.zip |
Auto merge of #8618 - paulrouget:reload, r=jdm
Browser API: implement iframe.reload()
fixes #8575
The implementation is naive, and doesn't support the `hardreload` parameter.
And for the test, I'm not sure how else I can test the reload.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8618)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/htmliframeelement.rs')
-rw-r--r-- | components/script/dom/htmliframeelement.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 72a38ce8c89..c7fdb9eb075 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -90,7 +90,7 @@ impl HTMLIFrameElement { (subpage_id, old_subpage_id) } - pub fn navigate_child_browsing_context(&self, url: Url) { + pub fn navigate_or_reload_child_browsing_context(&self, url: Option<Url>) { let sandboxed = if self.is_sandboxed() { IFrameSandboxed } else { @@ -127,7 +127,7 @@ impl HTMLIFrameElement { None => url!("about:blank"), }; - self.navigate_child_browsing_context(url); + self.navigate_or_reload_child_browsing_context(Some(url)); } #[allow(unsafe_code)] @@ -399,7 +399,12 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement { // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/reload fn Reload(&self, _hardReload: bool) -> Fallible<()> { - Err(Error::NotSupported) + if mozbrowser_enabled() { + if self.upcast::<Node>().is_in_doc() { + self.navigate_or_reload_child_browsing_context(None); + } + } + Ok(()) } // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/stop |