extension 4.1.31 → 4.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/597.cjs +27 -15
- package/dist/browsers.cjs +692 -183
- package/dist/cli.cjs +1075 -263
- package/dist/extension/__spec__/exec/gecko-system-profile.d.ts +3 -0
- package/dist/extension/browsers/__spec__/safari-fake-tools.d.ts +11 -1
- package/dist/extension/browsers/browsers-lib/instance-registry.d.ts +1 -0
- package/dist/extension/browsers/browsers-lib/messages.d.ts +12 -0
- package/dist/extension/browsers/browsers-lib/ready-stamp.d.ts +6 -0
- package/dist/extension/browsers/browsers-lib/resolve-profile.d.ts +1 -0
- package/dist/extension/browsers/browsers-types.d.ts +1 -0
- package/dist/extension/browsers/index.d.ts +1 -0
- package/dist/extension/browsers/run-chromium/cdp/cdp-client.d.ts +1 -0
- package/dist/extension/browsers/run-chromium/cdp/coded-error.d.ts +6 -0
- package/dist/extension/browsers/run-chromium/cdp/pipe-guard.d.ts +8 -0
- package/dist/extension/browsers/run-chromium/chromium-launch/index.d.ts +1 -0
- package/dist/extension/browsers/run-firefox/firefox-types.d.ts +1 -1
- package/dist/extension/browsers/run-firefox/rdp/evaluate-extension-document.d.ts +31 -1
- package/dist/extension/browsers/run-firefox/rdp/remote-firefox/evaluate.d.ts +4 -1
- package/dist/extension/browsers/run-firefox/rdp/remote-firefox/messaging-client.d.ts +1 -1
- package/dist/extension/browsers/run-only.d.ts +1 -0
- package/dist/extension/browsers/run-safari/safari-launch/container-app.d.ts +3 -0
- package/dist/extension/browsers/run-safari/safari-launch/index.d.ts +3 -1
- package/dist/extension/browsers/run-safari/safari-launch/tools.d.ts +14 -0
- package/dist/extension/browsers/run-safari/safari-launch/webdriver.d.ts +15 -0
- package/dist/extension/commands/act.d.ts +10 -0
- package/dist/extension/config-types.d.ts +15 -3
- package/dist/extension/helpers/messaging.d.ts +12 -4
- package/dist/extension/helpers/node-version-guard.d.ts +2 -1
- package/dist/extension/helpers/ready-contract-codes.d.ts +4 -0
- package/dist/extension/helpers/telemetry-cli.d.ts +1 -0
- package/dist/extension/helpers/template-catalog.d.ts +1 -1
- package/dist/extension/helpers/template-corpus.generated.d.ts +1 -1
- package/dist/extension/index.d.ts +1 -1
- package/package.json +4 -4
package/dist/browsers.cjs
CHANGED
|
@@ -422,6 +422,7 @@ var __webpack_modules__ = {
|
|
|
422
422
|
});
|
|
423
423
|
},
|
|
424
424
|
"./browsers/browsers-lib/instance-registry.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
425
|
+
var _helpers_messaging__rspack_import_0 = __webpack_require__("./helpers/messaging.ts");
|
|
425
426
|
function _define_property(obj, key, value) {
|
|
426
427
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
427
428
|
value: value,
|
|
@@ -434,7 +435,7 @@ var __webpack_modules__ = {
|
|
|
434
435
|
}
|
|
435
436
|
class AmbiguousInstanceError extends Error {
|
|
436
437
|
constructor(protocol, instanceId){
|
|
437
|
-
super(instanceId ? `Cannot resolve the ${protocol.toUpperCase()} port for instance "${instanceId}": it has not registered a port and no fallback was provided. Refusing to fall back to the most recently launched browser to avoid crossing instance streams.` : `Cannot resolve a ${protocol.toUpperCase()} port without an instance id and no fallback was provided. Refusing to fall back to the most recently launched browser to avoid crossing instance streams.`), _define_property(this, "protocol", void 0), _define_property(this, "instanceId", void 0);
|
|
438
|
+
super(instanceId ? `Cannot resolve the ${protocol.toUpperCase()} port for instance "${instanceId}": it has not registered a port and no fallback was provided. Refusing to fall back to the most recently launched browser to avoid crossing instance streams.` : `Cannot resolve a ${protocol.toUpperCase()} port without an instance id and no fallback was provided. Refusing to fall back to the most recently launched browser to avoid crossing instance streams.`), _define_property(this, "code", _helpers_messaging__rspack_import_0.Lp.E_INSTANCE_AMBIGUOUS), _define_property(this, "protocol", void 0), _define_property(this, "instanceId", void 0);
|
|
438
439
|
this.name = 'AmbiguousInstanceError';
|
|
439
440
|
this.protocol = protocol;
|
|
440
441
|
this.instanceId = instanceId;
|
|
@@ -764,6 +765,24 @@ var __webpack_modules__ = {
|
|
|
764
765
|
const next = 'dev' === command ? 'The dev server is still running but reloads cannot be delivered, restart "extension dev" to relaunch the browser.' : `The ${command} session is over.`;
|
|
765
766
|
return `[browser] ${browser} ${how}. ${next}`;
|
|
766
767
|
}
|
|
768
|
+
function systemProfileSourceLabel(source) {
|
|
769
|
+
if ('env' === source.kind) return `${source.name}=true`;
|
|
770
|
+
if ('config' === source.kind) return 'profile: false in extension.config.js';
|
|
771
|
+
return '--profile=false';
|
|
772
|
+
}
|
|
773
|
+
function systemProfileSourceFix(source) {
|
|
774
|
+
if ('env' === source.kind) return `unset ${source.name}`;
|
|
775
|
+
if ('config' === source.kind) return 'remove profile: false from extension.config.js';
|
|
776
|
+
return 'drop --profile=false';
|
|
777
|
+
}
|
|
778
|
+
function geckoSystemProfileRefused(browser, sources) {
|
|
779
|
+
const name = capitalizedBrowserName(browser);
|
|
780
|
+
const fixes = sources.map(systemProfileSourceFix).join(' and ');
|
|
781
|
+
return `${getLoggingPrefix('error')} ${name} can't load the add-on in its own profile, so it was not launched.\n${pintor__rspack_import_8_default().gray('SET BY')} ${sources.map(systemProfileSourceLabel).join(', ')}\nRemote debugging is off in a browser's own profile, and the add-on can only be installed over it.\nTo fix, ${fixes}, then let Extension.js manage the profile or pass ${pintor__rspack_import_8_default().blue('--profile=<path>')} to use a profile of your own.`;
|
|
782
|
+
}
|
|
783
|
+
function browserStderrTail(browser, lines) {
|
|
784
|
+
return `[browser] ${browser} wrote this before it exited:\n${lines.map((line)=>` ${line}`).join('\n')}`;
|
|
785
|
+
}
|
|
767
786
|
function browserGoneBeforeReady(browser) {
|
|
768
787
|
return `${getLoggingPrefix('error')} ${capitalizedBrowserName(browser)} exited before the extension loaded, so nothing is running.\nThe dev server keeps watching, but nothing will load until the browser is relaunched. Restart "extension dev".`;
|
|
769
788
|
}
|
|
@@ -915,6 +934,12 @@ var __webpack_modules__ = {
|
|
|
915
934
|
function safariNotYetRegistered(appName) {
|
|
916
935
|
return `${getLoggingPrefix('info')} Safari hasn't picked up ${pintor__rspack_import_8_default().yellow(appName)} yet.\nOpen the app once, then check Safari ▸ Settings ▸ Extensions.`;
|
|
917
936
|
}
|
|
937
|
+
function safariWebDriverSession(port, sessionId) {
|
|
938
|
+
return `${getLoggingPrefix('info')} WebDriver session ${pintor__rspack_import_8_default().gray(sessionId)} on port ${pintor__rspack_import_8_default().yellow(String(port))}.\nready.json carries it as ${pintor__rspack_import_8_default().gray('webdriverPort')} and ${pintor__rspack_import_8_default().gray('webdriverSessionId')}, attach to it instead of opening another.`;
|
|
939
|
+
}
|
|
940
|
+
function safariWebDriverUnavailable(reason) {
|
|
941
|
+
return `${getLoggingPrefix('info')} No WebDriver session for this run: ${reason}\nRun ${pintor__rspack_import_8_default().gray('safaridriver --enable')} once and turn on Safari ▸ Settings ▸ Developer ▸ Allow remote automation (Safari ▸ Develop ▸ Allow Remote Automation on older Safari) so tools can read Safari pages.`;
|
|
942
|
+
}
|
|
918
943
|
function safariRebuilt(appName) {
|
|
919
944
|
return `${getLoggingPrefix('success')} Rebuilt ${pintor__rspack_import_8_default().yellow(appName)}.`;
|
|
920
945
|
}
|
|
@@ -1135,17 +1160,20 @@ var __webpack_modules__ = {
|
|
|
1135
1160
|
H1: ()=>safariRegenerationDiscards,
|
|
1136
1161
|
HH: ()=>messageWithoutSenderError,
|
|
1137
1162
|
HL: ()=>binaryNotExecutable,
|
|
1163
|
+
Hp: ()=>safariWebDriverSession,
|
|
1138
1164
|
I5: ()=>chromiumForkNotInstalled,
|
|
1139
1165
|
Ih: ()=>browserNotInstalledError,
|
|
1140
1166
|
JB: ()=>devChannelSnapshotInUse,
|
|
1141
1167
|
KP: ()=>safariBuildCalled,
|
|
1142
1168
|
L: ()=>chromiumManifestLoadBlockers,
|
|
1143
1169
|
LD: ()=>firefoxDryRunBinary,
|
|
1170
|
+
LT: ()=>browserStderrTail,
|
|
1144
1171
|
M3: ()=>cdpClientConnected,
|
|
1145
1172
|
M6: ()=>chromiumExtensionLoadRefused,
|
|
1146
1173
|
MG: ()=>prettyPuppeteerInstallGuidance,
|
|
1147
1174
|
MQ: ()=>firefoxFailedToStart,
|
|
1148
1175
|
MS: ()=>errorConnectingToBrowser,
|
|
1176
|
+
Mm: ()=>geckoSystemProfileRefused,
|
|
1149
1177
|
N4: ()=>enhancedProcessManagementUnhandledRejection,
|
|
1150
1178
|
NO: ()=>mv3BackgroundScriptsNotSupportedByChromium,
|
|
1151
1179
|
NT: ()=>firstRunInstallDeclined,
|
|
@@ -1203,6 +1231,7 @@ var __webpack_modules__ = {
|
|
|
1203
1231
|
l9: ()=>parsingPacketError,
|
|
1204
1232
|
lO: ()=>firefoxDryRunArgs,
|
|
1205
1233
|
l_: ()=>safariConverted,
|
|
1234
|
+
lb: ()=>safariWebDriverUnavailable,
|
|
1206
1235
|
lk: ()=>firstRunInstallOffer,
|
|
1207
1236
|
ne: ()=>requireChromiumBinaryForChromiumBased,
|
|
1208
1237
|
nn: ()=>chromeProcessExited,
|
|
@@ -1722,6 +1751,29 @@ var __webpack_modules__ = {
|
|
|
1722
1751
|
(0, _write_json_atomic__rspack_import_3.Z)(readyPath, ready);
|
|
1723
1752
|
} catch {}
|
|
1724
1753
|
}
|
|
1754
|
+
function stampReadyWebDriver(extensionOutputPath, details, runId) {
|
|
1755
|
+
try {
|
|
1756
|
+
if (!extensionOutputPath) return;
|
|
1757
|
+
const readyPath = readyPathFor(extensionOutputPath);
|
|
1758
|
+
if (!node_fs__rspack_import_0.existsSync(readyPath)) return;
|
|
1759
|
+
const ready = JSON.parse(node_fs__rspack_import_0.readFileSync(readyPath, 'utf-8'));
|
|
1760
|
+
if (isForeignRun(ready, runId)) return;
|
|
1761
|
+
const sessionId = String(details?.sessionId || '').trim();
|
|
1762
|
+
const port = details?.port;
|
|
1763
|
+
if ('number' == typeof port && Number.isFinite(port) && sessionId) {
|
|
1764
|
+
ready.webdriverPort = port;
|
|
1765
|
+
ready.webdriverSessionId = sessionId;
|
|
1766
|
+
delete ready.webdriverUnavailableReason;
|
|
1767
|
+
} else {
|
|
1768
|
+
const reason = String(details?.unavailableReason || '').trim();
|
|
1769
|
+
if (!reason) return;
|
|
1770
|
+
delete ready.webdriverPort;
|
|
1771
|
+
delete ready.webdriverSessionId;
|
|
1772
|
+
ready.webdriverUnavailableReason = reason;
|
|
1773
|
+
}
|
|
1774
|
+
(0, _write_json_atomic__rspack_import_3.Z)(readyPath, ready);
|
|
1775
|
+
} catch {}
|
|
1776
|
+
}
|
|
1725
1777
|
function stampReadyBrowserLaunch(extensionOutputPath, details, runId) {
|
|
1726
1778
|
try {
|
|
1727
1779
|
if (!extensionOutputPath) return;
|
|
@@ -1777,6 +1829,18 @@ var __webpack_modules__ = {
|
|
|
1777
1829
|
const code = error?.code;
|
|
1778
1830
|
return 'string' == typeof code && code.startsWith('E_') ? code : void 0;
|
|
1779
1831
|
}
|
|
1832
|
+
function stampReadyCdpFault(extensionOutputPath, code, detail, runId) {
|
|
1833
|
+
try {
|
|
1834
|
+
if (!extensionOutputPath || !code) return;
|
|
1835
|
+
const readyPath = readyPathFor(extensionOutputPath);
|
|
1836
|
+
if (!node_fs__rspack_import_0.existsSync(readyPath)) return;
|
|
1837
|
+
const ready = JSON.parse(node_fs__rspack_import_0.readFileSync(readyPath, 'utf-8'));
|
|
1838
|
+
if (isForeignRun(ready, runId)) return;
|
|
1839
|
+
ready.cdpFaultCode = code;
|
|
1840
|
+
ready.cdpFaultMessage = String(detail || '').trim() || 'the CDP wire failed after launch';
|
|
1841
|
+
(0, _write_json_atomic__rspack_import_3.Z)(readyPath, ready);
|
|
1842
|
+
} catch {}
|
|
1843
|
+
}
|
|
1780
1844
|
function stampReadyExtensionId(extensionOutputPath, extensionId) {
|
|
1781
1845
|
try {
|
|
1782
1846
|
const id = String(extensionId || '').trim();
|
|
@@ -1848,8 +1912,10 @@ var __webpack_modules__ = {
|
|
|
1848
1912
|
M: ()=>stampReadyBrowserLaunch,
|
|
1849
1913
|
NE: ()=>launchFailureCode,
|
|
1850
1914
|
O3: ()=>readyPathFor,
|
|
1915
|
+
QP: ()=>stampReadyCdpFault,
|
|
1851
1916
|
Uf: ()=>readReadyRunId,
|
|
1852
1917
|
Wi: ()=>stampReadyBrowserExited,
|
|
1918
|
+
ZC: ()=>stampReadyWebDriver,
|
|
1853
1919
|
__: ()=>stampReadyRdpPort,
|
|
1854
1920
|
dT: ()=>describeLaunchFailure,
|
|
1855
1921
|
dz: ()=>stampReadyBrowserLaunchFailed,
|
|
@@ -2013,7 +2079,9 @@ var __webpack_modules__ = {
|
|
|
2013
2079
|
},
|
|
2014
2080
|
"./browsers/browsers-lib/resolve-profile.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
2015
2081
|
__webpack_require__.d(__webpack_exports__, {
|
|
2016
|
-
|
|
2082
|
+
Md: ()=>normalizeProfileOption,
|
|
2083
|
+
c6: ()=>resolveProfileConfig,
|
|
2084
|
+
Jv: ()=>systemProfileEnvName
|
|
2017
2085
|
});
|
|
2018
2086
|
var external_node_fs_ = __webpack_require__("node:fs");
|
|
2019
2087
|
var external_node_path_ = __webpack_require__("node:path");
|
|
@@ -2021,6 +2089,15 @@ var __webpack_modules__ = {
|
|
|
2021
2089
|
var messaging = __webpack_require__("./helpers/messaging.ts");
|
|
2022
2090
|
var messages = __webpack_require__("./browsers/browsers-lib/messages.ts");
|
|
2023
2091
|
var shared_utils = __webpack_require__("./browsers/browsers-lib/shared-utils.ts");
|
|
2092
|
+
function systemProfileEnvName(env = process.env) {
|
|
2093
|
+
for (const name of [
|
|
2094
|
+
'EXTENSION_USE_SYSTEM_PROFILE',
|
|
2095
|
+
'EXTJS_USE_SYSTEM_PROFILE'
|
|
2096
|
+
]){
|
|
2097
|
+
const value = env[name];
|
|
2098
|
+
if (value) return 'true' === String(value).toLowerCase().trim() ? name : void 0;
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2024
2101
|
function hasExplicit(rawProfile) {
|
|
2025
2102
|
return 'string' == typeof rawProfile && rawProfile.trim().length > 0;
|
|
2026
2103
|
}
|
|
@@ -2870,6 +2947,7 @@ var __webpack_modules__ = {
|
|
|
2870
2947
|
extension: opts.extensionsToLoad,
|
|
2871
2948
|
browser: opts.browser,
|
|
2872
2949
|
profile: opts.profile,
|
|
2950
|
+
profileSource: opts.profileSource,
|
|
2873
2951
|
preferences: opts.preferences,
|
|
2874
2952
|
browserFlags: opts.browserFlags,
|
|
2875
2953
|
startingUrl: opts.startingUrl,
|
|
@@ -2937,19 +3015,32 @@ var __webpack_modules__ = {
|
|
|
2937
3015
|
};
|
|
2938
3016
|
}
|
|
2939
3017
|
},
|
|
2940
|
-
"./browsers/run-chromium/cdp/
|
|
3018
|
+
"./browsers/run-chromium/cdp/coded-error.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
3019
|
+
var _helpers_messaging__rspack_import_0 = __webpack_require__("./helpers/messaging.ts");
|
|
3020
|
+
function codedError(code, message) {
|
|
3021
|
+
return Object.assign(new Error(message), {
|
|
3022
|
+
code
|
|
3023
|
+
});
|
|
3024
|
+
}
|
|
3025
|
+
function declaredCode(error) {
|
|
3026
|
+
const code = error?.code;
|
|
3027
|
+
return 'string' == typeof code && Object.prototype.hasOwnProperty.call(_helpers_messaging__rspack_import_0.Lp, code) ? code : void 0;
|
|
3028
|
+
}
|
|
2941
3029
|
__webpack_require__.d(__webpack_exports__, {
|
|
2942
|
-
|
|
2943
|
-
|
|
3030
|
+
A: ()=>codedError,
|
|
3031
|
+
K: ()=>declaredCode
|
|
2944
3032
|
});
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
var
|
|
2948
|
-
var
|
|
2949
|
-
var
|
|
3033
|
+
},
|
|
3034
|
+
"./browsers/run-chromium/cdp/discovery.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
3035
|
+
var node_http__rspack_import_0 = __webpack_require__("node:http");
|
|
3036
|
+
var node_net__rspack_import_1 = __webpack_require__("node:net");
|
|
3037
|
+
var _helpers_messaging__rspack_import_2 = __webpack_require__("./helpers/messaging.ts");
|
|
3038
|
+
var _browsers_lib_constants__rspack_import_3 = __webpack_require__("./browsers/browsers-lib/constants.ts");
|
|
3039
|
+
var _browsers_lib_messages__rspack_import_4 = __webpack_require__("./browsers/browsers-lib/messages.ts");
|
|
3040
|
+
var _coded_error__rspack_import_5 = __webpack_require__("./browsers/run-chromium/cdp/coded-error.ts");
|
|
2950
3041
|
async function getJson(host, port, path) {
|
|
2951
3042
|
return new Promise((resolve, reject)=>{
|
|
2952
|
-
const req =
|
|
3043
|
+
const req = node_http__rspack_import_0.request({
|
|
2953
3044
|
hostname: host,
|
|
2954
3045
|
port,
|
|
2955
3046
|
path,
|
|
@@ -2966,8 +3057,8 @@ var __webpack_modules__ = {
|
|
|
2966
3057
|
});
|
|
2967
3058
|
});
|
|
2968
3059
|
req.on('error', (err)=>reject(err));
|
|
2969
|
-
req.setTimeout(
|
|
2970
|
-
req.destroy(
|
|
3060
|
+
req.setTimeout(_browsers_lib_constants__rspack_import_3.C4, ()=>{
|
|
3061
|
+
req.destroy((0, _coded_error__rspack_import_5.A)(_helpers_messaging__rspack_import_2.Lp.E_CDP_TIMEOUT, `CDP endpoint timed out: ${path}`));
|
|
2971
3062
|
});
|
|
2972
3063
|
req.end();
|
|
2973
3064
|
});
|
|
@@ -2977,14 +3068,14 @@ var __webpack_modules__ = {
|
|
|
2977
3068
|
const version = await getJson(host, port, '/json/version');
|
|
2978
3069
|
const wsUrl = 'string' == typeof version?.webSocketDebuggerUrl ? version.webSocketDebuggerUrl : void 0;
|
|
2979
3070
|
if (wsUrl) {
|
|
2980
|
-
if (isDev) (0,
|
|
3071
|
+
if (isDev) (0, _helpers_messaging__rspack_import_2._w)(_browsers_lib_messages__rspack_import_4.Te());
|
|
2981
3072
|
return wsUrl;
|
|
2982
3073
|
}
|
|
2983
3074
|
} catch (error) {
|
|
2984
|
-
if (isDev) (0,
|
|
3075
|
+
if (isDev) (0, _helpers_messaging__rspack_import_2.mR)('[CDP] Failed to read /json/version:', String(error?.message || error));
|
|
2985
3076
|
}
|
|
2986
3077
|
const targets = await getJson(host, port, '/json');
|
|
2987
|
-
if (isDev) (0,
|
|
3078
|
+
if (isDev) (0, _helpers_messaging__rspack_import_2._w)(_browsers_lib_messages__rspack_import_4.FF((targets || []).length || 0));
|
|
2988
3079
|
const pageTarget = (targets || []).find((target)=>{
|
|
2989
3080
|
const type = String(target?.type || '');
|
|
2990
3081
|
const ws = 'string' == typeof target?.webSocketDebuggerUrl ? target.webSocketDebuggerUrl : '';
|
|
@@ -2992,14 +3083,14 @@ var __webpack_modules__ = {
|
|
|
2992
3083
|
});
|
|
2993
3084
|
const pageWs = 'string' == typeof pageTarget?.webSocketDebuggerUrl ? pageTarget.webSocketDebuggerUrl : '';
|
|
2994
3085
|
if (pageWs) {
|
|
2995
|
-
if (isDev) (0,
|
|
3086
|
+
if (isDev) (0, _helpers_messaging__rspack_import_2._w)(_browsers_lib_messages__rspack_import_4.Te());
|
|
2996
3087
|
return pageWs;
|
|
2997
3088
|
}
|
|
2998
|
-
throw
|
|
3089
|
+
throw (0, _coded_error__rspack_import_5.A)(_helpers_messaging__rspack_import_2.Lp.E_CDP_NOT_CONNECTED, 'No CDP WebSocket URL available');
|
|
2999
3090
|
}
|
|
3000
3091
|
async function checkChromeRemoteDebugging(port = 9222, host = '127.0.0.1') {
|
|
3001
3092
|
return new Promise((resolve)=>{
|
|
3002
|
-
const socket = new
|
|
3093
|
+
const socket = new node_net__rspack_import_1.Socket();
|
|
3003
3094
|
socket.on('connect', ()=>{
|
|
3004
3095
|
socket.destroy();
|
|
3005
3096
|
resolve(true);
|
|
@@ -3015,6 +3106,29 @@ var __webpack_modules__ = {
|
|
|
3015
3106
|
socket.connect(port, host);
|
|
3016
3107
|
});
|
|
3017
3108
|
}
|
|
3109
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
3110
|
+
N: ()=>discoverWebSocketDebuggerUrl,
|
|
3111
|
+
z: ()=>checkChromeRemoteDebugging
|
|
3112
|
+
});
|
|
3113
|
+
},
|
|
3114
|
+
"./browsers/run-chromium/cdp/pipe-guard.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
3115
|
+
const pipeOwners = new WeakMap();
|
|
3116
|
+
const guardedPipes = new WeakSet();
|
|
3117
|
+
function guardCdpPipe(stream) {
|
|
3118
|
+
if (!stream || 'function' != typeof stream.on) return;
|
|
3119
|
+
if (guardedPipes.has(stream)) return;
|
|
3120
|
+
guardedPipes.add(stream);
|
|
3121
|
+
stream.on('error', (error)=>{
|
|
3122
|
+
pipeOwners.get(stream)?.reportPipeGone(error);
|
|
3123
|
+
});
|
|
3124
|
+
}
|
|
3125
|
+
function claimCdpPipe(stream, owner) {
|
|
3126
|
+
pipeOwners.set(stream, owner);
|
|
3127
|
+
}
|
|
3128
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
3129
|
+
S: ()=>claimCdpPipe,
|
|
3130
|
+
b: ()=>guardCdpPipe
|
|
3131
|
+
});
|
|
3018
3132
|
},
|
|
3019
3133
|
"./browsers/run-chromium/chromium-context/index.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
3020
3134
|
function createChromiumContext() {
|
|
@@ -3351,7 +3465,9 @@ var __webpack_modules__ = {
|
|
|
3351
3465
|
var runtime_options = __webpack_require__("./browsers/browsers-lib/runtime-options.ts");
|
|
3352
3466
|
var shared_utils = __webpack_require__("./browsers/browsers-lib/shared-utils.ts");
|
|
3353
3467
|
var version_probe = __webpack_require__("./browsers/browsers-lib/version-probe.ts");
|
|
3468
|
+
var coded_error = __webpack_require__("./browsers/run-chromium/cdp/coded-error.ts");
|
|
3354
3469
|
var discovery = __webpack_require__("./browsers/run-chromium/cdp/discovery.ts");
|
|
3470
|
+
var pipe_guard = __webpack_require__("./browsers/run-chromium/cdp/pipe-guard.ts");
|
|
3355
3471
|
var manifest_readiness = __webpack_require__("./browsers/run-chromium/manifest-readiness.ts");
|
|
3356
3472
|
var companion_session = __webpack_require__("./browsers/browsers-lib/companion-session.ts");
|
|
3357
3473
|
var resolve_profile = __webpack_require__("./browsers/browsers-lib/resolve-profile.ts");
|
|
@@ -3882,6 +3998,17 @@ var __webpack_modules__ = {
|
|
|
3882
3998
|
code: messaging.Lp.E_BROWSER_BINARY_INVALID
|
|
3883
3999
|
});
|
|
3884
4000
|
}
|
|
4001
|
+
function binaryRequiredError() {
|
|
4002
|
+
return Object.assign(new Error(messages.ne()), {
|
|
4003
|
+
code: messaging.Lp.E_BROWSER_BINARY_REQUIRED
|
|
4004
|
+
});
|
|
4005
|
+
}
|
|
4006
|
+
function browserNotFoundError(reason) {
|
|
4007
|
+
return Object.assign(new Error(reason), {
|
|
4008
|
+
code: messaging.Lp.E_BROWSER_NOT_FOUND
|
|
4009
|
+
});
|
|
4010
|
+
}
|
|
4011
|
+
const STDERR_TAIL_LINES = 8;
|
|
3885
4012
|
class ChromiumLaunchPlugin {
|
|
3886
4013
|
getExtensionLoadRefusal() {
|
|
3887
4014
|
return this.extensionLoadRefused || null;
|
|
@@ -3914,6 +4041,11 @@ var __webpack_modules__ = {
|
|
|
3914
4041
|
const outputPath = (0, extension_output_path.W)(compilation, void 0);
|
|
3915
4042
|
(0, ready_stamp.dz)(outputPath, (0, ready_stamp.dT)(error), (0, ready_stamp.Uf)(outputPath), (0, ready_stamp.NE)(error));
|
|
3916
4043
|
}
|
|
4044
|
+
stampCdpFault(compilation, error) {
|
|
4045
|
+
const code = (0, coded_error.K)(error);
|
|
4046
|
+
if (!code) return;
|
|
4047
|
+
(0, ready_stamp.QP)((0, extension_output_path.W)(compilation, void 0), code, (0, ready_stamp.dT)(error), this.closeHandlerContext?.runId);
|
|
4048
|
+
}
|
|
3917
4049
|
apply(compiler) {
|
|
3918
4050
|
const host = compiler;
|
|
3919
4051
|
this.logger = 'function' == typeof host?.getInfrastructureLogger ? host.getInfrastructureLogger('ChromiumLaunchPlugin') : {
|
|
@@ -3925,8 +4057,8 @@ var __webpack_modules__ = {
|
|
|
3925
4057
|
host.hooks.done.tapPromise('chromium:launch', async (stats)=>{
|
|
3926
4058
|
try {
|
|
3927
4059
|
const hasErrors = 'function' == typeof stats?.hasErrors ? stats.hasErrors() : !!stats?.compilation?.errors?.length;
|
|
3928
|
-
if (hasErrors) return void this.logger.info(messages.y7());
|
|
3929
4060
|
if (this.didLaunch) return;
|
|
4061
|
+
if (hasErrors) return void this.logger.info(messages.y7());
|
|
3930
4062
|
await this.launchChromium(stats.compilation);
|
|
3931
4063
|
this.didLaunch = true;
|
|
3932
4064
|
if (!this.didReportReady && !this.extensionLoadRefused && !this.browserGone) (0, messaging._w)((0, ready_message.G)(stats.compilation.options.mode, this.options.browser));
|
|
@@ -3950,10 +4082,6 @@ var __webpack_modules__ = {
|
|
|
3950
4082
|
if (inTestRunner && !dryRun) return void logChromiumDryRun(this.options.browser, this.options?.chromiumBinary ? (0, wsl_support.f7)(String(this.options.chromiumBinary)) : 'chromium-mock-binary', []);
|
|
3951
4083
|
if (inTestRunner && dryRun) return void this.printDryRunPlan(compilation, this.options?.chromiumBinary ? (0, wsl_support.f7)(String(this.options.chromiumBinary)) : 'chromium-mock-binary');
|
|
3952
4084
|
const browser = this.options?.browser;
|
|
3953
|
-
const exitForLaunchFailure = (reason)=>{
|
|
3954
|
-
this.stampLaunchFailed(compilation, reason);
|
|
3955
|
-
process.exit(1);
|
|
3956
|
-
};
|
|
3957
4085
|
const notInstalledReason = `${String(browser)} isn't installed and no binary was found`;
|
|
3958
4086
|
let browserBinaryLocation = null;
|
|
3959
4087
|
let printedGuidance = false;
|
|
@@ -4174,11 +4302,11 @@ var __webpack_modules__ = {
|
|
|
4174
4302
|
const guidance = getInstallGuidanceText('edge');
|
|
4175
4303
|
printInstallGuidance(guidance, 'edge');
|
|
4176
4304
|
browserBinaryLocation = null;
|
|
4177
|
-
|
|
4178
|
-
exitForLaunchFailure(notInstalledReason);
|
|
4305
|
+
throw browserNotFoundError(notInstalledReason);
|
|
4179
4306
|
}
|
|
4180
4307
|
}
|
|
4181
|
-
} catch
|
|
4308
|
+
} catch (error) {
|
|
4309
|
+
if ((0, ready_stamp.NE)(error)) throw error;
|
|
4182
4310
|
const guidance = getInstallGuidanceText('edge');
|
|
4183
4311
|
const fallback = resolveWslFallback();
|
|
4184
4312
|
if (fallback) browserBinaryLocation = fallback;
|
|
@@ -4186,15 +4314,11 @@ var __webpack_modules__ = {
|
|
|
4186
4314
|
printInstallGuidance(guidance, 'edge');
|
|
4187
4315
|
browserBinaryLocation = null;
|
|
4188
4316
|
}
|
|
4189
|
-
if (!browserBinaryLocation)
|
|
4190
|
-
else exitForLaunchFailure(notInstalledReason);
|
|
4317
|
+
if (!browserBinaryLocation) throw browserNotFoundError(notInstalledReason);
|
|
4191
4318
|
}
|
|
4192
4319
|
break;
|
|
4193
4320
|
case 'chromium-based':
|
|
4194
|
-
|
|
4195
|
-
if (process.env.VITEST || process.env.VITEST_WORKER_ID) throw new Error('chromium-based requires --chromium-binary');
|
|
4196
|
-
exitForLaunchFailure('the chromium-based target needs --chromium-binary <abs-path>');
|
|
4197
|
-
break;
|
|
4321
|
+
throw binaryRequiredError();
|
|
4198
4322
|
default:
|
|
4199
4323
|
browserBinaryLocation = resolveChromeLikeBinary();
|
|
4200
4324
|
break;
|
|
@@ -4237,8 +4361,7 @@ var __webpack_modules__ = {
|
|
|
4237
4361
|
const forkGuidance = chromiumForkInstallGuidance(browser);
|
|
4238
4362
|
this.logger.error(null !== forkGuidance ? messages.I5(browser, forkGuidance) : messages.Ih(browser, browserBinaryLocation || ''));
|
|
4239
4363
|
}
|
|
4240
|
-
|
|
4241
|
-
exitForLaunchFailure(notInstalledReason);
|
|
4364
|
+
throw browserNotFoundError(notInstalledReason);
|
|
4242
4365
|
}
|
|
4243
4366
|
}
|
|
4244
4367
|
let browserVersionLine;
|
|
@@ -4363,6 +4486,8 @@ var __webpack_modules__ = {
|
|
|
4363
4486
|
input: child.stdio[4],
|
|
4364
4487
|
output: child.stdio[3]
|
|
4365
4488
|
} : void 0;
|
|
4489
|
+
(0, pipe_guard.b)(pipeStreams?.input);
|
|
4490
|
+
(0, pipe_guard.b)(pipeStreams?.output);
|
|
4366
4491
|
if (enableCdp && !pipeStreams) {
|
|
4367
4492
|
let portReady = false;
|
|
4368
4493
|
for(let attempt = 0; attempt < 10; attempt++){
|
|
@@ -4400,7 +4525,7 @@ var __webpack_modules__ = {
|
|
|
4400
4525
|
const CDP_SETUP_TIMEOUT_MS = 45000;
|
|
4401
4526
|
await Promise.race([
|
|
4402
4527
|
mod.setupCdpAfterLaunch(compilation, cdpConfig, chromiumConfig, pipeStreams),
|
|
4403
|
-
new Promise((_, reject)=>setTimeout(()=>reject(
|
|
4528
|
+
new Promise((_, reject)=>setTimeout(()=>reject((0, coded_error.A)(messaging.Lp.E_CDP_TIMEOUT, `CDP setup did not complete within ${CDP_SETUP_TIMEOUT_MS / 1000}s. Chrome likely rejected the extension at launch, open chrome://extensions in the dev browser window for the exact error. Common causes: MV3 content_security_policy with 'unsafe-inline', manifest keys Chrome does not support, or manifest references to files missing from the output. Reload/HMR cannot attach until this is fixed.`)), CDP_SETUP_TIMEOUT_MS).unref?.())
|
|
4404
4529
|
]);
|
|
4405
4530
|
if (cdpConfig.extensionLoadRefused) {
|
|
4406
4531
|
this.extensionLoadRefused = cdpConfig.extensionLoadRefused;
|
|
@@ -4418,6 +4543,7 @@ var __webpack_modules__ = {
|
|
|
4418
4543
|
if ('development' === compilation.options.mode) (0, messaging.Gg)(messages.u1(this.options.browser));
|
|
4419
4544
|
return;
|
|
4420
4545
|
}
|
|
4546
|
+
this.stampCdpFault(compilation, error);
|
|
4421
4547
|
reportReady();
|
|
4422
4548
|
}
|
|
4423
4549
|
}
|
|
@@ -4460,14 +4586,21 @@ var __webpack_modules__ = {
|
|
|
4460
4586
|
});
|
|
4461
4587
|
if ((0, messaging._o)()) this.logger.debug?.('[browser] Final Chrome flags:', launchArgs.join(' '));
|
|
4462
4588
|
const stderrStream = child.stdio?.[2];
|
|
4589
|
+
const stderrTail = [];
|
|
4590
|
+
let pending = '';
|
|
4591
|
+
const keepStderrLine = (line)=>{
|
|
4592
|
+
if (!line) return;
|
|
4593
|
+
stderrTail.push(line);
|
|
4594
|
+
if (stderrTail.length > STDERR_TAIL_LINES) stderrTail.shift();
|
|
4595
|
+
};
|
|
4463
4596
|
if (stderrStream && 'function' == typeof stderrStream.on) {
|
|
4464
|
-
let pending = '';
|
|
4465
4597
|
stderrStream.on('data', (chunk)=>{
|
|
4466
4598
|
pending += String(chunk);
|
|
4467
4599
|
let newline;
|
|
4468
4600
|
while(-1 !== (newline = pending.indexOf('\n'))){
|
|
4469
4601
|
const line = pending.slice(0, newline).trim();
|
|
4470
4602
|
pending = pending.slice(newline + 1);
|
|
4603
|
+
keepStderrLine(line);
|
|
4471
4604
|
if (/Failed to load extension|Manifest file is missing or unreadable|Manifest is not valid JSON/i.test(line)) this.logger.error(`[browser] Chrome rejected an extension at launch, reload/HMR cannot attach until this is fixed:\n${line}`);
|
|
4472
4605
|
}
|
|
4473
4606
|
});
|
|
@@ -4480,6 +4613,11 @@ var __webpack_modules__ = {
|
|
|
4480
4613
|
const beforeReady = !this.didReportReady;
|
|
4481
4614
|
this.browserGone = true;
|
|
4482
4615
|
this.logger.error(messages.NV(this.options.browser, code, signal, this.closeHandlerContext?.command || 'preview'));
|
|
4616
|
+
if (beforeReady) {
|
|
4617
|
+
keepStderrLine(pending.trim());
|
|
4618
|
+
pending = '';
|
|
4619
|
+
if (stderrTail.length > 0) this.logger.error(messages.LT(this.options.browser, stderrTail));
|
|
4620
|
+
}
|
|
4483
4621
|
(0, ready_stamp.Wi)(this.closeHandlerContext?.extensionOutputPath, code, signal, this.closeHandlerContext?.runId, {
|
|
4484
4622
|
beforeReady
|
|
4485
4623
|
});
|
|
@@ -4736,6 +4874,7 @@ var __webpack_modules__ = {
|
|
|
4736
4874
|
var ready_message = __webpack_require__("./browsers/browsers-lib/ready-message.ts");
|
|
4737
4875
|
var ready_stamp = __webpack_require__("./browsers/browsers-lib/ready-stamp.ts");
|
|
4738
4876
|
var resolve_live_pid = __webpack_require__("./browsers/browsers-lib/resolve-live-pid.ts");
|
|
4877
|
+
var resolve_profile = __webpack_require__("./browsers/browsers-lib/resolve-profile.ts");
|
|
4739
4878
|
var runtime_options = __webpack_require__("./browsers/browsers-lib/runtime-options.ts");
|
|
4740
4879
|
var shared_utils = __webpack_require__("./browsers/browsers-lib/shared-utils.ts");
|
|
4741
4880
|
var version_probe = __webpack_require__("./browsers/browsers-lib/version-probe.ts");
|
|
@@ -4828,7 +4967,6 @@ var __webpack_modules__ = {
|
|
|
4828
4967
|
}
|
|
4829
4968
|
var external_node_path_ = __webpack_require__("node:path");
|
|
4830
4969
|
var companion_session = __webpack_require__("./browsers/browsers-lib/companion-session.ts");
|
|
4831
|
-
var resolve_profile = __webpack_require__("./browsers/browsers-lib/resolve-profile.ts");
|
|
4832
4970
|
const masterPreferences = {
|
|
4833
4971
|
'browser.aboutwelcome.enabled': false,
|
|
4834
4972
|
'browser.startup.homepage_override.mstone': 'ignore',
|
|
@@ -4978,7 +5116,7 @@ var __webpack_modules__ = {
|
|
|
4978
5116
|
if (launchUrl) binaryArgs.push('--url', String(launchUrl));
|
|
4979
5117
|
const outPath = compilation.options.output?.path || external_node_path_.resolve(process.cwd(), 'dist/firefox');
|
|
4980
5118
|
const distRoot = external_node_path_.dirname(outPath);
|
|
4981
|
-
const useSystemProfile =
|
|
5119
|
+
const useSystemProfile = Boolean((0, resolve_profile.Jv)());
|
|
4982
5120
|
const contextDir = compilation?.options?.context || process.cwd();
|
|
4983
5121
|
const shownPath = (p)=>{
|
|
4984
5122
|
try {
|
|
@@ -5212,7 +5350,9 @@ var __webpack_modules__ = {
|
|
|
5212
5350
|
}
|
|
5213
5351
|
}
|
|
5214
5352
|
async function installTemporaryAddon(client, addonsActor, addonPath, openDevTools) {
|
|
5215
|
-
if (!addonsActor) throw new Error(messages.WV('firefox', 'No addonsActor available from Firefox RDP.'))
|
|
5353
|
+
if (!addonsActor) throw Object.assign(new Error(messages.WV('firefox', 'No addonsActor available from Firefox RDP.')), {
|
|
5354
|
+
code: messaging.Lp.E_ADDON_INSTALL
|
|
5355
|
+
});
|
|
5216
5356
|
const tryInstall = async (pathToUse)=>client.request({
|
|
5217
5357
|
to: addonsActor,
|
|
5218
5358
|
type: 'installTemporaryAddon',
|
|
@@ -5604,7 +5744,7 @@ var __webpack_modules__ = {
|
|
|
5604
5744
|
await new Promise((resolve)=>setTimeout(resolve, RETRY_INTERVAL));
|
|
5605
5745
|
} else {
|
|
5606
5746
|
const err = error;
|
|
5607
|
-
(0, messaging.Gg)(messages.dk(this.options.browser, err.stack ||
|
|
5747
|
+
(0, messaging.Gg)(messages.dk(this.options.browser, (0, messaging._o)() ? err.stack || err : err));
|
|
5608
5748
|
throw err;
|
|
5609
5749
|
}
|
|
5610
5750
|
}
|
|
@@ -5669,7 +5809,9 @@ var __webpack_modules__ = {
|
|
|
5669
5809
|
const outcome = classifyAddonInstallFailure(err);
|
|
5670
5810
|
if ('refused' === outcome.status) this.addonInstallRefusalReason = outcome.reason;
|
|
5671
5811
|
const message = requestErrorToMessage(err);
|
|
5672
|
-
throw new Error(messages.WV(this.options.browser, message))
|
|
5812
|
+
throw Object.assign(new Error(messages.WV(this.options.browser, message)), {
|
|
5813
|
+
code: (0, ready_stamp.NE)(err) ?? messaging.Lp.E_ADDON_INSTALL
|
|
5814
|
+
});
|
|
5673
5815
|
}
|
|
5674
5816
|
}
|
|
5675
5817
|
if (primaryUserAddonId) this.derivedExtensionId = primaryUserAddonId;
|
|
@@ -5904,6 +6046,23 @@ var __webpack_modules__ = {
|
|
|
5904
6046
|
code: messaging.Lp.E_BROWSER_BINARY_INVALID
|
|
5905
6047
|
});
|
|
5906
6048
|
}
|
|
6049
|
+
function systemProfileRefusal(browser, sources) {
|
|
6050
|
+
return Object.assign(new Error(messages.Mm(browser, sources)), {
|
|
6051
|
+
code: messaging.Lp.E_FLAG_NOT_SUPPORTED_HERE
|
|
6052
|
+
});
|
|
6053
|
+
}
|
|
6054
|
+
function systemProfileSources(host) {
|
|
6055
|
+
const sources = [];
|
|
6056
|
+
if (false === (0, resolve_profile.Md)(host.profile)) sources.push({
|
|
6057
|
+
kind: 'config' === host.profileSource ? 'config' : 'flag'
|
|
6058
|
+
});
|
|
6059
|
+
const envName = (0, resolve_profile.Jv)();
|
|
6060
|
+
if (envName) sources.push({
|
|
6061
|
+
kind: 'env',
|
|
6062
|
+
name: envName
|
|
6063
|
+
});
|
|
6064
|
+
return sources;
|
|
6065
|
+
}
|
|
5907
6066
|
class FirefoxLaunchPlugin {
|
|
5908
6067
|
get spawnedBrowser() {
|
|
5909
6068
|
return null !== this.child;
|
|
@@ -5945,12 +6104,12 @@ var __webpack_modules__ = {
|
|
|
5945
6104
|
host.hooks.done.tapAsync('run-firefox:launch', async (stats, done)=>{
|
|
5946
6105
|
try {
|
|
5947
6106
|
const hasErrors = 'function' == typeof stats?.hasErrors ? stats.hasErrors() : !!stats?.compilation?.errors?.length;
|
|
6107
|
+
if (this.ctx.didLaunch) return void done();
|
|
5948
6108
|
if (hasErrors) {
|
|
5949
6109
|
this.ctx.logger?.info?.(messages.y7());
|
|
5950
6110
|
done();
|
|
5951
6111
|
return;
|
|
5952
6112
|
}
|
|
5953
|
-
if (this.ctx.didLaunch) return void done();
|
|
5954
6113
|
await this.launch(stats.compilation, (0, runtime_options.zU)(this.host, stats.compilation.options.mode));
|
|
5955
6114
|
if ('development' === stats.compilation.options.mode && !this.host.extensionLoadRefused) this.reportReady('development');
|
|
5956
6115
|
this.ctx.didLaunch = true;
|
|
@@ -5959,8 +6118,6 @@ var __webpack_modules__ = {
|
|
|
5959
6118
|
const rendered = error instanceof Error ? error.message : String(error);
|
|
5960
6119
|
if ((0, messaging.Qi)(rendered)) (0, messaging.Gg)(rendered);
|
|
5961
6120
|
else this.ctx.logger?.error?.(messages.MQ(error));
|
|
5962
|
-
if (process.env.VITEST || process.env.VITEST_WORKER_ID) return void done(error);
|
|
5963
|
-
process.exit(1);
|
|
5964
6121
|
}
|
|
5965
6122
|
done();
|
|
5966
6123
|
});
|
|
@@ -5969,6 +6126,8 @@ var __webpack_modules__ = {
|
|
|
5969
6126
|
const compilationErrors = compilation?.errors || [];
|
|
5970
6127
|
if (compilationErrors.length > 0) return void this.ctx.logger?.info?.(messages.y7());
|
|
5971
6128
|
if ((0, messaging._o)()) this.ctx.logger?.info?.(messages.A9(this.host.browser));
|
|
6129
|
+
const systemProfile = systemProfileSources(this.host);
|
|
6130
|
+
if (systemProfile.length > 0) throw systemProfileRefusal(this.host.browser, systemProfile);
|
|
5972
6131
|
const normalizePath = (value)=>{
|
|
5973
6132
|
const normalized = value ? (0, wsl_support.f7)(value) : null;
|
|
5974
6133
|
return normalized && external_node_fs_.existsSync(normalized) ? normalized : null;
|
|
@@ -5990,19 +6149,16 @@ var __webpack_modules__ = {
|
|
|
5990
6149
|
return 'npx extension install firefox';
|
|
5991
6150
|
}
|
|
5992
6151
|
};
|
|
5993
|
-
const exitForLaunchFailure = (message)=>{
|
|
5994
|
-
if (message) (0, messaging.Gg)(message);
|
|
5995
|
-
this.stampLaunchFailed(message || `${this.host.browser} could not be launched`);
|
|
5996
|
-
process.exit(1);
|
|
5997
|
-
};
|
|
5998
6152
|
const failGeckoBinaryRequirement = ()=>{
|
|
5999
6153
|
if (this.host.geckoBinary) throw invalidBinaryPinError(String(this.host.geckoBinary));
|
|
6000
|
-
|
|
6154
|
+
throw Object.assign(new Error(messages.jk()), {
|
|
6155
|
+
code: messaging.Lp.E_BROWSER_BINARY_REQUIRED
|
|
6156
|
+
});
|
|
6001
6157
|
};
|
|
6002
|
-
const
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6158
|
+
const throwNotInstalled = ()=>{
|
|
6159
|
+
throw Object.assign(new Error(`${this.host.browser} isn't installed and no binary was found`), {
|
|
6160
|
+
code: messaging.Lp.E_BROWSER_NOT_FOUND
|
|
6161
|
+
});
|
|
6006
6162
|
};
|
|
6007
6163
|
const inTestRunner = Boolean(process.env.VITEST || process.env.VITEST_WORKER_ID);
|
|
6008
6164
|
const dryRun = Boolean(this.host.dryRun);
|
|
@@ -6010,12 +6166,9 @@ var __webpack_modules__ = {
|
|
|
6010
6166
|
if (inTestRunner && dryRun) return void await this.printDryRunPlan(compilation, options, this.host.geckoBinary ? (0, wsl_support.f7)(String(this.host.geckoBinary)) : 'firefox-mock-binary');
|
|
6011
6167
|
if ('librewolf' === this.host.browser) {
|
|
6012
6168
|
const remoteDebugging = (0, librewolf_overrides.u5)(external_node_fs_, process.env, process.platform);
|
|
6013
|
-
if (!remoteDebugging.enabled) {
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
this.stampLaunchFailed('LibreWolf remote debugging is disabled');
|
|
6017
|
-
process.exit(1);
|
|
6018
|
-
}
|
|
6169
|
+
if (!remoteDebugging.enabled) throw Object.assign(new Error(messages.bC(remoteDebugging.expectedPath)), {
|
|
6170
|
+
code: messaging.Lp.E_BROWSER_CONNECT
|
|
6171
|
+
});
|
|
6019
6172
|
}
|
|
6020
6173
|
let browserBinaryLocation = resolveManagedBinary();
|
|
6021
6174
|
let skipDetection = Boolean(browserBinaryLocation);
|
|
@@ -6099,7 +6252,7 @@ var __webpack_modules__ = {
|
|
|
6099
6252
|
if (wslFallback) browserBinaryLocation = wslFallback;
|
|
6100
6253
|
else {
|
|
6101
6254
|
this.printInstallHint(compilation, getInstallGuidanceText());
|
|
6102
|
-
|
|
6255
|
+
throwNotInstalled();
|
|
6103
6256
|
}
|
|
6104
6257
|
}
|
|
6105
6258
|
}
|
|
@@ -6165,7 +6318,7 @@ var __webpack_modules__ = {
|
|
|
6165
6318
|
const reason = error?.extensionLoadRefusedReason;
|
|
6166
6319
|
if (!reason) {
|
|
6167
6320
|
(0, ready_stamp.__)(this.extensionOutputPath, debugPort);
|
|
6168
|
-
(0, ready_stamp.dz)(this.extensionOutputPath, (0, ready_stamp.dT)(error), this.launchRunId);
|
|
6321
|
+
(0, ready_stamp.dz)(this.extensionOutputPath, (0, ready_stamp.dT)(error), this.launchRunId, (0, ready_stamp.NE)(error));
|
|
6169
6322
|
throw error;
|
|
6170
6323
|
}
|
|
6171
6324
|
this.reportAddonLoadRefused(reason);
|
|
@@ -6185,19 +6338,11 @@ var __webpack_modules__ = {
|
|
|
6185
6338
|
this.ctx.logger?.info?.(messages.dw(profilePath));
|
|
6186
6339
|
}
|
|
6187
6340
|
} catch {}
|
|
6188
|
-
} else
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
binary: this.child?.spawnfile || plan.binary,
|
|
6194
|
-
binaryProvenance: this.host.launchBinaryProvenance,
|
|
6195
|
-
extensionId: this.extensionOutputPath ? (0, banner.MT)(this.extensionOutputPath) : void 0
|
|
6196
|
-
}, this.launchRunId);
|
|
6197
|
-
this.wireChildLifecycle();
|
|
6198
|
-
if (debugPort > 0) (0, ready_stamp.__)(this.extensionOutputPath, debugPort);
|
|
6199
|
-
this.scheduleWatchTimeout();
|
|
6200
|
-
}
|
|
6341
|
+
} else throw systemProfileRefusal(this.host.browser, [
|
|
6342
|
+
{
|
|
6343
|
+
kind: 'flag'
|
|
6344
|
+
}
|
|
6345
|
+
]);
|
|
6201
6346
|
}
|
|
6202
6347
|
async printDryRunPlan(compilation, options, binaryPath) {
|
|
6203
6348
|
const launchConfig = await resolveFirefoxLaunchConfig(compilation, {
|
|
@@ -6255,8 +6400,6 @@ var __webpack_modules__ = {
|
|
|
6255
6400
|
if (!child) return;
|
|
6256
6401
|
child.on('error', (error)=>{
|
|
6257
6402
|
this.ctx.logger?.error?.(messages._D(this.host.browser, error));
|
|
6258
|
-
if (process.env.VITEST || process.env.VITEST_WORKER_ID) throw new Error('Firefox startup timed out');
|
|
6259
|
-
process.exit(1);
|
|
6260
6403
|
});
|
|
6261
6404
|
child.on('close', (code, signal)=>{
|
|
6262
6405
|
const expected = (0, process_teardown.Op)(child);
|
|
@@ -6499,15 +6642,9 @@ var __webpack_modules__ = {
|
|
|
6499
6642
|
Tu: LIBREWOLF_REMOTE_DEBUGGING_LINES
|
|
6500
6643
|
});
|
|
6501
6644
|
},
|
|
6502
|
-
"./browsers/run-firefox/rdp/remote-firefox/
|
|
6503
|
-
__webpack_require__.
|
|
6504
|
-
|
|
6505
|
-
});
|
|
6506
|
-
const external_node_events_namespaceObject = require("node:events");
|
|
6507
|
-
var external_node_events_default = /*#__PURE__*/ __webpack_require__.n(external_node_events_namespaceObject);
|
|
6508
|
-
var messages = __webpack_require__("./browsers/browsers-lib/messages.ts");
|
|
6509
|
-
var constants = __webpack_require__("./browsers/browsers-lib/constants.ts");
|
|
6510
|
-
const EVALUATION_TIMEOUT_MS = constants.pq;
|
|
6645
|
+
"./browsers/run-firefox/rdp/remote-firefox/evaluate.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
6646
|
+
var _browsers_lib_constants__rspack_import_0 = __webpack_require__("./browsers/browsers-lib/constants.ts");
|
|
6647
|
+
const EVALUATION_TIMEOUT_MS = _browsers_lib_constants__rspack_import_0.pq;
|
|
6511
6648
|
const EVALUATION_TYPES = [
|
|
6512
6649
|
'evaluateJSAsync',
|
|
6513
6650
|
'evalWithOptions',
|
|
@@ -6519,16 +6656,23 @@ var __webpack_modules__ = {
|
|
|
6519
6656
|
const initial = value?.initial;
|
|
6520
6657
|
return 'string' == typeof initial ? initial : '';
|
|
6521
6658
|
}
|
|
6659
|
+
class PageThrewError extends Error {
|
|
6660
|
+
constructor(message){
|
|
6661
|
+
super(message);
|
|
6662
|
+
this.name = 'PageThrewError';
|
|
6663
|
+
}
|
|
6664
|
+
}
|
|
6522
6665
|
function evaluationFailure(reply) {
|
|
6523
6666
|
if (!reply || 'object' != typeof reply) return;
|
|
6524
6667
|
const r = reply;
|
|
6525
6668
|
const message = exceptionText(r.exceptionMessage);
|
|
6526
6669
|
const threw = true === r.hasException || true === r.topLevelAwaitRejected || void 0 !== r.exception && null !== r.exception || message.length > 0;
|
|
6527
6670
|
if (!threw) return;
|
|
6528
|
-
return new
|
|
6671
|
+
return new PageThrewError(message || 'The expression threw inside the page');
|
|
6529
6672
|
}
|
|
6530
|
-
function buildEvaluationPayload(tabId, expression, type) {
|
|
6673
|
+
function buildEvaluationPayload(tabId, expression, type, extra) {
|
|
6531
6674
|
const payload = {
|
|
6675
|
+
...extra,
|
|
6532
6676
|
to: tabId,
|
|
6533
6677
|
type,
|
|
6534
6678
|
text: expression
|
|
@@ -6548,8 +6692,8 @@ var __webpack_modules__ = {
|
|
|
6548
6692
|
if ('function' == typeof client.removeListener) client.removeListener('message', listener);
|
|
6549
6693
|
};
|
|
6550
6694
|
}
|
|
6551
|
-
async function requestEvaluation(client, tabId, expression, type) {
|
|
6552
|
-
if ('evaluateJSAsync' !== type) return await client.request(buildEvaluationPayload(tabId, expression, type));
|
|
6695
|
+
async function requestEvaluation(client, tabId, expression, type, extra) {
|
|
6696
|
+
if ('evaluateJSAsync' !== type) return await client.request(buildEvaluationPayload(tabId, expression, type, extra));
|
|
6553
6697
|
let expectedResultId = '';
|
|
6554
6698
|
let cleanup = ()=>{};
|
|
6555
6699
|
let pendingMessage;
|
|
@@ -6589,7 +6733,7 @@ var __webpack_modules__ = {
|
|
|
6589
6733
|
}
|
|
6590
6734
|
});
|
|
6591
6735
|
try {
|
|
6592
|
-
const response = await client.request(buildEvaluationPayload(tabId, expression, type));
|
|
6736
|
+
const response = await client.request(buildEvaluationPayload(tabId, expression, type, extra));
|
|
6593
6737
|
if (response?.type === 'evaluationResult') {
|
|
6594
6738
|
cleanup();
|
|
6595
6739
|
return response;
|
|
@@ -6611,12 +6755,12 @@ var __webpack_modules__ = {
|
|
|
6611
6755
|
throw error;
|
|
6612
6756
|
}
|
|
6613
6757
|
}
|
|
6614
|
-
async function evaluate(client, tabId, expression) {
|
|
6758
|
+
async function evaluate(client, tabId, expression, extra) {
|
|
6615
6759
|
let lastError = null;
|
|
6616
6760
|
for (const type of EVALUATION_TYPES){
|
|
6617
6761
|
let response;
|
|
6618
6762
|
try {
|
|
6619
|
-
response = await requestEvaluation(client, tabId, expression, type);
|
|
6763
|
+
response = await requestEvaluation(client, tabId, expression, type, extra);
|
|
6620
6764
|
} catch (err) {
|
|
6621
6765
|
lastError = err;
|
|
6622
6766
|
continue;
|
|
@@ -6630,6 +6774,19 @@ var __webpack_modules__ = {
|
|
|
6630
6774
|
}
|
|
6631
6775
|
throw lastError || new Error('Failed to evaluate expression');
|
|
6632
6776
|
}
|
|
6777
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
6778
|
+
_: ()=>evaluate
|
|
6779
|
+
});
|
|
6780
|
+
},
|
|
6781
|
+
"./browsers/run-firefox/rdp/remote-firefox/messaging-client.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
6782
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
6783
|
+
G: ()=>MessagingClient
|
|
6784
|
+
});
|
|
6785
|
+
const external_node_events_namespaceObject = require("node:events");
|
|
6786
|
+
var external_node_events_default = /*#__PURE__*/ __webpack_require__.n(external_node_events_namespaceObject);
|
|
6787
|
+
var messaging = __webpack_require__("./helpers/messaging.ts");
|
|
6788
|
+
var messages = __webpack_require__("./browsers/browsers-lib/messages.ts");
|
|
6789
|
+
var evaluate = __webpack_require__("./browsers/run-firefox/rdp/remote-firefox/evaluate.ts");
|
|
6633
6790
|
async function listTabs(transport) {
|
|
6634
6791
|
const response = await transport.request({
|
|
6635
6792
|
to: 'root',
|
|
@@ -6645,7 +6802,6 @@ var __webpack_modules__ = {
|
|
|
6645
6802
|
}
|
|
6646
6803
|
var external_node_net_ = __webpack_require__("node:net");
|
|
6647
6804
|
var external_node_net_default = /*#__PURE__*/ __webpack_require__.n(external_node_net_);
|
|
6648
|
-
var messaging = __webpack_require__("./helpers/messaging.ts");
|
|
6649
6805
|
function parseRdpFrame(data) {
|
|
6650
6806
|
const dataString = data.toString();
|
|
6651
6807
|
const separatorIndex = dataString.indexOf(':');
|
|
@@ -6724,12 +6880,24 @@ var __webpack_modules__ = {
|
|
|
6724
6880
|
if (emitter.listenerCount('error') > 0) return void emitter.emit('error', error);
|
|
6725
6881
|
(0, messaging.Gg)(error instanceof Error ? error.message : String(error));
|
|
6726
6882
|
}
|
|
6883
|
+
function closedError(message) {
|
|
6884
|
+
return Object.assign(new Error(message), {
|
|
6885
|
+
code: messaging.Lp.E_BROWSER_CONNECTION_CLOSED
|
|
6886
|
+
});
|
|
6887
|
+
}
|
|
6888
|
+
function protocolError(message) {
|
|
6889
|
+
return Object.assign(new Error(message), {
|
|
6890
|
+
code: messaging.Lp.E_RDP_PROTOCOL
|
|
6891
|
+
});
|
|
6892
|
+
}
|
|
6727
6893
|
class RdpTransport extends external_node_events_default() {
|
|
6728
6894
|
async connect(port, host = '127.0.0.1') {
|
|
6729
6895
|
await new Promise((resolve, reject)=>{
|
|
6730
6896
|
const timeoutMs = rdpRequestTimeoutMs();
|
|
6731
6897
|
const timer = setTimeout(()=>{
|
|
6732
|
-
this.settleGreeting(new Error(`Firefox sent no RDP greeting on port ${port} within ${timeoutMs}ms`)
|
|
6898
|
+
this.settleGreeting(Object.assign(new Error(`Firefox sent no RDP greeting on port ${port} within ${timeoutMs}ms`), {
|
|
6899
|
+
code: messaging.Lp.E_BROWSER_START_TIMEOUT
|
|
6900
|
+
}));
|
|
6733
6901
|
this.onConnectionLost();
|
|
6734
6902
|
}, timeoutMs);
|
|
6735
6903
|
timer.unref?.();
|
|
@@ -6753,8 +6921,8 @@ var __webpack_modules__ = {
|
|
|
6753
6921
|
this.conn = void 0;
|
|
6754
6922
|
this.settleGreeting(err);
|
|
6755
6923
|
});
|
|
6756
|
-
c.on('end', this.onConnectionLost
|
|
6757
|
-
c.on('close', this.onConnectionLost
|
|
6924
|
+
c.on('end', ()=>this.onConnectionLost());
|
|
6925
|
+
c.on('close', ()=>this.onConnectionLost());
|
|
6758
6926
|
c.on('timeout', this.onTimeout.bind(this));
|
|
6759
6927
|
} catch (err) {
|
|
6760
6928
|
this.settleGreeting(err);
|
|
@@ -6765,7 +6933,7 @@ var __webpack_modules__ = {
|
|
|
6765
6933
|
this.greetingPending?.(error);
|
|
6766
6934
|
}
|
|
6767
6935
|
disconnect() {
|
|
6768
|
-
const closed =
|
|
6936
|
+
const closed = closedError(messages.qN('firefox'));
|
|
6769
6937
|
this.settleGreeting(closed);
|
|
6770
6938
|
const c = this.conn;
|
|
6771
6939
|
if (!c) return;
|
|
@@ -6808,7 +6976,7 @@ var __webpack_modules__ = {
|
|
|
6808
6976
|
this.pending = this.pending.filter(({ to, payload, deferred })=>{
|
|
6809
6977
|
if (this.active.has(to)) return true;
|
|
6810
6978
|
if (!this.conn) {
|
|
6811
|
-
deferred.reject(
|
|
6979
|
+
deferred.reject(closedError(messages.Fm('firefox')));
|
|
6812
6980
|
return false;
|
|
6813
6981
|
}
|
|
6814
6982
|
try {
|
|
@@ -6821,7 +6989,7 @@ var __webpack_modules__ = {
|
|
|
6821
6989
|
});
|
|
6822
6990
|
}
|
|
6823
6991
|
expectReply(to, deferred) {
|
|
6824
|
-
if (this.active.has(to)) throw
|
|
6992
|
+
if (this.active.has(to)) throw protocolError(messages.cD('firefox', to));
|
|
6825
6993
|
const timeoutMs = rdpRequestTimeoutMs();
|
|
6826
6994
|
const timer = setTimeout(()=>{
|
|
6827
6995
|
const entry = this.active.get(to);
|
|
@@ -6847,8 +7015,9 @@ var __webpack_modules__ = {
|
|
|
6847
7015
|
const { remainingData, parsedMessage, error, fatal } = parseRdpFrame(this.incoming);
|
|
6848
7016
|
this.incoming = remainingData;
|
|
6849
7017
|
if (error) {
|
|
6850
|
-
|
|
6851
|
-
|
|
7018
|
+
const malformed = protocolError(messages.l9('firefox', error));
|
|
7019
|
+
surfaceTransportError(this, malformed);
|
|
7020
|
+
if (fatal) this.onConnectionLost(malformed);
|
|
6852
7021
|
return !fatal;
|
|
6853
7022
|
}
|
|
6854
7023
|
if (!parsedMessage) return false;
|
|
@@ -6857,7 +7026,7 @@ var __webpack_modules__ = {
|
|
|
6857
7026
|
}
|
|
6858
7027
|
handleMessage(message) {
|
|
6859
7028
|
const from = message.from;
|
|
6860
|
-
if (!from) return void surfaceTransportError(this,
|
|
7029
|
+
if (!from) return void surfaceTransportError(this, protocolError(messages.HH('firefox', message)));
|
|
6861
7030
|
if (this.greetingPending && isRootGreeting(message)) this.settleGreeting();
|
|
6862
7031
|
const entry = isUnsolicitedPacket(message) ? void 0 : this.active.get(from);
|
|
6863
7032
|
if (entry) {
|
|
@@ -6870,7 +7039,7 @@ var __webpack_modules__ = {
|
|
|
6870
7039
|
}
|
|
6871
7040
|
this.emit('message', message);
|
|
6872
7041
|
}
|
|
6873
|
-
onConnectionLost() {
|
|
7042
|
+
onConnectionLost(cause) {
|
|
6874
7043
|
if (this.lost) return;
|
|
6875
7044
|
this.lost = true;
|
|
6876
7045
|
const c = this.conn;
|
|
@@ -6881,8 +7050,8 @@ var __webpack_modules__ = {
|
|
|
6881
7050
|
c.on('error', ()=>{});
|
|
6882
7051
|
c.destroy();
|
|
6883
7052
|
}
|
|
6884
|
-
const closed =
|
|
6885
|
-
this.settleGreeting(closed);
|
|
7053
|
+
const closed = closedError(messages.qN('firefox'));
|
|
7054
|
+
this.settleGreeting(cause ?? closed);
|
|
6886
7055
|
this.rejectAll(closed);
|
|
6887
7056
|
this.emit('end');
|
|
6888
7057
|
}
|
|
@@ -6964,7 +7133,9 @@ var __webpack_modules__ = {
|
|
|
6964
7133
|
to
|
|
6965
7134
|
});
|
|
6966
7135
|
}
|
|
6967
|
-
throw new Error(messages.jP())
|
|
7136
|
+
throw Object.assign(new Error(messages.jP()), {
|
|
7137
|
+
code: messaging.Lp.E_RDP_PROTOCOL
|
|
7138
|
+
});
|
|
6968
7139
|
}
|
|
6969
7140
|
async getTargets() {
|
|
6970
7141
|
return await listTabs(this.transport);
|
|
@@ -6982,8 +7153,8 @@ var __webpack_modules__ = {
|
|
|
6982
7153
|
return {};
|
|
6983
7154
|
}
|
|
6984
7155
|
}
|
|
6985
|
-
async evaluate(tabId, expression) {
|
|
6986
|
-
return evaluate(this, tabId, expression);
|
|
7156
|
+
async evaluate(tabId, expression, extra) {
|
|
7157
|
+
return (0, evaluate._)(this, tabId, expression, extra);
|
|
6987
7158
|
}
|
|
6988
7159
|
constructor(...args){
|
|
6989
7160
|
super(...args), messaging_client_define_property(this, "transport", new RdpTransport()), messaging_client_define_property(this, "forwardingSetup", false), messaging_client_define_property(this, "lastPort", null), messaging_client_define_property(this, "reconnecting", false), messaging_client_define_property(this, "disconnectedByUser", false);
|
|
@@ -6992,19 +7163,18 @@ var __webpack_modules__ = {
|
|
|
6992
7163
|
},
|
|
6993
7164
|
"./browsers/run-only.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
6994
7165
|
var node_fs__rspack_import_0 = __webpack_require__("node:fs");
|
|
6995
|
-
var
|
|
6996
|
-
var
|
|
6997
|
-
var
|
|
6998
|
-
var
|
|
6999
|
-
var
|
|
7000
|
-
var
|
|
7001
|
-
var
|
|
7002
|
-
var
|
|
7003
|
-
var
|
|
7004
|
-
var
|
|
7005
|
-
var
|
|
7006
|
-
var
|
|
7007
|
-
var _run_firefox_firefox_launch__rspack_import_10 = __webpack_require__("./browsers/run-firefox/firefox-launch/index.ts");
|
|
7166
|
+
var _helpers_messaging__rspack_import_1 = __webpack_require__("./helpers/messaging.ts");
|
|
7167
|
+
var _browsers_lib_banner__rspack_import_2 = __webpack_require__("./browsers/browsers-lib/banner.ts");
|
|
7168
|
+
var _browsers_lib_browser_family__rspack_import_3 = __webpack_require__("./browsers/browsers-lib/browser-family.ts");
|
|
7169
|
+
var _browsers_lib_messages__rspack_import_4 = __webpack_require__("./browsers/browsers-lib/messages.ts");
|
|
7170
|
+
var _browsers_lib_output_binaries_resolver__rspack_import_5 = __webpack_require__("./browsers/browsers-lib/output-binaries-resolver.ts");
|
|
7171
|
+
var _browsers_lib_ready_stamp__rspack_import_6 = __webpack_require__("./browsers/browsers-lib/ready-stamp.ts");
|
|
7172
|
+
var _browsers_lib_runtime_options__rspack_import_12 = __webpack_require__("./browsers/browsers-lib/runtime-options.ts");
|
|
7173
|
+
var _browsers_lib_version_probe__rspack_import_7 = __webpack_require__("./browsers/browsers-lib/version-probe.ts");
|
|
7174
|
+
var _run_chromium_chromium_context__rspack_import_10 = __webpack_require__("./browsers/run-chromium/chromium-context/index.ts");
|
|
7175
|
+
var _run_chromium_chromium_launch__rspack_import_8 = __webpack_require__("./browsers/run-chromium/chromium-launch/index.ts");
|
|
7176
|
+
var _run_firefox_firefox_context__rspack_import_11 = __webpack_require__("./browsers/run-firefox/firefox-context/index.ts");
|
|
7177
|
+
var _run_firefox_firefox_launch__rspack_import_9 = __webpack_require__("./browsers/run-firefox/firefox-launch/index.ts");
|
|
7008
7178
|
function createPreviewCompilationLike(opts) {
|
|
7009
7179
|
return {
|
|
7010
7180
|
options: {
|
|
@@ -7072,6 +7242,7 @@ var __webpack_modules__ = {
|
|
|
7072
7242
|
extension: pluginOptions.extension,
|
|
7073
7243
|
browser: pluginOptions.browser,
|
|
7074
7244
|
profile: pluginOptions.profile,
|
|
7245
|
+
profileSource: opts.profileSource,
|
|
7075
7246
|
preferences: pluginOptions.preferences,
|
|
7076
7247
|
browserFlags: pluginOptions.browserFlags,
|
|
7077
7248
|
startingUrl: pluginOptions.startingUrl,
|
|
@@ -7089,21 +7260,23 @@ var __webpack_modules__ = {
|
|
|
7089
7260
|
logTab: pluginOptions.logTab
|
|
7090
7261
|
};
|
|
7091
7262
|
}
|
|
7263
|
+
function pinnedBinaryPath(opts) {
|
|
7264
|
+
const pinned = (0, _browsers_lib_browser_family__rspack_import_3.M_)(opts.browser) ? opts.geckoBinary : opts.chromiumBinary;
|
|
7265
|
+
return 'string' == typeof pinned && node_fs__rspack_import_0.existsSync(pinned) ? pinned : void 0;
|
|
7266
|
+
}
|
|
7092
7267
|
async function resolvePinnedBinaryVersionLine(opts) {
|
|
7268
|
+
const pinned = pinnedBinaryPath(opts);
|
|
7269
|
+
if (!pinned) return;
|
|
7093
7270
|
try {
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
return (0, firefox_location2__rspack_import_1.getFirefoxVersion)(opts.geckoBinary) || void 0;
|
|
7097
|
-
}
|
|
7098
|
-
if (!opts.chromiumBinary || !node_fs__rspack_import_0.existsSync(opts.chromiumBinary)) return;
|
|
7099
|
-
return await (0, _browsers_lib_version_probe__rspack_import_8.yO)(opts.chromiumBinary, String(opts.browser)) || void 0;
|
|
7271
|
+
const line = (0, _browsers_lib_browser_family__rspack_import_3.M_)(opts.browser) ? await (0, _browsers_lib_version_probe__rspack_import_7.vE)(pinned) : await (0, _browsers_lib_version_probe__rspack_import_7.yO)(pinned, String(opts.browser));
|
|
7272
|
+
return line || void 0;
|
|
7100
7273
|
} catch (error) {
|
|
7101
|
-
if ((0,
|
|
7274
|
+
if ((0, _browsers_lib_version_probe__rspack_import_7.g_)(error)) throw error;
|
|
7102
7275
|
return;
|
|
7103
7276
|
}
|
|
7104
7277
|
}
|
|
7105
7278
|
async function buildPreviewBannerOptions(opts) {
|
|
7106
|
-
const
|
|
7279
|
+
const pinned = pinnedBinaryPath(opts);
|
|
7107
7280
|
return {
|
|
7108
7281
|
browser: opts.browser,
|
|
7109
7282
|
outPath: opts.outPath,
|
|
@@ -7111,17 +7284,17 @@ var __webpack_modules__ = {
|
|
|
7111
7284
|
includeRunId: false,
|
|
7112
7285
|
readyPath: opts.readyPath,
|
|
7113
7286
|
browserVersionLine: await resolvePinnedBinaryVersionLine(opts),
|
|
7114
|
-
...
|
|
7115
|
-
binaryPath:
|
|
7287
|
+
...pinned ? {
|
|
7288
|
+
binaryPath: pinned,
|
|
7116
7289
|
binaryProvenance: 'pinned'
|
|
7117
7290
|
} : {}
|
|
7118
7291
|
};
|
|
7119
7292
|
}
|
|
7120
7293
|
function asLaunchFailure(error, browser, spawned) {
|
|
7121
7294
|
const message = error instanceof Error ? error.message : String(error);
|
|
7122
|
-
if (spawned || (0,
|
|
7123
|
-
return Object.assign(new Error((0,
|
|
7124
|
-
code:
|
|
7295
|
+
if (spawned || (0, _helpers_messaging__rspack_import_1.Qi)(message) || (0, _browsers_lib_ready_stamp__rspack_import_6.NE)(error)) return error;
|
|
7296
|
+
return Object.assign(new Error((0, _browsers_lib_messages__rspack_import_4.uA)(browser, (0, _browsers_lib_ready_stamp__rspack_import_6.dT)(error))), {
|
|
7297
|
+
code: _helpers_messaging__rspack_import_1.Lp.E_BROWSER_LAUNCH,
|
|
7125
7298
|
cause: error
|
|
7126
7299
|
});
|
|
7127
7300
|
}
|
|
@@ -7135,21 +7308,21 @@ var __webpack_modules__ = {
|
|
|
7135
7308
|
process.once('SIGINT', scheduleExitOnSignal);
|
|
7136
7309
|
process.once('SIGTERM', scheduleExitOnSignal);
|
|
7137
7310
|
process.once('SIGHUP', scheduleExitOnSignal);
|
|
7138
|
-
(0,
|
|
7311
|
+
(0, _browsers_lib_ready_stamp__rspack_import_6.Jk)(opts.outPath, opts.readyPath);
|
|
7139
7312
|
const compilationLike = createPreviewCompilationLike(opts);
|
|
7140
7313
|
const previewPluginOptions = buildPreviewPluginOptions(opts);
|
|
7141
7314
|
let bannerOptions;
|
|
7142
7315
|
try {
|
|
7143
7316
|
bannerOptions = await buildPreviewBannerOptions(opts);
|
|
7144
7317
|
} catch (error) {
|
|
7145
|
-
(0,
|
|
7318
|
+
(0, _browsers_lib_ready_stamp__rspack_import_6.dz)(opts.outPath, (0, _browsers_lib_ready_stamp__rspack_import_6.dT)(error), (0, _browsers_lib_ready_stamp__rspack_import_6.Uf)(opts.outPath), (0, _browsers_lib_ready_stamp__rspack_import_6.NE)(error));
|
|
7146
7319
|
throw error;
|
|
7147
7320
|
}
|
|
7148
|
-
(0,
|
|
7149
|
-
if ((0,
|
|
7150
|
-
const ctx = (0,
|
|
7151
|
-
const launcher = new
|
|
7152
|
-
await (0,
|
|
7321
|
+
(0, _browsers_lib_output_binaries_resolver__rspack_import_5.LB)(compilationLike);
|
|
7322
|
+
if ((0, _browsers_lib_browser_family__rspack_import_3.rG)(opts.browser)) {
|
|
7323
|
+
const ctx = (0, _run_chromium_chromium_context__rspack_import_10.g)();
|
|
7324
|
+
const launcher = new _run_chromium_chromium_launch__rspack_import_8.f(buildPreviewChromiumOptions(opts), ctx);
|
|
7325
|
+
await (0, _browsers_lib_banner__rspack_import_2.MK)(bannerOptions);
|
|
7153
7326
|
try {
|
|
7154
7327
|
await launcher.runOnce(compilationLike, {
|
|
7155
7328
|
enableCdpPostLaunch: false,
|
|
@@ -7160,12 +7333,12 @@ var __webpack_modules__ = {
|
|
|
7160
7333
|
}
|
|
7161
7334
|
return;
|
|
7162
7335
|
}
|
|
7163
|
-
if ((0,
|
|
7164
|
-
const ctx = (0,
|
|
7165
|
-
const launcher = new
|
|
7166
|
-
await (0,
|
|
7336
|
+
if ((0, _browsers_lib_browser_family__rspack_import_3.M_)(opts.browser)) {
|
|
7337
|
+
const ctx = (0, _run_firefox_firefox_context__rspack_import_11.D)();
|
|
7338
|
+
const launcher = new _run_firefox_firefox_launch__rspack_import_9.c(buildPreviewFirefoxOptions(opts), ctx);
|
|
7339
|
+
await (0, _browsers_lib_banner__rspack_import_2.MK)(bannerOptions);
|
|
7167
7340
|
try {
|
|
7168
|
-
await launcher.runOnce(compilationLike, (0,
|
|
7341
|
+
await launcher.runOnce(compilationLike, (0, _browsers_lib_runtime_options__rspack_import_12.zU)(previewPluginOptions, 'production', {
|
|
7169
7342
|
persistProfile: previewPluginOptions.persistProfile,
|
|
7170
7343
|
geckoBinary: previewPluginOptions.geckoBinary
|
|
7171
7344
|
}));
|
|
@@ -7199,6 +7372,62 @@ var __webpack_modules__ = {
|
|
|
7199
7372
|
(0, messaging._w)(messages.Aj(xcodebuildCmd));
|
|
7200
7373
|
}
|
|
7201
7374
|
var safari_config = __webpack_require__("./browsers/run-safari/safari-launch/safari-config.ts");
|
|
7375
|
+
const RAISE_WAIT_MS = 5000;
|
|
7376
|
+
const QUIT_MS = 3000;
|
|
7377
|
+
const POLL_MS = 250;
|
|
7378
|
+
const raisedApps = new Set();
|
|
7379
|
+
let handlersInstalled = false;
|
|
7380
|
+
function sleep(ms) {
|
|
7381
|
+
return new Promise((resolve)=>setTimeout(resolve, ms));
|
|
7382
|
+
}
|
|
7383
|
+
function processAlive(pid) {
|
|
7384
|
+
try {
|
|
7385
|
+
process.kill(pid, 0);
|
|
7386
|
+
return true;
|
|
7387
|
+
} catch {
|
|
7388
|
+
return false;
|
|
7389
|
+
}
|
|
7390
|
+
}
|
|
7391
|
+
function terminate(pid) {
|
|
7392
|
+
try {
|
|
7393
|
+
process.kill(pid, 'SIGTERM');
|
|
7394
|
+
} catch {}
|
|
7395
|
+
}
|
|
7396
|
+
function quitAllOnExit() {
|
|
7397
|
+
for (const pid of raisedApps)terminate(pid);
|
|
7398
|
+
}
|
|
7399
|
+
function quitAllOnSignal() {
|
|
7400
|
+
closeSafariContainerApps();
|
|
7401
|
+
}
|
|
7402
|
+
function installHandlersOnce() {
|
|
7403
|
+
if (handlersInstalled) return;
|
|
7404
|
+
handlersInstalled = true;
|
|
7405
|
+
process.on('SIGINT', quitAllOnSignal);
|
|
7406
|
+
process.on('SIGTERM', quitAllOnSignal);
|
|
7407
|
+
process.on('SIGHUP', quitAllOnSignal);
|
|
7408
|
+
process.on('exit', quitAllOnExit);
|
|
7409
|
+
}
|
|
7410
|
+
async function rememberRaisedContainerApp(tools, appPath, before) {
|
|
7411
|
+
const deadline = Date.now() + RAISE_WAIT_MS;
|
|
7412
|
+
let raised = [];
|
|
7413
|
+
while(Date.now() < deadline){
|
|
7414
|
+
raised = (await tools.listAppPids(appPath)).filter((pid)=>!before.has(pid));
|
|
7415
|
+
if (raised.length > 0) break;
|
|
7416
|
+
await sleep(POLL_MS);
|
|
7417
|
+
}
|
|
7418
|
+
for (const pid of raised)raisedApps.add(pid);
|
|
7419
|
+
if (raised.length > 0) installHandlersOnce();
|
|
7420
|
+
return raised;
|
|
7421
|
+
}
|
|
7422
|
+
async function closeSafariContainerApps() {
|
|
7423
|
+
const pids = [
|
|
7424
|
+
...raisedApps
|
|
7425
|
+
];
|
|
7426
|
+
raisedApps.clear();
|
|
7427
|
+
for (const pid of pids)terminate(pid);
|
|
7428
|
+
const deadline = Date.now() + QUIT_MS;
|
|
7429
|
+
while(Date.now() < deadline && pids.some(processAlive))await sleep(POLL_MS);
|
|
7430
|
+
}
|
|
7202
7431
|
var external_node_child_process_ = __webpack_require__("node:child_process");
|
|
7203
7432
|
function isMacOS() {
|
|
7204
7433
|
return 'darwin' === process.platform;
|
|
@@ -7264,6 +7493,70 @@ var __webpack_modules__ = {
|
|
|
7264
7493
|
const tail = lines.slice(-TOOL_TAIL_LINES).join('\n');
|
|
7265
7494
|
return tail.length > TOOL_TAIL_BYTES ? tail.slice(-TOOL_TAIL_BYTES) : tail;
|
|
7266
7495
|
}
|
|
7496
|
+
function isAutomationSafariArgs(args) {
|
|
7497
|
+
const tokens = args.trim().split(/\s+/);
|
|
7498
|
+
const exe = tokens[0] || '';
|
|
7499
|
+
const name = exe.slice(exe.lastIndexOf('/') + 1);
|
|
7500
|
+
return 'Safari' === name && tokens.includes('--automation');
|
|
7501
|
+
}
|
|
7502
|
+
function isContainerAppArgs(appPath, args) {
|
|
7503
|
+
return args.trim().startsWith(`${appPath}/Contents/MacOS/`);
|
|
7504
|
+
}
|
|
7505
|
+
function openAppArgs(target) {
|
|
7506
|
+
return [
|
|
7507
|
+
'-g',
|
|
7508
|
+
target
|
|
7509
|
+
];
|
|
7510
|
+
}
|
|
7511
|
+
function listPidsWhere(matches) {
|
|
7512
|
+
return new Promise((resolve)=>{
|
|
7513
|
+
const child = (0, external_node_child_process_.spawn)('ps', [
|
|
7514
|
+
'-axww',
|
|
7515
|
+
'-o',
|
|
7516
|
+
'pid=,args='
|
|
7517
|
+
], {
|
|
7518
|
+
stdio: [
|
|
7519
|
+
'ignore',
|
|
7520
|
+
'pipe',
|
|
7521
|
+
'ignore'
|
|
7522
|
+
]
|
|
7523
|
+
});
|
|
7524
|
+
let out = '';
|
|
7525
|
+
child.stdout?.on('data', (chunk)=>out += String(chunk));
|
|
7526
|
+
child.on('error', ()=>resolve([]));
|
|
7527
|
+
child.on('close', ()=>{
|
|
7528
|
+
const pids = [];
|
|
7529
|
+
for (const line of out.split('\n')){
|
|
7530
|
+
const row = /^\s*(\d+)\s+(.*)$/.exec(line);
|
|
7531
|
+
if (row && matches(row[2])) pids.push(Number(row[1]));
|
|
7532
|
+
}
|
|
7533
|
+
resolve(pids);
|
|
7534
|
+
});
|
|
7535
|
+
});
|
|
7536
|
+
}
|
|
7537
|
+
function spawnWebDriverProcess(bin, args) {
|
|
7538
|
+
return new Promise((resolve)=>{
|
|
7539
|
+
const child = (0, external_node_child_process_.spawn)(bin, args, {
|
|
7540
|
+
stdio: 'ignore'
|
|
7541
|
+
});
|
|
7542
|
+
const stop = ()=>{
|
|
7543
|
+
try {
|
|
7544
|
+
child.kill('SIGTERM');
|
|
7545
|
+
} catch {}
|
|
7546
|
+
};
|
|
7547
|
+
child.once('error', (error)=>resolve({
|
|
7548
|
+
ok: false,
|
|
7549
|
+
output: String(error),
|
|
7550
|
+
stop
|
|
7551
|
+
}));
|
|
7552
|
+
child.once('spawn', ()=>resolve({
|
|
7553
|
+
ok: true,
|
|
7554
|
+
pid: child.pid,
|
|
7555
|
+
output: '',
|
|
7556
|
+
stop
|
|
7557
|
+
}));
|
|
7558
|
+
});
|
|
7559
|
+
}
|
|
7267
7560
|
function runTool(bin, args, opts) {
|
|
7268
7561
|
const streamOutput = (0, messaging._o)() && !opts?.quiet;
|
|
7269
7562
|
return new Promise((resolve)=>{
|
|
@@ -7320,9 +7613,7 @@ var __webpack_modules__ = {
|
|
|
7320
7613
|
detectToolchain: ()=>detectSafariToolchain(),
|
|
7321
7614
|
runConverter: (args)=>runTool('xcrun', args),
|
|
7322
7615
|
runXcodebuild: (args)=>runTool('xcodebuild', args),
|
|
7323
|
-
openApp: (target)=>runTool('open',
|
|
7324
|
-
target
|
|
7325
|
-
]),
|
|
7616
|
+
openApp: (target)=>runTool('open', openAppArgs(target)),
|
|
7326
7617
|
openSafari: (binary)=>runTool('open', [
|
|
7327
7618
|
'-a',
|
|
7328
7619
|
binary
|
|
@@ -7335,8 +7626,203 @@ var __webpack_modules__ = {
|
|
|
7335
7626
|
quiet: true
|
|
7336
7627
|
});
|
|
7337
7628
|
return ok ? output : '';
|
|
7629
|
+
},
|
|
7630
|
+
startWebDriver: (port)=>spawnWebDriverProcess('safaridriver', [
|
|
7631
|
+
'-p',
|
|
7632
|
+
String(port)
|
|
7633
|
+
]),
|
|
7634
|
+
listAutomationPids: ()=>listPidsWhere(isAutomationSafariArgs),
|
|
7635
|
+
listAppPids: (appPath)=>listPidsWhere((args)=>isContainerAppArgs(appPath, args))
|
|
7636
|
+
};
|
|
7637
|
+
}
|
|
7638
|
+
var external_node_http_ = __webpack_require__("node:http");
|
|
7639
|
+
var external_node_net_ = __webpack_require__("node:net");
|
|
7640
|
+
const DRIVER_READY_MS = 5000;
|
|
7641
|
+
const DRIVER_POLL_MS = 100;
|
|
7642
|
+
const SESSION_CREATE_MS = 30000;
|
|
7643
|
+
const SESSION_CLOSE_MS = 5000;
|
|
7644
|
+
const AUTOMATION_QUIT_MS = 3000;
|
|
7645
|
+
const activeSessions = new Set();
|
|
7646
|
+
const activeDrivers = new Set();
|
|
7647
|
+
let webdriver_handlersInstalled = false;
|
|
7648
|
+
function freePort() {
|
|
7649
|
+
return new Promise((resolve, reject)=>{
|
|
7650
|
+
const server = external_node_net_.createServer();
|
|
7651
|
+
server.unref();
|
|
7652
|
+
server.once('error', reject);
|
|
7653
|
+
server.listen(0, '127.0.0.1', ()=>{
|
|
7654
|
+
const address = server.address();
|
|
7655
|
+
const port = 'object' == typeof address && address ? address.port : 0;
|
|
7656
|
+
server.close(()=>resolve(port));
|
|
7657
|
+
});
|
|
7658
|
+
});
|
|
7659
|
+
}
|
|
7660
|
+
function driverRequest(port, method, pathname, body, timeoutMs) {
|
|
7661
|
+
return new Promise((resolve, reject)=>{
|
|
7662
|
+
const payload = void 0 === body ? '' : JSON.stringify(body);
|
|
7663
|
+
const request = external_node_http_.request({
|
|
7664
|
+
host: '127.0.0.1',
|
|
7665
|
+
port,
|
|
7666
|
+
method,
|
|
7667
|
+
path: pathname,
|
|
7668
|
+
headers: {
|
|
7669
|
+
'Content-Type': 'application/json',
|
|
7670
|
+
'Content-Length': Buffer.byteLength(payload)
|
|
7671
|
+
},
|
|
7672
|
+
timeout: timeoutMs
|
|
7673
|
+
}, (response)=>{
|
|
7674
|
+
let text = '';
|
|
7675
|
+
response.setEncoding('utf8');
|
|
7676
|
+
response.on('data', (chunk)=>text += chunk);
|
|
7677
|
+
response.on('end', ()=>{
|
|
7678
|
+
let parsed = {};
|
|
7679
|
+
try {
|
|
7680
|
+
parsed = text ? JSON.parse(text) : {};
|
|
7681
|
+
} catch {
|
|
7682
|
+
parsed = {
|
|
7683
|
+
value: {
|
|
7684
|
+
message: text.trim()
|
|
7685
|
+
}
|
|
7686
|
+
};
|
|
7687
|
+
}
|
|
7688
|
+
resolve({
|
|
7689
|
+
status: response.statusCode || 0,
|
|
7690
|
+
body: parsed
|
|
7691
|
+
});
|
|
7692
|
+
});
|
|
7693
|
+
});
|
|
7694
|
+
request.on('timeout', ()=>request.destroy(new Error('timed out')));
|
|
7695
|
+
request.on('error', reject);
|
|
7696
|
+
request.end(payload);
|
|
7697
|
+
});
|
|
7698
|
+
}
|
|
7699
|
+
async function waitForDriver(port) {
|
|
7700
|
+
const deadline = Date.now() + DRIVER_READY_MS;
|
|
7701
|
+
let lastError = '';
|
|
7702
|
+
while(Date.now() < deadline){
|
|
7703
|
+
try {
|
|
7704
|
+
const reply = await driverRequest(port, 'GET', '/status', void 0, 1000);
|
|
7705
|
+
if (200 === reply.status) return null;
|
|
7706
|
+
lastError = `HTTP ${reply.status}`;
|
|
7707
|
+
} catch (error) {
|
|
7708
|
+
lastError = String(error?.message || error);
|
|
7709
|
+
}
|
|
7710
|
+
await new Promise((resolve)=>setTimeout(resolve, DRIVER_POLL_MS));
|
|
7711
|
+
}
|
|
7712
|
+
return `safaridriver did not answer on port ${port} within ${DRIVER_READY_MS}ms (${lastError})`;
|
|
7713
|
+
}
|
|
7714
|
+
function refusalReason(reply) {
|
|
7715
|
+
const value = reply.body?.value;
|
|
7716
|
+
const message = 'string' == typeof value?.message ? value.message.trim() : '';
|
|
7717
|
+
if (message) return message;
|
|
7718
|
+
const error = 'string' == typeof value?.error ? value.error.trim() : '';
|
|
7719
|
+
return error || `safaridriver answered HTTP ${reply.status}`;
|
|
7720
|
+
}
|
|
7721
|
+
function stopAllDriversOnExit() {
|
|
7722
|
+
for (const driver of activeDrivers)driver.stop();
|
|
7723
|
+
}
|
|
7724
|
+
function closeAllOnSignal() {
|
|
7725
|
+
closeSafariWebDriverSessions();
|
|
7726
|
+
}
|
|
7727
|
+
function webdriver_installHandlersOnce() {
|
|
7728
|
+
if (webdriver_handlersInstalled) return;
|
|
7729
|
+
webdriver_handlersInstalled = true;
|
|
7730
|
+
process.on('SIGINT', closeAllOnSignal);
|
|
7731
|
+
process.on('SIGTERM', closeAllOnSignal);
|
|
7732
|
+
process.on('SIGHUP', closeAllOnSignal);
|
|
7733
|
+
process.on('exit', stopAllDriversOnExit);
|
|
7734
|
+
}
|
|
7735
|
+
async function closeSafariWebDriverSessions() {
|
|
7736
|
+
await Promise.all([
|
|
7737
|
+
...activeSessions
|
|
7738
|
+
].map((session)=>session.close()));
|
|
7739
|
+
}
|
|
7740
|
+
function webdriver_processAlive(pid) {
|
|
7741
|
+
try {
|
|
7742
|
+
process.kill(pid, 0);
|
|
7743
|
+
return true;
|
|
7744
|
+
} catch {
|
|
7745
|
+
return false;
|
|
7746
|
+
}
|
|
7747
|
+
}
|
|
7748
|
+
async function quitRaisedAutomation(tools, before) {
|
|
7749
|
+
const raised = (await tools.listAutomationPids()).filter((pid)=>!before.has(pid));
|
|
7750
|
+
for (const pid of raised)try {
|
|
7751
|
+
process.kill(pid, 'SIGTERM');
|
|
7752
|
+
} catch {}
|
|
7753
|
+
const deadline = Date.now() + AUTOMATION_QUIT_MS;
|
|
7754
|
+
while(Date.now() < deadline && raised.some(webdriver_processAlive))await new Promise((resolve)=>setTimeout(resolve, DRIVER_POLL_MS));
|
|
7755
|
+
}
|
|
7756
|
+
async function openSafariWebDriverSession(tools) {
|
|
7757
|
+
let port;
|
|
7758
|
+
try {
|
|
7759
|
+
port = await freePort();
|
|
7760
|
+
} catch (error) {
|
|
7761
|
+
return {
|
|
7762
|
+
reason: `no free port for safaridriver: ${String(error)}`
|
|
7763
|
+
};
|
|
7764
|
+
}
|
|
7765
|
+
const before = new Set(await tools.listAutomationPids());
|
|
7766
|
+
const driver = await tools.startWebDriver(port);
|
|
7767
|
+
if (!driver.ok) return {
|
|
7768
|
+
reason: `safaridriver could not start: ${driver.output}`
|
|
7769
|
+
};
|
|
7770
|
+
activeDrivers.add(driver);
|
|
7771
|
+
webdriver_installHandlersOnce();
|
|
7772
|
+
const stopDriver = async ()=>{
|
|
7773
|
+
driver.stop();
|
|
7774
|
+
activeDrivers.delete(driver);
|
|
7775
|
+
await quitRaisedAutomation(tools, before);
|
|
7776
|
+
};
|
|
7777
|
+
const notReady = await waitForDriver(port);
|
|
7778
|
+
if (notReady) {
|
|
7779
|
+
await stopDriver();
|
|
7780
|
+
return {
|
|
7781
|
+
reason: notReady
|
|
7782
|
+
};
|
|
7783
|
+
}
|
|
7784
|
+
let created;
|
|
7785
|
+
try {
|
|
7786
|
+
created = await driverRequest(port, 'POST', '/session', {
|
|
7787
|
+
capabilities: {
|
|
7788
|
+
alwaysMatch: {
|
|
7789
|
+
browserName: 'safari'
|
|
7790
|
+
}
|
|
7791
|
+
}
|
|
7792
|
+
}, SESSION_CREATE_MS);
|
|
7793
|
+
} catch (error) {
|
|
7794
|
+
await stopDriver();
|
|
7795
|
+
return {
|
|
7796
|
+
reason: `the WebDriver session request failed: ${String(error?.message || error)}`
|
|
7797
|
+
};
|
|
7798
|
+
}
|
|
7799
|
+
const sessionId = created.body?.value?.sessionId;
|
|
7800
|
+
if (200 !== created.status || 'string' != typeof sessionId || !sessionId) {
|
|
7801
|
+
await stopDriver();
|
|
7802
|
+
return {
|
|
7803
|
+
reason: refusalReason(created)
|
|
7804
|
+
};
|
|
7805
|
+
}
|
|
7806
|
+
let closing = null;
|
|
7807
|
+
const session = {
|
|
7808
|
+
port,
|
|
7809
|
+
sessionId,
|
|
7810
|
+
close: ()=>{
|
|
7811
|
+
if (closing) return closing;
|
|
7812
|
+
closing = (async ()=>{
|
|
7813
|
+
activeSessions.delete(session);
|
|
7814
|
+
try {
|
|
7815
|
+
await driverRequest(port, 'DELETE', `/session/${sessionId}`, void 0, SESSION_CLOSE_MS);
|
|
7816
|
+
} catch {}
|
|
7817
|
+
await stopDriver();
|
|
7818
|
+
})();
|
|
7819
|
+
return closing;
|
|
7338
7820
|
}
|
|
7339
7821
|
};
|
|
7822
|
+
activeSessions.add(session);
|
|
7823
|
+
return {
|
|
7824
|
+
session
|
|
7825
|
+
};
|
|
7340
7826
|
}
|
|
7341
7827
|
function fallbackLogger() {
|
|
7342
7828
|
return {
|
|
@@ -7429,6 +7915,24 @@ var __webpack_modules__ = {
|
|
|
7429
7915
|
(0, messaging._w)((0, ready_message.G)('development', String(host.browser)));
|
|
7430
7916
|
} catch {}
|
|
7431
7917
|
}
|
|
7918
|
+
async function holdWebDriverSession(tools, config, logger) {
|
|
7919
|
+
await closeSafariWebDriverSessions();
|
|
7920
|
+
const runId = (0, ready_stamp.Uf)(config.extensionDir);
|
|
7921
|
+
const outcome = await openSafariWebDriverSession(tools);
|
|
7922
|
+
if (outcome.session) {
|
|
7923
|
+
const { port, sessionId } = outcome.session;
|
|
7924
|
+
(0, ready_stamp.ZC)(config.extensionDir, {
|
|
7925
|
+
port,
|
|
7926
|
+
sessionId
|
|
7927
|
+
}, runId);
|
|
7928
|
+
logger.info?.(messages.Hp(port, sessionId));
|
|
7929
|
+
return;
|
|
7930
|
+
}
|
|
7931
|
+
(0, ready_stamp.ZC)(config.extensionDir, {
|
|
7932
|
+
unavailableReason: outcome.reason
|
|
7933
|
+
}, runId);
|
|
7934
|
+
logger.info?.(messages.lb(outcome.reason));
|
|
7935
|
+
}
|
|
7432
7936
|
async function runSafariPipeline(compilation, host, logger, mode) {
|
|
7433
7937
|
const tools = host.tools || createSafariTools();
|
|
7434
7938
|
const config = (0, safari_config.F7)(compilation, host);
|
|
@@ -7499,7 +8003,9 @@ var __webpack_modules__ = {
|
|
|
7499
8003
|
}
|
|
7500
8004
|
const target = external_node_fs_.existsSync(appPath) ? appPath : (0, safari_config.Gi)(config);
|
|
7501
8005
|
logger.info?.(messages.fw(target));
|
|
8006
|
+
const appsBefore = new Set(await tools.listAppPids(appPath));
|
|
7502
8007
|
await tools.openApp(target);
|
|
8008
|
+
if (host.announceDevReady) await rememberRaisedContainerApp(tools, appPath, appsBefore);
|
|
7503
8009
|
if (config.safariBinary) await tools.openSafari(config.safariBinary);
|
|
7504
8010
|
const raisedBundleId = config.safariBinary ? 'com.apple.Safari' : config.bundleIdentifier;
|
|
7505
8011
|
const browserPid = await tools.resolvePid(raisedBundleId);
|
|
@@ -7513,7 +8019,10 @@ var __webpack_modules__ = {
|
|
|
7513
8019
|
logger.info?.(messages.fO(config.appName, isSigned));
|
|
7514
8020
|
if (await confirmRegisteredWithSafari(tools, config.bundleIdentifier)) logger.info?.(messages.fd(config.appName));
|
|
7515
8021
|
else logger.info?.(messages.qY(config.appName));
|
|
7516
|
-
if (host.announceDevReady)
|
|
8022
|
+
if (host.announceDevReady) {
|
|
8023
|
+
await holdWebDriverSession(tools, config, logger);
|
|
8024
|
+
await announceSafariDevSession(host, config, appPath);
|
|
8025
|
+
}
|
|
7517
8026
|
return completePackage(config, logger, mode);
|
|
7518
8027
|
}
|
|
7519
8028
|
async function packageSafariExtension(host, outputPath, logger, mode = 'full') {
|
|
@@ -7803,8 +8312,25 @@ var __webpack_modules__ = {
|
|
|
7803
8312
|
});
|
|
7804
8313
|
},
|
|
7805
8314
|
"./helpers/messaging.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
7806
|
-
|
|
7807
|
-
|
|
8315
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
8316
|
+
Lp: ()=>CODES,
|
|
8317
|
+
T_: ()=>artifactNoun,
|
|
8318
|
+
QZ: ()=>browserDisplayName,
|
|
8319
|
+
A6: ()=>browserRowValue,
|
|
8320
|
+
Nr: ()=>card,
|
|
8321
|
+
od: ()=>claimCardKey,
|
|
8322
|
+
Qi: ()=>hasChannelPrefix,
|
|
8323
|
+
Gg: ()=>humanError,
|
|
8324
|
+
_w: ()=>humanLine,
|
|
8325
|
+
mR: ()=>humanWarn,
|
|
8326
|
+
VR: ()=>isCardKeyClaimed,
|
|
8327
|
+
_o: ()=>isDebug,
|
|
8328
|
+
Pl: ()=>prefix,
|
|
8329
|
+
UT: ()=>stripChannelPrefix
|
|
8330
|
+
});
|
|
8331
|
+
const external_node_util_namespaceObject = require("node:util");
|
|
8332
|
+
var external_pintor_ = __webpack_require__("pintor");
|
|
8333
|
+
var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_);
|
|
7808
8334
|
const GLYPH = '⏵⏵⏵';
|
|
7809
8335
|
const DEBUG_GLYPH = '···';
|
|
7810
8336
|
const DEBUG_VALUES = new Set([
|
|
@@ -7821,11 +8347,11 @@ var __webpack_modules__ = {
|
|
|
7821
8347
|
return DEBUG_VALUES.has(String(raw ?? '').trim().toLowerCase());
|
|
7822
8348
|
}
|
|
7823
8349
|
function prefix(type) {
|
|
7824
|
-
if ('error' === type) return
|
|
7825
|
-
if ('warn' === type) return
|
|
7826
|
-
if ('success' === type) return
|
|
7827
|
-
if ('debug' === type) return
|
|
7828
|
-
return
|
|
8350
|
+
if ('error' === type) return external_pintor_default().red(GLYPH);
|
|
8351
|
+
if ('warn' === type) return external_pintor_default().brightYellow(GLYPH);
|
|
8352
|
+
if ('success' === type) return external_pintor_default().green(GLYPH);
|
|
8353
|
+
if ('debug' === type) return external_pintor_default().dim(external_pintor_default().gray(DEBUG_GLYPH));
|
|
8354
|
+
return external_pintor_default().gray(GLYPH);
|
|
7829
8355
|
}
|
|
7830
8356
|
const ANSI_PATTERN = /\[[0-9;]*m/g;
|
|
7831
8357
|
function hasChannelPrefix(text) {
|
|
@@ -7842,7 +8368,7 @@ var __webpack_modules__ = {
|
|
|
7842
8368
|
return MACHINE_OUTPUT_VALUES.has(String(process.env.EXTENSION_OUTPUT || '').trim().toLowerCase());
|
|
7843
8369
|
}
|
|
7844
8370
|
function humanLine(...parts) {
|
|
7845
|
-
if (isMachineOutput()) return;
|
|
8371
|
+
if (isMachineOutput()) return void process.stderr.write(`${(0, external_node_util_namespaceObject.format)(...parts)}\n`);
|
|
7846
8372
|
console.log(...parts);
|
|
7847
8373
|
}
|
|
7848
8374
|
function humanWarn(...parts) {
|
|
@@ -7857,10 +8383,10 @@ var __webpack_modules__ = {
|
|
|
7857
8383
|
function card(input = {}) {
|
|
7858
8384
|
const version = String(input.version || '').trim();
|
|
7859
8385
|
const suffix = String(input.suffix || '').trim();
|
|
7860
|
-
const head = ` 🧩 Extension.js` + (version ? ` ${
|
|
8386
|
+
const head = ` 🧩 Extension.js` + (version ? ` ${external_pintor_default().gray(version)}` : '') + (suffix ? ` ${suffix}` : '');
|
|
7861
8387
|
const body = (input.rows || []).filter((row)=>String(row.value || '').trim().length > 0).slice(0, MAX_CARD_ROWS).map((row)=>{
|
|
7862
8388
|
const label = row.label.padEnd(CARD_LABEL_WIDTH);
|
|
7863
|
-
return ` ${label}${
|
|
8389
|
+
return ` ${label}${external_pintor_default().gray(String(row.value).trim())}`;
|
|
7864
8390
|
});
|
|
7865
8391
|
return [
|
|
7866
8392
|
head,
|
|
@@ -7972,7 +8498,6 @@ var __webpack_modules__ = {
|
|
|
7972
8498
|
E_CONFIG_LOAD: 'E_CONFIG_LOAD',
|
|
7973
8499
|
E_MANAGED_DEP_CONFLICT: 'E_MANAGED_DEP_CONFLICT',
|
|
7974
8500
|
E_TYPES_EMIT: 'E_TYPES_EMIT',
|
|
7975
|
-
E_TSCONFIG_MISSING: 'E_TSCONFIG_MISSING',
|
|
7976
8501
|
E_OPTIONAL_DEP_UNRESOLVED: 'E_OPTIONAL_DEP_UNRESOLVED',
|
|
7977
8502
|
E_OPTIONAL_DEP_LOAD: 'E_OPTIONAL_DEP_LOAD',
|
|
7978
8503
|
E_OPTIONAL_DEP_UNKNOWN: 'E_OPTIONAL_DEP_UNKNOWN',
|
|
@@ -7988,11 +8513,9 @@ var __webpack_modules__ = {
|
|
|
7988
8513
|
E_CSS_PARSE: 'E_CSS_PARSE',
|
|
7989
8514
|
E_CSS_PREPROCESSOR_MISSING: 'E_CSS_PREPROCESSOR_MISSING',
|
|
7990
8515
|
E_CSS_DEAD_REF: 'E_CSS_DEAD_REF',
|
|
7991
|
-
E_INTEGRATION_INSTALL: 'E_INTEGRATION_INSTALL',
|
|
7992
8516
|
E_POLYFILL_NOT_FOUND: 'E_POLYFILL_NOT_FOUND',
|
|
7993
8517
|
E_LOCALES_LAYOUT: 'E_LOCALES_LAYOUT',
|
|
7994
8518
|
E_WAR_INVALID: 'E_WAR_INVALID',
|
|
7995
|
-
E_MATCH_PATTERN_INVALID: 'E_MATCH_PATTERN_INVALID',
|
|
7996
8519
|
E_BACKGROUND_REQUIRED: 'E_BACKGROUND_REQUIRED',
|
|
7997
8520
|
E_CONTENT_SCRIPT_SYNTAX: 'E_CONTENT_SCRIPT_SYNTAX',
|
|
7998
8521
|
E_NO_ENTRYPOINTS: 'E_NO_ENTRYPOINTS',
|
|
@@ -8011,7 +8534,6 @@ var __webpack_modules__ = {
|
|
|
8011
8534
|
E_BROWSER_START_TIMEOUT: 'E_BROWSER_START_TIMEOUT',
|
|
8012
8535
|
E_LAUNCH_SKIPPED_COMPILE_ERRORS: 'E_LAUNCH_SKIPPED_COMPILE_ERRORS',
|
|
8013
8536
|
E_INSTANCE_AMBIGUOUS: 'E_INSTANCE_AMBIGUOUS',
|
|
8014
|
-
E_WSL_INTEROP: 'E_WSL_INTEROP',
|
|
8015
8537
|
E_EXTENSION_LOAD_REFUSED: 'E_EXTENSION_LOAD_REFUSED',
|
|
8016
8538
|
E_ADDON_INSTALL: 'E_ADDON_INSTALL',
|
|
8017
8539
|
E_BROWSER_CONNECT: 'E_BROWSER_CONNECT',
|
|
@@ -8023,27 +8545,11 @@ var __webpack_modules__ = {
|
|
|
8023
8545
|
E_RDP_PROTOCOL: 'E_RDP_PROTOCOL',
|
|
8024
8546
|
E_PORT_IN_USE: 'E_PORT_IN_USE',
|
|
8025
8547
|
E_SESSION_STOPPED: 'E_SESSION_STOPPED',
|
|
8548
|
+
E_SESSION_EXISTS: 'E_SESSION_EXISTS',
|
|
8026
8549
|
E_LOGS_STREAM_GAP: 'E_LOGS_STREAM_GAP',
|
|
8027
8550
|
E_BROWSER_INSTALL_PRIVILEGE: 'E_BROWSER_INSTALL_PRIVILEGE',
|
|
8028
8551
|
E_UNINSTALL_NOOP: 'E_UNINSTALL_NOOP'
|
|
8029
8552
|
};
|
|
8030
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
8031
|
-
A6: ()=>browserRowValue,
|
|
8032
|
-
Gg: ()=>humanError,
|
|
8033
|
-
Nr: ()=>card,
|
|
8034
|
-
Pl: ()=>prefix,
|
|
8035
|
-
QZ: ()=>browserDisplayName,
|
|
8036
|
-
Qi: ()=>hasChannelPrefix,
|
|
8037
|
-
T_: ()=>artifactNoun,
|
|
8038
|
-
UT: ()=>stripChannelPrefix,
|
|
8039
|
-
VR: ()=>isCardKeyClaimed,
|
|
8040
|
-
_o: ()=>isDebug,
|
|
8041
|
-
_w: ()=>humanLine,
|
|
8042
|
-
mR: ()=>humanWarn,
|
|
8043
|
-
od: ()=>claimCardKey
|
|
8044
|
-
}, {
|
|
8045
|
-
Lp: CODES
|
|
8046
|
-
});
|
|
8047
8553
|
},
|
|
8048
8554
|
"./helpers/vendors.ts" () {
|
|
8049
8555
|
function isSafariVendor(value) {
|
|
@@ -8108,6 +8614,9 @@ var __webpack_modules__ = {
|
|
|
8108
8614
|
"node:fs" (module) {
|
|
8109
8615
|
module.exports = require("node:fs");
|
|
8110
8616
|
},
|
|
8617
|
+
"node:http" (module) {
|
|
8618
|
+
module.exports = require("node:http");
|
|
8619
|
+
},
|
|
8111
8620
|
"node:module" (module) {
|
|
8112
8621
|
module.exports = require("node:module");
|
|
8113
8622
|
},
|