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

Unified Diff: src/elements.cc

Issue 1491743008: [proxies] Add all-can-read/String/Symbol filtering support to GetKeys() (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: critical correctness fix ;-) 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/key-accumulator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/elements.cc
diff --git a/src/elements.cc b/src/elements.cc
index e4cc7efb9fd6ed51bc734e6e47dae7155b69c69c..28700b8f0abe31e90e32a0f2c6be65d787c915dd 100644
--- a/src/elements.cc
+++ b/src/elements.cc
@@ -859,6 +859,10 @@ class ElementsAccessorBase : public ElementsAccessor {
KeyAccumulator* keys, uint32_t range,
PropertyFilter filter,
uint32_t offset) {
+ if (filter & ONLY_ALL_CAN_READ) {
+ // Non-dictionary elements can't have all-can-read accessors.
+ return;
+ }
uint32_t length = 0;
if (object->IsJSArray()) {
length = Smi::cast(JSArray::cast(*object)->length())->value();
@@ -1140,6 +1144,12 @@ class DictionaryElementsAccessor
uint32_t index = static_cast<uint32_t>(k->Number());
if (index < offset) continue;
PropertyDetails details = dictionary->DetailsAt(i);
+ if (filter & ONLY_ALL_CAN_READ) {
+ if (details.kind() != kAccessor) continue;
+ Object* accessors = dictionary->ValueAt(i);
+ if (!accessors->IsAccessorInfo()) continue;
+ if (!AccessorInfo::cast(accessors)->all_can_read()) continue;
+ }
PropertyAttributes attr = details.attributes();
if ((attr & filter) != 0) continue;
keys->AddKey(index);
« no previous file with comments | « no previous file | src/key-accumulator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698