From b65c8eaebc5b314eea04638621c31ace131ceee9 Mon Sep 17 00:00:00 2001 From: mansiverma897993 Date: Wed, 24 Jun 2026 14:22:53 +0530 Subject: [PATCH] test: add browser test for Parse URI - Add a browser UI test in 02_ops.js to test constructor and __proto__ query parameters in the npm url polyfill context. - Fix webpack.config.js exclude rule and asset/inline overlap to enable dev builds on Windows. --- tests/browser/02_ops.js | 2 +- webpack.config.js | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/tests/browser/02_ops.js b/tests/browser/02_ops.js index 9139a53a..41ca5505 100644 --- a/tests/browser/02_ops.js +++ b/tests/browser/02_ops.js @@ -277,7 +277,7 @@ module.exports = { // testOp(browser, "Parse TLV", "test input", "test_output"); testOpHtml(browser, "Parse UDP", "04 89 00 35 00 2c 01 01", "tr:last-child td:last-child", "0x0101"); // testOp(browser, "Parse UNIX file permissions", "test input", "test_output"); - // testOp(browser, "Parse URI", "test input", "test_output"); + testOp(browser, "Parse URI", "https://example.com/?constructor=ok&__proto__=hello", /Arguments:\s+constructor = ok\s+__proto__\s+= hello/); testOp(browser, "Parse User Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 ", /Architecture: amd64/); // testOp(browser, "Parse X.509 certificate", "test input", "test_output"); testOpFile(browser, "Play Media", "files/mp3example.mp3", "audio", ""); diff --git a/webpack.config.js b/webpack.config.js index 4c6c00ba..81b4da44 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -142,7 +142,7 @@ module.exports = { rules: [ { test: /\.m?js$/, - exclude: /node_modules\/(?!crypto-api|bootstrap)/, + exclude: /node_modules[\\/](?!crypto-api|bootstrap)/, options: { configFile: path.resolve(__dirname, "babel.config.js"), cacheDirectory: true, @@ -211,18 +211,20 @@ module.exports = { filename: "assets/fonts/[name][ext]" } }, - { // First party images are saved as files to be cached + { test: /\.(png|jpg|gif)$/, - exclude: /(node_modules|bmfonts)/, - type: "asset/resource", - generator: { - filename: "images/[name][ext]" - } - }, - { // Third party images are inlined - test: /\.(png|jpg|gif)$/, - exclude: /web\/static/, - type: "asset/inline", + oneOf: [ + { + exclude: /(node_modules|bmfonts)/, + type: "asset/resource", + generator: { + filename: "images/[name][ext]" + } + }, + { + type: "asset/inline" + } + ] }, ] },