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

Unified Diff: third_party/WebKit/LayoutTests/storage/indexeddb/key_conversion_exceptions.html

Issue 2255413004: IndexedDB: Avoid side effects by evaluating key paths w/ HasOwnProperty (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
Index: third_party/WebKit/LayoutTests/storage/indexeddb/key_conversion_exceptions.html
diff --git a/third_party/WebKit/LayoutTests/storage/indexeddb/key_conversion_exceptions.html b/third_party/WebKit/LayoutTests/storage/indexeddb/key_conversion_exceptions.html
index 9bfd6aaff647c4f854b1e0bb328d08629afb0fe5..23ed89be9955e6a222933918f20a323f1d8a7b53 100644
--- a/third_party/WebKit/LayoutTests/storage/indexeddb/key_conversion_exceptions.html
+++ b/third_party/WebKit/LayoutTests/storage/indexeddb/key_conversion_exceptions.html
@@ -29,7 +29,7 @@ function throwing_key(name) {
var err = new Error('throwing from getter');
err.name = name;
throw err;
- }});
+ }, enumerable: true});
return throws;
}
@@ -115,16 +115,18 @@ simple_idb_test(function(t, db) {
var cursor = request.result;
assert_not_equals(cursor, null, 'cursor should find a value');
- // Put property on prototype because the keypath is
- // evaluated against a structured clone, not the passed value.
var value = {};
-
- value.__proto__.prop = throwing_key('getter');
- assert_throws({name:'getter'}, function() {
+ value.prop = throwing_key('getter');
+ assert_throws({name: 'getter'}, function() {
cursor.update(value);
- }, 'key conversion with throwing getter should rethrow');
+ }, 'throwing getter should rethrow during clone');
+
+ // Throwing from the getter during key conversion is
+ // not possible since (1) a clone is used, (2) only own
+ // properties are cloned, and (3) only own properties
+ // are used for key path evaluation.
- value.__proto__.prop = invalid_key;
+ value.prop = invalid_key;
assert_throws('DataError', function() {
cursor.update(value);
}, 'key conversion with invalid key should throw DataError');
@@ -156,16 +158,18 @@ test(function(t) {
out_of_line[method]('value', invalid_key);
}, 'key conversion with invalid key should throw DataError');
- // Put property on prototype because the keypath is
- // evaluated against a structured clone, not the passed value.
var value = {};
-
- value.__proto__.prop = throwing_key('getter');
+ value.prop = throwing_key('getter');
assert_throws({name:'getter'}, function() {
in_line[method](value);
- }, 'key conversion with throwing getter should rethrow');
+ }, 'throwing getter should rethrow during clone');
+
+ // Throwing from the getter during key conversion is
+ // not possible since (1) a clone is used, (2) only own
+ // properties are cloned, and (3) only own properties
+ // are used for key path evaluation.
- value.__proto__.prop = invalid_key;
+ value.prop = invalid_key;
assert_throws('DataError', function() {
in_line[method](value);
}, 'key conversion with invalid key should throw DataError');

Powered by Google App Engine
This is Rietveld 408576698