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 <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
This commit is contained in:
Tor Lillqvist 2020-03-25 13:39:40 +02:00
parent 30f9f7bfdc
commit 09821236ef

View file

@ -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 {