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

'userutils not defined' #659

Open
Gl17chV opened this issue Oct 17, 2024 · 6 comments
Open

'userutils not defined' #659

Gl17chV opened this issue Oct 17, 2024 · 6 comments
Labels
addon: FireMonkey bug 🐞 Something isn't working done ✓ Completed userscript: compatibility userScript/userCSS Compatibility

Comments

@Gl17chV
Copy link

Gl17chV commented Oct 17, 2024

Hi dev, I added this script on FireMonkey https://greasyfork.org/en/scripts/475682-betterytm
but it fails to insert due to 'UserUtils is not defined' do you know why?

@erosman
Copy link
Owner

erosman commented Oct 17, 2024

That userscript generates too many error to pin point the cause.

@erosman erosman added userscript: compatibility userScript/userCSS Compatibility addon: FireMonkey labels Oct 17, 2024
@Gl17chV
Copy link
Author

Gl17chV commented Oct 17, 2024

:/ So there's nothing I can do?

@erosman
Copy link
Owner

erosman commented Oct 17, 2024

The script is too large to debug. You can ask the userscript developer. He might be able to find out the reason.

@Sv443
Copy link

Sv443 commented Oct 18, 2024

Hi, author here, I've just tested with a tiny script and came to the conclusion that loading @resource directives via GM.getResourceUrl doesn't work at all in FireMonkey. I'm not sure if I'm doing something wrong or if there's something else blocking the request (I already disabled all my other extensions like uBlock Origin), but I also know that this exact code works fine on ViolentMonkey and TamperMonkey.
The GM.getResourceUrl function itself exists, but the Promise always resolves to an error, without any hint as to what is going wrong:

Script source - click to expand
// ==UserScript==
// @name             FM resource test
// @match            *://*.example.org/*
// @version          1.0
// @resource         abc https://raw.githubusercontent.com/Sv443/BetterYTM/v2.1.0/assets/translations/en_US.json
// @grant            GM.getResourceUrl
// ==/UserScript==

(async () => {
  console.log("GM", GM);
  console.log("GM.getResourceUrl", GM.getResourceUrl);
  console.log(`GM.getResourceUrl("abc")`, GM.getResourceUrl("abc"))
  console.log(`await GM.getResourceUrl("abc")`, await GM.getResourceUrl("abc"))
})();

image

@erosman
Copy link
Owner

erosman commented Oct 18, 2024

There is a typo bug in FireMonkey. It should be resources.
It is fixed in v2.73.

const {name, id = `_${name}`, injectInto, resource} = info.script; // set id as _name

support/content/api.js

Lines 215 to 217 in a2a7357

static getResourceUrl(resourceName) {
return resource[resourceName];
}

support/content/api.js

Lines 653 to 655 in a2a7357

async getResourceUrl(resourceName) {
return resource[resourceName];
},

@erosman erosman added bug 🐞 Something isn't working done ✓ Completed labels Oct 18, 2024
@Sv443
Copy link

Sv443 commented Oct 18, 2024

Alright thanks, I'll verify everything once it's released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addon: FireMonkey bug 🐞 Something isn't working done ✓ Completed userscript: compatibility userScript/userCSS Compatibility
Projects
None yet
Development

No branches or pull requests

3 participants