Lootyhoof / stylem

User styles manager for Pale Moon and other Mozilla-style software
GNU General Public License v3.0
22 stars 8 forks source link

Fix the registering of stylesheets on SeaMonkey #5

Closed Miouyouyou closed 6 years ago

Miouyouyou commented 6 years ago

I guess I should create another branch with only the appropriate fix, since Github don't allow pull requests from references ( dfab072 link ).

Anyway : I tried this extension on Seamonkey but the main functionality was broken.

After adding some logs here and there, and checking Mozilla's (now obsolete) documentation about how to load User Style Sheets from an extension, I made calculateRegistrationMethod return USER_SHEET instead of AUTHOR_SHEET when creating a stylesheet for websites and... it worked !

That said, it works on Seamonkey, but I haven't tested this on Palemoon and Waterfox, so maybe it breaks things on those browsers.

Lootyhoof commented 6 years ago

While this may fix things in SeaMonkey specifically, this topic was actually discussed upstream prior to implementation there, especially https://github.com/stylish-userstyles/stylish/issues/78#issuecomment-25424269. Essentially, it has the possibility of breaking existing userstyles (if people for some reason didn't use !important).

I'll do a bit of digging into what's actually used in the wild here and see what would be best going forward. Of course improved SeaMonkey compatibility would be useful, so I'd like to see this merged, but we'll see.

Miouyouyou commented 6 years ago

Interesting. I didn't know that this was discussed upstream.

Maybe adding the possibility to define / USER_SHEET / in the CSS might resolve the issue, without breaking other user styles.

Meanwhile, I'll try to implement that and see why AUTHOR_SHEET doesn't work on SeaMonkey. I think I was using "!important" every time. I'll try without, just to be sure.

Lootyhoof commented 6 years ago

As per https://github.com/stylish-userstyles/stylish/issues/184, it's probably best to use

/* AGENT_SHEET */

Where possible. If you use that in a user style that doesn't currently work in SeaMonkey, what happens?

Lootyhoof commented 6 years ago

OK, I've come up with a compromise here in https://github.com/Lootyhoof/stylem/commit/a59125b31b102727e76806c836c3e845e112f001.

It seems we already check if AUTHOR_SHEET is available at here, but for some reason SeaMonkey actually reports that's available (but doesn't initialize with it), so it doesn't even attempt to enter that loop. As such, I've forced it to enter that loop, and now it always attempts to use AGENT_SHEET instead of AUTHOR_SHEET, where other applications can still use AUTHOR_SHEET if available. From my testing this seems to work well.

Closing this as we have another implementation instead. All being well, I'll push an update soon with this included.

Miouyouyou commented 6 years ago

Alright, I've been able to test this version on a fresh installation of Seamonkey 2.49.4 and stylesheets are applied without issues.

Thanks for fixing this issue.