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

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

Issue 11368136: Fix behavior of oneshot accessors of error objects. (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
« no previous file with comments | « src/messages.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 60%
copy from test/mjsunit/regress/regress-cntl-descriptors-enum.js
copy to test/mjsunit/error-accessors.js
index ee72fafc8a7c67f2b1ab6cc22a734ef8033a5697..9dbdbf3ae641041966392dc4c78ba1266140f2d5 100644
--- a/test/mjsunit/regress/regress-cntl-descriptors-enum.js
+++ b/test/mjsunit/error-accessors.js
@@ -25,22 +25,38 @@
// (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 oneshot accessors of error objects behave just like
+// data properties wrt objects that have the error object in the
+// prototype chain.
-DontEnum = 2;
+var o;
-var o = {};
-%SetProperty(o, "a", 0, DontEnum);
+// message is constructed as data property.
+var data_error = new Error("custom message");
+o = {};
+o.__proto__ = data_error;
-var o2 = {};
-%SetProperty(o2, "a", 0, DontEnum);
+assertEquals("custom message", o.message);
+o.message = "another message";
+assertEquals("another message", o.message);
+assertEquals("custom message", data_error.message);
-assertTrue(%HaveSameMap(o, o2));
+// message is constructed as getter.
+var getter_error_1;
+try { x.x } catch (e) { getter_error_1 = e; }
+o = {};
+o.__proto__ = getter_error_1;
-o.y = 2;
+assertEquals("x is not defined", o.message); // Getter fires.
+o.message = "another message";
+assertEquals("another message", o.message);
+assertEquals("x is not defined", getter_error_1.message);
-for (var v in o) { print(v); }
+var getter_error_2;
+try { x.x } catch (e) { getter_error_2 = e; }
o = {};
-gc();
+o.__proto__ = getter_error_2;
-for (var v in o2) { print(v); }
+o.message = "another message"; // Setter fires.
+assertEquals("another message", o.message);
+assertEquals("x is not defined", getter_error_1.message);
« no previous file with comments | « src/messages.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698