Commit 5a7d4abb authored by Chase Phillips's avatar Chase Phillips Committed by Commit Bot

IndexedDB: Fix WPT bindings-inject-key to clean up Object.prototype

Add a new cleanup for the 'prototype chain' test to fix a crash that
happens when the test is run under chromedriver.  Update the other
tests to use t.add_cleanup() so they follow our test best practices.

The underlying chromedriver issue is tracked upstream at
https://crbug.com/chromedriver/2555.

Bug: 934844
Change-Id: Id1b4ab2a908bfbc001e2a2d045eeec3ef01c24d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1497613
Commit-Queue: Chase Phillips <cmp@chromium.org>
Reviewed-by: default avatarJoshua Bell <jsbell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#637410}
parent 1608acd3
......@@ -21,6 +21,9 @@ indexeddb_test(
configurable: true,
set: t.step_func((value) => { setter_called = true; }),
});
t.add_cleanup(function() {
delete Object.prototype['10'];
});
request.onerror = t.unreached_func('request should not fail');
request.onsuccess = t.step_func(() => {
const result = request.result;
......@@ -31,8 +34,6 @@ 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();
});
},
......@@ -53,6 +54,9 @@ indexeddb_test(
configurable: true,
set: t.step_func(function(value) { setter_called = true; }),
});
t.add_cleanup(function() {
delete Object.prototype['id'];
});
request.onerror = t.unreached_func('request should not fail');
request.onsuccess = t.step_func(function() {
const result = request.result;
......@@ -63,8 +67,6 @@ 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();
});
},
......@@ -81,6 +83,11 @@ indexeddb_test(
const request = tx.objectStore('store').get(1);
Object.prototype.a = {b: {c: 'on proto'}};
t.add_cleanup(function() {
delete Object.prototype.a;
});
assert_equals(Object.prototype.a.b.c, 'on proto',
'Prototype should be configured for test');
request.onerror = t.unreached_func('request should not fail');
request.onsuccess = t.step_func(function() {
......@@ -94,7 +101,7 @@ indexeddb_test(
assert_equals(result.a.b.c, 1,
'Own property should match primary key generator value');
assert_equals(Object.prototype.a.b.c, 'on proto',
'Prototype should not be modified');
'Prototype should not be modified');
t.done();
});
},
......
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