Skip to content

Commit

Permalink
Fix settings not displaying in Firefox 116 (fixes #378)
Browse files Browse the repository at this point in the history
This should make PWAsForFirefox settings should again on `about:preferences` in Firefox 116. I don't know why this happens, and it seems like the order in which scripts get executed was changed, so it misses the initialization. Because of this, the script now tries to immediately add the new preferences instead of waiting for the initialization.

This is not a perfect fix though. If the user opens `about:preferences` on a non-general category and switches to a general category, settings will still be hidden. This will probably be fixed in the future.
  • Loading branch information
filips123 committed Aug 3, 2023
1 parent 3fd078d commit 17e2c90
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions native/userchrome/profile/chrome/pwa/content/preferences.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ XPCOMUtils.defineLazyModuleGetters(this, {
});

class PwaPreferences {
preferenceElementsAdded = false

constructor () {
this.addPreferenceData();
try { this.addPreferenceElements() } catch {}
hookFunction(gMainPane, 'init', null, () => { this.addPreferenceElements(); });

// Handle switch of preferences on load and when they changes
Expand Down Expand Up @@ -35,6 +38,9 @@ class PwaPreferences {
}

addPreferenceElements () {
if (this.preferenceElementsAdded) return;
this.preferenceElementsAdded = true;

const firefoxpwaGroup = MozXULElement.parseXULToFragment(`
<groupbox id="firefoxpwaGroup" data-category="paneGeneral">
<label>
Expand Down

0 comments on commit 17e2c90

Please sign in to comment.