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

Unified Diff: src/v8natives.js

Issue 1142393003: [strong] Implement per-object restrictions behaviour of property freezing (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cl feedback Created 5 years, 7 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 | « src/messages.h ('k') | test/mjsunit/strong/object-freeze-property.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 834b41ce82efcfb4e9f8a84752116e4ee446b612..c3231ad7131b38a3d388d3093af9f0ee77bada27 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -681,14 +681,19 @@ function DefineObjectProperty(obj, p, desc, should_throw) {
}
// Step 10a
if (IsDataDescriptor(current) && IsDataDescriptor(desc)) {
- if (!current.isWritable() && desc.isWritable()) {
- if (should_throw) {
- throw MakeTypeError(kRedefineDisallowed, p);
- } else {
- return false;
+ var currentIsWritable = current.isWritable();
+ if (currentIsWritable != desc.isWritable()) {
+ if (!currentIsWritable || IS_STRONG(obj)) {
+ if (should_throw) {
+ throw IS_STRONG(obj) ?
+ MakeTypeError(kStrongRedefineDisallowed, o, p) :
rossberg 2015/05/22 14:15:29 Nit: style guide wants ? and : each first on the n
conradw 2015/05/27 18:15:45 Done.
+ MakeTypeError(kRedefineDisallowed, p)
+ } else {
+ return false;
+ }
}
}
- if (!current.isWritable() && desc.hasValue() &&
+ if (!currentIsWritable && desc.hasValue() &&
!$sameValue(desc.getValue(), current.getValue())) {
if (should_throw) {
throw MakeTypeError(kRedefineDisallowed, p);
« no previous file with comments | « src/messages.h ('k') | test/mjsunit/strong/object-freeze-property.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698