Spidermonkey: error with const on second run of script

Hello all,

In own of my test-javascripts I'm using the line:

const engine = Engine.getEngine(); // get first registered engine

Engine is a custom class (JSClass) that I've build.

When I run this script for the first time all seems to be okay.

When I run the same script for the second time I get an error that a const
variable is redefined.

Here's the code that runs the script (C++ wrapper around Spidermonkey)
void Context::runScriptFile(const char* source)
{
jsval result;

JSScript* script = JS_CompileFile(context, globalObj, source);
if (script)
   {
  JSBool ok = JS_ExecuteScript(context, globalObj, script, &result);
  if (ok == JS_FALSE)
     {
     _STD::cout << "error in Context::runScriptFile()" << _STD::endl;
     }
  JS_DestroyScript(context, script);
  }
}

The context is not destroyed. How can I prevent this error?

I'm not quit sure if I've handled the context right. When I create the
JS_Runtime, I also create 1 JS_Context. This context is destroyed when the
JS_Runtime is destroyed.

With kind regards,
Peter Paulus

0
Peter
7/23/2003 2:56:41 PM
netscape.mozilla.jseng 1530 articles. 0 followers. Follow

0 Replies
386 Views

Similar Articles

[PageSpeed] 55

Reply:

Similar Artilces:

error when I run the setup script checksetup.pl secondly
Hello everybody,when I run the scrips checksetup.pl secondely ,error occured as below: [Mon Jun 26 06:07:59 2006] checksetup.pl: DBD::mysql::db do failed: Access denied for user 'bugs'@'localhost' to database 'bugs' at Bugzilla/DB/Mysql.pm line 196 [Mon Jun 26 06:07:59 2006] checksetup.pl: Bugzilla::DB::Mysql::bz_lock_tables('Bugzilla::DB::Mysql=HASH(0x37dd980)', 'series_categories WRITE', 'series WRITE') called at Bugzilla/Series.pm line 175 [Mon Jun 26 06:07:59 2006] checksetup.pl: Bugzilla::Series::writeToDatabase('Bugzi...

Error Running Script
I'm trying to implement willyd.ca's User Management Console.  When I try to execute the script he provides on the db I get the following error(s):   Msg 911, Level 16, State 1, Line 1 Could not locate entry in sysdatabases for database 'wrhighfield'. No entry found with that name. Make sure that the name is entered correctly. Msg 2714, Level 16, State 6, Line 1 There is already an object named 'RegistrationQueue' in the database. Msg 208, Level 16, State 1, Line 1 Invalid object name 'sys.objects'. Msg 208, Level 16, State 1, Line 1 Invalid object name 'sys.objects'. Msg ...

superreview cancelled: [Bug 78089] A script on this page is causing mozilla to run slowly. Do you want to abort the script? OK Cancel
Johnny Stenback <jst@mozilla.org> has cancelled superreview: Bug 78089: A script on this page is causing mozilla to run slowly. Do you want to abort the script? OK Cancel https://bugzilla.mozilla.org/show_bug.cgi?id=78089 Attachment 82936: better patch https://bugzilla.mozilla.org/attachment.cgi?id=82936&action=edit ------- Additional Comments from Johnny Stenback <jst@mozilla.org> This isn't needed any more is it? If it is, please re-request sr on this patch, or an updated one... ...

superreview requested: [Bug 78089] A script on this page is causing mozilla to run slowly. Do you want to abort the script? OK Cancel : [Attachment 82936] better patch
timeless@myrealbox.com (working) <timeless@bemail.org> has asked Johnny Stenback <jst@mozilla.jstenback.com> for superreview: Bug 78089: A script on this page is causing mozilla to run slowly. Do you want to abort the script? OK Cancel https://bugzilla.mozilla.org/show_bug.cgi?id=78089 Attachment 82936: better patch https://bugzilla.mozilla.org/attachment.cgi?id=82936&action=edit ...

Error running import script
Hi, I am having problems running my import query. It runs to a point, then the next block of SQL it fails on, does anyone know why this is? I have included the code and the error message underneath. The import is ran using SQLwebadminThanks  SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE VIEW [HOME_RECORDS] AS SELECT dbo.TEAMS.TEAM_ID, ISNULL(dbo.HW.COUNT_HOME_WINS, 0) AS W, ISNULL(dbo.HD.COUNT_HOME_DRAWS, 0) AS D, ISNULL(dbo.HL.COUNT_HOME_LOSES, 0) AS L, ISNULL(dbo.HW.HGF, 0) + ISNULL(dbo.HD.HGF, 0) + ISNULL(dbo.HL.HGF, 0) AS F, ISNULL(dbo...

Script Error On First Run
Name: Product: Firefox Release Candidate Summary: Script Error On First Run Comments: When I started Firefox for the first time, I got a script error message. I since have not wrote down the file path..but if the problem persists I will return with the file path. OS: Windows 7 Ultimate Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2b4) Gecko/20091124 Firefox/3.6b4 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for...

Script does not want to run, error
Hi, I am having problems opening this script on my machine. i have been getting help from a very helpful person on this list. I have checked the shebang line, that perl exists, and perl -v gives proper output. i try to run the script below as follow: [root@cctv httpd]# cd cgi-bin [root@cctv cgi-bin]# ls -la total 28 drwxr-xr-x 2 me root 4096 Mar 5 21:49 . drwxr-xr-x 5 me root 4096 Mar 3 01:50 .. -rwxr-xr-x 1 me root 268 Mar 4 13:50 printenv -rwxr-xr-x 1 me me 1792 Mar 5 15:20 renamer -rwxr-xr-x ...

Error running VB Scripts
When I try to run any VB Scripts from within PowerDesigner, I get the message "All or some of PowerDesigner scripting objects libraries are not properly registered. Please check product installation." No other users in my office have the same issues. I have reinstalled PD, and have done my best to ensure that my Windows Registry entries match theirs. Any ideas? To work with the PowerDesigner COM objects defined in each module, the PowerDesigner Application and Type Libraries should be registered. PowerDesigner automatically register the application and type libraries w...

Error while running a perl script
------=_NextPart_000_0045_01C1BEAA.DCC154E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Can't locate HTML/Parse.pm in @INC (@INC contains: = /usr/lib/perl5/5.6.0/i386-li ux /usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i386-linux = /usr/lib/perl /site_perl/5.6.0 /usr/lib/perl5/site_perl .) at example3 line 3. BEGIN failed--compilation aborted at example3 line 3. Anybody tell me how to overcome this error . Regard's kavitha jude ------=_NextPart_000_0045_01C1BEAA.DCC154E0-- >----- Original Me...

Script does not want to run, error
Hi, I am having problems opening this script on my machine. i have been getting help from a very helpful person on this list. I have checked the shebang line, that perl exists, and perl -v gives proper output. i try to run the script below as follow: [root@cctv httpd]# cd cgi-bin [root@cctv cgi-bin]# ls -la total 28 drwxr-xr-x 2 me root 4096 Mar 5 21:49 . drwxr-xr-x 5 me root 4096 Mar 3 01:50 .. -rwxr-xr-x 1 me root 268 Mar 4 13:50 printenv -rwxr-xr-x 1 me me 1792 Mar 5 15:20 renamer -rwxr-xr-x ...

<script runat="server">code</script> in aspx file errors when I try to run same code in mypage.aspx.cs file
This code runs file in the aspx file ---- "Profile" and "MasterPageFile" are defined in Web.config <script runat="server">    protected void Page_PreInit(object sender, EventArgs e)    {        if (Request["master"] != null)        {            switch (Request["master"])            {       ...

I am facing this error in mozilla thunderbird when i crawl email address "A script on this page may be busy, or it may have stopped responding. you can stop the script now, or you can continue to see
Name: Email: kashifalikhan79atgmaildotcom Product: Firefox Summary: I am facing this error in mozilla thunderbird when i crawl email address "A script on this page may be busy, or it may have stopped responding. you can stop the script now, or you can continue to see if the script will complete" Comments: I am facing this error in mozilla thunderbird when i crawl email address "A script on this page may be busy, or it may have stopped responding. you can stop the script now, or you can continue to see if the script will complete" Browser Details: Mozi...

superreview cancelled: [Bug 226803] RFE: mozilla should provide a simple way to run custom shell scripts at mozilla startup and shutdown : [Attachment 136388] Patch for 2003-11-10-trunk
Roland Mainz (Rumors of my death have been greatly exaggerated :-) <Roland.Mainz@informatik.med.uni-giessen.de> has cancelled Roland Mainz (Rumors of my death have been greatly exaggerated :-) <Roland.Mainz@informatik.med.uni-giessen.de>'s request for superreview: Bug 226803: RFE: mozilla should provide a simple way to run custom shell scripts at mozilla startup and shutdown http://bugzilla.mozilla.org/show_bug.cgi?id=226803 Attachment 136388: Patch for 2003-11-10-trunk http://bugzilla.mozilla.org/attachment.cgi?id=136388&action=edit ------- Additional Commen...

superreview requested: [Bug 226803] RFE: mozilla should provide a simple way to run custom shell scripts at mozilla startup and shutdown : [Attachment 136388] Patch for 2003-11-10-trunk
Roland Mainz (Rumors of my death have been greatly exaggerated :-) <Roland.Mainz@informatik.med.uni-giessen.de> has asked Boris Zbarsky (not really reading bugmail) <bz-vacation@mit.edu> for superreview: Bug 226803: RFE: mozilla should provide a simple way to run custom shell scripts at mozilla startup and shutdown http://bugzilla.mozilla.org/show_bug.cgi?id=226803 Attachment 136388: Patch for 2003-11-10-trunk http://bugzilla.mozilla.org/attachment.cgi?id=136388&action=edit ------- Additional Comments from Roland Mainz (Rumors of my death have been greatly exagge...

Web resources about - Spidermonkey: error with const on second run of script - netscape.mozilla.jseng

Resources last updated: 12/13/2015 8:47:13 PM