Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Crash when writing to a property without setter

$
0
0
Hello !
I'm using Clearscript 5.4 with default V8.

It crashes when trying to write to a property without setter.. but only if I add another global object first, as illustrated with the test below (the fact that it is a PropertyBag does not seems to be relevant). Otherwise it behaves as expected, throwing an exception.

Any idea of what might be happening here ?
#
# Fatal error in ..\..\src\api.cc, line 2905
# CHECK(!(isolate)->external_caught_exception()) failed
#
Exception de première chance à 0x00000000 dans nunit.exe : 0xC0000005: Violation d'accès à l'emplacement 0x0000000000000000.
Exception non gérée à 0x00000000 dans nunit.exe : 0xC0000005: Violation d'accès à l'emplacement 0x0000000000000000.
class MissingSetter
        {
            privatestring _back_title;
            public MissingSetter(string title)
            {
                _back_title = title;
            }
            publicstring title
            {
                get
                {
                    return _back_title;
                }
            }
        }

        [Test]
        publicvirtualvoid Test_InterfaceAndScriptAccess_basic([Values(false, true)] bool withPropertyBag)
        {
            using (var run0 = new V8ScriptEngine())
            {
                if (withPropertyBag)
                    run0.AddHostObject("bag", HostItemFlags.GlobalMembers, new PropertyBag());
                run0.AddHostObject("__other_page", HostItemFlags.GlobalMembers, new MissingSetter("BBB"));
                Assert.AreEqual("BBB", run0.Evaluate("title"));
                Assert.Throws<Microsoft.ClearScript.ScriptEngineException>(delegate
                {
                    run0.Execute("title = 'AAA'");
                });
                Assert.AreEqual("BBB", run0.Evaluate("title"));
            }
        }

Viewing all articles
Browse latest Browse all 2297

Trending Articles