From 2a86f9d165f2c6482fcbe093f3029f09ae2b1232 Mon Sep 17 00:00:00 2001 From: Paul Rouget Date: Tue, 8 Dec 2015 04:39:37 +0100 Subject: Browser API: implement iframe.reload() --- components/script/dom/htmliframeelement.rs | 11 ++++++++--- components/script/script_task.rs | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'components/script') diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 3798ab4f539..e7816399619 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) { 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::().is_in_doc() { + self.navigate_or_reload_child_browsing_context(None); + } + } + Ok(()) } // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/stop diff --git a/components/script/script_task.rs b/components/script/script_task.rs index f0ea6bd1354..77cc03a53ac 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -1943,7 +1943,7 @@ impl ScriptTask { doc.find_iframe(subpage_id) }); if let Some(iframe) = iframe.r() { - iframe.navigate_child_browsing_context(load_data.url); + iframe.navigate_or_reload_child_browsing_context(Some(load_data.url)); } } None => { -- cgit v1.2.3