Skip to content
Permalink
Browse files

Do not unwrap in element{,s}FromPoint

  • Loading branch information
KiChjang committed May 8, 2018
1 parent acd4e21 commit df23f909cdf0460186776e43f451233985150eab
@@ -3624,7 +3624,7 @@ impl DocumentMethods for Document {
let y = *y as f32;
let point = &Point2D::new(x, y);
let window = window_from_node(self);
let viewport = window.window_size().unwrap().initial_viewport;
let viewport = window.window_size()?.initial_viewport;

if self.browsing_context().is_none() {
return None;
@@ -3658,7 +3658,10 @@ impl DocumentMethods for Document {
let y = *y as f32;
let point = &Point2D::new(x, y);
let window = window_from_node(self);
let viewport = window.window_size().unwrap().initial_viewport;
let viewport = match window.window_size() {
Some(size) => size.initial_viewport,
None => return vec![]
};

if self.browsing_context().is_none() {
return vec!();
@@ -1,4 +1,7 @@
[elementsFromPoint.html]
type: testharness
expected: CRASH
[SVG element at x,y]
expected: FAIL
[transformed element at x,y]
expected: FAIL

@@ -1,5 +1,6 @@
[matchMedia.xht]
type: testharness
expected: TIMEOUT
[window.matchMedia exists]
expected: FAIL
[MediaQueryList.matches for "(max-width: 199px), all and (min-width: 200px)"]
@@ -11,5 +12,9 @@
[MediaQueryList.matches for "(min-width: 150px)"]
expected: FAIL
[Resize iframe from 200x100 to 200x50, then to 100x50]
expected: FAIL
expected: NOTRUN
[Listeners are called in the order which they have been added]
expected: NOTRUN
[Listener added twice is only called once.]
expected: NOTRUN

0 comments on commit df23f90

Please sign in to comment.
You can’t perform that action at this time.