Skip to content

Commit

Permalink
Bug 1532845 [wpt PR 15637] - IndexedDB: Fix WPT bindings-inject-key t…
Browse files Browse the repository at this point in the history
…o clean up Object.prototype, a=testonly

Automatic update from web-platform-tests
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>
    mozilla#2 0x563ff38fcd7c <unknown>
    mozilla#3 0x563ff38ff78c <unknown>
    mozilla#4 0x563ff38ff5f7 <unknown>
    mozilla#5 0x563ff38ffbe7 <unknown>
    mozilla#6 0x563ff38fff1b <unknown>
    mozilla#7 0x563ff38a3f7a <unknown>
    mozilla#8 0x563ff3899bf2 <unknown>
    mozilla#9 0x563ff38a37b7 <unknown>
    mozilla#10 0x563ff3899ac3 <unknown>
    mozilla#11 0x563ff38782d2 <unknown>
    mozilla#12 0x563ff3879112 <unknown>
    mozilla#13 0x563ff39fe865 <unknown>
    mozilla#14 0x563ff39ff32b <unknown>
    mozilla#15 0x563ff39ff70c <unknown>
    mozilla#16 0x563ff39d940a <unknown>
    mozilla#17 0x563ff39ff997 <unknown>
    mozilla#18 0x563ff39e9947 <unknown>
    mozilla#19 0x563ff3a1a800 <unknown>
    mozilla#20 0x563ff3a3c8be <unknown>
    mozilla#21 0x7f3bf4545494 start_thread
    mozilla#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

--

wpt-commits: 1be74ca2738a05f6e8d98d55ba44c50e3a332554
wpt-pr: 15637
  • Loading branch information
chasephillips authored and jgraham committed Apr 1, 2019
1 parent a0e7255 commit ab5f22c
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions testing/web-platform/tests/IndexedDB/bindings-inject-key.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
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;
Expand All @@ -31,8 +34,6 @@
'Result should have own-property overriding prototype setter.');
assert_equals(result[10], 'key',
'Result should have expected property.');

delete Object.prototype['10'];
t.done();
});
},
Expand All @@ -53,6 +54,9 @@
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;
Expand All @@ -63,8 +67,6 @@
'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();
});
},
Expand All @@ -81,6 +83,11 @@
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() {
Expand All @@ -94,7 +101,7 @@
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();
});
},
Expand Down

0 comments on commit ab5f22c

Please sign in to comment.