From 57eb9fc150a39813a5ece232e026f161b25f601a Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 8 Mar 2020 11:12:47 -0400 Subject: [PATCH] Expect that IntersectionObserver API may not be available Related issue: - https://github.com/uBlockOrigin/uMatrix-issues/issues/235 The popup-resize functionality won't be available if the IntersectionObserver API is not available. The purpose of the popup-resize code is to adjust the matrix visuals on small display -- i.e. on mobile or when the popup panel is used in the overflow menu in Firefox. --- src/js/popup.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/js/popup.js b/src/js/popup.js index 3a9346a..b4d8e3f 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -77,6 +77,11 @@ const resizePopup = (( ) => { // The purpose of `xobserver` is to initiate the resize handler only // when the popup panel is actually visible. + + // https://github.com/uBlockOrigin/uMatrix-issues/issues/235 + if ( self.IntersectionObserver instanceof Object === false ) { + return ( ) => { }; + } let xobserver = new IntersectionObserver(intersections => { if ( intersections.length === 0 ) { return; } if ( intersections[0].isIntersecting === false ) { return; }