afelix / YouTube Aspect Ratio Control

Your @include appears to be exactly identical in functionality to

// @match *://www.youtube.com/*

As a general rule, @match is more reliable and performant than using include regex. It's less likely to break, seeing as it's a part of the Chrome addon specification (and the newer WebExtensions spefication). It's also more widely supported on different UserScript engines. There have even been talks of removing the regex feature of @include.

You can read more about match patterns here.

Re: @BigTSDMB:

As a general rule, @match is more reliable and performant than using include regex.

This is false. Most engines, and browsers, that support regular expressions (re's) convert patterned globs, such as @match to regular expressions. So reducing an extra set of conversions is an improvement. @match is less "performant" since it has a stricter pattern.

It's less likely to break, seeing as it's a part of the Chrome addon specification (and the newer WebExtensions spefication)

In order of effectiveness... re's, generic globs, and then specific glob matches. So it's a good idea to include all three if one is that paranoid about breakage between the different engines and browsers (including versions).

It's also more widely supported on different UserScript engines.

Untrue with @match throughout the history of Userscripts.

There have even been talks of removing the regex feature of @include.

This part may be true on the Fx side since the Fx development team is getting rather lazy these days.

For the record, the stuff you said here is incorrect. @match runs in native browser code. @include only partially does, due to not working quite the same way as iunclude_globs in manifest.json. The one thing that runs entirely in the userscript engine are Regex matches. And, if you don't include any sort of @match, your regex will run on every page.

Your regex is exactly equivalent to the @match code I included above. (Using * for the protocol is defined to be http or https only, and does not match other protocols.) And the @match will run better. @include has been "not recommended" and not used in userscripts for a long time. And @include /regex/ has in fact been discussed to be removed, and in fact is not implemented in many newer and lighter userscript engines.

I leave this here not because you didn't already figure this out yourself (as your WebExtension versions use match in manifest.json). But so that other developers don't see this and assume that @include /regex/ is the way to go. Use @match for as much as you can, and then you can use @include if you need to be more specific. And, if you need to use regex, just use this simple one liner

if (!/your_regex/.test(location.href)) { return; }

In fact I'd personally recommend that you write your code to fail gracefully if it's running where it shouldn't. It's just less work in the future.