Skip to content

Commit 1be74ca

Browse files
chasephillipsHexcles
authored andcommitted
IndexedDB: Fix WPT bindings-inject-key to clean up Object.prototype
chromedriver doesn't allow changing Object.prototype to add enumerable properties, but this test requires setting some values on Object.prototype. When Object.prototype.a is set to: {b: {c: 'on proto'}} chromedriver fails with: JavascriptErrorException: javascript error (500): Maximum call stack size exceeded (Session info: chrome=72.0.3626.121) Remote-end stacktrace: #0 0x563ff3a32a59 <unknown> #1 0x563ff39cb7f3 <unknown> #2 0x563ff38fcd7c <unknown> #3 0x563ff38ff78c <unknown> #4 0x563ff38ff5f7 <unknown> #5 0x563ff38ffbe7 <unknown> #6 0x563ff38fff1b <unknown> #7 0x563ff38a3f7a <unknown> #8 0x563ff3899bf2 <unknown> #9 0x563ff38a37b7 <unknown> #10 0x563ff3899ac3 <unknown> #11 0x563ff38782d2 <unknown> #12 0x563ff3879112 <unknown> #13 0x563ff39fe865 <unknown> #14 0x563ff39ff32b <unknown> #15 0x563ff39ff70c <unknown> #16 0x563ff39d940a <unknown> #17 0x563ff39ff997 <unknown> #18 0x563ff39e9947 <unknown> #19 0x563ff3a1a800 <unknown> #20 0x563ff3a3c8be <unknown> #21 0x7f3bf4545494 start_thread #22 0x7f3bf2d58a8f clone Ran 1 tests finished in 2.0 seconds. • 0 ran as expected. 0 tests skipped. • 1 tests had errors unexpectedly Work around this problem by cleaning up the test environment so Object.prototype no longer has the override by the time chromedriver tries to inspect the test result. While here, fix the other tests to use the t.add_cleanup() function so they'll cleanup their test environment in case they exit in some other way besides reaching t.done(). The underlying chromedriver issue is tracked upstream at https://crbug.com/chromedriver/2555. Bug: 934844 Change-Id: Id1b4ab2a908bfbc001e2a2d045eeec3ef01c24d9
1 parent 0d35193 commit 1be74ca

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

IndexedDB/bindings-inject-key.html

+12-5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
configurable: true,
2222
set: t.step_func((value) => { setter_called = true; }),
2323
});
24+
t.add_cleanup(function() {
25+
delete Object.prototype['10'];
26+
});
2427
request.onerror = t.unreached_func('request should not fail');
2528
request.onsuccess = t.step_func(() => {
2629
const result = request.result;
@@ -31,8 +34,6 @@
3134
'Result should have own-property overriding prototype setter.');
3235
assert_equals(result[10], 'key',
3336
'Result should have expected property.');
34-
35-
delete Object.prototype['10'];
3637
t.done();
3738
});
3839
},
@@ -53,6 +54,9 @@
5354
configurable: true,
5455
set: t.step_func(function(value) { setter_called = true; }),
5556
});
57+
t.add_cleanup(function() {
58+
delete Object.prototype['id'];
59+
});
5660
request.onerror = t.unreached_func('request should not fail');
5761
request.onsuccess = t.step_func(function() {
5862
const result = request.result;
@@ -63,8 +67,6 @@
6367
'Result should have own-property overriding prototype setter.');
6468
assert_equals(result.id, 1,
6569
'Own property should match primary key generator value');
66-
67-
delete Object.prototype['id'];
6870
t.done();
6971
});
7072
},
@@ -81,6 +83,11 @@
8183
const request = tx.objectStore('store').get(1);
8284

8385
Object.prototype.a = {b: {c: 'on proto'}};
86+
t.add_cleanup(function() {
87+
delete Object.prototype.a;
88+
});
89+
assert_equals(Object.prototype.a.b.c, 'on proto',
90+
'Prototype should be configured for test');
8491

8592
request.onerror = t.unreached_func('request should not fail');
8693
request.onsuccess = t.step_func(function() {
@@ -94,7 +101,7 @@
94101
assert_equals(result.a.b.c, 1,
95102
'Own property should match primary key generator value');
96103
assert_equals(Object.prototype.a.b.c, 'on proto',
97-
'Prototype should not be modified');
104+
'Prototype should not be modified');
98105
t.done();
99106
});
100107
},

0 commit comments

Comments
 (0)