Inspecting a source of a Chrome extension

I don’t like installing many extensions to my Chrome browser mostly for security reasons. But there is this annoying issue with Chrome and my laptop – every time I scroll and decide to change a tab the content on the page will zoom (Ctrl + Scroll zooms the content) on my Windows and Linux machines.

There are couple ways how to solve it on a system level, but I have this problem only inside Chrome and the only solution is to use an extension to disable the zooming. An extension that has access to your page data and that can modify them. Yeah, right – that doesn’t sound very secure.

The extension that I found is called No MouseWheel Zoom and it has a reasonable rating, but it’s one of the smaller ones and it doesn’t have a source on Github so I was very hesitant to install it. But every extension is just a Javascript running inside the browser and there is an easy way how to view the source.

And in this folder the versions of extension are stored and you can check out the source code.

function mousewheelfn(a) {
    if (a.ctrlKey) {
        a.preventDefault();
        a.stopPropagation()
    }
}
window.onmousewheel = document.onmousewheel = mousewheelfn;

The code is simple and doesn’t do anything harmful, it just disables mouse wheel propagation when the control key is pressed so I can live with that.

Bear in mind that there is still a security issue when the extension gets updated its source can be modified to something else. Some Adware companies are buying successful extensions and releasing malicious code in their updates.

Resources


Would you like to get the most interesting content about programming every Monday?
Sign up to Programming Digest and stay up to date!