Commit d09a925b authored by caitpotter88's avatar caitpotter88 Committed by Commit bot

Revert "[api] expose Array Iterators to API"

This reverts commit 24aca870.

The API makes these values appear to be per-isolate, when in fact
they are per-context. Installing the results of these on Template
objects instantiated in multiple contexts can result in security
violations and contexts being retained indefinitely.

An alternative mechanism for using these in a sensible way is
provided by https://crrev.com/1409593002

BUG=
LOG=N
R=jochen@chromium.org, adamk@chromium.org

Review URL: https://codereview.chromium.org/1415663002

Cr-Commit-Position: refs/heads/master@{#31417}
parent 2abd768e
......@@ -2962,15 +2962,7 @@ class V8_EXPORT Array : public Object {
*/
static Local<Array> New(Isolate* isolate, int length = 0);
/**
* Access to Array Iterator methods
*/
static Local<Function> GetKeysIterator(Isolate* isolate);
static Local<Function> GetValuesIterator(Isolate* isolate);
static Local<Function> GetEntriesIterator(Isolate* isolate);
V8_INLINE static Array* Cast(Value* obj);
private:
Array();
static void CheckCast(Value* obj);
......
......@@ -6095,33 +6095,6 @@ Local<Object> Array::CloneElementAt(uint32_t index) {
}
Local<Function> Array::GetKeysIterator(Isolate* isolate) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::Handle<i::JSFunction> keys(
i_isolate->native_context()->array_keys_iterator(), i_isolate);
DCHECK(!keys.is_null());
return Utils::ToLocal(keys);
}
Local<Function> Array::GetValuesIterator(Isolate* isolate) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::Handle<i::JSFunction> values(
i_isolate->native_context()->array_values_iterator(), i_isolate);
DCHECK(!values.is_null());
return Utils::ToLocal(values);
}
Local<Function> Array::GetEntriesIterator(Isolate* isolate) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::Handle<i::JSFunction> entries(
i_isolate->native_context()->array_entries_iterator(), i_isolate);
DCHECK(!entries.is_null());
return Utils::ToLocal(entries);
}
Local<v8::Map> v8::Map::New(Isolate* isolate) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
LOG_API(i_isolate, "Map::New");
......
......@@ -106,9 +106,7 @@ enum BindingFlags {
V(ARRAY_SPLICE_INDEX, JSFunction, array_splice) \
V(ARRAY_SLICE_INDEX, JSFunction, array_slice) \
V(ARRAY_UNSHIFT_INDEX, JSFunction, array_unshift) \
V(ARRAY_KEYS_ITERATOR_INDEX, JSFunction, array_keys_iterator) \
V(ARRAY_VALUES_ITERATOR_INDEX, JSFunction, array_values_iterator) \
V(ARRAY_ENTRIES_ITERATOR_INDEX, JSFunction, array_entries_iterator) \
V(CREATE_DATE_FUN_INDEX, JSFunction, create_date_fun) \
V(DERIVED_GET_TRAP_INDEX, JSFunction, derived_get_trap) \
V(DERIVED_HAS_TRAP_INDEX, JSFunction, derived_has_trap) \
......
......@@ -164,10 +164,6 @@ utils.Export(function(to) {
to.ArrayValues = ArrayValues;
});
%InstallToContext([
"array_keys_iterator", ArrayKeys,
"array_values_iterator", ArrayValues,
"array_entries_iterator", ArrayEntries
]);
%InstallToContext(["array_values_iterator", ArrayValues]);
})
......@@ -21933,18 +21933,3 @@ TEST(AccessCheckedIsConcatSpreadable) {
ExpectTrue("result.length === 1");
ExpectTrue("object[Symbol.isConcatSpreadable] === undefined");
}
TEST(ArrayIteratorMethods) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
LocalContext env;
env->Global()->Set(v8_str("keys"), v8::Array::GetKeysIterator(isolate));
env->Global()->Set(v8_str("values"), v8::Array::GetValuesIterator(isolate));
env->Global()->Set(v8_str("entries"), v8::Array::GetEntriesIterator(isolate));
ExpectString("typeof keys", "function");
ExpectString("typeof values", "function");
ExpectString("typeof entries", "function");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment