From 968367b042c95a4aea152b5a2bba518ef76ef83b Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Fri, 19 Jan 2018 15:25:03 -0500 Subject: [PATCH] Simplify logic for checking if an element is a frame --- qutebrowser/javascript/webelem.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/qutebrowser/javascript/webelem.js b/qutebrowser/javascript/webelem.js index 76296acaa..d635de412 100644 --- a/qutebrowser/javascript/webelem.js +++ b/qutebrowser/javascript/webelem.js @@ -278,10 +278,13 @@ window._qutebrowser.webelem = (function() { // Check if elem is an iframe, and if so, return the result of func on it. // If no iframes match, return null function call_if_frame(elem, func) { - const frame = elem.contentWindow; // Check if elem is a frame, and if so, call func on the window - if (frame && iframe_same_domain(frame) && frame.frameElement) { - return func(frame); + if ("contentWindow" in elem) { + const frame = elem.contentWindow; + if (iframe_same_domain(frame) && + "frameElement" in elem.contentWindow) { + return func(frame); + } } return null; }