aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/window.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r--components/script/dom/window.rs34
1 files changed, 30 insertions, 4 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index e210476a5df..90782e217b7 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -787,6 +787,32 @@ impl WindowMethods<crate::DomTypeHolder> for Window {
doc.abort(can_gc);
}
+ /// <https://html.spec.whatwg.org/multipage/#dom-window-focus>
+ fn Focus(&self) {
+ // > 1. Let `current` be this `Window` object's browsing context.
+ // >
+ // > 2. If `current` is null, then return.
+ let current = match self.undiscarded_window_proxy() {
+ Some(proxy) => proxy,
+ None => return,
+ };
+
+ // > 3. Run the focusing steps with `current`.
+ current.focus();
+
+ // > 4. If current is a top-level browsing context, user agents are
+ // > encouraged to trigger some sort of notification to indicate to
+ // > the user that the page is attempting to gain focus.
+ //
+ // TODO: Step 4
+ }
+
+ // https://html.spec.whatwg.org/multipage/#dom-window-blur
+ fn Blur(&self) {
+ // > User agents are encouraged to ignore calls to this `blur()` method
+ // > entirely.
+ }
+
// https://html.spec.whatwg.org/multipage/#dom-open
fn Open(
&self,
@@ -1220,7 +1246,7 @@ impl WindowMethods<crate::DomTypeHolder> for Window {
let rv = jsval_to_webdriver(cx, &self.globalscope, val, realm, can_gc);
let opt_chan = self.webdriver_script_chan.borrow_mut().take();
if let Some(chan) = opt_chan {
- chan.send(rv).unwrap();
+ let _ = chan.send(rv);
}
}
@@ -1229,9 +1255,9 @@ impl WindowMethods<crate::DomTypeHolder> for Window {
let opt_chan = self.webdriver_script_chan.borrow_mut().take();
if let Some(chan) = opt_chan {
if let Ok(rv) = rv {
- chan.send(Err(WebDriverJSError::JSException(rv))).unwrap();
+ let _ = chan.send(Err(WebDriverJSError::JSException(rv)));
} else {
- chan.send(rv).unwrap();
+ let _ = chan.send(rv);
}
}
}
@@ -1239,7 +1265,7 @@ impl WindowMethods<crate::DomTypeHolder> for Window {
fn WebdriverTimeout(&self) {
let opt_chan = self.webdriver_script_chan.borrow_mut().take();
if let Some(chan) = opt_chan {
- chan.send(Err(WebDriverJSError::Timeout)).unwrap();
+ let _ = chan.send(Err(WebDriverJSError::Timeout));
}
}