@skrillex1224/playwright-toolkit 2.1.256 → 2.1.258

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/index.cjs CHANGED
@@ -2303,7 +2303,7 @@ async function createApifyKit() {
2303
2303
  options
2304
2304
  }
2305
2305
  );
2306
- await Actor2.fail(`Run Step ${step} \u5931\u8D25 (\u5DF2\u91CD\u8BD5 ${retryTimes} \u6B21): ${finalError.message}`);
2306
+ await Actor2.fail(`Run Step ${step} \u5931\u8D25 (\u5DF2\u91CD\u8BD5 ${retryTimes} \u6B21): ${finalError.message} | url: ${page.url()}`);
2307
2307
  } else {
2308
2308
  throw finalError;
2309
2309
  }
@@ -9069,6 +9069,13 @@ var Share = {
9069
9069
  const domMode = options.domMode ?? Mutation.Mode.All;
9070
9070
  const performActions = typeof options.performActions === "function" ? options.performActions : async () => {
9071
9071
  };
9072
+ const signal = options.signal;
9073
+ const isAborted = () => Boolean(signal?.aborted);
9074
+ const abortReason = () => {
9075
+ const reason = signal?.reason;
9076
+ if (reason instanceof Error) return reason.message;
9077
+ return reason ? String(reason) : "aborted";
9078
+ };
9072
9079
  if (share.prefix === void 0) {
9073
9080
  throw new Error("Share.captureLink requires options.share.prefix");
9074
9081
  }
@@ -9092,6 +9099,15 @@ var Share = {
9092
9099
  lastMatchedUrl: "",
9093
9100
  responseSampleUrls: []
9094
9101
  };
9102
+ if (isAborted()) {
9103
+ logger15.warning(`captureLink \u5DF2\u53D6\u6D88: ${abortReason()}`);
9104
+ return {
9105
+ link: null,
9106
+ payloadText: "",
9107
+ payloadSnapshot: abortReason(),
9108
+ source: "none"
9109
+ };
9110
+ }
9095
9111
  const candidates = {
9096
9112
  dom: null,
9097
9113
  response: null,
@@ -9150,6 +9166,7 @@ var Share = {
9150
9166
  if (candidates.response?.link) return;
9151
9167
  stats.responseObserved += 1;
9152
9168
  try {
9169
+ if (isAborted()) return;
9153
9170
  const url = String(response.url() || "");
9154
9171
  if (url && stats.responseSampleUrls.length < 8 && !stats.responseSampleUrls.includes(url)) {
9155
9172
  stats.responseSampleUrls.push(url);
@@ -9204,7 +9221,7 @@ var Share = {
9204
9221
  const actionTimeout = getRemainingMs();
9205
9222
  logger15.start("captureLink.performActions", `\u6267\u884C\u52A8\u4F5C\u9884\u7B97=${actionTimeout}ms`);
9206
9223
  let actionValue;
9207
- if (actionTimeout > 0) {
9224
+ if (!isAborted() && actionTimeout > 0) {
9208
9225
  let timer = null;
9209
9226
  const actionPromise = Promise.resolve().then(() => performActions()).then((result) => ({ type: "done", result })).catch((error) => ({ type: "error", error }));
9210
9227
  const timeoutPromise = new Promise((resolve) => {
@@ -9235,6 +9252,15 @@ var Share = {
9235
9252
  }
9236
9253
  let nextProgressLogTs = Date.now() + 3e3;
9237
9254
  while (true) {
9255
+ if (isAborted()) {
9256
+ logger15.warning(`captureLink \u5DF2\u53D6\u6D88: ${abortReason()}`);
9257
+ return {
9258
+ link: null,
9259
+ payloadText: "",
9260
+ payloadSnapshot: abortReason(),
9261
+ source: "none"
9262
+ };
9263
+ }
9238
9264
  const selected = candidates[share.mode];
9239
9265
  if (selected?.link) {
9240
9266
  logger15.success("captureLink", `\u6355\u83B7\u6210\u529F: source=${share.mode}, link=${selected.link}`);