Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1086)

Unified Diff: test/mjsunit/error-accessors.js

Issue 11368142: Turn message property of the error object into a data property. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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); }
« src/messages.cc ('K') | « src/runtime.cc ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698