happy-dom 13.6.2 → 13.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of happy-dom might be problematic. Click here for more details.
- package/cjs/PropertySymbol.cjs +2 -1
- package/cjs/PropertySymbol.cjs.map +1 -1
- package/cjs/PropertySymbol.d.ts +1 -0
- package/cjs/PropertySymbol.d.ts.map +1 -1
- package/cjs/browser/BrowserFrame.cjs +12 -2
- package/cjs/browser/BrowserFrame.cjs.map +1 -1
- package/cjs/browser/BrowserFrame.d.ts.map +1 -1
- package/cjs/browser/detached-browser/DetachedBrowserFrame.cjs +12 -2
- package/cjs/browser/detached-browser/DetachedBrowserFrame.cjs.map +1 -1
- package/cjs/browser/detached-browser/DetachedBrowserFrame.d.ts.map +1 -1
- package/cjs/browser/utilities/BrowserFrameFactory.cjs +5 -0
- package/cjs/browser/utilities/BrowserFrameFactory.cjs.map +1 -1
- package/cjs/browser/utilities/BrowserFrameFactory.d.ts.map +1 -1
- package/cjs/browser/utilities/BrowserFrameNavigator.cjs +20 -13
- package/cjs/browser/utilities/BrowserFrameNavigator.cjs.map +1 -1
- package/cjs/browser/utilities/BrowserFrameNavigator.d.ts +21 -10
- package/cjs/browser/utilities/BrowserFrameNavigator.d.ts.map +1 -1
- package/cjs/browser/utilities/BrowserFrameURL.cjs +2 -2
- package/cjs/browser/utilities/BrowserFrameURL.cjs.map +1 -1
- package/cjs/browser/utilities/BrowserFrameURL.d.ts.map +1 -1
- package/cjs/config/IHTMLElementTagNameMap.cjs +3 -0
- package/cjs/config/IHTMLElementTagNameMap.cjs.map +1 -0
- package/cjs/config/IHTMLElementTagNameMap.d.ts +146 -0
- package/cjs/config/IHTMLElementTagNameMap.d.ts.map +1 -0
- package/cjs/config/ISVGElementTagNameMap.cjs +3 -0
- package/cjs/config/ISVGElementTagNameMap.cjs.map +1 -0
- package/cjs/config/ISVGElementTagNameMap.d.ts +67 -0
- package/cjs/config/ISVGElementTagNameMap.d.ts.map +1 -0
- package/cjs/event/events/HashChangeEvent.cjs +26 -0
- package/cjs/event/events/HashChangeEvent.cjs.map +1 -0
- package/cjs/event/events/HashChangeEvent.d.ts +19 -0
- package/cjs/event/events/HashChangeEvent.d.ts.map +1 -0
- package/cjs/event/events/IHashChangeEventInit.cjs +3 -0
- package/cjs/event/events/IHashChangeEventInit.cjs.map +1 -0
- package/cjs/event/events/IHashChangeEventInit.d.ts +6 -0
- package/cjs/event/events/IHashChangeEventInit.d.ts.map +1 -0
- package/cjs/fetch/Fetch.cjs +10 -34
- package/cjs/fetch/Fetch.cjs.map +1 -1
- package/cjs/fetch/Fetch.d.ts +0 -10
- package/cjs/fetch/Fetch.d.ts.map +1 -1
- package/cjs/fetch/Request.cjs +2 -2
- package/cjs/fetch/Request.cjs.map +1 -1
- package/cjs/fetch/Response.cjs +2 -6
- package/cjs/fetch/Response.cjs.map +1 -1
- package/cjs/fetch/Response.d.ts.map +1 -1
- package/cjs/fetch/SyncFetch.cjs +3 -3
- package/cjs/fetch/SyncFetch.cjs.map +1 -1
- package/cjs/fetch/utilities/FetchBodyUtility.cjs +62 -19
- package/cjs/fetch/utilities/FetchBodyUtility.cjs.map +1 -1
- package/cjs/fetch/utilities/FetchBodyUtility.d.ts +24 -12
- package/cjs/fetch/utilities/FetchBodyUtility.d.ts.map +1 -1
- package/cjs/fetch/utilities/FetchRequestHeaderUtility.cjs +5 -3
- package/cjs/fetch/utilities/FetchRequestHeaderUtility.cjs.map +1 -1
- package/cjs/fetch/utilities/FetchRequestHeaderUtility.d.ts.map +1 -1
- package/cjs/fetch/utilities/FetchRequestReferrerUtility.cjs +1 -1
- package/cjs/fetch/utilities/FetchRequestReferrerUtility.cjs.map +1 -1
- package/cjs/fetch/utilities/FetchRequestReferrerUtility.d.ts.map +1 -1
- package/cjs/form-data/FormData.cjs +1 -1
- package/cjs/form-data/FormData.cjs.map +1 -1
- package/cjs/form-data/FormData.d.ts +1 -1
- package/cjs/form-data/FormData.d.ts.map +1 -1
- package/cjs/index.cjs +7 -3
- package/cjs/index.cjs.map +1 -1
- package/cjs/index.d.ts +7 -3
- package/cjs/index.d.ts.map +1 -1
- package/cjs/location/Location.cjs +270 -0
- package/cjs/location/Location.cjs.map +1 -0
- package/cjs/location/Location.d.ts +144 -0
- package/cjs/location/Location.d.ts.map +1 -0
- package/cjs/named-node-map/NamedNodeMap.cjs +2 -1
- package/cjs/named-node-map/NamedNodeMap.cjs.map +1 -1
- package/cjs/named-node-map/NamedNodeMap.d.ts.map +1 -1
- package/cjs/nodes/document/Document.cjs +4 -4
- package/cjs/nodes/document/Document.cjs.map +1 -1
- package/cjs/nodes/document/Document.d.ts +114 -6
- package/cjs/nodes/document/Document.d.ts.map +1 -1
- package/cjs/nodes/document/IDocument.d.ts +28 -12
- package/cjs/nodes/document/IDocument.d.ts.map +1 -1
- package/cjs/nodes/document-fragment/DocumentFragment.cjs +2 -2
- package/cjs/nodes/document-fragment/DocumentFragment.cjs.map +1 -1
- package/cjs/nodes/document-fragment/DocumentFragment.d.ts +31 -1
- package/cjs/nodes/document-fragment/DocumentFragment.d.ts.map +1 -1
- package/cjs/nodes/document-fragment/IDocumentFragment.d.ts +6 -0
- package/cjs/nodes/document-fragment/IDocumentFragment.d.ts.map +1 -1
- package/cjs/nodes/element/Element.cjs +1 -1
- package/cjs/nodes/element/Element.cjs.map +1 -1
- package/cjs/nodes/element/Element.d.ts +61 -1
- package/cjs/nodes/element/Element.d.ts.map +1 -1
- package/cjs/nodes/element/HTMLCollection.cjs +2 -1
- package/cjs/nodes/element/HTMLCollection.cjs.map +1 -1
- package/cjs/nodes/element/HTMLCollection.d.ts.map +1 -1
- package/cjs/nodes/html-anchor-element/HTMLAnchorElement.cjs +2 -0
- package/cjs/nodes/html-anchor-element/HTMLAnchorElement.cjs.map +1 -1
- package/cjs/nodes/html-anchor-element/HTMLAnchorElement.d.ts.map +1 -1
- package/cjs/nodes/html-button-element/HTMLButtonElement.cjs +93 -4
- package/cjs/nodes/html-button-element/HTMLButtonElement.cjs.map +1 -1
- package/cjs/nodes/html-button-element/HTMLButtonElement.d.ts +49 -1
- package/cjs/nodes/html-button-element/HTMLButtonElement.d.ts.map +1 -1
- package/cjs/nodes/html-button-element/IHTMLButtonElement.d.ts +5 -1
- package/cjs/nodes/html-button-element/IHTMLButtonElement.d.ts.map +1 -1
- package/cjs/nodes/html-form-element/HTMLFormControlsCollection.cjs +2 -1
- package/cjs/nodes/html-form-element/HTMLFormControlsCollection.cjs.map +1 -1
- package/cjs/nodes/html-form-element/HTMLFormControlsCollection.d.ts.map +1 -1
- package/cjs/nodes/html-form-element/HTMLFormElement.cjs +104 -9
- package/cjs/nodes/html-form-element/HTMLFormElement.cjs.map +1 -1
- package/cjs/nodes/html-form-element/HTMLFormElement.d.ts +8 -2
- package/cjs/nodes/html-form-element/HTMLFormElement.d.ts.map +1 -1
- package/cjs/nodes/html-iframe-element/HTMLIFrameElement.cjs +14 -0
- package/cjs/nodes/html-iframe-element/HTMLIFrameElement.cjs.map +1 -1
- package/cjs/nodes/html-iframe-element/HTMLIFrameElement.d.ts +10 -0
- package/cjs/nodes/html-iframe-element/HTMLIFrameElement.d.ts.map +1 -1
- package/cjs/nodes/html-iframe-element/HTMLIFrameElementPageLoader.cjs +4 -1
- package/cjs/nodes/html-iframe-element/HTMLIFrameElementPageLoader.cjs.map +1 -1
- package/cjs/nodes/html-iframe-element/HTMLIFrameElementPageLoader.d.ts.map +1 -1
- package/cjs/nodes/html-iframe-element/IHTMLIFrameElement.d.ts +1 -0
- package/cjs/nodes/html-iframe-element/IHTMLIFrameElement.d.ts.map +1 -1
- package/cjs/nodes/html-input-element/HTMLInputElement.cjs +100 -52
- package/cjs/nodes/html-input-element/HTMLInputElement.cjs.map +1 -1
- package/cjs/nodes/html-input-element/HTMLInputElement.d.ts +49 -23
- package/cjs/nodes/html-input-element/HTMLInputElement.d.ts.map +1 -1
- package/cjs/nodes/html-input-element/IHTMLInputElement.d.ts +2 -0
- package/cjs/nodes/html-input-element/IHTMLInputElement.d.ts.map +1 -1
- package/cjs/nodes/html-label-element/HTMLLabelElement.cjs +1 -0
- package/cjs/nodes/html-label-element/HTMLLabelElement.cjs.map +1 -1
- package/cjs/nodes/html-label-element/HTMLLabelElement.d.ts.map +1 -1
- package/cjs/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.cjs +1 -1
- package/cjs/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.cjs.map +1 -1
- package/cjs/nodes/html-script-element/HTMLScriptElementScriptLoader.cjs +1 -1
- package/cjs/nodes/html-script-element/HTMLScriptElementScriptLoader.cjs.map +1 -1
- package/cjs/nodes/html-select-element/HTMLSelectElement.cjs.map +1 -1
- package/cjs/nodes/html-select-element/HTMLSelectElement.d.ts.map +1 -1
- package/cjs/nodes/node/Node.cjs.map +1 -1
- package/cjs/nodes/node/Node.d.ts.map +1 -1
- package/cjs/nodes/parent-node/IParentNode.d.ts +17 -0
- package/cjs/nodes/parent-node/IParentNode.d.ts.map +1 -1
- package/cjs/nodes/parent-node/ParentNodeUtility.cjs.map +1 -1
- package/cjs/nodes/parent-node/ParentNodeUtility.d.ts.map +1 -1
- package/cjs/query-selector/QuerySelector.cjs.map +1 -1
- package/cjs/query-selector/QuerySelector.d.ts +34 -0
- package/cjs/query-selector/QuerySelector.d.ts.map +1 -1
- package/cjs/version.cjs +1 -1
- package/cjs/window/BrowserWindow.cjs +9 -3
- package/cjs/window/BrowserWindow.cjs.map +1 -1
- package/cjs/window/BrowserWindow.d.ts +5 -4
- package/cjs/window/BrowserWindow.d.ts.map +1 -1
- package/cjs/window/CrossOriginBrowserWindow.d.ts +1 -1
- package/cjs/window/CrossOriginBrowserWindow.d.ts.map +1 -1
- package/cjs/window/IBrowserWindow.d.ts +3 -2
- package/cjs/window/IBrowserWindow.d.ts.map +1 -1
- package/cjs/window/ICrossOriginBrowserWindow.d.ts +1 -1
- package/cjs/window/ICrossOriginBrowserWindow.d.ts.map +1 -1
- package/cjs/window/WindowPageOpenUtility.cjs +4 -2
- package/cjs/window/WindowPageOpenUtility.cjs.map +1 -1
- package/cjs/window/WindowPageOpenUtility.d.ts.map +1 -1
- package/lib/PropertySymbol.d.ts +1 -0
- package/lib/PropertySymbol.d.ts.map +1 -1
- package/lib/PropertySymbol.js +1 -0
- package/lib/PropertySymbol.js.map +1 -1
- package/lib/browser/BrowserFrame.d.ts.map +1 -1
- package/lib/browser/BrowserFrame.js +12 -2
- package/lib/browser/BrowserFrame.js.map +1 -1
- package/lib/browser/detached-browser/DetachedBrowserFrame.d.ts.map +1 -1
- package/lib/browser/detached-browser/DetachedBrowserFrame.js +12 -2
- package/lib/browser/detached-browser/DetachedBrowserFrame.js.map +1 -1
- package/lib/browser/utilities/BrowserFrameFactory.d.ts.map +1 -1
- package/lib/browser/utilities/BrowserFrameFactory.js +5 -0
- package/lib/browser/utilities/BrowserFrameFactory.js.map +1 -1
- package/lib/browser/utilities/BrowserFrameNavigator.d.ts +21 -10
- package/lib/browser/utilities/BrowserFrameNavigator.d.ts.map +1 -1
- package/lib/browser/utilities/BrowserFrameNavigator.js +20 -13
- package/lib/browser/utilities/BrowserFrameNavigator.js.map +1 -1
- package/lib/browser/utilities/BrowserFrameURL.d.ts.map +1 -1
- package/lib/browser/utilities/BrowserFrameURL.js +2 -2
- package/lib/browser/utilities/BrowserFrameURL.js.map +1 -1
- package/lib/config/IHTMLElementTagNameMap.d.ts +146 -0
- package/lib/config/IHTMLElementTagNameMap.d.ts.map +1 -0
- package/lib/config/IHTMLElementTagNameMap.js +2 -0
- package/lib/config/IHTMLElementTagNameMap.js.map +1 -0
- package/lib/config/ISVGElementTagNameMap.d.ts +67 -0
- package/lib/config/ISVGElementTagNameMap.d.ts.map +1 -0
- package/lib/config/ISVGElementTagNameMap.js +2 -0
- package/lib/config/ISVGElementTagNameMap.js.map +1 -0
- package/lib/event/events/HashChangeEvent.d.ts +19 -0
- package/lib/event/events/HashChangeEvent.d.ts.map +1 -0
- package/lib/event/events/HashChangeEvent.js +20 -0
- package/lib/event/events/HashChangeEvent.js.map +1 -0
- package/lib/event/events/IHashChangeEventInit.d.ts +6 -0
- package/lib/event/events/IHashChangeEventInit.d.ts.map +1 -0
- package/lib/event/events/IHashChangeEventInit.js +2 -0
- package/lib/event/events/IHashChangeEventInit.js.map +1 -0
- package/lib/fetch/Fetch.d.ts +0 -10
- package/lib/fetch/Fetch.d.ts.map +1 -1
- package/lib/fetch/Fetch.js +10 -34
- package/lib/fetch/Fetch.js.map +1 -1
- package/lib/fetch/Request.js +2 -2
- package/lib/fetch/Request.js.map +1 -1
- package/lib/fetch/Response.d.ts.map +1 -1
- package/lib/fetch/Response.js +2 -6
- package/lib/fetch/Response.js.map +1 -1
- package/lib/fetch/SyncFetch.js +3 -3
- package/lib/fetch/SyncFetch.js.map +1 -1
- package/lib/fetch/utilities/FetchBodyUtility.d.ts +24 -12
- package/lib/fetch/utilities/FetchBodyUtility.d.ts.map +1 -1
- package/lib/fetch/utilities/FetchBodyUtility.js +62 -19
- package/lib/fetch/utilities/FetchBodyUtility.js.map +1 -1
- package/lib/fetch/utilities/FetchRequestHeaderUtility.d.ts.map +1 -1
- package/lib/fetch/utilities/FetchRequestHeaderUtility.js +4 -2
- package/lib/fetch/utilities/FetchRequestHeaderUtility.js.map +1 -1
- package/lib/fetch/utilities/FetchRequestReferrerUtility.d.ts.map +1 -1
- package/lib/fetch/utilities/FetchRequestReferrerUtility.js +1 -1
- package/lib/fetch/utilities/FetchRequestReferrerUtility.js.map +1 -1
- package/lib/form-data/FormData.d.ts +1 -1
- package/lib/form-data/FormData.d.ts.map +1 -1
- package/lib/form-data/FormData.js +1 -1
- package/lib/form-data/FormData.js.map +1 -1
- package/lib/index.d.ts +7 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/location/Location.d.ts +144 -0
- package/lib/location/Location.d.ts.map +1 -0
- package/lib/location/Location.js +241 -0
- package/lib/location/Location.js.map +1 -0
- package/lib/named-node-map/NamedNodeMap.d.ts.map +1 -1
- package/lib/named-node-map/NamedNodeMap.js +2 -1
- package/lib/named-node-map/NamedNodeMap.js.map +1 -1
- package/lib/nodes/document/Document.d.ts +114 -6
- package/lib/nodes/document/Document.d.ts.map +1 -1
- package/lib/nodes/document/Document.js +4 -4
- package/lib/nodes/document/Document.js.map +1 -1
- package/lib/nodes/document/IDocument.d.ts +28 -12
- package/lib/nodes/document/IDocument.d.ts.map +1 -1
- package/lib/nodes/document-fragment/DocumentFragment.d.ts +31 -1
- package/lib/nodes/document-fragment/DocumentFragment.d.ts.map +1 -1
- package/lib/nodes/document-fragment/DocumentFragment.js +2 -2
- package/lib/nodes/document-fragment/DocumentFragment.js.map +1 -1
- package/lib/nodes/document-fragment/IDocumentFragment.d.ts +6 -0
- package/lib/nodes/document-fragment/IDocumentFragment.d.ts.map +1 -1
- package/lib/nodes/element/Element.d.ts +61 -1
- package/lib/nodes/element/Element.d.ts.map +1 -1
- package/lib/nodes/element/Element.js +1 -1
- package/lib/nodes/element/Element.js.map +1 -1
- package/lib/nodes/element/HTMLCollection.d.ts.map +1 -1
- package/lib/nodes/element/HTMLCollection.js +2 -1
- package/lib/nodes/element/HTMLCollection.js.map +1 -1
- package/lib/nodes/html-anchor-element/HTMLAnchorElement.d.ts.map +1 -1
- package/lib/nodes/html-anchor-element/HTMLAnchorElement.js +2 -0
- package/lib/nodes/html-anchor-element/HTMLAnchorElement.js.map +1 -1
- package/lib/nodes/html-button-element/HTMLButtonElement.d.ts +49 -1
- package/lib/nodes/html-button-element/HTMLButtonElement.d.ts.map +1 -1
- package/lib/nodes/html-button-element/HTMLButtonElement.js +93 -4
- package/lib/nodes/html-button-element/HTMLButtonElement.js.map +1 -1
- package/lib/nodes/html-button-element/IHTMLButtonElement.d.ts +5 -1
- package/lib/nodes/html-button-element/IHTMLButtonElement.d.ts.map +1 -1
- package/lib/nodes/html-form-element/HTMLFormControlsCollection.d.ts.map +1 -1
- package/lib/nodes/html-form-element/HTMLFormControlsCollection.js +2 -1
- package/lib/nodes/html-form-element/HTMLFormControlsCollection.js.map +1 -1
- package/lib/nodes/html-form-element/HTMLFormElement.d.ts +8 -2
- package/lib/nodes/html-form-element/HTMLFormElement.d.ts.map +1 -1
- package/lib/nodes/html-form-element/HTMLFormElement.js +106 -10
- package/lib/nodes/html-form-element/HTMLFormElement.js.map +1 -1
- package/lib/nodes/html-iframe-element/HTMLIFrameElement.d.ts +10 -0
- package/lib/nodes/html-iframe-element/HTMLIFrameElement.d.ts.map +1 -1
- package/lib/nodes/html-iframe-element/HTMLIFrameElement.js +14 -0
- package/lib/nodes/html-iframe-element/HTMLIFrameElement.js.map +1 -1
- package/lib/nodes/html-iframe-element/HTMLIFrameElementPageLoader.d.ts.map +1 -1
- package/lib/nodes/html-iframe-element/HTMLIFrameElementPageLoader.js +4 -1
- package/lib/nodes/html-iframe-element/HTMLIFrameElementPageLoader.js.map +1 -1
- package/lib/nodes/html-iframe-element/IHTMLIFrameElement.d.ts +1 -0
- package/lib/nodes/html-iframe-element/IHTMLIFrameElement.d.ts.map +1 -1
- package/lib/nodes/html-input-element/HTMLInputElement.d.ts +49 -23
- package/lib/nodes/html-input-element/HTMLInputElement.d.ts.map +1 -1
- package/lib/nodes/html-input-element/HTMLInputElement.js +100 -52
- package/lib/nodes/html-input-element/HTMLInputElement.js.map +1 -1
- package/lib/nodes/html-input-element/IHTMLInputElement.d.ts +2 -0
- package/lib/nodes/html-input-element/IHTMLInputElement.d.ts.map +1 -1
- package/lib/nodes/html-label-element/HTMLLabelElement.d.ts.map +1 -1
- package/lib/nodes/html-label-element/HTMLLabelElement.js +1 -0
- package/lib/nodes/html-label-element/HTMLLabelElement.js.map +1 -1
- package/lib/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.js +1 -1
- package/lib/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.js.map +1 -1
- package/lib/nodes/html-script-element/HTMLScriptElementScriptLoader.js +1 -1
- package/lib/nodes/html-script-element/HTMLScriptElementScriptLoader.js.map +1 -1
- package/lib/nodes/html-select-element/HTMLSelectElement.d.ts.map +1 -1
- package/lib/nodes/html-select-element/HTMLSelectElement.js.map +1 -1
- package/lib/nodes/node/Node.d.ts.map +1 -1
- package/lib/nodes/node/Node.js.map +1 -1
- package/lib/nodes/parent-node/IParentNode.d.ts +17 -0
- package/lib/nodes/parent-node/IParentNode.d.ts.map +1 -1
- package/lib/nodes/parent-node/ParentNodeUtility.d.ts.map +1 -1
- package/lib/nodes/parent-node/ParentNodeUtility.js.map +1 -1
- package/lib/query-selector/QuerySelector.d.ts +34 -0
- package/lib/query-selector/QuerySelector.d.ts.map +1 -1
- package/lib/query-selector/QuerySelector.js.map +1 -1
- package/lib/version.js +1 -1
- package/lib/window/BrowserWindow.d.ts +5 -4
- package/lib/window/BrowserWindow.d.ts.map +1 -1
- package/lib/window/BrowserWindow.js +10 -4
- package/lib/window/BrowserWindow.js.map +1 -1
- package/lib/window/CrossOriginBrowserWindow.d.ts +1 -1
- package/lib/window/CrossOriginBrowserWindow.d.ts.map +1 -1
- package/lib/window/IBrowserWindow.d.ts +3 -2
- package/lib/window/IBrowserWindow.d.ts.map +1 -1
- package/lib/window/ICrossOriginBrowserWindow.d.ts +1 -1
- package/lib/window/ICrossOriginBrowserWindow.d.ts.map +1 -1
- package/lib/window/WindowPageOpenUtility.d.ts.map +1 -1
- package/lib/window/WindowPageOpenUtility.js +4 -2
- package/lib/window/WindowPageOpenUtility.js.map +1 -1
- package/package.json +1 -1
- package/src/PropertySymbol.ts +1 -0
- package/src/browser/BrowserFrame.ts +12 -2
- package/src/browser/detached-browser/DetachedBrowserFrame.ts +12 -7
- package/src/browser/utilities/BrowserFrameFactory.ts +7 -0
- package/src/browser/utilities/BrowserFrameNavigator.ts +28 -18
- package/src/browser/utilities/BrowserFrameURL.ts +2 -2
- package/src/config/IHTMLElementTagNameMap.ts +151 -0
- package/src/config/ISVGElementTagNameMap.ts +67 -0
- package/src/event/events/HashChangeEvent.ts +25 -0
- package/src/event/events/IHashChangeEventInit.ts +6 -0
- package/src/fetch/Fetch.ts +28 -37
- package/src/fetch/Request.ts +2 -2
- package/src/fetch/Response.ts +3 -6
- package/src/fetch/SyncFetch.ts +3 -3
- package/src/fetch/utilities/FetchBodyUtility.ts +67 -20
- package/src/fetch/utilities/FetchRequestHeaderUtility.ts +4 -5
- package/src/fetch/utilities/FetchRequestReferrerUtility.ts +2 -1
- package/src/form-data/FormData.ts +2 -2
- package/src/index.ts +9 -1
- package/src/location/Location.ts +257 -0
- package/src/named-node-map/NamedNodeMap.ts +1 -0
- package/src/nodes/document/Document.ts +224 -17
- package/src/nodes/document/IDocument.ts +33 -11
- package/src/nodes/document-fragment/DocumentFragment.ts +59 -1
- package/src/nodes/document-fragment/IDocumentFragment.ts +14 -0
- package/src/nodes/element/Element.ts +120 -1
- package/src/nodes/element/HTMLCollection.ts +1 -0
- package/src/nodes/html-anchor-element/HTMLAnchorElement.ts +2 -0
- package/src/nodes/html-button-element/HTMLButtonElement.ts +107 -5
- package/src/nodes/html-button-element/IHTMLButtonElement.ts +5 -1
- package/src/nodes/html-form-element/HTMLFormControlsCollection.ts +1 -0
- package/src/nodes/html-form-element/HTMLFormElement.ts +111 -5
- package/src/nodes/html-iframe-element/HTMLIFrameElement.ts +16 -0
- package/src/nodes/html-iframe-element/HTMLIFrameElementPageLoader.ts +5 -1
- package/src/nodes/html-iframe-element/IHTMLIFrameElement.ts +1 -0
- package/src/nodes/html-input-element/HTMLInputElement.ts +111 -57
- package/src/nodes/html-input-element/IHTMLInputElement.ts +2 -0
- package/src/nodes/html-label-element/HTMLLabelElement.ts +1 -0
- package/src/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.ts +1 -1
- package/src/nodes/html-script-element/HTMLScriptElementScriptLoader.ts +1 -1
- package/src/nodes/html-select-element/HTMLSelectElement.ts +1 -2
- package/src/nodes/node/Node.ts +1 -2
- package/src/nodes/parent-node/IParentNode.ts +36 -0
- package/src/nodes/parent-node/ParentNodeUtility.ts +1 -0
- package/src/query-selector/QuerySelector.ts +76 -2
- package/src/window/BrowserWindow.ts +11 -4
- package/src/window/CrossOriginBrowserWindow.ts +1 -1
- package/src/window/IBrowserWindow.ts +3 -2
- package/src/window/ICrossOriginBrowserWindow.ts +1 -1
- package/src/window/WindowPageOpenUtility.ts +4 -2
- package/cjs/url/Location.cjs +0 -111
- package/cjs/url/Location.cjs.map +0 -1
- package/cjs/url/Location.d.ts +0 -48
- package/cjs/url/Location.d.ts.map +0 -1
- package/lib/url/Location.d.ts +0 -48
- package/lib/url/Location.d.ts.map +0 -1
- package/lib/url/Location.js +0 -82
- package/lib/url/Location.js.map +0 -1
- package/src/url/Location.ts +0 -79
@@ -167,7 +167,12 @@ export default class DetachedBrowserFrame implements IBrowserFrame {
|
|
167
167
|
* @returns Response.
|
168
168
|
*/
|
169
169
|
public goto(url: string, options?: IGoToOptions): Promise<IResponse | null> {
|
170
|
-
return BrowserFrameNavigator.
|
170
|
+
return BrowserFrameNavigator.navigate({
|
171
|
+
windowClass: this.page.context.browser.windowClass,
|
172
|
+
frame: this,
|
173
|
+
url: url,
|
174
|
+
goToOptions: options
|
175
|
+
});
|
171
176
|
}
|
172
177
|
|
173
178
|
/**
|
@@ -177,11 +182,11 @@ export default class DetachedBrowserFrame implements IBrowserFrame {
|
|
177
182
|
* @returns Response.
|
178
183
|
*/
|
179
184
|
public reload(options: IReloadOptions): Promise<IResponse | null> {
|
180
|
-
return BrowserFrameNavigator.
|
181
|
-
this.page.context.browser.windowClass,
|
182
|
-
this,
|
183
|
-
this.url,
|
184
|
-
options
|
185
|
-
);
|
185
|
+
return BrowserFrameNavigator.navigate({
|
186
|
+
windowClass: this.page.context.browser.windowClass,
|
187
|
+
frame: this,
|
188
|
+
url: this.url,
|
189
|
+
goToOptions: options
|
190
|
+
});
|
186
191
|
}
|
187
192
|
}
|
@@ -63,11 +63,18 @@ export default class BrowserFrameFactory {
|
|
63
63
|
return frame[PropertySymbol.asyncTaskManager].destroy().then(() => {
|
64
64
|
frame[PropertySymbol.exceptionObserver]?.disconnect();
|
65
65
|
if (frame.window) {
|
66
|
+
const listeners = frame[PropertySymbol.listeners];
|
67
|
+
|
66
68
|
frame.window[PropertySymbol.destroy]();
|
67
69
|
(<IBrowserPage | null>frame.page) = null;
|
68
70
|
(<IBrowserWindow | null>frame.window) = null;
|
71
|
+
frame[PropertySymbol.listeners] = null;
|
69
72
|
frame[PropertySymbol.openerFrame] = null;
|
70
73
|
frame[PropertySymbol.openerWindow] = null;
|
74
|
+
|
75
|
+
for (const listener of listeners.navigation) {
|
76
|
+
listener();
|
77
|
+
}
|
71
78
|
}
|
72
79
|
resolve();
|
73
80
|
});
|
@@ -11,30 +11,38 @@ import BrowserFrameURL from './BrowserFrameURL.js';
|
|
11
11
|
import BrowserFrameValidator from './BrowserFrameValidator.js';
|
12
12
|
import AsyncTaskManager from '../../async-task-manager/AsyncTaskManager.js';
|
13
13
|
import BrowserErrorCaptureEnum from '../enums/BrowserErrorCaptureEnum.js';
|
14
|
+
import FormData from '../../form-data/FormData.js';
|
14
15
|
|
15
16
|
/**
|
16
17
|
* Browser frame navigation utility.
|
17
18
|
*/
|
18
19
|
export default class BrowserFrameNavigator {
|
19
20
|
/**
|
20
|
-
*
|
21
|
+
* Navigates to a page.
|
21
22
|
*
|
22
23
|
* @throws Error if the request can't be resolved (because of SSL error or similar). It will not throw if the response is not ok.
|
23
|
-
* @param
|
24
|
-
* @param
|
25
|
-
* @param
|
26
|
-
* @param
|
24
|
+
* @param options Options.
|
25
|
+
* @param options.windowClass Window class.
|
26
|
+
* @param options.frame Frame.
|
27
|
+
* @param options.url URL.
|
28
|
+
* @param [options.formData] Form data.
|
29
|
+
* @param [options.method] Method.
|
30
|
+
* @param [options.goToOptions] Go to options.
|
27
31
|
* @returns Response.
|
28
32
|
*/
|
29
|
-
public static async
|
33
|
+
public static async navigate(options: {
|
30
34
|
windowClass: new (
|
31
35
|
browserFrame: IBrowserFrame,
|
32
36
|
options?: { url?: string; width?: number; height?: number }
|
33
|
-
) => IBrowserWindow
|
34
|
-
frame: IBrowserFrame
|
35
|
-
url: string
|
36
|
-
|
37
|
-
|
37
|
+
) => IBrowserWindow;
|
38
|
+
frame: IBrowserFrame;
|
39
|
+
url: string;
|
40
|
+
goToOptions?: IGoToOptions;
|
41
|
+
method?: string;
|
42
|
+
formData?: FormData;
|
43
|
+
}): Promise<IResponse | null> {
|
44
|
+
const { windowClass, frame, url, formData, method, goToOptions } = options;
|
45
|
+
const referrer = goToOptions?.referrer || frame.window.location.origin;
|
38
46
|
const targetURL = BrowserFrameURL.getRelativeURL(frame, url);
|
39
47
|
|
40
48
|
if (!frame.window) {
|
@@ -98,8 +106,8 @@ export default class BrowserFrameNavigator {
|
|
98
106
|
(<IBrowserWindow>frame.window) = new windowClass(frame, { url: targetURL.href, width, height });
|
99
107
|
(<number>frame.window.devicePixelRatio) = devicePixelRatio;
|
100
108
|
|
101
|
-
if (
|
102
|
-
frame.window.document[PropertySymbol.referrer] =
|
109
|
+
if (referrer) {
|
110
|
+
frame.window.document[PropertySymbol.referrer] = referrer;
|
103
111
|
}
|
104
112
|
|
105
113
|
if (targetURL.protocol === 'about:') {
|
@@ -118,7 +126,7 @@ export default class BrowserFrameNavigator {
|
|
118
126
|
|
119
127
|
const timeout = frame.window.setTimeout(
|
120
128
|
() => abortController.abort('Request timed out.'),
|
121
|
-
|
129
|
+
goToOptions?.timeout ?? 30000
|
122
130
|
);
|
123
131
|
const finalize = (): void => {
|
124
132
|
frame.window.clearTimeout(timeout);
|
@@ -132,16 +140,18 @@ export default class BrowserFrameNavigator {
|
|
132
140
|
|
133
141
|
try {
|
134
142
|
response = await frame.window.fetch(targetURL.href, {
|
135
|
-
referrer
|
136
|
-
referrerPolicy:
|
143
|
+
referrer,
|
144
|
+
referrerPolicy: goToOptions?.referrerPolicy || 'origin',
|
137
145
|
signal: abortController.signal,
|
138
|
-
|
146
|
+
method: method || (formData ? 'POST' : 'GET'),
|
147
|
+
headers: goToOptions?.hard ? { 'Cache-Control': 'no-cache' } : undefined,
|
148
|
+
body: formData
|
139
149
|
});
|
140
150
|
|
141
151
|
// Handles the "X-Frame-Options" header for child frames.
|
142
152
|
if (frame.parentFrame) {
|
143
153
|
const originURL = frame.parentFrame.window.location;
|
144
|
-
const xFrameOptions = response.headers
|
154
|
+
const xFrameOptions = response.headers?.get('X-Frame-Options')?.toLowerCase();
|
145
155
|
const isSameOrigin = originURL.origin === targetURL.origin || targetURL.origin === 'null';
|
146
156
|
|
147
157
|
if (xFrameOptions === 'deny' || (xFrameOptions === 'sameorigin' && !isSameOrigin)) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import IBrowserFrame from '../types/IBrowserFrame.js';
|
2
|
-
import { URL } from 'url';
|
3
2
|
import DOMException from '../../exception/DOMException.js';
|
4
3
|
import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum.js';
|
4
|
+
import { URL } from 'url';
|
5
5
|
|
6
6
|
/**
|
7
7
|
* Browser frame URL utility.
|
@@ -22,7 +22,7 @@ export default class BrowserFrameURL {
|
|
22
22
|
}
|
23
23
|
|
24
24
|
try {
|
25
|
-
return new URL(url, frame.window.location);
|
25
|
+
return new URL(url, frame.window.location.href);
|
26
26
|
} catch (e) {
|
27
27
|
if (frame.window.location.hostname) {
|
28
28
|
throw new DOMException(
|
@@ -0,0 +1,151 @@
|
|
1
|
+
import IHTMLAnchorElement from '../nodes/html-anchor-element/IHTMLAnchorElement.js';
|
2
|
+
import IHTMLElement from '../nodes/html-element/IHTMLElement.js';
|
3
|
+
import IHTMLAudioElement from '../nodes/html-audio-element/IHTMLAudioElement.js';
|
4
|
+
import IHTMLBaseElement from '../nodes/html-base-element/IHTMLBaseElement.js';
|
5
|
+
import IHTMLTemplateElement from '../nodes/html-template-element/IHTMLTemplateElement.js';
|
6
|
+
import IHTMLFormElement from '../nodes/html-form-element/IHTMLFormElement.js';
|
7
|
+
import IHTMLInputElement from '../nodes/html-input-element/IHTMLInputElement.js';
|
8
|
+
import IHTMLTextAreaElement from '../nodes/html-text-area-element/IHTMLTextAreaElement.js';
|
9
|
+
import IHTMLScriptElement from '../nodes/html-script-element/IHTMLScriptElement.js';
|
10
|
+
import IHTMLImageElement from '../nodes/html-image-element/IHTMLImageElement.js';
|
11
|
+
import IHTMLLinkElement from '../nodes/html-link-element/IHTMLLinkElement.js';
|
12
|
+
import IHTMLStyleElement from '../nodes/html-style-element/IHTMLStyleElement.js';
|
13
|
+
import IHTMLLabelElement from '../nodes/html-label-element/IHTMLLabelElement.js';
|
14
|
+
import IHTMLSlotElement from '../nodes/html-slot-element/IHTMLSlotElement.js';
|
15
|
+
import IHTMLMetaElement from '../nodes/html-meta-element/IHTMLMetaElement.js';
|
16
|
+
import IHTMLButtonElement from '../nodes/html-button-element/IHTMLButtonElement.js';
|
17
|
+
import IHTMLDialogElement from '../nodes/html-dialog-element/IHTMLDialogElement.js';
|
18
|
+
import IHTMLIFrameElement from '../nodes/html-iframe-element/IHTMLIFrameElement.js';
|
19
|
+
import IHTMLOptGroupElement from '../nodes/html-opt-group-element/IHTMLOptGroupElement.js';
|
20
|
+
import IHTMLOptionElement from '../nodes/html-option-element/IHTMLOptionElement.js';
|
21
|
+
import IHTMLSelectElement from '../nodes/html-select-element/IHTMLSelectElement.js';
|
22
|
+
import IHTMLVideoElement from '../nodes/html-video-element/IHTMLVideoElement.js';
|
23
|
+
|
24
|
+
// Makes it work with custom elements when they declare their own interface.
|
25
|
+
declare global {
|
26
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
27
|
+
/* eslint-disable @typescript-eslint/no-empty-interface */
|
28
|
+
interface HTMLElementTagNameMap {}
|
29
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
30
|
+
/* eslint-enable @typescript-eslint/no-empty-interface */
|
31
|
+
}
|
32
|
+
|
33
|
+
export default interface IHTMLElementTagNameMap extends HTMLElementTagNameMap {
|
34
|
+
a: IHTMLAnchorElement;
|
35
|
+
abbr: IHTMLElement;
|
36
|
+
address: IHTMLElement;
|
37
|
+
area: IHTMLElement;
|
38
|
+
article: IHTMLElement;
|
39
|
+
aside: IHTMLElement;
|
40
|
+
audio: IHTMLAudioElement;
|
41
|
+
b: IHTMLElement;
|
42
|
+
base: IHTMLBaseElement;
|
43
|
+
bdi: IHTMLElement;
|
44
|
+
bdo: IHTMLElement;
|
45
|
+
blockquaote: IHTMLElement;
|
46
|
+
body: IHTMLElement;
|
47
|
+
template: IHTMLTemplateElement;
|
48
|
+
form: IHTMLFormElement;
|
49
|
+
input: IHTMLInputElement;
|
50
|
+
textarea: IHTMLTextAreaElement;
|
51
|
+
script: IHTMLScriptElement;
|
52
|
+
img: IHTMLImageElement;
|
53
|
+
link: IHTMLLinkElement;
|
54
|
+
style: IHTMLStyleElement;
|
55
|
+
label: IHTMLLabelElement;
|
56
|
+
slot: IHTMLSlotElement;
|
57
|
+
meta: IHTMLMetaElement;
|
58
|
+
blockquote: IHTMLElement;
|
59
|
+
br: IHTMLElement;
|
60
|
+
button: IHTMLButtonElement;
|
61
|
+
canvas: IHTMLElement;
|
62
|
+
caption: IHTMLElement;
|
63
|
+
cite: IHTMLElement;
|
64
|
+
code: IHTMLElement;
|
65
|
+
col: IHTMLElement;
|
66
|
+
colgroup: IHTMLElement;
|
67
|
+
data: IHTMLElement;
|
68
|
+
datalist: IHTMLElement;
|
69
|
+
dd: IHTMLElement;
|
70
|
+
del: IHTMLElement;
|
71
|
+
details: IHTMLElement;
|
72
|
+
dfn: IHTMLElement;
|
73
|
+
dialog: IHTMLDialogElement;
|
74
|
+
div: IHTMLElement;
|
75
|
+
dl: IHTMLElement;
|
76
|
+
dt: IHTMLElement;
|
77
|
+
em: IHTMLElement;
|
78
|
+
embed: IHTMLElement;
|
79
|
+
fieldset: IHTMLElement;
|
80
|
+
figcaption: IHTMLElement;
|
81
|
+
figure: IHTMLElement;
|
82
|
+
footer: IHTMLElement;
|
83
|
+
h1: IHTMLElement;
|
84
|
+
h2: IHTMLElement;
|
85
|
+
h3: IHTMLElement;
|
86
|
+
h4: IHTMLElement;
|
87
|
+
h5: IHTMLElement;
|
88
|
+
h6: IHTMLElement;
|
89
|
+
head: IHTMLElement;
|
90
|
+
header: IHTMLElement;
|
91
|
+
hgroup: IHTMLElement;
|
92
|
+
hr: IHTMLElement;
|
93
|
+
html: IHTMLElement;
|
94
|
+
i: IHTMLElement;
|
95
|
+
iframe: IHTMLIFrameElement;
|
96
|
+
ins: IHTMLElement;
|
97
|
+
kbd: IHTMLElement;
|
98
|
+
legend: IHTMLElement;
|
99
|
+
li: IHTMLElement;
|
100
|
+
main: IHTMLElement;
|
101
|
+
map: IHTMLElement;
|
102
|
+
mark: IHTMLElement;
|
103
|
+
math: IHTMLElement;
|
104
|
+
menu: IHTMLElement;
|
105
|
+
menuitem: IHTMLElement;
|
106
|
+
meter: IHTMLElement;
|
107
|
+
nav: IHTMLElement;
|
108
|
+
noscript: IHTMLElement;
|
109
|
+
object: IHTMLElement;
|
110
|
+
ol: IHTMLElement;
|
111
|
+
optgroup: IHTMLOptGroupElement;
|
112
|
+
option: IHTMLOptionElement;
|
113
|
+
output: IHTMLElement;
|
114
|
+
p: IHTMLElement;
|
115
|
+
param: IHTMLElement;
|
116
|
+
picture: IHTMLElement;
|
117
|
+
pre: IHTMLElement;
|
118
|
+
progress: IHTMLElement;
|
119
|
+
q: IHTMLElement;
|
120
|
+
rb: IHTMLElement;
|
121
|
+
rp: IHTMLElement;
|
122
|
+
rt: IHTMLElement;
|
123
|
+
rtc: IHTMLElement;
|
124
|
+
ruby: IHTMLElement;
|
125
|
+
s: IHTMLElement;
|
126
|
+
samp: IHTMLElement;
|
127
|
+
section: IHTMLElement;
|
128
|
+
select: IHTMLSelectElement;
|
129
|
+
small: IHTMLElement;
|
130
|
+
source: IHTMLElement;
|
131
|
+
span: IHTMLElement;
|
132
|
+
strong: IHTMLElement;
|
133
|
+
sub: IHTMLElement;
|
134
|
+
summary: IHTMLElement;
|
135
|
+
sup: IHTMLElement;
|
136
|
+
table: IHTMLElement;
|
137
|
+
tbody: IHTMLElement;
|
138
|
+
td: IHTMLElement;
|
139
|
+
tfoot: IHTMLElement;
|
140
|
+
th: IHTMLElement;
|
141
|
+
thead: IHTMLElement;
|
142
|
+
time: IHTMLElement;
|
143
|
+
title: IHTMLElement;
|
144
|
+
tr: IHTMLElement;
|
145
|
+
track: IHTMLElement;
|
146
|
+
u: IHTMLElement;
|
147
|
+
ul: IHTMLElement;
|
148
|
+
var: IHTMLElement;
|
149
|
+
video: IHTMLVideoElement;
|
150
|
+
wbr: IHTMLElement;
|
151
|
+
}
|
@@ -0,0 +1,67 @@
|
|
1
|
+
import ISVGSVGElement from '../nodes/svg-element/ISVGSVGElement.js';
|
2
|
+
import ISVGElement from '../nodes/svg-element/ISVGElement.js';
|
3
|
+
|
4
|
+
export default interface ISVGElementTagNameMap {
|
5
|
+
svg: ISVGSVGElement;
|
6
|
+
animate: ISVGElement;
|
7
|
+
animateMotion: ISVGElement;
|
8
|
+
animateTransform: ISVGElement;
|
9
|
+
circle: ISVGElement;
|
10
|
+
clipPath: ISVGElement;
|
11
|
+
defs: ISVGElement;
|
12
|
+
desc: ISVGElement;
|
13
|
+
ellipse: ISVGElement;
|
14
|
+
feBlend: ISVGElement;
|
15
|
+
feColorMatrix: ISVGElement;
|
16
|
+
feComponentTransfer: ISVGElement;
|
17
|
+
feComposite: ISVGElement;
|
18
|
+
feConvolveMatrix: ISVGElement;
|
19
|
+
feDiffuseLighting: ISVGElement;
|
20
|
+
feDisplacementMap: ISVGElement;
|
21
|
+
feDistantLight: ISVGElement;
|
22
|
+
feDropShadow: ISVGElement;
|
23
|
+
feFlood: ISVGElement;
|
24
|
+
feFuncA: ISVGElement;
|
25
|
+
feFuncB: ISVGElement;
|
26
|
+
feFuncG: ISVGElement;
|
27
|
+
feFuncR: ISVGElement;
|
28
|
+
feGaussianBlur: ISVGElement;
|
29
|
+
feImage: ISVGElement;
|
30
|
+
feMerge: ISVGElement;
|
31
|
+
feMergeNode: ISVGElement;
|
32
|
+
feMorphology: ISVGElement;
|
33
|
+
feOffset: ISVGElement;
|
34
|
+
fePointLight: ISVGElement;
|
35
|
+
feSpecularLighting: ISVGElement;
|
36
|
+
feSpotLight: ISVGElement;
|
37
|
+
feTile: ISVGElement;
|
38
|
+
feTurbulence: ISVGElement;
|
39
|
+
filter: ISVGElement;
|
40
|
+
foreignObject: ISVGElement;
|
41
|
+
g: ISVGElement;
|
42
|
+
image: ISVGElement;
|
43
|
+
line: ISVGElement;
|
44
|
+
linearGradient: ISVGElement;
|
45
|
+
marker: ISVGElement;
|
46
|
+
mask: ISVGElement;
|
47
|
+
metadata: ISVGElement;
|
48
|
+
mpath: ISVGElement;
|
49
|
+
path: ISVGElement;
|
50
|
+
pattern: ISVGElement;
|
51
|
+
polygon: ISVGElement;
|
52
|
+
polyline: ISVGElement;
|
53
|
+
radialGradient: ISVGElement;
|
54
|
+
rect: ISVGElement;
|
55
|
+
script: ISVGElement;
|
56
|
+
set: ISVGElement;
|
57
|
+
stop: ISVGElement;
|
58
|
+
style: ISVGElement;
|
59
|
+
switch: ISVGElement;
|
60
|
+
symbol: ISVGElement;
|
61
|
+
text: ISVGElement;
|
62
|
+
textPath: ISVGElement;
|
63
|
+
title: ISVGElement;
|
64
|
+
tspan: ISVGElement;
|
65
|
+
use: ISVGElement;
|
66
|
+
view: ISVGElement;
|
67
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import Event from '../Event.js';
|
2
|
+
import IHashChangeEventInit from './IHashChangeEventInit.js';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Hash change event.
|
6
|
+
*
|
7
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/HashChangeEvent
|
8
|
+
*/
|
9
|
+
export default class HashChangeEvent extends Event {
|
10
|
+
public readonly newURL: string;
|
11
|
+
public readonly oldURL: string;
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Constructor.
|
15
|
+
*
|
16
|
+
* @param type Event type.
|
17
|
+
* @param [eventInit] Event init.
|
18
|
+
*/
|
19
|
+
constructor(type: string, eventInit: IHashChangeEventInit | null = null) {
|
20
|
+
super(type, eventInit);
|
21
|
+
|
22
|
+
this.newURL = eventInit?.newURL ?? '';
|
23
|
+
this.oldURL = eventInit?.oldURL ?? '';
|
24
|
+
}
|
25
|
+
}
|
package/src/fetch/Fetch.ts
CHANGED
@@ -14,7 +14,6 @@ import { Socket } from 'net';
|
|
14
14
|
import Stream from 'stream';
|
15
15
|
import DataURIParser from './data-uri/DataURIParser.js';
|
16
16
|
import FetchCORSUtility from './utilities/FetchCORSUtility.js';
|
17
|
-
import { ReadableStream } from 'stream/web';
|
18
17
|
import Request from './Request.js';
|
19
18
|
import Response from './Response.js';
|
20
19
|
import Event from '../event/Event.js';
|
@@ -28,6 +27,7 @@ import FetchResponseRedirectUtility from './utilities/FetchResponseRedirectUtili
|
|
28
27
|
import FetchResponseHeaderUtility from './utilities/FetchResponseHeaderUtility.js';
|
29
28
|
import FetchHTTPSCertificate from './certificate/FetchHTTPSCertificate.js';
|
30
29
|
import { Buffer } from 'buffer';
|
30
|
+
import FetchBodyUtility from './utilities/FetchBodyUtility.js';
|
31
31
|
|
32
32
|
const LAST_CHUNK = Buffer.from('0\r\n\r\n');
|
33
33
|
|
@@ -102,7 +102,7 @@ export default class Fetch {
|
|
102
102
|
* @returns Response.
|
103
103
|
*/
|
104
104
|
public async send(): Promise<IResponse> {
|
105
|
-
FetchRequestReferrerUtility.prepareRequest(this.#window.location, this.request);
|
105
|
+
FetchRequestReferrerUtility.prepareRequest(new URL(this.#window.location.href), this.request);
|
106
106
|
FetchRequestValidationUtility.validateSchema(this.request);
|
107
107
|
|
108
108
|
if (this.request.signal.aborted) {
|
@@ -247,7 +247,7 @@ export default class Fetch {
|
|
247
247
|
private async compliesWithCrossOriginPolicy(): Promise<boolean> {
|
248
248
|
if (
|
249
249
|
this.disableCrossOriginPolicy ||
|
250
|
-
!FetchCORSUtility.isCORS(this.#window.location, this.request[PropertySymbol.url])
|
250
|
+
!FetchCORSUtility.isCORS(this.#window.location.href, this.request[PropertySymbol.url])
|
251
251
|
) {
|
252
252
|
return true;
|
253
253
|
}
|
@@ -545,7 +545,10 @@ export default class Fetch {
|
|
545
545
|
nodeResponse.statusCode === 204 ||
|
546
546
|
nodeResponse.statusCode === 304
|
547
547
|
) {
|
548
|
-
this.response = new this.#window.Response(
|
548
|
+
this.response = new this.#window.Response(
|
549
|
+
FetchBodyUtility.nodeToWebStream(body),
|
550
|
+
responseOptions
|
551
|
+
);
|
549
552
|
(<boolean>this.response.redirected) = this.redirectCount > 0;
|
550
553
|
(<string>this.response.url) = this.request.url;
|
551
554
|
this.resolve(this.response);
|
@@ -567,7 +570,10 @@ export default class Fetch {
|
|
567
570
|
// Ignore error as it is forwarded to the response body.
|
568
571
|
}
|
569
572
|
});
|
570
|
-
this.response = new this.#window.Response(
|
573
|
+
this.response = new this.#window.Response(
|
574
|
+
FetchBodyUtility.nodeToWebStream(body),
|
575
|
+
responseOptions
|
576
|
+
);
|
571
577
|
(<boolean>this.response.redirected) = this.redirectCount > 0;
|
572
578
|
(<string>this.response.url) = this.request.url;
|
573
579
|
this.resolve(this.response);
|
@@ -599,7 +605,10 @@ export default class Fetch {
|
|
599
605
|
});
|
600
606
|
}
|
601
607
|
|
602
|
-
this.response = new this.#window.Response(
|
608
|
+
this.response = new this.#window.Response(
|
609
|
+
FetchBodyUtility.nodeToWebStream(body),
|
610
|
+
responseOptions
|
611
|
+
);
|
603
612
|
(<boolean>this.response.redirected) = this.redirectCount > 0;
|
604
613
|
(<string>this.response.url) = this.request.url;
|
605
614
|
this.resolve(this.response);
|
@@ -607,7 +616,10 @@ export default class Fetch {
|
|
607
616
|
raw.on('end', () => {
|
608
617
|
// Some old IIS servers return zero-length OK deflate responses, so 'data' is never emitted.
|
609
618
|
if (!this.response) {
|
610
|
-
this.response = new this.#window.Response(
|
619
|
+
this.response = new this.#window.Response(
|
620
|
+
FetchBodyUtility.nodeToWebStream(body),
|
621
|
+
responseOptions
|
622
|
+
);
|
611
623
|
(<boolean>this.response.redirected) = this.redirectCount > 0;
|
612
624
|
(<string>this.response.url) = this.request.url;
|
613
625
|
this.resolve(this.response);
|
@@ -623,7 +635,10 @@ export default class Fetch {
|
|
623
635
|
// Ignore error as it is forwarded to the response body.
|
624
636
|
}
|
625
637
|
});
|
626
|
-
this.response = new this.#window.Response(
|
638
|
+
this.response = new this.#window.Response(
|
639
|
+
FetchBodyUtility.nodeToWebStream(body),
|
640
|
+
responseOptions
|
641
|
+
);
|
627
642
|
(<boolean>this.response.redirected) = this.redirectCount > 0;
|
628
643
|
(<string>this.response.url) = this.request.url;
|
629
644
|
this.resolve(this.response);
|
@@ -631,7 +646,10 @@ export default class Fetch {
|
|
631
646
|
}
|
632
647
|
|
633
648
|
// Otherwise, use response as is
|
634
|
-
this.response = new this.#window.Response(
|
649
|
+
this.response = new this.#window.Response(
|
650
|
+
FetchBodyUtility.nodeToWebStream(body),
|
651
|
+
responseOptions
|
652
|
+
);
|
635
653
|
(<boolean>this.response.redirected) = this.redirectCount > 0;
|
636
654
|
(<string>this.response.url) = this.request.url;
|
637
655
|
this.resolve(this.response);
|
@@ -714,7 +732,7 @@ export default class Fetch {
|
|
714
732
|
if (
|
715
733
|
this.request.credentials === 'omit' ||
|
716
734
|
(this.request.credentials === 'same-origin' &&
|
717
|
-
FetchCORSUtility.isCORS(this.#window.location, locationURL))
|
735
|
+
FetchCORSUtility.isCORS(this.#window.location.href, locationURL))
|
718
736
|
) {
|
719
737
|
headers.delete('authorization');
|
720
738
|
headers.delete('www-authenticate');
|
@@ -806,31 +824,4 @@ export default class Fetch {
|
|
806
824
|
this.reject(error);
|
807
825
|
}
|
808
826
|
}
|
809
|
-
|
810
|
-
/**
|
811
|
-
* Wraps a Node.js stream into a browser-compatible ReadableStream.
|
812
|
-
*
|
813
|
-
* Enables the use of Node.js streams where browser ReadableStreams are required.
|
814
|
-
* Handles 'data', 'end', and 'error' events from the Node.js stream.
|
815
|
-
*
|
816
|
-
* @param nodeStream The Node.js stream to be converted.
|
817
|
-
* @returns ReadableStream
|
818
|
-
*/
|
819
|
-
private nodeToWebStream(nodeStream: Stream): ReadableStream {
|
820
|
-
return new ReadableStream({
|
821
|
-
start(controller) {
|
822
|
-
nodeStream.on('data', (chunk) => {
|
823
|
-
controller.enqueue(chunk);
|
824
|
-
});
|
825
|
-
|
826
|
-
nodeStream.on('end', () => {
|
827
|
-
controller.close();
|
828
|
-
});
|
829
|
-
|
830
|
-
nodeStream.on('error', (err) => {
|
831
|
-
controller.error(err);
|
832
|
-
});
|
833
|
-
}
|
834
|
-
});
|
835
|
-
}
|
836
827
|
}
|
package/src/fetch/Request.ts
CHANGED
@@ -121,9 +121,9 @@ export default class Request implements IRequest {
|
|
121
121
|
} else {
|
122
122
|
try {
|
123
123
|
if (input instanceof Request && input.url) {
|
124
|
-
this[PropertySymbol.url] = new URL(input.url, injected.window.location);
|
124
|
+
this[PropertySymbol.url] = new URL(input.url, injected.window.location.href);
|
125
125
|
} else {
|
126
|
-
this[PropertySymbol.url] = new URL(<string>input, injected.window.location);
|
126
|
+
this[PropertySymbol.url] = new URL(<string>input, injected.window.location.href);
|
127
127
|
}
|
128
128
|
} catch (error) {
|
129
129
|
throw new DOMException(
|
package/src/fetch/Response.ts
CHANGED
@@ -267,18 +267,15 @@ export default class Response implements IResponse {
|
|
267
267
|
* @returns Clone.
|
268
268
|
*/
|
269
269
|
public clone(): Response {
|
270
|
-
const
|
270
|
+
const body = FetchBodyUtility.cloneBodyStream(this);
|
271
|
+
|
272
|
+
const response = new this.#window.Response(body, {
|
271
273
|
status: this.status,
|
272
274
|
statusText: this.statusText,
|
273
275
|
headers: this.headers
|
274
276
|
});
|
275
277
|
|
276
|
-
(<number>response.status) = this.status;
|
277
|
-
(<string>response.statusText) = this.statusText;
|
278
278
|
(<boolean>response.ok) = this.ok;
|
279
|
-
(<Headers>response.headers) = new Headers(this.headers);
|
280
|
-
(<ReadableStream>response.body) = this.body;
|
281
|
-
(<boolean>response.bodyUsed) = this.bodyUsed;
|
282
279
|
(<boolean>response.redirected) = this.redirected;
|
283
280
|
(<string>response.type) = this.type;
|
284
281
|
(<string>response.url) = this.url;
|
package/src/fetch/SyncFetch.ts
CHANGED
@@ -86,7 +86,7 @@ export default class SyncFetch {
|
|
86
86
|
* @returns Response.
|
87
87
|
*/
|
88
88
|
public send(): ISyncResponse {
|
89
|
-
FetchRequestReferrerUtility.prepareRequest(this.#window.location, this.request);
|
89
|
+
FetchRequestReferrerUtility.prepareRequest(new URL(this.#window.location.href), this.request);
|
90
90
|
FetchRequestValidationUtility.validateSchema(this.request);
|
91
91
|
|
92
92
|
if (this.request.signal.aborted) {
|
@@ -231,7 +231,7 @@ export default class SyncFetch {
|
|
231
231
|
private compliesWithCrossOriginPolicy(): boolean {
|
232
232
|
if (
|
233
233
|
this.disableCrossOriginPolicy ||
|
234
|
-
!FetchCORSUtility.isCORS(this.#window.location, this.request[PropertySymbol.url])
|
234
|
+
!FetchCORSUtility.isCORS(this.#window.location.href, this.request[PropertySymbol.url])
|
235
235
|
) {
|
236
236
|
return true;
|
237
237
|
}
|
@@ -512,7 +512,7 @@ export default class SyncFetch {
|
|
512
512
|
if (
|
513
513
|
this.request.credentials === 'omit' ||
|
514
514
|
(this.request.credentials === 'same-origin' &&
|
515
|
-
FetchCORSUtility.isCORS(this.#window.location, locationURL))
|
515
|
+
FetchCORSUtility.isCORS(this.#window.location.href, locationURL))
|
516
516
|
) {
|
517
517
|
headers.delete('authorization');
|
518
518
|
headers.delete('www-authenticate');
|