wqx081 / v8cgi

Automatically exported from code.google.com/p/v8cgi
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Global object property caching #30

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I've noticed, that some global object properties are cached between requests.

Sample code:

{{{
var Foo = function() {
    this.bar = 'baz';
}

var myFoo = new Foo();

response.write('<pre>\n');
for (var property in global)
{
    response.write('global.' + property + '\n');
}
response.write('</pre>\n');

Steps to reproduce:
1. Run the script
2. Comment the first five lines (class definition and instantiation)
3. Run script again

Expected output (after step 3):
{{{
global.property
global.include
global.require
global.onexit
global.global
// ...
}}}

Actual output:
{{{
global.property
global.Foo
global.myFoo
global.include
global.require
global.onexit
global.global
// ...
}}}

OS: Windows XP SP3
Server: Apache 2.2.4.0
v8cgi: 0.7.0 win32 (as apache module)

Original issue reported on code.google.com by kpobo...@gmail.com on 25 Oct 2009 at 11:11

GoogleCodeExporter commented 8 years ago
This is because the windows apache module is compiled with context reusing.

In future, I will:

1) distribute two versions of mod_v8cgi.dll, one with reusing and one with not,
2) further improve the context reusing code so that the scenario above won't 
happen
at all.

However, note that the context reusing feature by definition allows *some* 
sharing
between requests, at least those realized via built-in objects, e.g.
Array.prototype.someProperty.

Original comment by ondrej.zara on 25 Oct 2009 at 9:06

GoogleCodeExporter commented 8 years ago

Original comment by ondrej.zara on 25 Oct 2009 at 9:07

GoogleCodeExporter commented 8 years ago
Global object is cleaned in a better way, starting from SVN rev. 608. Further
releases will contain two versions of apache module.

Original comment by ondrej.zara on 26 Oct 2009 at 7:58