Compat Macro Error

On this page, {{compat}} is throwing an error that I’m unable to identify. The current call looks like this:

{{Compat("api.WebGL2RenderingContext")}}

It appears to be ‘api.’ that it’s choking on (just guessing). When I remove that part of the path, it works, but prints “No compatibility data found. Please contribute data for “WebGL2RenderingContext” (depth: 1) to the MDN compatibility data repository.” I’ve confirmed that the file exists. Can someone with more knowledge of this macro look into this for me?

Thanks

1 Like

Well, the exception is occurring in the traverseFeatures() method in the macro, while it goes through gathering up cumulative compatibility based on all of a feature’s subfeatures.

Since it’s happening while looking at the value of version_added of an object that’s undefined, that implies that the error is either happening in line 480 (when looking at the feature whose subfeatures are currently being gathered to get its version_added) or in line 481 (looking at the subfeature’s version_added).

That means that either the feature being iterated over has no "support" property (which is impossible because we couldn’t have gotten here otherwise, since we used that property to get the list of browser names to iterate over) or the subfeature has no "support" property with the same browser name as the feature.

That’s what I think is wrong here. There’s someplace in this file where one of the subfeatures is missing at least one entry for one of the browsers supported by its parent feature. Might be a typo, might be outright missing.

So, the JSON needs to be updated. But the macro should also be updated to cope better with this situation should it arise again.

Sheppy

1 Like

One place this happens for sure: the entry for "SharedArrayBuffer_as_param" only lists a handful of browsers (the Blink-based ones). You can’t leave out any browsers that are listed in the parent like this entry does.

Sheppy

1 Like

Thanks for letting us know, Joe!
Thanks for analysing the situation, Sheppy!

To fix the symptom, we’ve merged your BCD PR https://github.com/mdn/browser-compat-data/pull/646. But as our data validation allows to leave out browsers like it was done here, this is error could happen again. So, to fix the cause, I’ve opened https://github.com/mdn/kumascript/pull/419.

Thanks
Florian

2 Likes

This only fixed the WebGL2RenderingContext interface; the same problem exists in WebGLRenderingContext. I’ve submitted BCD PR https://github.com/mdn/browser-compat-data/pull/687 to fix this in that interface as well.

It would be helpful to get that reviewed as soon as is practicable, to fix the errors on these pages.

Sheppy

1 Like