Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preparation for Firefox 117 #265

Open
onemen opened this issue Jul 11, 2023 · 113 comments
Open

Preparation for Firefox 117 #265

onemen opened this issue Jul 11, 2023 · 113 comments

Comments

@onemen
Copy link

onemen commented Jul 11, 2023

@xiaoxiaoflood

Firefox 117 changes

firefox-scripts will stop working on Firefox 117 without these changes

Update utils

BootstrapLoader.jsm

 let EXPORTED_SYMBOLS = [];

 const { XPCOMUtils } = ChromeUtils.import('resource://gre/modules/XPCOMUtils.jsm');
+const Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services;

 XPCOMUtils.defineLazyModuleGetters(this, {
   Blocklist: 'resource://gre/modules/Blocklist.jsm',
   ConsoleAPI: 'resource://gre/modules/Console.jsm',
   InstallRDF: 'chrome://userchromejs/content/RDFManifestConverter.jsm',
-  Services: 'resource://gre/modules/Services.jsm',
 });

 Services.obs.addObserver(doc => {

RDFDataSource.jsm

 var EXPORTED_SYMBOLS = ["RDFLiteral", "RDFBlankNode", "RDFResource", "RDFDataSource"];

 const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+const Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services;

 XPCOMUtils.defineLazyGlobalGetters(this, ["DOMParser", "Element", "fetch"]);

-ChromeUtils.defineModuleGetter(this, "Services",
-                               "resource://gre/modules/Services.jsm");
-
 function isElement(obj) {
   return Element.isInstance(obj);
 }

userChrome.jsm

 let EXPORTED_SYMBOLS = [];

-const { Services } = ChromeUtils.import('resource://gre/modules/Services.jsm');
+const Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services;
 const { xPref } = ChromeUtils.import('chrome://userchromejs/content/xPref.jsm');
 const { Management } = ChromeUtils.import('resource://gre/modules/Extension.jsm');
 const { AppConstants } = ChromeUtils.import('resource://gre/modules/AppConstants.jsm');

xPref.jsm

 let EXPORTED_SYMBOLS = ['xPref'];

-const {Services} = ChromeUtils.import('resource://gre/modules/Services.jsm');
+const Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services;

 var xPref = {
   // Retorna o valor da preferência, seja qual for o tipo, mas não
@117649
Copy link

117649 commented Jul 11, 2023

@onemen @xiaoxiaoflood is lost contact for so long may be consider put all these in a fork?

@onemen
Copy link
Author

onemen commented Jul 11, 2023

maybe @xiaoxiaoflood can update us about what are the plans for this repository

@Aleksandra0056
Copy link

Aleksandra0056 commented Jul 11, 2023

Last commit by xiaoxiaoflood was made on February 25, 2023 (4.5 months ago), so it is unlikely, that he will make any change.

@117649
Copy link

117649 commented Jul 11, 2023

maybe @xiaoxiaoflood can update us about what are the plans for this repository

Last commit by xiaoxiaoflood was made on February 25, 2023 (4.5 months ago), so it is unlikely, that he will make any change.

Make a pr so if @xiaoxiaoflood showed up again he can accept it?

@Aleksandra0056
Copy link

Aleksandra0056 commented Jul 11, 2023

I don't know what happened to xiaoxiaoflood, but maybe he lost his password, or maybe someone hacked him account, or maybe he had an accident.

If one of these theories are true, then he didn't show up again, but onemen should decide what to do, if he forks this repository or if he makes a Pull Request.

@Aleksandra0056
Copy link

Aleksandra0056 commented Jul 11, 2023

And only extensions stop work? Or also scripts (like status bar, or extensions options menu) stop work from Firefox 117.0?

@megamorphg
Copy link

megamorphg commented Jul 11, 2023

Yeah, he used to respond fairly quickly.
I honestly use only a couple of the add-ons. I'm wondering if I just uninstall this... it's just too complicated to maintain this on top of all the other FF customizations.

Does FF 117 automatically make things go back to default or do I have to do anything else? I might just leave it be and remove the addons and scripts if it doesn't break anything to do so.

@Aleksandra0056
Copy link

So, I think, that forking this repository would be the best idea if xiaoxiaoflood is not responding. If I'll update to Firefox 117.0 then I will change my JS files in chrome directory to use actual code as onemen wrote, other people should do the same.

@marty60
Copy link

marty60 commented Jul 11, 2023

Thanks for this, it probably explains why I'm suddenly having context menu problems with DTA in 117.

xiaoxiaoflood is still around, he posts at Reddit as tustamido:

https://old.reddit.com/user/tustamido

@onemen
Copy link
Author

onemen commented Jul 11, 2023

Firefox 117 is now on Nightly, until it reach production we will figure out what to do.

@117649
Copy link

117649 commented Jul 11, 2023

Thanks for this, it probably explains why I'm suddenly having context menu problems with DTA in 117.

xiaoxiaoflood is still around, he posts at Reddit as tustamido:

https://old.reddit.com/user/tustamido

Hoping you're not mismatching accounts of different person.

@marty60
Copy link

marty60 commented Jul 11, 2023

Hoping you're not mismatching accounts of different person.

This is the thread I got the name from:

https://old.reddit.com/r/XUL_for_Quantum_Dev/comments/fs76ff/little_update_current_fx_version_75/

@marty60
Copy link

marty60 commented Jul 11, 2023

This whole thing is a mess now. Removing that one line from config.js breaks the custom buttons addon so I can't do anything with that since CB is a must have.

Even with all of the changes the two scripts I have still don't work and that's probably due to updates that need to be made with the scripts.

In addition, keyconfig and DTA are dead, also must haves. Might as well stay with an earlier nightly for the time being until everything can be sorted out. Hopefully xiaoxiaoflood returns since he's usually been good with this project.

@onemen
Copy link
Author

onemen commented Jul 11, 2023

@marty60,

you probably need to fix +const Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services for all scripts that use Services

@marty60
Copy link

marty60 commented Jul 11, 2023

you probably need to fix +const Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services for all scripts that use Services

Thanks for that but tried and still didn't work. It's a script by Aris that makes the forward button moveable so I can visit him and he'll probably give me an update.

@marty60
Copy link

marty60 commented Jul 12, 2023

Yesterday seemed dire but today's nightly everything returned except for keyconfig. DTA is still functional. I was able to fix Aris's script by simply removing this line:

var {Services} = Components.utils.import("resource://gre/modules/Services.jsm", {});

The only caveat is if I delete the line from config.js everything breaks so keeping it in seems to be the fix, at least for me since custom buttons apparently needs it and it's not breaking the scripts.

Any chance at taking a look at keyconfig? I don't know about any of the other extensions.

@marty60
Copy link

marty60 commented Jul 12, 2023

For anyone using Password Manager open passwordManager.js with Wordpad and delete these lines:

/* eslint-disable-next-line no-var */
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");

@marty60
Copy link

marty60 commented Jul 12, 2023

Getting keyconfig to work again was actually pretty easy. You just need to go through these files and delete these lines:

Bootstrap.js:
Components.utils.import("resource://gre/modules/Services.jsm");

defaultPreferencesLoader.jsm:
const { utils: Cu, classes: Cc, interfaces: Ci } = Components;
Cu.import('resource://gre/modules/Services.jsm');

edit.xhtml:
var {Services} = ChromeUtils.import('resource://gre/modules/Services.jsm');

Keyconfig.js:
var {Services} = ChromeUtils.import('resource://gre/modules/Services.jsm');

ChromeManifest.jsm:
Components.utils.import("resource://gre/modules/Services.jsm");

Overlays.jsm:
ChromeUtils.defineModuleGetter(
this,
"Services",
"resource://gre/modules/Services.jsm"
);

If you start Firefox and it’s not showing in Tools going into about:addons disabling then re-enabling it should bring it back. Might have to reboot it a few times and clean out the error log.

@Aleksandra0056
Copy link

What is keyconfig?

@marty60
Copy link

marty60 commented Jul 14, 2023

What is keyconfig?

It's one of xiaoxiaoflood's revised addons:

https://github.com/xiaoxiaoflood/firefox-scripts/tree/master/extensions

It's been around forever, it was originally developed by dorando and let's you easily re-map keyboard shortcuts. It's been a must have for me since the firefox 3.6 days.

@benzBrake
Copy link

What is keyconfig?

It's one of xiaoxiaoflood's revised addons:

master/extensions

It's been around forever, it was originally developed by dorando and let's you easily re-map keyboard shortcuts. It's been a must have for me since the firefox 3.6 days.

You can try this script for temporary usage

@Aleksandra0056
Copy link

Yesterday seemed dire but today's nightly everything returned except for keyconfig.

@marty60 What returned? You mean, that extensions are working again? Or also scripts are working again? You wrote it unclearly.

@marty60
Copy link

marty60 commented Jul 15, 2023

@marty60 What returned? You mean, that extensions are working again? Or also scripts are working again? You wrote it unclearly.

After making the changes to the files in the utils folder that onemen posted but leaving that line in config.js the scripts are working (I had to manually fix one of them). DTA is also working. Keyconfig had to be manually updated, the changes to the files were posted above.

At least for me, everything is back to normal. If you're having a problem with any scripts or addons post it and maybe someone can help.

@marty60
Copy link

marty60 commented Jul 15, 2023

You can try this script for temporary usage

@benzBrake I've got keyconfig updated to load again in 117.0 but how does your script work? I tried using it but am getting an error. If it does what keyconfig can it would make a useful backup.

@benzBrake
Copy link

You can try this script for temporary usage

@benzBrake I've got keyconfig updated to load again in 117.0 but how does your script work? I tried using it but am getting an error. If it does what keyconfig can it would make a useful backup.

I have add a English Version of Readme. What's the error message?

@Aleksandra0056
Copy link

Aleksandra0056 commented Jul 16, 2023

So, someone should contact xiaoxiaoflood here https://www.reddit.com/user/tustamido if it is his reddit account.

@marty60
Copy link

marty60 commented Jul 16, 2023

I have add a English Version of Readme. What's the error message?

Actually getting two error messages, one at startup and then another load error after clicking that. It's also generating a file in userChrome called _keychanger.js.

What exactly does this script do and how does it work? Does it do the same thing as keyconfig?

load error.zip

@benzBrake
Copy link

I have add a English Version of Readme. What's the error message?

Actually getting two error messages, one at startup and then another load error after clicking that. It's also generating a file in userChrome called _keychanger.js.

What exactly does this script do and how does it work? Does it do the same thing as keyconfig?

load error.zip

The first message is to let you click and then automatically create a configuration file _keychanger.js.
The second message is that the configuration file is empty.

Here is a reference configuration file: https://github.com/benzBrake/FirefoxCustomize/blob/master/userChromeJS/KeyChanger/_keychanger.js

@marty60
Copy link

marty60 commented Jul 17, 2023

Ok I see how it works and this is why Firefox is the best browser hands down. I was able to get everyone of the keyconfig codes and re-mapping I use in the addon with your script. Nice job.

_keychanger.zip

@marty60
Copy link

marty60 commented Sep 10, 2023

I updated utils based on the package in this comment and then config.js and restarted and scripts broken still.

The editing of config.js could be the problem. Try putting that back the way it was previously and only update the files in the utils folder.

@megamorphg
Copy link

@marty60 Yes I tried the config.js that gets over-written as:

// skip 1st line
lockPref('xpinstall.signatures.required', false);
lockPref('extensions.install_origins.enabled', false);

try {
  const cmanifest = Cc['@mozilla.org/file/directory_service;1'].getService(Ci.nsIProperties).get('UChrm', Ci.nsIFile);
  cmanifest.append('utils');
  cmanifest.append('chrome.manifest');
  Components.manager.QueryInterface(Ci.nsIComponentRegistrar).autoRegister(cmanifest);

  // signing bypass by Dumby from forum.mozilla-russia.org
  const g = Cu.getGlobalForObject(Cu);
  const sandbox = new Cu.Sandbox(g, { freshCompartment: true });
  Cc['@mozilla.org/jsdebugger;1'].createInstance(Ci.IJSDebugger).addClass(sandbox);
  const dbg = new sandbox.Debugger();
  dbg.addDebuggee(g);
  const gref = dbg.makeGlobalObjectReference(g);

  dbg.onEnterFrame = frame => {
    const { script } = frame;

    if (!script.url.startsWith('resource://gre/modules/AppConstants.'))
      return;

    dbg.onEnterFrame = undefined;

    if (script.isModule) { // ESM, Fx 108+
      const env = frame.environment;
      frame.onPop = () => env.setVariable('AppConstants', gref.makeDebuggeeValue(Object.freeze(
        Object.assign(new Object(), env.getVariable('AppConstants').unsafeDereference(), {
          'MOZ_REQUIRE_SIGNING': false
        })
      )));
    } else { // JSM
      const nsvo = frame.this.unsafeDereference();
      nsvo.Object = {
        freeze (ac) {
          ac.MOZ_REQUIRE_SIGNING = false;
          delete nsvo.Object;
          return Object.freeze(ac);
        }
      };
    }
  }

  ChromeUtils.import('resource://gre/modules/addons/XPIInstall.jsm');

  dbg.removeAllDebuggees();

  Cu.import('chrome://userchromejs/content/BootstrapLoader.jsm');
} catch (ex) {};

try {
  Cu.import('chrome://userchromejs/content/userChrome.jsm');
} catch (ex) {};

And also the one in this main repository.
Also tried rebuilding repository after each attempt. The other program files looked the same as repository.

@marty60
Copy link

marty60 commented Sep 10, 2023

@megamorphg,

That's the same one I'm using by Dumby and it works fine for me, the only difference is I have this extra line on top:

lockPref("extensions.experiments.enabled", true);

If it's still broke with this config.js file and the utils folder with the updated files inside the Chrome folder then it's possible your scripts need updating. I had to edit a few of those myself even with these changes. It was just a simple matter of removing a services line. You can post one of the scripts or zip it so someone can take a look at it.

@onemen
Copy link
Author

onemen commented Sep 10, 2023

I am using this config.js

// skip 1st line
lockPref('xpinstall.signatures.required', false);
lockPref('extensions.install_origins.enabled', false);
lockPref("extensions.experiments.enabled", true);

try {
  const cmanifest = Cc['@mozilla.org/file/directory_service;1'].getService(Ci.nsIProperties).get('UChrm', Ci.nsIFile);
  cmanifest.append('utils');
  cmanifest.append('chrome.manifest');
  Components.manager.QueryInterface(Ci.nsIComponentRegistrar).autoRegister(cmanifest);

  const objRef = ChromeUtils.import('resource://gre/modules/addons/XPIDatabase.jsm');
  objRef.XPIDatabase.SIGNED_TYPES.delete("extension");

  Cu.import('chrome://userchromejs/content/BootstrapLoader.jsm');
} catch (ex) {};

try {
  Cu.import('chrome://userchromejs/content/userChrome.jsm');
} catch (ex) {};

@megamorphg
Copy link

megamorphg commented Sep 10, 2023

@onemen @marty60 I've tried both your scripts on the latest 117 on Release channel and it still doesn't work.

  1. replace config.js with what you've posted
  2. replace the chrome utils files
  3. start FF

None of the scripts load. I'm only using the following scripts and extensions (all from the main repository except Animancer's which worked too):
image

@marty60
Copy link

marty60 commented Sep 10, 2023

@megamorphg,

Just want to check all the bases, you also have the config-prefs.js file in the prefs folder?

If you go to Menu Bar/Tools is the userChromeJS Manager there and if so all of the scripts checked to run? Or alternately if you have the button on the Navigation bar.

@megamorphg
Copy link

megamorphg commented Sep 11, 2023

@marty60 so I needed to refresh the startup via about:support (and not by deleting addonstartup)... and then all my scripts started working!
Addons are still disabled... any idea on how to re-enable that for Release? I tried "update addons" and it didn't work like last time. Otherwise I'll have to find the right add-on ID for all disabled extensions in my 3 browsers and run JS as instructed in #264...

@onemen
Copy link
Author

onemen commented Sep 11, 2023

Read this

@rebmcr
Copy link

rebmcr commented Sep 11, 2023

splitting Cu.import("chrome://userchromejs/content/BootstrapLoader.jsm"); into its own try catch block fixed it somehow.

This is what worked for me too — I never had a BootstrapLoader.jsm in the first place.

@117649
Copy link

117649 commented Sep 11, 2023

@marty60 so I needed to refresh the startup via about:support (and not by deleting addonstartup)... and then all my scripts started working! Addons are still disabled... any idea on how to re-enable that for Release? I tried "update addons" and it didn't work like last time. Otherwise I'll have to find the right add-on ID for all disabled extensions in my 3 browsers and run JS as instructed in #264...

If you know how to use f12 you can use that on about:addons to reveal the hidden enable switch.
Flip it back and forth one or more times should kick start the addon if you have all scripts in function.

@GreatestFool
Copy link

@megamorphg, I see you've mentioned that you're using "release" and the "Release channel" a few times. Do note that advanced modification using userscripts in the chrome directory requires that you use Firefox Developer Edition. Or the aurora release channel, if you want to reference what it says in the about section of the browser. Bootloaders like this one will not work on the release channel, the regular Firefox.

@117649
Copy link

117649 commented Sep 11, 2023

@megamorphg, I see you've mentioned that you're using "release" and the "Release channel" a few times. Do note that advanced modification using userscripts in the chrome directory requires that you use Firefox Developer Edition. Or the aurora release channel, if you want to reference what it says in the about section of the browser. Bootloaders like this one will not work on the release channel, the regular Firefox.

NO, it not.

@megamorphg
Copy link

Bootloaders like this one will not work on the release channel, the regular Firefox.
@GreatestFool

I've been using them in Release FF for a while. Didn't want to switch to dev to avoid facing issues I can't resolve first. ':)

@117649 can you provide more clarity on using the F12 inspector? I can't find the on/off button using it.

@117649
Copy link

117649 commented Sep 11, 2023

Bootloaders like this one will not work on the release channel, the regular Firefox.
@GreatestFool

I've been using them in Release FF for a while. Didn't want to switch to dev to avoid facing issues I can't resolve first. ':)

@117649 can you provide more clarity on using the F12 inspector? I can't find the on/off button using it.

image
Use the pick tool inside the red circle to select the card of the addon.
This will take you to the code section of the card in the html view, under this card section you will find many hidden elements that is grayed out(inside green circle).
Select any of them, then find this specific rule inside blue circle in the css view uncheck the checkbox before it.
Which will in turn unveil all hidden elements on the page.

@megamorphg
Copy link

megamorphg commented Sep 11, 2023

@117649 I guess something else is wrong because I did toggle the enable disable (and restart) and it still doesn't work:
image

Is it possible the config needs to be different? I used the one from the main repository but it sounds like even that needed to be changed a bit since the owner is gone?

@117649
Copy link

117649 commented Sep 11, 2023

@117649 I guess something else is wrong because I did toggle the enable disable (and restart) and it still doesn't work: image

Is it possible the config needs to be different? I used the one from the main repository but it sounds like even that needed to be changed a bit since the owner is gone?

use this:#265 (comment)

@megamorphg
Copy link

@117649 cool that worked... I guess Fast Tab Switcher won't work anymore, settings got wiped and can't set a keyboard shortcut anymore:
image

@GreatestFool
Copy link

@117649, @megamorphg, it's not that it won't work. Note that I said advanced modification, not any or all modifications. Certain actions will not work as intended and may fail straight out or be simply not viable on other channels. As an example, extension signatures cannot be disabled for Release and Beta channels.

@117649
Copy link

117649 commented Sep 12, 2023

@117649, @megamorphg, it's not that it won't work. Note that I said advanced modification, not any or all modifications. Certain actions will not work as intended and may fail straight out or be simply not viable on other channels. As an example, extension signatures cannot be disabled for Release and Beta channels.

Completely wrong.

// skip 1st line
lockPref('xpinstall.signatures.required', false);
lockPref('extensions.install_origins.enabled', false);
lockPref("extensions.experiments.enabled", true);

try {
  const cmanifest = Cc['@mozilla.org/file/directory_service;1'].getService(Ci.nsIProperties).get('UChrm', Ci.nsIFile);
  cmanifest.append('utils');
  cmanifest.append('chrome.manifest');
  Components.manager.QueryInterface(Ci.nsIComponentRegistrar).autoRegister(cmanifest);

  const objRef = ChromeUtils.import('resource://gre/modules/addons/XPIDatabase.jsm');
  objRef.XPIDatabase.SIGNED_TYPES.delete("extension");

  Cu.import('chrome://userchromejs/content/BootstrapLoader.jsm');
} catch (ex) {};

try {
  Cu.import('chrome://userchromejs/content/userChrome.jsm');
} catch (ex) {};

This piece disable extension signature on release and beta
image
image

@GreatestFool
Copy link

The wiki also specifies "Firefox Release and Beta versions will not have any way to disable signature checks. Signature checks can be disabled in other versions, as described in detail below." Where it goes on to describe how to use about:config to flip the required setting. And as I understand the surrounding code, mustSign is not the function that is used to check if unsigned extensions can be installed. It is used in verifySignatures, isUsableAddon and loadManifest, along with others depending on the function, where it fails if a signature isn't valid. It's essentially just setting the state when being called by the larger functions that control that part.

But whatever. I don't particularly care anyway, it was the first thing that came to mind. Perhaps they've changed it since, and simply not updated their wiki. Regardless, that doesn't change the point I was making.

@117649
Copy link

117649 commented Sep 12, 2023

The wiki also specifies "Firefox Release and Beta versions will not have any way to disable signature checks. Signature checks can be disabled in other versions, as described in detail below." Where it goes on to describe how to use about:config to flip the required setting. And as I understand the surrounding code, mustSign is not the function that is used to check if unsigned extensions can be installed. It is used in verifySignatures, isUsableAddon and loadManifest, along with others depending on the function, where it fails if a signature isn't valid. It's essentially just setting the state when being called by the larger functions that control that part.

But whatever. I don't particularly care anyway, it was the first thing that came to mind. Perhaps they've changed it since, and simply not updated their wiki. Regardless, that doesn't change the point I was making.

The wiki isn't wrong but the way the config.js works give it so much power that it can manipulate key values directly.

@MelchiorGaspar
Copy link

MelchiorGaspar commented Oct 16, 2023

I just updated my laptop's Firefox install to v118.0.2 from v116 and now TabMixPlus won't work or reinstall..
I copied the updated util folder jsm files and program files js files but no go... odd.. I will keep at it and report back.

edit:
nvm I forgot to clear the script cache.
its working now.

@MelchiorGaspar
Copy link

MelchiorGaspar commented Nov 18, 2023

I am trying out Ubuntu on an old 2008 Toshiba laptop...

how do I get TabMixPlus to run on Firefox on it?
please and thx.

edit:
nvm, Linux has its issues too...
so I reinstalled Windows 7 on it... got it working..

@limaceous-bushwhacker
Copy link

The wiki also specifies "Firefox Release and Beta versions will not have any way to disable signature checks. Signature checks can be disabled in other versions, as described in detail below." Where it goes on to describe how to use about:config to flip the required setting. And as I understand the surrounding code, mustSign is not the function that is used to check if unsigned extensions can be installed. It is used in verifySignatures, isUsableAddon and loadManifest, along with others depending on the function, where it fails if a signature isn't valid. It's essentially just setting the state when being called by the larger functions that control that part.
But whatever. I don't particularly care anyway, it was the first thing that came to mind. Perhaps they've changed it since, and simply not updated their wiki. Regardless, that doesn't change the point I was making.

The wiki isn't wrong but the way the config.js works give it so much power that it can manipulate key values directly.

Is it possible to install .xpi in stable Firefox?

@onemen
Copy link
Author

onemen commented Nov 18, 2023

Read here how to install Tab Mix Plus on Firefox version 117 or newer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests