firefox-omni-tweaks icon indicating copy to clipboard operation
firefox-omni-tweaks copied to clipboard

Tweaks not applying to firefox 125.0.1

Open Unit193 opened this issue 1 year ago • 0 comments
trafficstars

Description

  • [x] I made sure that the issue still occurs in the latest commit of the script.
  • [x] I am aware of the mechanics around the startup cache of Firefox and how this script should be clearing it.
  • Firefox version and build ID: 124.0.1-1
  • Operating system: Debian unstable

Steps to reproduce the issue

  1. Upgrade from firefox 124.0.1-1 to 125.0.1-1
  2. Run ./fixfx.sh -o preventClickSelectsAll= -o autoSelectCopiesToClipboard
  3. Start firefox, notice tweak not applied.
  4. Downgrade to firefox 124.0.1-1 and re-run fixfx.sh
  5. Start firefox with --allow-downgrade, notice tweak applied.

Upon running fixfx.sh with 125, there's some warning from the script:

Warning: Pattern 's/(_on_select\(event\) \{)/\1\n    this.window.fixfx_isOpeningLocation = false;\n    /' could not be matched in file 'modules/UrlbarInput.sys.mjs'.
Warning: Pattern 's/(_on_select\(event\) \{)/\1\n    if(event?.detail?.fixfx_openingLocationCall){\n      this.window.fixfx_isSwitchingTab = false;\n    }\n    \n    const fixfx_isSwitchingTab = this.window.fixfx_isSwitchingTab;\n    \n    if(this.window.fixfx_isSwitchingTab){\n      this.window.setTimeout(() => this.window.setTimeout(() => this.window.fixfx_isSwitchingTab = false));\n    }\n    /' could not be matched in file 'modules/UrlbarInput.sys.mjs'.
Warning: Pattern '/_on_select\(event\) \{/,/ClipboardHelper/ s/(if \(!val)\)/\1 || !this.window.windowUtils.isHandlingUserInput \&\& val !== this.inputField.value \&\& this.inputField.value.endsWith(val))/' could not be matched in file 'modules/UrlbarInput.sys.mjs'.

This can be easily fixed with:

--- fixfx.sh	2024-04-20 02:47:53.495086420 -0400
+++ fixfx.sh.new	2024-04-20 02:47:42.575239869 -0400
@@ -709,7 +709,7 @@
   fi
   
   if [[ "${settings[options|autoSelectCopiesToClipboard]-}" ]]; then
-    edit_file 'autoSelectCopiesToClipboard' 'browser_omni' "${urlbarinput_path}" 's/(_on_select\(event\) \{)/\1\n    this.window.fixfx_isOpeningLocation = false;\n    /' \
+    edit_file 'autoSelectCopiesToClipboard' 'browser_omni' "${urlbarinput_path}" 's/(_on_select\(\) \{)/\1\n    this.window.fixfx_isOpeningLocation = false;\n    /' \
       's/(this\._suppressPrimaryAdjustment = )true;/\1false;/' \
       's/(this\.inputField\.select\(\);)/\1\n    \n    if(this.window.fixfx_isOpeningLocation){\n      this._on_select({\n        detail: {\n          fixfx_openingLocationCall: true\n        }\n      });\n    }\n    /'
     edit_file 'autoSelectCopiesToClipboard' 'browser_omni' 'chrome/browser/content/browser/browser.js' '/function openLocation/,/gURLBar\.select\(\);/ s/(gURLBar\.select\(\);)/window.fixfx_isOpeningLocation = true;\n    \1/' \
@@ -722,12 +722,12 @@
     if [[ "${settings[options|tabSwitchCopiesToClipboard]-}" ]]; then
       edit_file 'tabSwitchCopiesToClipboard' 'browser_omni' "${urlbarinput_path}" 's/^\s*!this\.window\.windowUtils\.isHandlingUserInput \|\|$//'
     else
-      edit_file 'tabSwitchCopiesToClipboard' 'browser_omni' "${urlbarinput_path}" 's/(_on_select\(event\) \{)/\1\n    if(event?.detail?.fixfx_openingLocationCall){\n      this.window.fixfx_isSwitchingTab = false;\n    }\n    \n    const fixfx_isSwitchingTab = this.window.fixfx_isSwitchingTab;\n    \n    if(this.window.fixfx_isSwitchingTab){\n      this.window.setTimeout(() => this.window.setTimeout(() => this.window.fixfx_isSwitchingTab = false));\n    }\n    /' \
+      edit_file 'tabSwitchCopiesToClipboard' 'browser_omni' "${urlbarinput_path}" 's/(_on_select\(\) \{)/\1\n    if(event?.detail?.fixfx_openingLocationCall){\n      this.window.fixfx_isSwitchingTab = false;\n    }\n    \n    const fixfx_isSwitchingTab = this.window.fixfx_isSwitchingTab;\n    \n    if(this.window.fixfx_isSwitchingTab){\n      this.window.setTimeout(() => this.window.setTimeout(() => this.window.fixfx_isSwitchingTab = false));\n    }\n    /' \
         's/!this\.window\.windowUtils\.isHandlingUserInput \|\|/fixfx_isSwitchingTab ||/'
     fi
     
     if [[ ! "${settings[options|autoCompleteCopiesToClipboard]-}" ]]; then
-      edit_file 'autoCompleteCopiesToClipboard' 'browser_omni' "${urlbarinput_path}" '/_on_select\(event\) \{/,/ClipboardHelper/ s/(if \(!val)\)/\1 || !this.window.windowUtils.isHandlingUserInput \&\& val !== this.inputField.value \&\& this.inputField.value.endsWith(val))/'
+      edit_file 'autoCompleteCopiesToClipboard' 'browser_omni' "${urlbarinput_path}" '/_on_select\(\) \{/,/ClipboardHelper/ s/(if \(!val)\)/\1 || !this.window.windowUtils.isHandlingUserInput \&\& val !== this.inputField.value \&\& this.inputField.value.endsWith(val))/'
     fi
   fi
   

And inspecting the resulting omni.ja file the changes appear to be inserted correctly, but that doesn't fix the underlying js changes.

Unit193 avatar Apr 23 '24 05:04 Unit193