Closed sentry-io[bot] closed 5 months ago
Note the blob
URL - this is being raised from the predictive-text worker.
What I'm seeing here doesn't seem to make much sense.
The line for the error report, based on the minified ES5 version of the worker's code:
*/Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex", /* ... */
Line 5, column 69: "|findIndex"
- that is, after the opening quotation mark of the string "findIndex"
. But... that shouldn't be capable of generating this error, right?
Also of interest: so far, this is exclusively from Chrome for Android WebView 39.0 and vivo Y31A devices. It does not reproduce with a local, Android-Studio-emulator-based Android 5.0 device.
There are indications that there is an emulation target that can trigger it: there are now a few entries for "Android SDK built for x86". No other devices have reported an issue.
Setting up a Pixel 2 XL API 22 was sufficient to get a local reproduction. Sadly, attempts to "inspect device" through Chrome are currently instantly "detached", so I may need to figure out what that's about.
It does, at least, give us a line within the unminified version of app/webview:
blob:null/e4ffe3c5-df90-4811-a92c-33bf39e648b0 at line 5258:24
So that's something I can chase, even without inspection.
So far, I can tell that it occurs while generating predictions - in particular, from the predictFromCorrections
method of ModelCompositor
.
Reference, after adding custom errors as a substitute for console logging b/c it's worker code:
https://keyman.sentry.io/issues/5359770502/events/f009a872785b4ba68a749414a9530ba4/
It's hard to conclusively state that this is the only error that would be thrown, but it's certainly the first.
Edit: it's coming from lexical-model code. It's probably from the TrieModel
template somehow.
https://keyman.sentry.io/issues/5359770502/events/a7d0e9154fce488b9f42b70d364e18c1/
An extra line would have been included in the error message had line 47 below completed successfully:
Note - it often does complete successfully; the method that code block is in successfully returns multiple times before the error is first thrown.
I've now isolated the error to the following call:
And even further down that that, to here:
Drilling ever deeper, I've now isolated the error to this call:
And found it! There was a lingering use-case of Array.from
within the wordbreaker code that wasn't phased out when we fixed all the other Array.from
cases.
With no Array.from
polyfill in place, this will also trigger errors:
This code is baked into a number of currently in-distribution lexical-models. As a result, it's clear that removing the Array.from
polyfill was removed too soon; we still need it. Fun detail though - the polyfill we were previously using did not account for surrogate pairs like the real, modern Array.from
does.
Sentry Issue: KEYMAN-WEB-K4