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

Unified Diff: src/messages.js

Issue 6146009: Do not allow accessors to intercept getting/setting properties on... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 11 months 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 | « no previous file | test/mjsunit/error-constructors.js » ('j') | test/mjsunit/error-constructors.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/messages.js
===================================================================
--- src/messages.js (revision 6270)
+++ src/messages.js (working copy)
@@ -946,12 +946,18 @@
f.prototype.name = name;
%SetCode(f, function(m) {
if (%_IsConstructCall()) {
+ // Define all the expected properties directly on the error
+ // object. This avoids going through getters and setters defined
+ // on prototype objects.
+ %IgnoreAttributesAndSetProperty(this, 'stack', void 0);
+ %IgnoreAttributesAndSetProperty(this, 'arguments', void 0);
+ %IgnoreAttributesAndSetProperty(this, 'type', void 0);
if (m === kAddMessageAccessorsMarker) {
Søren Thygesen Gjesse 2011/01/12 15:46:41 Maybe add a comment that DefineOneShotAccessor ens
DefineOneShotAccessor(this, 'message', function (obj) {
return FormatMessage({type: obj.type, args: obj.arguments});
});
} else if (!IS_UNDEFINED(m)) {
- this.message = ToString(m);
+ %IgnoreAttributesAndSetProperty(this, 'message', ToString(m));
}
captureStackTrace(this, f);
} else {
@@ -992,8 +998,8 @@
if (type && !this.hasOwnProperty("message")) {
return this.name + ": " + FormatMessage({ type: type, args: this.arguments });
}
- var message = this.message;
- return this.name + (message ? (": " + message) : "");
+ var message = this.hasOwnProperty("message") ? (": " + this.message) : "";
+ return this.name + message;
}, DONT_ENUM);
« no previous file with comments | « no previous file | test/mjsunit/error-constructors.js » ('j') | test/mjsunit/error-constructors.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698