HiddenBrowser: options is optional, support data: URIs

This commit is contained in:
Abe Jellinek 2024-05-03 10:33:37 -04:00
parent 82107beaa9
commit e7b792e2d5

View file

@ -121,14 +121,14 @@ class HiddenBrowser {
/** /**
* *
* @param {String} source - HTTP URL, file: URL, or file path * @param {String} source - HTTP URL, file: URL, or file path
* @param {Object} options * @param {Object} [options]
* @param {Boolean} [options.requireSuccessfulStatus] * @param {Boolean} [options.requireSuccessfulStatus]
* @returns {Promise<boolean>} * @returns {Promise<boolean>}
*/ */
async load(source, options) { async load(source, options) {
await this._createdPromise; await this._createdPromise;
let url; let url;
if (/^(file|https?|chrome|resource|blob):/.test(source)) { if (/^(file|https?|chrome|resource|blob|data):/.test(source)) {
url = source; url = source;
} }
// Convert string path to file: URL // Convert string path to file: URL