Skip to content

Commit

Permalink
[java][bidi] Add validation for browsing context id (#12920)
Browse files Browse the repository at this point in the history
Co-authored-by: Diego Molina <[email protected]>
Co-authored-by: Titus Fortner <[email protected]>
Co-authored-by: Puja Jagani <[email protected]>
  • Loading branch information
4 people authored Oct 11, 2023
1 parent 1f8b8d9 commit bbcfc9a
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public BrowsingContext(WebDriver driver, String id) {
throw new IllegalArgumentException("WebDriver instance must support BiDi protocol");
}

Require.precondition(!id.isEmpty(), "Browsing Context id cannot be empty");

this.bidi = ((HasBiDi) driver).getBiDi();
this.id = id;
}
Expand All @@ -94,6 +96,9 @@ public BrowsingContext(WebDriver driver, WindowType type) {
public BrowsingContext(WebDriver driver, WindowType type, String referenceContextId) {
Require.nonNull("WebDriver", driver);
Require.nonNull("Reference browsing context id", referenceContextId);

Require.precondition(!referenceContextId.isEmpty(), "Reference Context id cannot be empty");

if (!(driver instanceof HasBiDi)) {
throw new IllegalArgumentException("WebDriver instance must support BiDi protocol");
}
Expand Down

0 comments on commit bbcfc9a

Please sign in to comment.