Skip to content

Commit

Permalink
Updated JSArray to call its parent's constructor. Bug 681962
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbasta committed Sep 22, 2011
1 parent 1f76ed4 commit 3f97cab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions tests/test_js_jstypes.py
Expand Up @@ -47,6 +47,7 @@ def test_jsarray_recursion():
print ja.get_literal_value()
assert "(recursion)" in ja.get_literal_value()


def test_jsliteral_regex():
"""
Test that there aren't tracebacks from JSLiterals that perform raw binary
Expand All @@ -58,3 +59,15 @@ def test_jsliteral_regex():
var z = /bar/i + 0;
""").failed()


def test_jsarray_contsructor():
"""
Test for tracebacks that were caused by JSArray not calling it's parent's
constructor.
"""
assert not _do_test_raw("""
var x = [];
x.foo = "bar";
x["zap"] = "foo";
baz("zap" in x);
""").failed()
3 changes: 2 additions & 1 deletion validator/testcases/javascript/jstypes.py
Expand Up @@ -327,8 +327,8 @@ class JSLiteral(JSObject):
"""Represents a literal JavaScript value."""

def __init__(self, value=None):
super(JSLiteral, self).__init__()
self.value = value
JSObject.__init__(self)

def set_value(self, value):
self.value = value
Expand Down Expand Up @@ -386,6 +386,7 @@ class JSArray(JSObject):
"""A class that represents both a JS Array and a JS list."""

def __init__(self):
super(JSArray, self).__init__()
self.elements = []

def get(self, index, instantiate=False, traverser=None):
Expand Down

0 comments on commit 3f97cab

Please sign in to comment.