Skip to content

Commit

Permalink
gamepad: Check that the DocumentLoader is not null
Browse files Browse the repository at this point in the history
Gamepad timestamps are reported relative to the navigationStart
timestamp, accessed from the DocumentLoader's DocumentLoadTiming.
In some scenarios the document may have been detached before the
NavigatorGamepad is initialized, causing the DocumentLoader to be
nullptr.

This CL checks that the DocumentLoader is non-null, and uses the
current time in place of navigationStart if it is null.

Bug: 1483777
Change-Id: Ib3efcf3a612cd4c1c543218fa5fb8568c7129dcf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4899018
Reviewed-by: Alvin Ji <[email protected]>
Commit-Queue: Matt Reynolds <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1204813}
  • Loading branch information
nondebug authored and Lightning00Blade committed Dec 11, 2023
1 parent 68754a0 commit c884b5a
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<head>
<script src="../resources/js-test.js"></script>
<script>
function onLoad() {
const x1 = document.getElementById('x1');
x1.addEventListener('DOMSubtreeModified', () => {
const x2 = document.getElementById('x2');
x2.contentDocument;
});
x1.setAttribute('inputmode', 'url');
}
function insertAdjacent() {
const x2 = document.getElementById('x2');
const x3 = document.getElementById('x3');
document.onreadystatechange = insertAdjacent;
x3.insertAdjacentElement('beforebegin', x2);
}
</script>
</head>
<body onload="onLoad()">
<div id="x1"></div>
<object id="x2" data="invalid-url" onerror="insertAdjacent()"></object>
<div id="x3"></div>
</body>
</html>

0 comments on commit c884b5a

Please sign in to comment.