Originally reported by @krinkle
>>! In T262493#6580137, @Krinkle wrote:
> […]
> * There seems to be something fundamentally broken about the pipeline since the overall client-error traffic, even after filtering out logged-in traffic, seems to be heavily biased toward Firefox. More than 95% in fact. Barring a miracle growth in market share in the past 24 hours, or something special about Commons' audience in pariticular, I would guess there is a bug in the instrumentation that is causing the vast majority of (real) errors to dropped by our instrumentation and never reported.
> ** I suspect the `file_url` check in the instrumentation is at fault. This was added to filter out a bit of noise from cross-site script imports of which the URL is hidden by the browser for security reasons, but I suspect it is instead causing > 90% of genuine errors to be dropped as well because cached script run from localStorage and thus don't have an HTTP-based URL. Due to performance issues in Firefox, we have disabled use of localStorage in Firefox, which would explain why the errors we do get are mostly from the <5% of users using Firefox, or from edge cases where scripts couldn't be cached.
Errors that have no file_url or url are dropped by our client side error instrumentation.
For modules in Chrome, certain errors (currently only reproducable for ResourceLoaderWikiModule modules) are unexpectedly being triggered without this information so are correctly being dropped. We would like these errors to not be dropped but for that we need to ensure they carry the required information.
# Replication steps
Put the following code inside MediaWiki:Common.js
```
window.error = function () {
console.log('window.error', arguments);
}
mw.trackSubscribe( 'global.error', function ( s, yp ) {
console.log('s', yp);
})
setTimeout(function () {
mw.undefinedExample();
}, 1000);
```
and visit a page in the Chrome browser.
The error will be reported with an empty url, no file_url and anonymized stack trace.
The issue does not seem to impact issues inside the code itself. When I put the same code in ~/git/core/skins/Vector/resources/skins.vector.js/skin.js the file_url and url are both present.
# Error thrown by module created from MediaWiki:Common.js
```
{errorMessage: "Uncaught TypeError: mw.undefinedExample is not a function", url: "", lineNumber: 3, columnNumber: 26, stackTrace: "at <anonymous>:3:26↵", …}columnNumber: 26errorMessage: "Uncaught TypeError: mw.undefinedExample is not a function"errorObject: TypeError: mw.undefinedExample is not a function
at <anonymous>:3:26lineNumber: 3stackTrace: "at <anonymous>:3:26↵"url: ""__proto__: Objectconstructor: ƒ Object()hasOwnProperty: ƒ hasOwnProperty()isPrototypeOf: ƒ isPrototypeOf()propertyIsEnumerable: ƒ propertyIsEnumerable()toLocaleString: ƒ toLocaleString()toString: ƒ toString()valueOf: ƒ valueOf()__defineGetter__: ƒ __defineGetter__()__defineSetter__: ƒ __defineSetter__()__lookupGetter__: ƒ __lookupGetter__()__lookupSetter__: ƒ __lookupSetter__()get __proto__: ƒ __proto__()set __proto__: ƒ __proto__()
```
# Error thrown by Vector script
```
{errorMessage: "Uncaught TypeError: mw.undefinedExample is not a function", url: "http://localhost:8888/w/load.php?lang=en&modules=j…Csite%7Cskins.vector.js&skin=vector&version=n8enw", lineNumber: 155, columnNumber: 1579, stackTrace: "at http://localhost:8888/w/load.php?lang=en&module…ins.vector.js&skin=vector&version=n8enw:155:1579↵", …}
columnNumber: 1579
errorMessage: "Uncaught TypeError: mw.undefinedExample is not a function"
errorObject: TypeError: mw.undefinedExample is not a function at http://localhost:8888/w/load.php?lang=en&modules=jquery%2Csite%7Cskins.vector.js&skin=vector&version=n8enw:155:1579
lineNumber: 155
stackTrace: "at http://localhost:8888/w/load.php?lang=en&modules=jquery%2Csite%7Cskins.vector.js&skin=vector&version=n8enw:155:1579↵"
url: "http://localhost:8888/w/load.php?lang=en&modules=jquery%2Csite%7Cskins.vector.js&skin=vector&version=n8enw"
```