Revision: 21256
Author: [email protected]
Date: Mon May 12 08:49:51 2014 UTC
Log: Harden %SetIsObserved with RUNTIME_ASSERTs
Now throws if its argument is already observed, or if the argument is
the global proxy.
BUG=371782
LOG=Y
[email protected]
Review URL: https://codereview.chromium.org/274163002
http://code.google.com/p/v8/source/detail?r=21256
Added:
/branches/bleeding_edge/test/mjsunit/es7/object-observe-runtime.js
Modified:
/branches/bleeding_edge/src/runtime.cc
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/es7/object-observe-runtime.js Mon
May 12 08:49:51 2014 UTC
@@ -0,0 +1,18 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+// These tests are meant to ensure that that the Object.observe runtime
+// functions are hardened.
+
+var obj = {};
+%SetIsObserved(obj);
+assertThrows(function() {
+ %SetIsObserved(obj);
+});
+
+assertThrows(function() {
+ %SetIsObserved(this);
+});
=======================================
--- /branches/bleeding_edge/src/runtime.cc Fri May 9 18:22:28 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc Mon May 12 08:49:51 2014 UTC
@@ -14855,9 +14855,9 @@
HandleScope scope(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0);
- ASSERT(!obj->IsJSGlobalProxy());
- if (obj->IsJSProxy())
- return isolate->heap()->undefined_value();
+ RUNTIME_ASSERT(!obj->IsJSGlobalProxy());
+ if (obj->IsJSProxy()) return isolate->heap()->undefined_value();
+ RUNTIME_ASSERT(!obj->map()->is_observed());
ASSERT(obj->IsJSObject());
JSObject::SetObserved(Handle<JSObject>::cast(obj));
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.