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

Unified Diff: third_party/WebKit/LayoutTests/storage/indexeddb/bindings-edges.html

Issue 2332003002: IndexedDB: Avoid side effects for array key conversion w/ HasOwnProperty (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/storage/indexeddb/bindings-edges.html
diff --git a/third_party/WebKit/LayoutTests/storage/indexeddb/bindings-edges.html b/third_party/WebKit/LayoutTests/storage/indexeddb/bindings-edges.html
index 8d43077da00469594867ad421872e99e06129115..45e5b20297c4ebf66eb38d5c99866149bd00da05 100644
--- a/third_party/WebKit/LayoutTests/storage/indexeddb/bindings-edges.html
+++ b/third_party/WebKit/LayoutTests/storage/indexeddb/bindings-edges.html
@@ -14,6 +14,7 @@ indexeddb_test(
var setter_called = false;
Object.defineProperty(Object.prototype, '10', {
+ configurable: true,
set: t.step_func(function(value) { setter_called = true; })
});
request.onerror = t.unreached_func('request should not fail');
@@ -25,6 +26,8 @@ indexeddb_test(
'Result should have own-property overriding prototype setter.');
assert_equals(result[10], 'key',
'Result should have expected property.');
+
+ delete Object.prototype['10'];
t.done();
});
},
@@ -42,6 +45,7 @@ indexeddb_test(
var setter_called = false;
Object.defineProperty(Object.prototype, 'id', {
+ configurable: true,
set: t.step_func(function(value) { setter_called = true; })
});
request.onerror = t.unreached_func('request should not fail');
@@ -53,6 +57,8 @@ indexeddb_test(
'Result should have own-property overriding prototype setter.');
assert_equals(result.id, 1,
'Own property should match primary key generator value');
+
+ delete Object.prototype['id'];
t.done();
});
},
@@ -384,4 +390,38 @@ indexeddb_test(
},
'Key path evaluation: Exceptions from enumerable getters on prototype'
);
+
+indexeddb_test(
+ function(t, db) {
+ var store = db.createObjectStore('store');
+ store.createIndex('index', 'index0');
+ },
+ function(t, db) {
+ var tx = db.transaction('store', 'readwrite');
+
+ var array = [];
+ array[99] = 1;
+
+ var getter_called = 0;
+ var prop = '50';
+ Object.defineProperty(Object.prototype, prop, {
+ enumerable: true, configurable: true,
+ get: function() {
+ ++getter_called;
+ return 'foo';
+ }
+ });
+
+ var request = tx.objectStore('store').put({index0: array}, 'key');
+ request.onerror = t.unreached_func('put should not fail');
+ request.onsuccess = t.step_func(function() {
+ assert_equals(getter_called, 0,
+ 'Prototype getter should not be called');
+ delete Object.prototype[prop];
+ t.done();
+ });
+ },
+ 'Array key conversion should not invoke prototype getters'
+);
+
</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698