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

Reference to undefined variable gBrowser #7

Closed dirkf closed 4 years ago

dirkf commented 4 years ago

At start-up and possibly other times the identifier gBrowser used in this line may not be defined:

https://github.com/Lootyhoof/stylem/blob/2708543314904806f3d30e1411f55bd90441adfc/src/content/overlay.js#L536

    get currentURI() {
/*536*/     return gBrowser.currentURI; 
    },

This probably happens/ed in Stylish and Stylus as well.

As there seem to be no ill effects except an Error Console entry, instead try:

    get currentURI() {
        return (typeof gBrowser != "undefined") ? gBrowser.currentURI: null; 
    },
Lootyhoof commented 4 years ago

Sorry for the delay. Thanks for spotting this!

dirkf commented 4 years ago

On 01/12/19 14:13, Ryan C wrote:

Sorry for the delay. Thanks for spotting this!

Thanks, glad to help in the war against bad web designers.

/df

-- London SW6 UK