Skip to content

Commit

Permalink
Modified 'new URL' calls use single parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
satyajandhyala committed Jul 22, 2024
1 parent 8a64704 commit 4f30b6c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion js/common/test/type-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const prepareTestFileList = () =>
const compileTypeScriptFiles = (filepaths: string[]): readonly typescript.Diagnostic[] => {
// TypeScript compiler options, base URL is reset to `TYPE_TESTS_DIR`.
const compilerOptions =
JSON.parse(readFileSync(new URL('./type-tests/tsconfig.json', import.meta.url), 'utf-8')).compilerOptions as
JSON.parse(readFileSync(new URL(import.meta.url), 'utf-8')).compilerOptions as
typescript.CompilerOptions;
compilerOptions.baseUrl = TYPE_TESTS_DIR;

Expand Down
4 changes: 2 additions & 2 deletions js/web/lib/wasm/wasm-utils-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const origin = isNode || typeof location === 'undefined' ? undefined : location.
const isSameOrigin = (filename: string, prefixOverride?: string) => {
try {
const baseUrl = prefixOverride ?? scriptSrc;
const url = baseUrl ? new URL(filename, baseUrl) : new URL(filename);
const url = baseUrl ? new URL(baseUrl) : new URL(filename);
return url.origin === origin;
} catch {
return false;
Expand All @@ -45,7 +45,7 @@ const isSameOrigin = (filename: string, prefixOverride?: string) => {
const normalizeUrl = (filename: string, prefixOverride?: string) => {
const baseUrl = prefixOverride ?? scriptSrc;
try {
const url = baseUrl ? new URL(filename, baseUrl) : new URL(filename);
const url = baseUrl ? new URL(baseUrl) : new URL(filename);
return url.href;
} catch {
return undefined;
Expand Down
4 changes: 2 additions & 2 deletions js/web/test/e2e/browser-test-wasm-path-override-filename.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ it('Browser E2E testing - WebAssembly backend (path override filename)', async f
ort.env.wasm.wasmPaths = {};

if (typeof __ort_arg_files === 'string' && __ort_arg_files.includes('wasm')) {
const overrideWasmUrl = new URL('./test-wasm-path-override/renamed.wasm', base).href;
const overrideWasmUrl = new URL(base).href;
console.log(`ort.env.wasm.wasmPaths['wasm'] = ${JSON.stringify(overrideWasmUrl)};`);
ort.env.wasm.wasmPaths.wasm = overrideWasmUrl;
}

if (typeof __ort_arg_files === 'string' && __ort_arg_files.includes('mjs')) {
const overrideMjsUrl = new URL('./test-wasm-path-override/renamed.mjs', base).href;
const overrideMjsUrl = new URL(base).href;
console.log(`ort.env.wasm.wasmPaths['mjs'] = ${JSON.stringify(overrideMjsUrl)};`);
ort.env.wasm.wasmPaths.mjs = overrideMjsUrl;
}
Expand Down
2 changes: 1 addition & 1 deletion js/web/test/e2e/browser-test-wasm-path-override-prefix.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ it('Browser E2E testing - WebAssembly backend (path override prefix)', async fun
const base = `http://localhost:${__ort_arg_port}/`;

// override .wasm file path prefix
const prefix = new URL('./test-wasm-path-override/', base).href;
const prefix = new URL(base).href;
console.log(`ort.env.wasm.wasmPaths = ${JSON.stringify(prefix)};`);
ort.env.wasm.wasmPaths = prefix;

Expand Down
2 changes: 1 addition & 1 deletion js/web/test/e2e/simple-http-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const fs = require('fs');
const path = require('path');

const getRequestData = (url, dir) => {
const pathname = new URL(url, 'http://localhost').pathname;
const pathname = new URL('http://localhost').pathname;

let filepath;
let mimeType;
Expand Down

0 comments on commit 4f30b6c

Please sign in to comment.