You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Added Source field to various log entry classes (BaseLogEntry, ConsoleLogEntry, GenericLogEntry, JavascriptLogEntry) in both Java and JavaScript implementations.
Updated constructors and fromJson methods to handle the new Source field.
Removed realm field and related methods from log entry classes.
Updated tests to include assertions for the Source field and removed assertions for realm.
Possible Bug:
The removal of the 'realm' field in the Java classes without a corresponding update in the JavaScript classes might lead to inconsistencies or errors when the 'realm' is expected but not provided.
Code Consistency:
The 'source' field is added to log entries, but the handling of this new field in JavaScript seems inconsistent. For example, the 'source' is used in constructors but not always in corresponding methods or JSON parsing functions.
public ConsoleLogEntry(
LogLevel level, Source source, String text, long timestamp, String type, StackTrace stackTrace) {
+ if (source == null) {+ throw new IllegalArgumentException("Source cannot be null");+ }
super(level, source, text, timestamp, type, stackTrace);
}
Apply this suggestion
Suggestion importance[1-10]: 9
Why: Adding null checks for the source parameter in the constructor is a good practice to ensure robustness and prevent runtime exceptions, making the code more reliable.
9
Possible bug
Initialize the source field to prevent null pointer exceptions
Ensure that the source field is properly initialized in the constructor to avoid NullPointerException when the getSource() method is called without setting the source.
-private Source source;+private Source source = new Source(); // Adjust the constructor as per actual implementation
...
this.source = source;
Suggestion importance[1-10]: 7
Why: Initializing the source field can prevent potential NullPointerException, improving robustness. However, the suggestion assumes a default constructor for Source, which may not be accurate without further context.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
Add source to log entry events in compliance with the spec so the user can use that browsing context information to chain more commands.
Motivation and Context
Types of changes
Checklist
PR Type
Enhancement, Tests
Description
Source
field to various log entry classes (BaseLogEntry
,ConsoleLogEntry
,GenericLogEntry
,JavascriptLogEntry
) in both Java and JavaScript implementations.fromJson
methods to handle the newSource
field.realm
field and related methods from log entry classes.Source
field and removed assertions forrealm
.Changes walkthrough 📝
BaseLogEntry.java
Add `Source` field to `BaseLogEntry` class.
java/src/org/openqa/selenium/bidi/log/BaseLogEntry.java
Source
field toBaseLogEntry
.Source
.Source
.ConsoleLogEntry.java
Add `Source` field and remove `realm` in `ConsoleLogEntry`.
java/src/org/openqa/selenium/bidi/log/ConsoleLogEntry.java
Source
field toConsoleLogEntry
.Source
.fromJson
method to readSource
.realm
field and related methods.GenericLogEntry.java
Add `Source` field to `GenericLogEntry` class.
java/src/org/openqa/selenium/bidi/log/GenericLogEntry.java
Source
field toGenericLogEntry
.Source
.fromJson
method to readSource
.JavascriptLogEntry.java
Add `Source` field to `JavascriptLogEntry` class.
java/src/org/openqa/selenium/bidi/log/JavascriptLogEntry.java
Source
field toJavascriptLogEntry
.Source
.fromJson
method to readSource
.logEntries.js
Add `Source` field and remove `realm` in log entries.
javascript/node/selenium-webdriver/bidi/logEntries.js
Source
field toBaseLogEntry
.Source
.realm
field and related methods inConsoleLogEntry
.logInspector.js
Include `Source` field in log entry creation.
javascript/node/selenium-webdriver/bidi/logInspector.js
Source
field.realm
field handling.LogInspectorTest.java
Update tests to include `Source` field assertions.
java/test/org/openqa/selenium/bidi/log/LogInspectorTest.java
Source
field in log entry tests.realm
.log_inspector_test.js
Update tests to include `Source` field assertions.
javascript/node/selenium-webdriver/test/bidi/log_inspector_test.js
Source
field in log entry tests.realm
.