From 09821236ef237711bb38b46c47b3d123d2adc9bf Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 25 Mar 2020 13:39:40 +0200 Subject: [PATCH] Add two pseudo-assertions for code that IMHO will never be executed I suggest we introduce this convention for such assertions. Feel free to modify the message syntax. The idea is that if you notice some code block you think will never be executed, add a comment and a console.log with a message in this syntax. If somebody then later sees that logging appear after all, they can add/modify a comment describing what is actually going on. Change-Id: I76302e414d78912b6d20ba149c69d00d995613c6 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91048 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tor Lillqvist --- loleaflet/src/control/Control.Menubar.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index 5d24b7ebf..e2396faf5 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -895,6 +895,11 @@ L.Control.Menubar = L.Control.extend({ if (this.checked) { self._map.fire('closesidebar'); if (!L.Browser.mobile) { + // Surely this code, if it really is related only to the hamburger menu, + // will never be invoked on non-mobile browsers? I might be wrong though. + // If you notice this logging, please modify this comment to indicate what is + // going on. + console.log('======> Assertion failed!? Not L.Browser.mobile? Control.Menubar.js #1'); $nav.css({height: 'initial', bottom: '38px'}); $menu.hide().slideDown(250, function() { $menu.css('display', ''); }); $('#mobile-wizard-header').show(); @@ -906,6 +911,8 @@ L.Control.Menubar = L.Control.extend({ $('#mobile-wizard-header').hide(); } } else if (!L.Browser.mobile) { + // Ditto. + console.log('======> Assertion failed!? Not L.Browser.mobile? Control.Menubar.js #2'); $menu.show().slideUp(250, function() { $menu.css('display', ''); }); $nav.css({height:'', bottom: ''}); } else {