Note that there are some explanatory texts on larger screens.

plurals
  1. POError adding SCRIPTITEM_CODEONLY symbol using IE9 JS engine (Chakra)
    text
    copied!<p>We've been using active scripting in our browser extension (BHO) for a while with the old JScript engine (CLSID_JScript), and we recently decided to support the new IE9 script engine (Chakra) as well. One thing we do is add symbols to the engine using <code>AddNamedItem</code> with the <code>SCRIPTITEM_CODEONLY</code> option to create our own modules (namespaces). Unfortunately, we haven't been able to get this to work with Chakra. Even the most trivial example where we add a symbol and immediately retrieve its script dispatch yields an <code>E_OUTOFMEMORY</code> error.</p> <pre><code>if (SUCCEEDED(hr)) { hr = scriptEngine-&gt;AddNamedItem(L"test", SCRIPTITEM_CODEONLY); } if (SUCCEEDED(hr)) { hr = scriptEngine-&gt;GetScriptDispatch(L"test", &amp;scriptDispatch); } </code></pre> <p>The <code>GetScriptDispatch</code> call returns the error. You can see the whole example <a href="https://github.com/IUnknown68/ascptest/blob/master/ascperror/ascperror.cpp" rel="nofollow">on Github</a>.</p> <p>I set breakpoints on all the <code>IActiveScriptSite</code> methods and the only ones that are called are <code>GetLCID</code> and <code>OnStateChange</code>, so don't think the site implementation is the problem. </p> <p>I've looked at every example I can find and tried everything I can think of, including setting the engine state to <code>SCRIPTSTATE_CONNECTED</code> manually, implementing any additional interfaces that it QIs for, etc. I even tried returning a valid <code>LCID</code>. Nothing seems to make a difference.</p> <p>Any idea what gives? I assume this basic example should work in Chakra.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload