xiaoxiaoflood / firefox-scripts

userChromeJS / autoconfig.js and extensions
Mozilla Public License 2.0
954 stars 83 forks source link

Preparation for Firefox 117 #265

Open onemen opened 1 year ago

onemen commented 1 year ago

@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
megamorphg commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

@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 commented 10 months ago

@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:https://github.com/xiaoxiaoflood/firefox-scripts/issues/265#issuecomment-1712709643

megamorphg commented 10 months ago

@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 commented 10 months ago

@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 commented 10 months ago

@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 commented 10 months ago

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 commented 10 months ago

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 commented 9 months ago

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 commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

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