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
Describe the bug
Happy-dom throws the next error: TypeError: url.startsWith is not a function. (In 'url.startsWith("about:")', 'url.startsWith' is undefined)
To Reproduce
Steps to reproduce the behavior:
Not sure tbh. But did some debugging and partly found the cause of this.
This is the part where it fails in BrowserFrameURL:
The problem is that url is not an instance of URL, but still an object, alyhough the string value is about:blank. Because of not being an instance of URL, but still being an object the .startsWith fails.
replacing the url assignment with url = (url instanceof URL || typeof url === 'object' ? url.toString() : url) || 'about:blank'; fixes the error/issue
Expected behavior
Happy-dom not to throw an error on a 'wrong' url
Screenshots
If applicable, add screenshots to help explain your problem.
Device:
OS: macOS 14.6.1 (23G93)
Browser Bun vv1.1.42
Version 16.2.7
Additional context
Add any other context about the problem here.
TypeError: url.startsWith is not a function. (In 'url.startsWith("about:")', 'url.startsWith' is undefined)
at getRelativeURL (<path-to-project></>/node_modules/happy-dom/lib/browser/utilities/BrowserFrameURL.js:16:17)
at <path-to-project></>/node_modules/happy-dom/lib/browser/utilities/BrowserFrameNavigator.js:63:20
at navigate (<path-to-project></>/node_modules/happy-dom/lib/browser/utilities/BrowserFrameNavigator.js:57:44)
at href (<path-to-project></>/node_modules/happy-dom/lib/location/Location.js:210:13)
at location (<path-to-project></>/node_modules/happy-dom/lib/window/BrowserWindow.js:904:31)
at <path-to-project></>/src/components/Popup/Popup.spec.tsx:40:6```
The text was updated successfully, but these errors were encountered:
Describe the bug
Happy-dom throws the next error:
TypeError: url.startsWith is not a function. (In 'url.startsWith("about:")', 'url.startsWith' is undefined)
To Reproduce
Steps to reproduce the behavior:
Not sure tbh. But did some debugging and partly found the cause of this.
This is the part where it fails in
BrowserFrameURL
:The problem is that url is not an instance of URL, but still an object, alyhough the string value is
about:blank
. Because of not being an instance of URL, but still being an object the.startsWith
fails.replacing the url assignment with
url = (url instanceof URL || typeof url === 'object' ? url.toString() : url) || 'about:blank';
fixes the error/issueExpected behavior
Happy-dom not to throw an error on a 'wrong' url
Screenshots
If applicable, add screenshots to help explain your problem.
Device:
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: