playwright-core
Advanced tools
Comparing version 1.51.0-beta-1740773665000 to 1.52.0-alpha-2025-03-01
@@ -57,11 +57,2 @@ "use strict"; | ||
switch (c) { | ||
case '?': | ||
tokens.push('.'); | ||
break; | ||
case '[': | ||
tokens.push('['); | ||
break; | ||
case ']': | ||
tokens.push(']'); | ||
break; | ||
case '{': | ||
@@ -101,3 +92,26 @@ inGroup = true; | ||
if (baseURL && /^https?:\/\//.test(baseURL) && /^wss?:\/\//.test(urlString)) baseURL = baseURL.replace(/^http/, 'ws'); | ||
match = constructURLBasedOnBaseURL(baseURL, match); | ||
const tokenMap = new Map(); | ||
function mapToken(original, replacement) { | ||
if (original.length === 0) return ''; | ||
tokenMap.set(replacement, original); | ||
return replacement; | ||
} | ||
// Escaped `\\?` behaves the same as `?` in our glob patterns. | ||
match = match.replaceAll(/\\\\\?/g, '?'); | ||
// Glob symbols may be escaped in the URL and some of them such as ? affect resolution, | ||
// so we replace them with safe components first. | ||
const relativePath = match.split('/').map((token, index) => { | ||
if (token === '.' || token === '..' || token === '') return token; | ||
// Handle special case of http*://, note that the new schema has to be | ||
// a web schema so that slashes are properly inserted after domain. | ||
if (index === 0 && token.endsWith(':')) return mapToken(token, 'http:'); | ||
const questionIndex = token.indexOf('?'); | ||
if (questionIndex === -1) return mapToken(token, `$_${index}_$`); | ||
const newPrefix = mapToken(token.substring(0, questionIndex), `$_${index}_$`); | ||
const newSuffix = mapToken(token.substring(questionIndex), `?$_${index}_$`); | ||
return newPrefix + newSuffix; | ||
}).join('/'); | ||
let resolved = constructURLBasedOnBaseURL(baseURL, relativePath); | ||
for (const [token, original] of tokenMap) resolved = resolved.replace(token, original); | ||
match = resolved; | ||
} | ||
@@ -104,0 +118,0 @@ if ((0, _stringUtils.isString)(match)) match = globToRegex(match); |
{ | ||
"name": "playwright-core", | ||
"version": "1.51.0-beta-1740773665000", | ||
"version": "1.52.0-alpha-2025-03-01", | ||
"description": "A high-level API to automate web browsers", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is too big to display
7935398
110928