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

Unified Diff: src/js/v8natives.js

Issue 1489423002: [proxies] Make Object.{freeze,seal} behave correctly for proxies. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add some tests. Created 5 years 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 | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/v8natives.js
diff --git a/src/js/v8natives.js b/src/js/v8natives.js
index 427741e9a1be7684d3b66825f535c73ce34e56fc..d1a4da17a68326e0f3db45ed136cbceefae65d91 100644
--- a/src/js/v8natives.js
+++ b/src/js/v8natives.js
@@ -1051,54 +1051,14 @@ function ObjectDefineProperties(obj, properties) {
// ES5 section 15.2.3.8.
function ObjectSealJS(obj) {
if (!IS_SPEC_OBJECT(obj)) return obj;
- var isProxy = %_IsJSProxy(obj);
- if (isProxy || %HasSloppyArgumentsElements(obj) || %IsObserved(obj)) {
- // TODO(neis): For proxies, must call preventExtensions trap first.
- var names = OwnPropertyKeys(obj);
- for (var i = 0; i < names.length; i++) {
- var name = names[i];
- var desc = GetOwnPropertyJS(obj, name);
- if (desc.isConfigurable()) {
- desc.setConfigurable(false);
- DefineOwnProperty(obj, name, desc, true);
- }
- }
- %PreventExtensions(obj);
- } else {
- // TODO(adamk): Is it worth going to this fast path if the
- // object's properties are already in dictionary mode?
- %ObjectSeal(obj);
- }
- return obj;
+ return %ObjectSeal(obj);
}
// ES5 section 15.2.3.9.
function ObjectFreezeJS(obj) {
if (!IS_SPEC_OBJECT(obj)) return obj;
- var isProxy = %_IsJSProxy(obj);
- // TODO(conradw): Investigate modifying the fast path to accommodate strong
- // objects.
- if (isProxy || %HasSloppyArgumentsElements(obj) || %IsObserved(obj) ||
- IS_STRONG(obj)) {
- // TODO(neis): For proxies, must call preventExtensions trap first.
- var names = OwnPropertyKeys(obj);
- for (var i = 0; i < names.length; i++) {
- var name = names[i];
- var desc = GetOwnPropertyJS(obj, name);
- if (desc.isWritable() || desc.isConfigurable()) {
- if (IsDataDescriptor(desc)) desc.setWritable(false);
- desc.setConfigurable(false);
- DefineOwnProperty(obj, name, desc, true);
- }
- }
- %PreventExtensions(obj);
- } else {
- // TODO(adamk): Is it worth going to this fast path if the
- // object's properties are already in dictionary mode?
- %ObjectFreeze(obj);
- }
- return obj;
+ return %ObjectFreeze(obj);
}
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698