omgmog / chrome-conditional-font-changer

Conditional Font Changer is an extension for Google Chrome
7 stars 2 forks source link

Changing the font twice without reloading crashes the browser tab #2

Open rjmunro opened 8 years ago

rjmunro commented 8 years ago

I think the second change of font triggers the mutationObserver to apply the first change of font again, which then gets stuck in a loop. Possibly 2 mutationObservers are being created, and they fight each other. I'm not quite sure.

omgmog commented 8 years ago

Perhaps we could call MutationObserver.takeRecords(), check the length and then if it is > 0, call MutationObserver.disconnect() before trying to observe again.

omgmog commented 8 years ago

I've had a look, and this only seems to be an issue if you apply one font, then try to apply another. I think that's pretty edge case, so not really an issue.

Right now, if you try to apply the same font multiple times it's fine.