Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Web Inspector: Console: timestamps are always wrong
https://bugs.webkit.org/show_bug.cgi?id=255033 Reviewed by Patrick Angle. Use `WallTime` instead of `Monotonic` time since this is a timestamp we expect to display rather than something for comparison (i.e. "was this before that?"). * Source/JavaScriptCore/inspector/ConsoleMessage.h: * Source/JavaScriptCore/inspector/ConsoleMessage.cpp: (Inspector::ConsoleMessage::ConsoleMessage): (Inspector::ConsoleMessage::addToFrontend): (Inspector::ConsoleMessage::updateRepeatCountInConsole): * Source/WebCore/page/PageConsoleClient.cpp: (WebCore::PageConsoleClient::screenshot): * LayoutTests/inspector/console/timestamp.html: Added. * LayoutTests/inspector/console/timestamp-expected.txt: Added. Canonical link: https://commits.webkit.org/263261@main
- Loading branch information
Showing
5 changed files
with
67 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CONSOLE MESSAGE: 42 | ||
Test for the ConsoleMessage.timestamp event. | ||
|
||
|
||
== Running test suite: ConsoleMessage.Timestamp | ||
-- Running test case: ConsoleMessage.Timestamp.Basic | ||
PASS: Should be after pre-captured timestamp. | ||
PASS: Should be before post-captured timestamp. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../../http/tests/inspector/resources/inspector-test.js"></script> | ||
<script> | ||
function test() | ||
{ | ||
let suite = InspectorTest.createAsyncSuite("ConsoleMessage.Timestamp"); | ||
|
||
suite.addTestCase({ | ||
name: "ConsoleMessage.Timestamp.Basic", | ||
async test() { | ||
let before = Date.now(); | ||
let [event] = await Promise.all([ | ||
WI.consoleManager.awaitEvent(WI.ConsoleManager.Event.MessageAdded), | ||
InspectorTest.evaluateInPage(`console.log(42)`), | ||
]); | ||
let after = Date.now(); | ||
|
||
let {message} = event.data; | ||
|
||
InspectorTest.expectGreaterThanOrEqual(message.timestamp * 1000, before, "Should be after pre-captured timestamp."); | ||
InspectorTest.expectLessThanOrEqual(message.timestamp * 1000, after, "Should be before post-captured timestamp."); | ||
}, | ||
}); | ||
|
||
suite.runTestCasesAndFinish(); | ||
} | ||
</script> | ||
</head> | ||
<body onload="runTest()"> | ||
<p>Test for the ConsoleMessage.timestamp event.</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters