Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3343914
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:00:34+00:00 2026-05-18T01:00:34+00:00

I have an experimental version of wxWebConnect (embedding XULRunner in wxWidgets) at https://github.com/jonmmorgan/wxwebconnect/ .

  • 0

I have an experimental version of wxWebConnect (embedding XULRunner in wxWidgets) at https://github.com/jonmmorgan/wxwebconnect/. It offers a method

wxString wxWebControl::ExecuteScriptWithResult(const wxString& js_code)

which executes the Javascript string using nsIScriptContext::EvaluateStringWithValue, converts the value to a string with JS_ValueToString, and then returns the string.

However, I found with the current implementation that if the Javascript string is syntactically invalid (e.g. WebControl.ExecuteScriptWithResult(‘{a:2’)) then the program would crash when trying to convert the result to a string. I discovered the aIsUndefined parameter, which I can use to determine whether script execution succeeded or not and prevent the crash. However, this doesn’t help me find what the actual error was, and I think it would be good to report that (like Firebug tells me “SyntaxError: missing } in compound statement”). As far as I can see, even using something like nsIScriptContext::CompileScript will just tell me whether the compilation succeeded or not, and doesn’t give me a way to get at the actual syntax error.

Following http://chadaustin.me/2009/02/evaluating-javascript-in-an-embedded-xulrunnergecko-window/, I tried using JS_GetPendingException, but it never seems to return true. Even when I run webcontrol.ExecuteScriptWithResult(“throw new Error(‘a’);”) it still doesn’t have a pending exception, but does say the result is undefined.

Is there any other good way to get a compilation or execution error from nsIScriptContext or the SpiderMonkey API? Any idea why JS_GetPendingException doesn’t seem to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T01:00:34+00:00Added an answer on May 18, 2026 at 1:00 am

    I have actually found an answer to this:
    In nsJSContext, it registers an error reporter function. As part of that error reporter function, it clears pending exceptions. If you register your own error reporter it overrides that and allows you to actually do something with the error. This does mean that your error won’t turn up in the Error Console. I don’t know if you lose any other important functionality by overriding the builtin error handler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a simulation system. I will soon have experimental data (histograms)
I have experimented with a sigmoid and logarithmic fade out for volume over a
I have an experiment streaming up 1Mb/s of numeric data which needs to be
I have a function called: void initializeJSP(string Experiment) And in my MyJSP.h file I
Ok so part two of I have no will power experiment is: Summary Question
I have a bunch of servers, on which I run experiments using screen .
I want to experiment with GCC whole program optimizations. To do so I have
I am designing a psychology experiment with java applets. I have to make my
What is the best compiler to experiment with C++0x features? I have been experimenting
Have just started using Google Chrome , and noticed in parts of our site,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.