Index: test/mjsunit/error-accessors.js |
diff --git a/test/mjsunit/regress/regress-cntl-descriptors-enum.js b/test/mjsunit/error-accessors.js |
similarity index 67% |
copy from test/mjsunit/regress/regress-cntl-descriptors-enum.js |
copy to test/mjsunit/error-accessors.js |
index ee72fafc8a7c67f2b1ab6cc22a734ef8033a5697..95810502405e5d5e084c756550750f3742e0825d 100644 |
--- a/test/mjsunit/regress/regress-cntl-descriptors-enum.js |
+++ b/test/mjsunit/error-accessors.js |
@@ -25,22 +25,30 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Flags: --allow-natives-syntax --expose-gc |
+// Test that the message property of error objects is a data property. |
-DontEnum = 2; |
+var o; |
-var o = {}; |
-%SetProperty(o, "a", 0, DontEnum); |
- |
-var o2 = {}; |
-%SetProperty(o2, "a", 0, DontEnum); |
- |
-assertTrue(%HaveSameMap(o, o2)); |
+// message is constructed using the constructor. |
+var error1 = new Error("custom message"); |
+o = {}; |
+o.__proto__ = error1; |
-o.y = 2; |
+assertEquals("custom message", |
+ Object.getOwnPropertyDescriptor(error1, "message").value); |
+o.message = "another message"; |
+assertEquals("another message", o.message); |
+assertEquals("custom message", error1.message); |
-for (var v in o) { print(v); } |
+// message is constructed by the runtime. |
+var error2; |
+try { x.x } catch (e) { error2 = e; } |
o = {}; |
-gc(); |
+o.__proto__ = error2; |
+ |
+assertEquals("x is not defined", |
+ Object.getOwnPropertyDescriptor(error2, "message").value); |
+o.message = "another message"; |
+assertEquals("another message", o.message); |
+assertEquals("x is not defined", error2.message); |
-for (var v in o2) { print(v); } |