Re: error: incomplete type ‘JSLinearString’ used in nested name specifier

Kram Jordy <[email protected]> Sat, 30 May 2020 23:39:03 -0700 (PDT)
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <[email protected]>
On Saturday, 30 May 2020 22:55:52 UTC+1, Tom Schuster  wrote:
> You should only use the first code snippet using
> JS_EnsureLinearString. Like Steve said it would be a good idea to add
> those tracing kinds, because right now you strings seem to be
> unrooted.

Hi Tom. Yes I'll make sure I use this API function. I've not actually posted any of my code, so if there are any bugs in the snippets, then they are also bugs in the javascript shell js.cpp.


> > I was following the examples in the js-shell, however, they do the same thing about 4 different ways, so I was rather confused!
> I assume you are talking about:
> https://searchfox.org/mozilla-central/source/js/src/shell/js.cpp ? In
> that case you really should not necessarily be using this file as a
> template. The shell is considered part of the JavaScript engine proper
> and uses many internal APIs. (Out of necessity really, many APIs that
> need testing are only internal)

Yes that's the one. Like it or not, this is the *only* up-to-date piece of code that spidermonkey embedders can look to for examples that I'm aware of. It would be great if the spidermonkey team could do regular code reviews on it to ensure it reflects the current best practices and idioms.