AprilSylph / XKit-Rewritten

🧰 The enhancement suite for Tumblr's new web interface
GNU General Public License v3.0
274 stars 44 forks source link

Mutations util: Feature errors can break other features #1508

Open marcustyphoon opened 1 week ago

marcustyphoon commented 1 week ago

Platform

MacOS 14.4.1 arm64

Browser

Chrome 125.0.6422.77

Addon version

v0.23.6 (+ dev commits)

Details

https://github.com/AprilSylph/XKit-Rewritten/blob/a7bad978ff9978eecb8dc437dae7ef9af3a5571f/src/util/mutations.js#L77-L82

If a callback registered with pageModifications throws, and it is not an async function, onBeforeRepaint will throw and the entire set of callbacks remaining in the queue will not be executed. This means that a bug in a feature could become visible to the user as an entirely different feature not functioning, resulting in their bug report being very difficult to find the root cause of.

This, as they say in the business, Bad.

Only vaguely related: #1001 (in a vague sense the opposite of that PR in a number of ways, actually)

marcustyphoon commented 5 days ago

This should probably be done for other parts of the extension too.