Skip to content

Commit

Permalink
Fix compatibility with new titlebar structure
Browse files Browse the repository at this point in the history
  • Loading branch information
filips123 committed Oct 15, 2024
1 parent 6fd5dac commit 08e4fac
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions native/userchrome/profile/chrome/pwa/content/browser.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ class PwaBrowser {
let shownByDefault = Services.xulStore.getValue(window.document.documentURI, iconBar.id, 'collapsed') !== 'true';
if (!shownByDefault) {
window.TabBarVisibility.update = function () {}
titleBar.setAttribute('autohide', 'true');
titleBar?.setAttribute('autohide', 'true');
iconBar.setAttribute('collapsed', 'true');
}

Expand Down Expand Up @@ -653,10 +653,10 @@ class PwaBrowser {
(event.key !== 'AltGraph')
) {
if (iconBar.hasAttribute('collapsed')) {
titleBar.removeAttribute('autohide');
titleBar?.removeAttribute('autohide');
iconBar.removeAttribute('collapsed');
} else {
titleBar.setAttribute('autohide', 'true');
titleBar?.setAttribute('autohide', 'true');
iconBar.setAttribute('collapsed', 'true');
}
}
Expand All @@ -671,10 +671,10 @@ class PwaBrowser {
hookFunction(window, 'setToolbarVisibility', (toolbar, visible, persist) => {
if (toolbar === iconBar && persist) {
if (!visible) {
titleBar.setAttribute('autohide', 'true');
titleBar?.setAttribute('autohide', 'true');
window.TabBarVisibility.update = function () {};
} else {
titleBar.removeAttribute('autohide');
titleBar?.removeAttribute('autohide');
}

shownByDefault = visible;
Expand All @@ -683,11 +683,11 @@ class PwaBrowser {

// Show/hide main titlebar when menu bar is active/inactive
document.addEventListener('DOMMenuBarActive', () => {
titleBar.removeAttribute('autohide');
titleBar?.removeAttribute('autohide');
});

document.addEventListener('DOMMenuBarInactive', () => {
titleBar.setAttribute('autohide', 'true');
titleBar?.setAttribute('autohide', 'true');
});
}

Expand Down

0 comments on commit 08e4fac

Please sign in to comment.