Enhance refactor commands with controller-aware Route() updates and fix code quality violations

Add semantic token highlighting for 'that' variable and comment file references in VS Code extension
Add Phone_Text_Input and Currency_Input components with formatting utilities
Implement client widgets, form standardization, and soft delete functionality
Add modal scroll lock and update documentation
Implement comprehensive modal system with form integration and validation
Fix modal component instantiation using jQuery plugin API
Implement modal system with responsive sizing, queuing, and validation support
Implement form submission with validation, error handling, and loading states
Implement country/state selectors with dynamic data loading and Bootstrap styling
Revert Rsx::Route() highlighting in Blade/PHP files
Target specific PHP scopes for Rsx::Route() highlighting in Blade
Expand injection selector for Rsx::Route() highlighting
Add custom syntax highlighting for Rsx::Route() and Rsx.Route() calls
Update jqhtml packages to v2.2.165
Add bundle path validation for common mistakes (development mode only)
Create Ajax_Select_Input widget and Rsx_Reference_Data controller
Create Country_Select_Input widget with default country support
Initialize Tom Select on Select_Input widgets
Add Tom Select bundle for enhanced select dropdowns
Implement ISO 3166 geographic data system for country/region selection
Implement widget-based form system with disabled state support

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-10-30 06:21:56 +00:00
parent e678b987c2
commit f6ac36c632
5683 changed files with 5854736 additions and 22329 deletions

0
node_modules/playwright-core/LICENSE generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/bin/install_media_pack.ps1 generated vendored Executable file → Normal file
View File

View File

@@ -0,0 +1,35 @@
$ErrorActionPreference = 'Stop'
# WebKit WSL Installation Script
# See webkit-wsl-transport-server.ts for the complete architecture diagram.
# This script sets up a WSL distribution that will be used to run WebKit.
$Distribution = "playwright"
$Username = "pwuser"
$distributions = (wsl --list --quiet) -split "\r?\n"
if ($distributions -contains $Distribution) {
Write-Host "WSL distribution '$Distribution' already exists. Skipping installation."
} else {
Write-Host "Installing new WSL distribution '$Distribution'..."
$VhdSize = "10GB"
wsl --install -d Ubuntu-24.04 --name $Distribution --no-launch --vhd-size $VhdSize
wsl -d $Distribution -u root adduser --gecos GECOS --disabled-password $Username
}
$pwshDirname = (Resolve-Path -Path $PSScriptRoot).Path;
$playwrightCoreRoot = Resolve-Path (Join-Path $pwshDirname "..")
$initScript = @"
if [ ! -f "/home/$Username/node/bin/node" ]; then
mkdir -p /home/$Username/node
curl -fsSL https://nodejs.org/dist/v22.17.0/node-v22.17.0-linux-x64.tar.xz -o /home/$Username/node/node-v22.17.0-linux-x64.tar.xz
tar -xJf /home/$Username/node/node-v22.17.0-linux-x64.tar.xz -C /home/$Username/node --strip-components=1
fi
/home/$Username/node/bin/node cli.js install-deps webkit
cp lib/server/webkit/wsl/webkit-wsl-transport-client.js /home/$Username/
sudo -u $Username PLAYWRIGHT_SKIP_BROWSER_GC=1 /home/$Username/node/bin/node cli.js install webkit
"@ -replace "\r\n", "`n"
wsl -d $Distribution --cd $playwrightCoreRoot -u root -- bash -c "$initScript"
Write-Host "Done!"

View File

@@ -4,7 +4,7 @@ set -x
rm -rf "/Applications/Google Chrome Beta.app"
cd /tmp
curl --retry 3 -o ./googlechromebeta.dmg -k https://dl.google.com/chrome/mac/universal/beta/googlechromebeta.dmg
curl --retry 3 -o ./googlechromebeta.dmg https://dl.google.com/chrome/mac/universal/beta/googlechromebeta.dmg
hdiutil attach -nobrowse -quiet -noautofsck -noautoopen -mountpoint /Volumes/googlechromebeta.dmg ./googlechromebeta.dmg
cp -pR "/Volumes/googlechromebeta.dmg/Google Chrome Beta.app" /Applications
hdiutil detach /Volumes/googlechromebeta.dmg

0
node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 generated vendored Executable file → Normal file
View File

View File

@@ -4,7 +4,7 @@ set -x
rm -rf "/Applications/Google Chrome.app"
cd /tmp
curl --retry 3 -o ./googlechrome.dmg -k https://dl.google.com/chrome/mac/universal/stable/GGRO/googlechrome.dmg
curl --retry 3 -o ./googlechrome.dmg https://dl.google.com/chrome/mac/universal/stable/GGRO/googlechrome.dmg
hdiutil attach -nobrowse -quiet -noautofsck -noautoopen -mountpoint /Volumes/googlechrome.dmg ./googlechrome.dmg
cp -pR "/Volumes/googlechrome.dmg/Google Chrome.app" /Applications
hdiutil detach /Volumes/googlechrome.dmg

0
node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 generated vendored Executable file → Normal file
View File

View File

@@ -3,7 +3,7 @@ set -e
set -x
cd /tmp
curl --retry 3 -o ./msedge_beta.pkg -k "$1"
curl --retry 3 -o ./msedge_beta.pkg "$1"
# Note: there's no way to uninstall previously installed MSEdge.
# However, running PKG again seems to update installation.
sudo installer -pkg /tmp/msedge_beta.pkg -target /

0
node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 generated vendored Executable file → Normal file
View File

View File

@@ -3,7 +3,7 @@ set -e
set -x
cd /tmp
curl --retry 3 -o ./msedge_dev.pkg -k "$1"
curl --retry 3 -o ./msedge_dev.pkg "$1"
# Note: there's no way to uninstall previously installed MSEdge.
# However, running PKG again seems to update installation.
sudo installer -pkg /tmp/msedge_dev.pkg -target /

0
node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 generated vendored Executable file → Normal file
View File

View File

@@ -3,7 +3,7 @@ set -e
set -x
cd /tmp
curl --retry 3 -o ./msedge_stable.pkg -k "$1"
curl --retry 3 -o ./msedge_stable.pkg "$1"
# Note: there's no way to uninstall previously installed MSEdge.
# However, running PKG again seems to update installation.
sudo installer -pkg /tmp/msedge_stable.pkg -target /

0
node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 generated vendored Executable file → Normal file
View File

View File

@@ -3,43 +3,43 @@
"browsers": [
{
"name": "chromium",
"revision": "1187",
"revision": "1194",
"installByDefault": true,
"browserVersion": "140.0.7339.16"
"browserVersion": "141.0.7390.37"
},
{
"name": "chromium-headless-shell",
"revision": "1187",
"revision": "1194",
"installByDefault": true,
"browserVersion": "140.0.7339.16"
"browserVersion": "141.0.7390.37"
},
{
"name": "chromium-tip-of-tree",
"revision": "1357",
"revision": "1371",
"installByDefault": false,
"browserVersion": "141.0.7342.0"
"browserVersion": "142.0.7430.0"
},
{
"name": "chromium-tip-of-tree-headless-shell",
"revision": "1357",
"revision": "1371",
"installByDefault": false,
"browserVersion": "141.0.7342.0"
"browserVersion": "142.0.7430.0"
},
{
"name": "firefox",
"revision": "1490",
"revision": "1495",
"installByDefault": true,
"browserVersion": "141.0"
"browserVersion": "142.0.1"
},
{
"name": "firefox-beta",
"revision": "1485",
"revision": "1490",
"installByDefault": false,
"browserVersion": "142.0b4"
"browserVersion": "143.0b10"
},
{
"name": "webkit",
"revision": "2203",
"revision": "2215",
"installByDefault": true,
"revisionOverrides": {
"debian11-x64": "2105",

View File

@@ -49,8 +49,8 @@ class BrowserServerLauncherImpl {
const playwright = (0, import_playwright.createPlaywright)({ sdkLanguage: "javascript", isServer: true });
const metadata = { id: "", startTime: 0, endTime: 0, type: "Internal", method: "", params: {}, log: [], internal: true };
const validatorContext = {
tChannelImpl: (names, arg, path) => {
throw new validatorPrimitives.ValidationError(`${path}: channels are not expected in launchServer`);
tChannelImpl: (names, arg, path2) => {
throw new validatorPrimitives.ValidationError(`${path2}: channels are not expected in launchServer`);
},
binary: "buffer",
isUnderTest: import_debug.isUnderTest
@@ -82,11 +82,8 @@ class BrowserServerLauncherImpl {
(0, import_stackTrace.rewriteErrorMessage)(e, `${e.message} Failed to launch browser.${log}`);
throw e;
}
return this.launchServerOnExistingBrowser(browser, options);
}
async launchServerOnExistingBrowser(browser, options) {
const path = options.wsPath ? options.wsPath.startsWith("/") ? options.wsPath : `/${options.wsPath}` : `/${(0, import_crypto.createGuid)()}`;
const server = new import_playwrightServer.PlaywrightServer({ mode: options._sharedBrowser ? "launchServerShared" : "launchServer", path, maxConnections: Infinity, preLaunchedBrowser: browser, debugController: options._debugController });
const server = new import_playwrightServer.PlaywrightServer({ mode: options._sharedBrowser ? "launchServerShared" : "launchServer", path, maxConnections: Infinity, preLaunchedBrowser: browser });
const wsEndpoint = await server.listen(options.port, options.host);
const browserServer = new import_utilsBundle.ws.EventEmitter();
browserServer.process = () => browser.options.browserProcess.process;

0
node_modules/playwright-core/lib/cli/driver.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/cli/program.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/cli/programWithTestStub.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/accessibility.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/android.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/api.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/artifact.js generated vendored Executable file → Normal file
View File

10
node_modules/playwright-core/lib/client/browser.js generated vendored Executable file → Normal file
View File

@@ -120,16 +120,6 @@ class Browser extends import_channelOwner.ChannelOwner {
async newBrowserCDPSession() {
return import_cdpSession.CDPSession.from((await this._channel.newBrowserCDPSession()).session);
}
async _launchServer(options = {}) {
const serverLauncher = this._browserType._serverLauncher;
const browserImpl = this._connection.toImpl?.(this);
if (!serverLauncher || !browserImpl)
throw new Error("Launching server is not supported");
return await serverLauncher.launchServerOnExistingBrowser(browserImpl, {
_sharedBrowser: true,
...options
});
}
async startTracing(page, options = {}) {
this._path = options.path;
await this._channel.startTracing({ ...options, page: page ? page._channel : void 0 });

10
node_modules/playwright-core/lib/client/browserContext.js generated vendored Executable file → Normal file
View File

@@ -67,7 +67,6 @@ class BrowserContext extends import_channelOwner.ChannelOwner {
this._browser = null;
this._bindings = /* @__PURE__ */ new Map();
this._forReuse = false;
this._backgroundPages = /* @__PURE__ */ new Set();
this._serviceWorkers = /* @__PURE__ */ new Set();
this._harRecorders = /* @__PURE__ */ new Map();
this._closingStatus = "none";
@@ -83,11 +82,6 @@ class BrowserContext extends import_channelOwner.ChannelOwner {
this._channel.on("page", ({ page }) => this._onPage(import_page.Page.from(page)));
this._channel.on("route", ({ route }) => this._onRoute(network.Route.from(route)));
this._channel.on("webSocketRoute", ({ webSocketRoute }) => this._onWebSocketRoute(network.WebSocketRoute.from(webSocketRoute)));
this._channel.on("backgroundPage", ({ page }) => {
const backgroundPage = import_page.Page.from(page);
this._backgroundPages.add(backgroundPage);
this.emit(import_events.Events.BrowserContext.BackgroundPage, backgroundPage);
});
this._channel.on("serviceWorker", ({ worker }) => {
const serviceWorker = import_worker.Worker.from(worker);
serviceWorker._context = this;
@@ -95,7 +89,7 @@ class BrowserContext extends import_channelOwner.ChannelOwner {
this.emit(import_events.Events.BrowserContext.ServiceWorker, serviceWorker);
});
this._channel.on("console", (event) => {
const consoleMessage = new import_consoleMessage.ConsoleMessage(this._platform, event);
const consoleMessage = new import_consoleMessage.ConsoleMessage(this._platform, event, import_page.Page.fromNullable(event.page));
this.emit(import_events.Events.BrowserContext.Console, consoleMessage);
const page = consoleMessage.page();
if (page)
@@ -402,7 +396,7 @@ class BrowserContext extends import_channelOwner.ChannelOwner {
return state;
}
backgroundPages() {
return [...this._backgroundPages];
return [];
}
serviceWorkers() {
return [...this._serviceWorkers];

0
node_modules/playwright-core/lib/client/browserType.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/cdpSession.js generated vendored Executable file → Normal file
View File

7
node_modules/playwright-core/lib/client/channelOwner.js generated vendored Executable file → Normal file
View File

@@ -164,14 +164,7 @@ class ChannelOwner extends import_eventEmitter.EventEmitter {
else
e.stack = "";
if (!options?.internal) {
const recoveryHandlers = [];
apiZone.error = e;
this._instrumentation.onApiCallRecovery(apiZone, e, recoveryHandlers);
for (const handler of recoveryHandlers) {
const recoverResult = await handler();
if (recoverResult.status === "recovered")
return recoverResult.value;
}
logApiCall(this._platform, logger, `<= ${apiZone.apiName} failed`);
this._instrumentation.onApiCallEnd(apiZone);
}

0
node_modules/playwright-core/lib/client/clientHelper.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/clientInstrumentation.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/clientStackTrace.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/clock.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/connection.js generated vendored Executable file → Normal file
View File

5
node_modules/playwright-core/lib/client/consoleMessage.js generated vendored Executable file → Normal file
View File

@@ -22,10 +22,9 @@ __export(consoleMessage_exports, {
});
module.exports = __toCommonJS(consoleMessage_exports);
var import_jsHandle = require("./jsHandle");
var import_page = require("./page");
class ConsoleMessage {
constructor(platform, event) {
this._page = "page" in event && event.page ? import_page.Page.from(event.page) : null;
constructor(platform, event, page) {
this._page = page;
this._event = event;
if (platform.inspectCustom)
this[platform.inspectCustom] = () => this._inspect();

0
node_modules/playwright-core/lib/client/coverage.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/dialog.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/download.js generated vendored Executable file → Normal file
View File

2
node_modules/playwright-core/lib/client/electron.js generated vendored Executable file → Normal file
View File

@@ -66,7 +66,7 @@ class ElectronApplication extends import_channelOwner.ChannelOwner {
this._channel.on("close", () => {
this.emit(import_events.Events.ElectronApplication.Close);
});
this._channel.on("console", (event) => this.emit(import_events.Events.ElectronApplication.Console, new import_consoleMessage.ConsoleMessage(this._platform, event)));
this._channel.on("console", (event) => this.emit(import_events.Events.ElectronApplication.Console, new import_consoleMessage.ConsoleMessage(this._platform, event, null)));
this._setEventToSubscriptionMapping(/* @__PURE__ */ new Map([
[import_events.Events.ElectronApplication.Console, "console"]
]));

0
node_modules/playwright-core/lib/client/elementHandle.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/errors.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/eventEmitter.js generated vendored Executable file → Normal file
View File

1
node_modules/playwright-core/lib/client/events.js generated vendored Executable file → Normal file
View File

@@ -45,6 +45,7 @@ const Events = {
// @see https://nodejs.org/api/events.html#events_error_events
WebError: "weberror",
BackgroundPage: "backgroundpage",
// Deprecated in v1.56, never emitted anymore.
ServiceWorker: "serviceworker",
Request: "request",
Response: "response",

0
node_modules/playwright-core/lib/client/fetch.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/fileChooser.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/fileUtils.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/frame.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/harRouter.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/input.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/jsHandle.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/jsonPipe.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/localUtils.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/locator.js generated vendored Executable file → Normal file
View File

3
node_modules/playwright-core/lib/client/network.js generated vendored Executable file → Normal file
View File

@@ -51,6 +51,7 @@ class Request extends import_channelOwner.ChannelOwner {
this._redirectedTo = null;
this._failureText = null;
this._fallbackOverrides = {};
this._hasResponse = false;
this._redirectedFrom = Request.fromNullable(initializer.redirectedFrom);
if (this._redirectedFrom)
this._redirectedFrom._redirectedTo = this;
@@ -66,6 +67,8 @@ class Request extends import_channelOwner.ChannelOwner {
responseStart: -1,
responseEnd: -1
};
this._hasResponse = this._initializer.hasResponse;
this._channel.on("response", () => this._hasResponse = true);
}
static from(request) {
return request._object;

14
node_modules/playwright-core/lib/client/page.js generated vendored Executable file → Normal file
View File

@@ -48,6 +48,7 @@ var import_stringUtils = require("../utils/isomorphic/stringUtils");
var import_urlMatch = require("../utils/isomorphic/urlMatch");
var import_manualPromise = require("../utils/isomorphic/manualPromise");
var import_rtti = require("../utils/isomorphic/rtti");
var import_consoleMessage = require("./consoleMessage");
class Page extends import_channelOwner.ChannelOwner {
constructor(parent, type, guid, initializer) {
super(parent, type, guid, initializer);
@@ -174,7 +175,6 @@ class Page extends import_channelOwner.ChannelOwner {
_onClose() {
this._closed = true;
this._browserContext._pages.delete(this);
this._browserContext._backgroundPages.delete(this);
this._disposeHarRouters();
this.emit(import_events.Events.Page.Close, this);
}
@@ -534,6 +534,14 @@ class Page extends import_channelOwner.ChannelOwner {
async fill(selector, value, options) {
return await this._mainFrame.fill(selector, value, options);
}
async consoleMessages() {
const { messages } = await this._channel.consoleMessages();
return messages.map((message) => new import_consoleMessage.ConsoleMessage(this._platform, message, this));
}
async pageErrors() {
const { errors } = await this._channel.pageErrors();
return errors.map((error) => (0, import_errors.parseError)(error));
}
locator(selector, options) {
return this.mainFrame().locator(selector, options);
}
@@ -627,6 +635,10 @@ class Page extends import_channelOwner.ChannelOwner {
async waitForFunction(pageFunction, arg, options) {
return await this._mainFrame.waitForFunction(pageFunction, arg, options);
}
async requests() {
const { requests } = await this._channel.requests();
return requests.map((request) => import_network.Request.from(request));
}
workers() {
return [...this._workers];
}

0
node_modules/playwright-core/lib/client/platform.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/playwright.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/selectors.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/stream.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/timeoutSettings.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/tracing.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/types.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/video.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/waiter.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/webError.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/webSocket.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/worker.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/client/writableStream.js generated vendored Executable file → Normal file
View File

2
node_modules/playwright-core/lib/generated/bindingsControllerSource.js generated vendored Executable file → Normal file

File diff suppressed because one or more lines are too long

0
node_modules/playwright-core/lib/generated/clockSource.js generated vendored Executable file → Normal file
View File

2
node_modules/playwright-core/lib/generated/injectedScriptSource.js generated vendored Executable file → Normal file

File diff suppressed because one or more lines are too long

2
node_modules/playwright-core/lib/generated/pollingRecorderSource.js generated vendored Executable file → Normal file

File diff suppressed because one or more lines are too long

0
node_modules/playwright-core/lib/generated/storageScriptSource.js generated vendored Executable file → Normal file
View File

2
node_modules/playwright-core/lib/generated/utilityScriptSource.js generated vendored Executable file → Normal file

File diff suppressed because one or more lines are too long

0
node_modules/playwright-core/lib/generated/webSocketMockSource.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/protocol/serializers.js generated vendored Executable file → Normal file
View File

41
node_modules/playwright-core/lib/protocol/validator.js generated vendored Executable file → Normal file
View File

@@ -450,17 +450,7 @@ import_validatorPrimitives.scheme.DebugControllerSetModeRequestedEvent = (0, imp
mode: import_validatorPrimitives.tString
});
import_validatorPrimitives.scheme.DebugControllerStateChangedEvent = (0, import_validatorPrimitives.tObject)({
pageCount: import_validatorPrimitives.tInt,
browsers: (0, import_validatorPrimitives.tArray)((0, import_validatorPrimitives.tObject)({
id: import_validatorPrimitives.tString,
name: import_validatorPrimitives.tString,
channel: (0, import_validatorPrimitives.tOptional)(import_validatorPrimitives.tString),
contexts: (0, import_validatorPrimitives.tArray)((0, import_validatorPrimitives.tObject)({
pages: (0, import_validatorPrimitives.tArray)((0, import_validatorPrimitives.tObject)({
url: import_validatorPrimitives.tString
}))
}))
}))
pageCount: import_validatorPrimitives.tInt
});
import_validatorPrimitives.scheme.DebugControllerSourceChangedEvent = (0, import_validatorPrimitives.tObject)({
text: import_validatorPrimitives.tString,
@@ -963,9 +953,6 @@ import_validatorPrimitives.scheme.BrowserContextWebSocketRouteEvent = (0, import
import_validatorPrimitives.scheme.BrowserContextVideoEvent = (0, import_validatorPrimitives.tObject)({
artifact: (0, import_validatorPrimitives.tChannel)(["Artifact"])
});
import_validatorPrimitives.scheme.BrowserContextBackgroundPageEvent = (0, import_validatorPrimitives.tObject)({
page: (0, import_validatorPrimitives.tChannel)(["Page"])
});
import_validatorPrimitives.scheme.BrowserContextServiceWorkerEvent = (0, import_validatorPrimitives.tObject)({
worker: (0, import_validatorPrimitives.tChannel)(["Worker"])
});
@@ -1245,6 +1232,19 @@ import_validatorPrimitives.scheme.PageCloseParams = (0, import_validatorPrimitiv
reason: (0, import_validatorPrimitives.tOptional)(import_validatorPrimitives.tString)
});
import_validatorPrimitives.scheme.PageCloseResult = (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tObject)({}));
import_validatorPrimitives.scheme.PageConsoleMessagesParams = (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tObject)({}));
import_validatorPrimitives.scheme.PageConsoleMessagesResult = (0, import_validatorPrimitives.tObject)({
messages: (0, import_validatorPrimitives.tArray)((0, import_validatorPrimitives.tObject)({
type: import_validatorPrimitives.tString,
text: import_validatorPrimitives.tString,
args: (0, import_validatorPrimitives.tArray)((0, import_validatorPrimitives.tChannel)(["ElementHandle", "JSHandle"])),
location: (0, import_validatorPrimitives.tObject)({
url: import_validatorPrimitives.tString,
lineNumber: import_validatorPrimitives.tInt,
columnNumber: import_validatorPrimitives.tInt
})
}))
});
import_validatorPrimitives.scheme.PageEmulateMediaParams = (0, import_validatorPrimitives.tObject)({
media: (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tEnum)(["screen", "print", "no-override"])),
colorScheme: (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tEnum)(["dark", "light", "no-preference", "no-override"])),
@@ -1440,6 +1440,10 @@ import_validatorPrimitives.scheme.PageAccessibilitySnapshotParams = (0, import_v
import_validatorPrimitives.scheme.PageAccessibilitySnapshotResult = (0, import_validatorPrimitives.tObject)({
rootAXNode: (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tType)("AXNode"))
});
import_validatorPrimitives.scheme.PagePageErrorsParams = (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tObject)({}));
import_validatorPrimitives.scheme.PagePageErrorsResult = (0, import_validatorPrimitives.tObject)({
errors: (0, import_validatorPrimitives.tArray)((0, import_validatorPrimitives.tType)("SerializedError"))
});
import_validatorPrimitives.scheme.PagePdfParams = (0, import_validatorPrimitives.tObject)({
scale: (0, import_validatorPrimitives.tOptional)(import_validatorPrimitives.tFloat),
displayHeaderFooter: (0, import_validatorPrimitives.tOptional)(import_validatorPrimitives.tBoolean),
@@ -1464,6 +1468,10 @@ import_validatorPrimitives.scheme.PagePdfParams = (0, import_validatorPrimitives
import_validatorPrimitives.scheme.PagePdfResult = (0, import_validatorPrimitives.tObject)({
pdf: import_validatorPrimitives.tBinary
});
import_validatorPrimitives.scheme.PageRequestsParams = (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tObject)({}));
import_validatorPrimitives.scheme.PageRequestsResult = (0, import_validatorPrimitives.tObject)({
requests: (0, import_validatorPrimitives.tArray)((0, import_validatorPrimitives.tChannel)(["Request"]))
});
import_validatorPrimitives.scheme.PageSnapshotForAIParams = (0, import_validatorPrimitives.tObject)({
timeout: import_validatorPrimitives.tFloat
});
@@ -1922,6 +1930,7 @@ import_validatorPrimitives.scheme.FrameExpectResult = (0, import_validatorPrimit
matches: import_validatorPrimitives.tBoolean,
received: (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tType)("SerializedValue")),
timedOut: (0, import_validatorPrimitives.tOptional)(import_validatorPrimitives.tBoolean),
errorMessage: (0, import_validatorPrimitives.tOptional)(import_validatorPrimitives.tString),
log: (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tArray)(import_validatorPrimitives.tString))
});
import_validatorPrimitives.scheme.WorkerInitializer = (0, import_validatorPrimitives.tObject)({
@@ -2246,8 +2255,10 @@ import_validatorPrimitives.scheme.RequestInitializer = (0, import_validatorPrimi
postData: (0, import_validatorPrimitives.tOptional)(import_validatorPrimitives.tBinary),
headers: (0, import_validatorPrimitives.tArray)((0, import_validatorPrimitives.tType)("NameValue")),
isNavigationRequest: import_validatorPrimitives.tBoolean,
redirectedFrom: (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tChannel)(["Request"]))
redirectedFrom: (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tChannel)(["Request"])),
hasResponse: import_validatorPrimitives.tBoolean
});
import_validatorPrimitives.scheme.RequestResponseEvent = (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tObject)({}));
import_validatorPrimitives.scheme.RequestResponseParams = (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tObject)({}));
import_validatorPrimitives.scheme.RequestResponseResult = (0, import_validatorPrimitives.tObject)({
response: (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tChannel)(["Response"]))

0
node_modules/playwright-core/lib/protocol/validatorPrimitives.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/remote/playwrightConnection.js generated vendored Executable file → Normal file
View File

26
node_modules/playwright-core/lib/remote/playwrightServer.js generated vendored Executable file → Normal file
View File

@@ -86,20 +86,6 @@ ${uaError}` };
const isExtension = this._options.mode === "extension";
const allowFSPaths = isExtension;
launchOptions = filterLaunchOptions(launchOptions, allowFSPaths);
if (url.searchParams.has("debug-controller")) {
if (!(this._options.debugController || isExtension))
throw new Error("Debug controller is not enabled");
return new import_playwrightConnection.PlaywrightConnection(
controllerSemaphore,
ws,
true,
this._playwright,
async () => {
throw new Error("shouldnt be used");
},
id
);
}
if (isExtension) {
const connectFilter = url.searchParams.get("connect");
if (connectFilter) {
@@ -114,6 +100,18 @@ ${uaError}` };
id
);
}
if (url.searchParams.has("debug-controller")) {
return new import_playwrightConnection.PlaywrightConnection(
controllerSemaphore,
ws,
true,
this._playwright,
async () => {
throw new Error("shouldnt be used");
},
id
);
}
return new import_playwrightConnection.PlaywrightConnection(
reuseBrowserSemaphore,
ws,

0
node_modules/playwright-core/lib/server/accessibility.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/server/android/android.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/server/android/backendAdb.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/server/artifact.js generated vendored Executable file → Normal file
View File

64
node_modules/playwright-core/lib/server/bidi/bidiBrowser.js generated vendored Executable file → Normal file
View File

@@ -30,7 +30,8 @@ var bidiBrowser_exports = {};
__export(bidiBrowser_exports, {
BidiBrowser: () => BidiBrowser,
BidiBrowserContext: () => BidiBrowserContext,
Network: () => Network
Network: () => Network,
getScreenOrientation: () => getScreenOrientation
});
module.exports = __toCommonJS(bidiBrowser_exports);
var import_eventsHelper = require("../utils/eventsHelper");
@@ -78,6 +79,11 @@ class BidiBrowser extends import_browser.Browser {
"script"
]
});
await browser._browserSession.send("network.addDataCollector", {
dataTypes: [bidi.Network.DataType.Response],
maxEncodedDataSize: 2e7
// same default as in CDP: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/inspector/inspector_network_agent.cc;l=134;drc=4128411589187a396829a827f59a655bed876aa7
});
if (options.persistent) {
const context = new BidiBrowserContext(browser, void 0, options.persistent);
browser._defaultContext = context;
@@ -189,6 +195,18 @@ class BidiBrowserContext extends import_browserContext.BrowserContext {
userContexts: [this._userContextId()]
}));
}
if (this._options.timezoneId) {
promises.push(this._browser._browserSession.send("emulation.setTimezoneOverride", {
timezone: this._options.timezoneId,
userContexts: [this._userContextId()]
}));
}
if (this._options.userAgent) {
promises.push(this._browser._browserSession.send("emulation.setUserAgentOverride", {
userAgent: this._options.userAgent,
userContexts: [this._userContextId()]
}));
}
await Promise.all(promises);
}
possiblyUninitializedPages() {
@@ -284,6 +302,11 @@ class BidiBrowserContext extends import_browserContext.BrowserContext {
async doUpdateExtraHTTPHeaders() {
}
async setUserAgent(userAgent) {
this._options.userAgent = userAgent;
await this._browser._browserSession.send("emulation.setUserAgentOverride", {
userAgent: userAgent ?? null,
userContexts: [this._userContextId()]
});
}
async doUpdateOffline() {
}
@@ -315,14 +338,20 @@ class BidiBrowserContext extends import_browserContext.BrowserContext {
async doUpdateDefaultViewport() {
if (!this._options.viewport)
return;
await this._browser._browserSession.send("browsingContext.setViewport", {
viewport: {
width: this._options.viewport.width,
height: this._options.viewport.height
},
devicePixelRatio: this._options.deviceScaleFactor || 1,
userContexts: [this._userContextId()]
});
await Promise.all([
this._browser._browserSession.send("browsingContext.setViewport", {
viewport: {
width: this._options.viewport.width,
height: this._options.viewport.height
},
devicePixelRatio: this._options.deviceScaleFactor || 1,
userContexts: [this._userContextId()]
}),
this._browser._browserSession.send("emulation.setScreenOrientationOverride", {
screenOrientation: getScreenOrientation(!!this._options.isMobile, this._options.viewport),
userContexts: [this._userContextId()]
})
]);
}
async doUpdateDefaultEmulatedMedia() {
}
@@ -385,6 +414,8 @@ function fromBidiSameSite(sameSite) {
return "Lax";
case "none":
return "None";
case "default":
return "Lax";
}
return "None";
}
@@ -429,6 +460,18 @@ function getProxyConfiguration(proxySettings) {
proxy.noProxy = bypass.split(",");
return proxy;
}
function getScreenOrientation(isMobile, viewportSize) {
const screenOrientation = {
type: "landscape-primary",
natural: bidi.Emulation.ScreenOrientationNatural.Landscape
};
if (isMobile) {
screenOrientation.natural = bidi.Emulation.ScreenOrientationNatural.Portrait;
if (viewportSize.width <= viewportSize.height)
screenOrientation.type = "portrait-primary";
}
return screenOrientation;
}
var Network;
((Network2) => {
let SameSite;
@@ -442,5 +485,6 @@ var Network;
0 && (module.exports = {
BidiBrowser,
BidiBrowserContext,
Network
Network,
getScreenOrientation
});

2
node_modules/playwright-core/lib/server/bidi/bidiChromium.js generated vendored Executable file → Normal file
View File

@@ -86,7 +86,7 @@ class BidiChromium extends import_browserType.BrowserType {
supportsPipeTransport() {
return false;
}
defaultArgs(options, isPersistent, userDataDir) {
async defaultArgs(options, isPersistent, userDataDir) {
const chromeArguments = this._innerDefaultArgs(options);
chromeArguments.push(`--user-data-dir=${userDataDir}`);
chromeArguments.push("--remote-debugging-port=0");

37
node_modules/playwright-core/lib/server/bidi/bidiConnection.js generated vendored Executable file → Normal file
View File

@@ -20,19 +20,24 @@ var bidiConnection_exports = {};
__export(bidiConnection_exports, {
BidiConnection: () => BidiConnection,
BidiSession: () => BidiSession,
kBrowserCloseMessageId: () => kBrowserCloseMessageId
kBrowserCloseMessageId: () => kBrowserCloseMessageId,
kShutdownSessionNewMessageId: () => kShutdownSessionNewMessageId
});
module.exports = __toCommonJS(bidiConnection_exports);
var import_events = require("events");
var import_debugLogger = require("../utils/debugLogger");
var import_helper = require("../helper");
var import_protocolError = require("../protocolError");
const kBrowserCloseMessageId = 0;
const kBrowserCloseMessageId = Number.MAX_SAFE_INTEGER - 1;
const kShutdownSessionNewMessageId = kBrowserCloseMessageId - 1;
class BidiConnection {
constructor(transport, onDisconnect, protocolLogger, browserLogsCollector) {
this._lastId = 0;
this._closed = false;
this._browsingContextToSession = /* @__PURE__ */ new Map();
this._realmToBrowsingContext = /* @__PURE__ */ new Map();
// TODO: shared/service workers might have multiple owner realms.
this._realmToOwnerRealm = /* @__PURE__ */ new Map();
this._transport = transport;
this._onDisconnect = onDisconnect;
this._protocolLogger = protocolLogger;
@@ -54,11 +59,30 @@ class BidiConnection {
this._protocolLogger("receive", message);
const object = message;
if (object.type === "event") {
if (object.method === "script.realmCreated") {
if ("context" in object.params)
this._realmToBrowsingContext.set(object.params.realm, object.params.context);
if (object.params.type === "dedicated-worker")
this._realmToOwnerRealm.set(object.params.realm, object.params.owners[0]);
} else if (object.method === "script.realmDestroyed") {
this._realmToBrowsingContext.delete(object.params.realm);
this._realmToOwnerRealm.delete(object.params.realm);
}
let context;
if ("context" in object.params)
let realm;
if ("context" in object.params) {
context = object.params.context;
else if (object.method === "log.entryAdded" || object.method === "script.message")
} else if (object.method === "log.entryAdded" || object.method === "script.message") {
context = object.params.source?.context;
realm = object.params.source?.realm;
} else if (object.method === "script.realmCreated" && object.params.type === "dedicated-worker") {
realm = object.params.owners[0];
}
if (!context && realm) {
while (this._realmToOwnerRealm.get(realm))
realm = this._realmToOwnerRealm.get(realm);
context = this._realmToBrowsingContext.get(realm);
}
if (context) {
const session = this._browsingContextToSession.get(context);
if (session) {
@@ -159,7 +183,7 @@ class BidiSession extends import_events.EventEmitter {
}
dispatchMessage(message) {
const object = message;
if (object.id === kBrowserCloseMessageId)
if (object.id === kBrowserCloseMessageId || object.id === kShutdownSessionNewMessageId)
return;
if (object.id && this._callbacks.has(object.id)) {
const callback = this._callbacks.get(object.id);
@@ -183,5 +207,6 @@ class BidiSession extends import_events.EventEmitter {
0 && (module.exports = {
BidiConnection,
BidiSession,
kBrowserCloseMessageId
kBrowserCloseMessageId,
kShutdownSessionNewMessageId
});

8
node_modules/playwright-core/lib/server/bidi/bidiExecutionContext.js generated vendored Executable file → Normal file
View File

@@ -67,7 +67,7 @@ class BidiExecutionContext {
if (response.type === "success")
return import_bidiDeserializer.BidiDeserializer.deserialize(response.result);
if (response.type === "exception")
throw new js.JavaScriptErrorInEvaluate(response.exceptionDetails.text + "\nFull val: " + JSON.stringify(response.exceptionDetails));
throw new js.JavaScriptErrorInEvaluate(response.exceptionDetails.text);
throw new js.JavaScriptErrorInEvaluate("Unexpected response type: " + JSON.stringify(response));
}
async rawEvaluateHandle(context, expression) {
@@ -86,7 +86,7 @@ class BidiExecutionContext {
throw new js.JavaScriptErrorInEvaluate("Cannot get handle: " + JSON.stringify(response.result));
}
if (response.type === "exception")
throw new js.JavaScriptErrorInEvaluate(response.exceptionDetails.text + "\nFull val: " + JSON.stringify(response.exceptionDetails));
throw new js.JavaScriptErrorInEvaluate(response.exceptionDetails.text);
throw new js.JavaScriptErrorInEvaluate("Unexpected response type: " + JSON.stringify(response));
}
async evaluateWithArguments(functionDeclaration, returnByValue, utilityScript, values, handles) {
@@ -105,7 +105,7 @@ class BidiExecutionContext {
userActivation: true
});
if (response.type === "exception")
throw new js.JavaScriptErrorInEvaluate(response.exceptionDetails.text + "\nFull val: " + JSON.stringify(response.exceptionDetails));
throw new js.JavaScriptErrorInEvaluate(response.exceptionDetails.text);
if (response.type === "success") {
if (returnByValue)
return (0, import_utilityScriptSerializers.parseEvaluationResultValue)(import_bidiDeserializer.BidiDeserializer.deserialize(response.result));
@@ -180,7 +180,7 @@ class BidiExecutionContext {
userActivation: true
});
if (response.type === "exception")
throw new js.JavaScriptErrorInEvaluate(response.exceptionDetails.text + "\nFull val: " + JSON.stringify(response.exceptionDetails));
throw new js.JavaScriptErrorInEvaluate(response.exceptionDetails.text);
if (response.type === "success")
return response.result;
throw new js.JavaScriptErrorInEvaluate("Unexpected response type: " + JSON.stringify(response));

17
node_modules/playwright-core/lib/server/bidi/bidiFirefox.js generated vendored Executable file → Normal file
View File

@@ -74,6 +74,19 @@ Workaround: Set the HOME=/root environment variable${process.env.GITHUB_ACTION ?
return env;
}
attemptToGracefullyCloseBrowser(transport) {
this._attemptToGracefullyCloseBrowser(transport).catch(() => {
});
}
async _attemptToGracefullyCloseBrowser(transport) {
if (!transport.onmessage) {
transport.send({ method: "session.new", params: { capabilities: {} }, id: import_bidiConnection.kShutdownSessionNewMessageId });
await new Promise((resolve) => {
transport.onmessage = (message) => {
if (message.id === import_bidiConnection.kShutdownSessionNewMessageId)
resolve(true);
};
});
}
transport.send({ method: "browser.close", params: {}, id: import_bidiConnection.kBrowserCloseMessageId });
}
supportsPipeTransport() {
@@ -85,11 +98,13 @@ Workaround: Set the HOME=/root environment variable${process.env.GITHUB_ACTION ?
preferences: options.firefoxUserPrefs || {}
});
}
defaultArgs(options, isPersistent, userDataDir) {
async defaultArgs(options, isPersistent, userDataDir) {
const { args = [], headless } = options;
const userDataDirArg = args.find((arg) => arg.startsWith("-profile") || arg.startsWith("--profile"));
if (userDataDirArg)
throw this._createUserDataDirArgMisuseError("--profile");
if (args.find((arg) => !arg.startsWith("-")))
throw new Error("Arguments can not specify page to be opened");
const firefoxArguments = ["--remote-debugging-port=0"];
if (headless)
firefoxArguments.push("--headless");

0
node_modules/playwright-core/lib/server/bidi/bidiInput.js generated vendored Executable file → Normal file
View File

98
node_modules/playwright-core/lib/server/bidi/bidiNetworkManager.js generated vendored Executable file → Normal file
View File

@@ -40,6 +40,7 @@ class BidiNetworkManager {
constructor(bidiSession, page) {
this._userRequestInterceptionEnabled = false;
this._protocolRequestInterceptionEnabled = false;
this._attemptedAuthentications = /* @__PURE__ */ new Set();
this._session = bidiSession;
this._requests = /* @__PURE__ */ new Map();
this._page = page;
@@ -62,7 +63,7 @@ class BidiNetworkManager {
if (!frame)
return;
if (redirectedFrom)
this._requests.delete(redirectedFrom._id);
this._deleteRequest(redirectedFrom._id);
let route;
if (param.intercepts) {
if (redirectedFrom) {
@@ -86,7 +87,9 @@ class BidiNetworkManager {
if (!request)
return;
const getResponseBody = async () => {
throw new Error(`Response body is not available for requests in Bidi`);
const { bytes } = await this._session.send("network.getData", { request: params.request.request, dataType: bidi.Network.DataType.Response });
const encoding = bytes.type === "base64" ? "base64" : "utf8";
return Buffer.from(bytes.value, encoding);
};
const timings = params.request.timings;
const startTime = timings.requestTime;
@@ -124,7 +127,7 @@ class BidiNetworkManager {
if (isRedirected) {
response._requestFinished(responseEndTime);
} else {
this._requests.delete(request._id);
this._deleteRequest(request._id);
response._requestFinished(responseEndTime);
}
response._setHttpVersion(params.response.protocol);
@@ -134,7 +137,7 @@ class BidiNetworkManager {
const request = this._requests.get(params.request.request);
if (!request)
return;
this._requests.delete(request._id);
this._deleteRequest(request._id);
const response = request.request._existingResponse();
if (response) {
response.setTransferSize(null);
@@ -147,23 +150,35 @@ class BidiNetworkManager {
_onAuthRequired(params) {
const isBasic = params.response.authChallenges?.some((challenge) => challenge.scheme.startsWith("Basic"));
const credentials = this._page.browserContext._options.httpCredentials;
if (isBasic && credentials) {
this._session.sendMayFail("network.continueWithAuth", {
request: params.request.request,
action: "provideCredentials",
credentials: {
type: "password",
username: credentials.username,
password: credentials.password
}
});
if (isBasic && credentials && (!credentials.origin || new URL(params.request.url).origin.toLowerCase() === credentials.origin.toLowerCase())) {
if (this._attemptedAuthentications.has(params.request.request)) {
this._session.sendMayFail("network.continueWithAuth", {
request: params.request.request,
action: "cancel"
});
} else {
this._attemptedAuthentications.add(params.request.request);
this._session.sendMayFail("network.continueWithAuth", {
request: params.request.request,
action: "provideCredentials",
credentials: {
type: "password",
username: credentials.username,
password: credentials.password
}
});
}
} else {
this._session.sendMayFail("network.continueWithAuth", {
request: params.request.request,
action: "default"
action: "cancel"
});
}
}
_deleteRequest(requestId) {
this._requests.delete(requestId);
this._attemptedAuthentications.delete(requestId);
}
async setRequestInterception(value) {
this._userRequestInterceptionEnabled = value;
await this._updateProtocolRequestInterception();
@@ -209,7 +224,7 @@ class BidiRequest {
redirectedFrom ? redirectedFrom.request : null,
payload.navigation ?? void 0,
payload.request.url,
"other",
resourceTypeFromBidi(payload.request.destination, payload.request.initiatorType, payload.initiator?.type),
payload.request.method,
postDataBuffer,
fromBidiHeaders(payload.request.headers)
@@ -310,6 +325,57 @@ function toBidiSameSite(sameSite) {
return bidi.Network.SameSite.Lax;
return bidi.Network.SameSite.None;
}
function resourceTypeFromBidi(requestDestination, requestInitiatorType, eventInitiatorType) {
switch (requestDestination) {
case "audio":
return "media";
case "audioworklet":
return "script";
case "document":
return "document";
case "font":
return "font";
case "frame":
return "document";
case "iframe":
return "document";
case "image":
return "image";
case "object":
return "object";
case "paintworklet":
return "script";
case "script":
return "script";
case "serviceworker":
return "script";
case "sharedworker":
return "script";
case "style":
return "stylesheet";
case "track":
return "texttrack";
case "video":
return "media";
case "worker":
return "script";
case "":
switch (requestInitiatorType) {
case "fetch":
return "fetch";
case "font":
return "font";
case "xmlhttprequest":
return "xhr";
case null:
return eventInitiatorType === "script" ? "xhr" : "document";
default:
return "other";
}
default:
return "other";
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BidiNetworkManager,

0
node_modules/playwright-core/lib/server/bidi/bidiOverCdp.js generated vendored Executable file → Normal file
View File

102
node_modules/playwright-core/lib/server/bidi/bidiPage.js generated vendored Executable file → Normal file
View File

@@ -35,6 +35,7 @@ module.exports = __toCommonJS(bidiPage_exports);
var import_eventsHelper = require("../utils/eventsHelper");
var dialog = __toESM(require("../dialog"));
var dom = __toESM(require("../dom"));
var import_bidiBrowser = require("./bidiBrowser");
var import_page = require("../page");
var import_bidiExecutionContext = require("./bidiExecutionContext");
var import_bidiInput = require("./bidiInput");
@@ -45,6 +46,7 @@ const UTILITY_WORLD_NAME = "__playwright_utility_world__";
const kPlaywrightBindingChannel = "playwrightChannel";
class BidiPage {
constructor(browserContext, bidiSession, opener) {
this._realmToWorkerContext = /* @__PURE__ */ new Map();
this._sessionListeners = [];
this._initScriptIds = /* @__PURE__ */ new Map();
this._session = bidiSession;
@@ -70,6 +72,8 @@ class BidiPage {
import_eventsHelper.eventsHelper.addEventListener(bidiSession, "browsingContext.historyUpdated", this._onHistoryUpdated.bind(this)),
import_eventsHelper.eventsHelper.addEventListener(bidiSession, "browsingContext.domContentLoaded", this._onDomContentLoaded.bind(this)),
import_eventsHelper.eventsHelper.addEventListener(bidiSession, "browsingContext.load", this._onLoad.bind(this)),
import_eventsHelper.eventsHelper.addEventListener(bidiSession, "browsingContext.downloadWillBegin", this._onDownloadWillBegin.bind(this)),
import_eventsHelper.eventsHelper.addEventListener(bidiSession, "browsingContext.downloadEnd", this._onDownloadEnded.bind(this)),
import_eventsHelper.eventsHelper.addEventListener(bidiSession, "browsingContext.userPromptOpened", this._onUserPromptOpened.bind(this)),
import_eventsHelper.eventsHelper.addEventListener(bidiSession, "log.entryAdded", this._onLogEntryAdded.bind(this))
];
@@ -105,6 +109,13 @@ class BidiPage {
}
}
_onRealmCreated(realmInfo) {
if (realmInfo.type === "dedicated-worker") {
const delegate2 = new import_bidiExecutionContext.BidiExecutionContext(this._session, realmInfo);
const worker = new import_page.Worker(this._page, realmInfo.origin);
this._realmToWorkerContext.set(realmInfo.realm, worker.createExecutionContext(delegate2));
this._page.addWorker(realmInfo.realm, worker);
return;
}
if (this._realmToContext.has(realmInfo.realm))
return;
if (realmInfo.type !== "window")
@@ -143,11 +154,17 @@ class BidiPage {
}
_onRealmDestroyed(params) {
const context = this._realmToContext.get(params.realm);
if (!context)
return false;
this._realmToContext.delete(params.realm);
context.frame._contextDestroyed(context);
return true;
if (context) {
this._realmToContext.delete(params.realm);
context.frame._contextDestroyed(context);
return true;
}
const existed = this._realmToWorkerContext.delete(params.realm);
if (existed) {
this._page.removeWorker(params.realm);
return true;
}
return false;
}
// TODO: route the message directly to the browser
_onBrowsingContextDestroyed(params) {
@@ -198,11 +215,47 @@ class BidiPage {
event.defaultValue
));
}
_onDownloadWillBegin(event) {
if (!event.navigation)
return;
this._page.frameManager.frameAbortedNavigation(event.context, "Download is starting");
let originPage = this._page.initializedOrUndefined();
if (!originPage && this._opener)
originPage = this._opener._page.initializedOrUndefined();
if (!originPage)
return;
this._browserContext._browser._downloadCreated(originPage, event.navigation, event.url, event.suggestedFilename);
}
_onDownloadEnded(event) {
if (!event.navigation)
return;
this._browserContext._browser._downloadFinished(event.navigation, event.status === "canceled" ? "canceled" : void 0);
}
_onLogEntryAdded(params) {
if (params.type === "javascript" && params.level === "error") {
let errorName = "";
let errorMessage;
if (params.text?.includes(": ")) {
const index = params.text.indexOf(": ");
errorName = params.text.substring(0, index);
errorMessage = params.text.substring(index + 2);
} else {
errorMessage = params.text ?? void 0;
}
const error = new Error(errorMessage);
error.name = errorName;
error.stack = `${params.text}
${params.stackTrace?.callFrames.map((f) => {
const location2 = `${f.url}:${f.lineNumber + 1}:${f.columnNumber + 1}`;
return f.functionName ? ` at ${f.functionName} (${location2})` : ` at ${location2}`;
}).join("\n")}`;
this._page.addPageError(error);
return;
}
if (params.type !== "console")
return;
const entry = params;
const context = this._realmToContext.get(params.source.realm);
const context = this._realmToContext.get(params.source.realm) ?? this._realmToWorkerContext.get(params.source.realm);
if (!context)
return;
const callFrame = params.stackTrace?.callFrames[0];
@@ -233,14 +286,20 @@ class BidiPage {
if (!emulatedSize)
return;
const viewportSize = emulatedSize.viewport;
await this._session.send("browsingContext.setViewport", {
context: this._session.sessionId,
viewport: {
width: viewportSize.width,
height: viewportSize.height
},
devicePixelRatio: options.deviceScaleFactor || 1
});
await Promise.all([
this._session.send("browsingContext.setViewport", {
context: this._session.sessionId,
viewport: {
width: viewportSize.width,
height: viewportSize.height
},
devicePixelRatio: options.deviceScaleFactor || 1
}),
this._session.send("emulation.setScreenOrientationOverride", {
contexts: [this._session.sessionId],
screenOrientation: (0, import_bidiBrowser.getScreenOrientation)(!!options.isMobile, viewportSize)
})
]);
}
async updateRequestInterception() {
await this._networkManager.setRequestInterception(this._page.needsRequestInterception());
@@ -307,10 +366,17 @@ class BidiPage {
await Promise.all(ids.map((script) => this._session.send("script.removePreloadScript", { script })));
}
async closePage(runBeforeUnload) {
await this._session.send("browsingContext.close", {
context: this._session.sessionId,
promptUnload: runBeforeUnload
});
if (runBeforeUnload) {
this._session.sendMayFail("browsingContext.close", {
context: this._session.sessionId,
promptUnload: runBeforeUnload
});
} else {
await this._session.send("browsingContext.close", {
context: this._session.sessionId,
promptUnload: runBeforeUnload
});
}
}
async setBackgroundColor(color) {
}

0
node_modules/playwright-core/lib/server/bidi/bidiPdf.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/server/bidi/third_party/bidiCommands.d.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/server/bidi/third_party/bidiDeserializer.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/server/bidi/third_party/bidiKeyboard.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/server/bidi/third_party/bidiProtocol.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/server/bidi/third_party/bidiProtocolCore.js generated vendored Executable file → Normal file
View File

View File

0
node_modules/playwright-core/lib/server/bidi/third_party/bidiSerializer.js generated vendored Executable file → Normal file
View File

0
node_modules/playwright-core/lib/server/bidi/third_party/firefoxPrefs.js generated vendored Executable file → Normal file
View File

Some files were not shown because too many files have changed in this diff Show More