@chromahq/core 1.0.54 → 1.0.55

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.
@@ -343,8 +343,10 @@ const _PopupVisibilityService = class _PopupVisibilityService {
343
343
  onPortConnected() {
344
344
  const wasVisible = this.isPopupVisible();
345
345
  this.connectedPortCount++;
346
+ console.log(`[PopupVisibilityService] Port connected, count: ${this.connectedPortCount}`);
346
347
  if (!wasVisible && this.isPopupVisible()) {
347
348
  this.lastVisibilityChangeAt = Date.now();
349
+ console.log("[PopupVisibilityService] Popup became visible, notifying listeners");
348
350
  this.notifyListeners(true);
349
351
  }
350
352
  }
@@ -355,8 +357,10 @@ const _PopupVisibilityService = class _PopupVisibilityService {
355
357
  onPortDisconnected() {
356
358
  const wasVisible = this.isPopupVisible();
357
359
  this.connectedPortCount = Math.max(0, this.connectedPortCount - 1);
360
+ console.log(`[PopupVisibilityService] Port disconnected, count: ${this.connectedPortCount}`);
358
361
  if (wasVisible && !this.isPopupVisible()) {
359
362
  this.lastVisibilityChangeAt = Date.now();
363
+ console.log("[PopupVisibilityService] Popup became hidden, notifying listeners");
360
364
  this.notifyListeners(false);
361
365
  }
362
366
  }
@@ -1309,7 +1313,7 @@ class JobRegistry {
1309
1313
  }
1310
1314
  pause(id) {
1311
1315
  const entry = this.jobs.get(id);
1312
- if (entry && entry.context.state === JobState.RUNNING) {
1316
+ if (entry && (entry.context.state === JobState.RUNNING || entry.context.state === JobState.SCHEDULED)) {
1313
1317
  this.updateState(id, JobState.PAUSED);
1314
1318
  this.clearTimers(id);
1315
1319
  entry.job.pause?.();
@@ -1974,7 +1978,9 @@ class Scheduler {
1974
1978
  */
1975
1979
  setupPopupVisibilityListener() {
1976
1980
  const visibilityService = PopupVisibilityService.instance;
1981
+ this.logger.info("[Scheduler] Setting up popup visibility listener");
1977
1982
  this.popupVisibilityUnsubscribe = visibilityService.onVisibilityChange((isVisible) => {
1983
+ this.logger.info(`[Scheduler] Visibility changed: ${isVisible ? "visible" : "hidden"}`);
1978
1984
  if (isVisible) {
1979
1985
  this.resumePopupDependentJobs();
1980
1986
  } else {
@@ -1987,18 +1993,29 @@ class Scheduler {
1987
1993
  */
1988
1994
  pausePopupDependentJobs() {
1989
1995
  const jobs = this.registry.listAll();
1996
+ this.logger.info(`[Scheduler] pausePopupDependentJobs called, total jobs: ${jobs.length}`);
1990
1997
  let pausedCount = 0;
1998
+ const pausedJobIds = [];
1991
1999
  for (const job of jobs) {
1992
- if (job.options?.requiresPopup && !this.registry.getContext(job.id)?.isPaused()) {
1993
- this.logger.debug(`Pausing popup-dependent job: ${job.id}`);
2000
+ const hasRequiresPopup = job.options?.requiresPopup;
2001
+ const isPaused = this.registry.getContext(job.id)?.isPaused();
2002
+ this.logger.debug(
2003
+ `[Scheduler] Job ${job.id}: requiresPopup=${hasRequiresPopup}, isPaused=${isPaused}`
2004
+ );
2005
+ if (hasRequiresPopup && !isPaused) {
1994
2006
  this.alarm.cancel(job.id);
1995
2007
  this.timeout.cancel(job.id);
1996
2008
  this.registry.pause(job.id);
2009
+ pausedJobIds.push(job.id);
1997
2010
  pausedCount++;
1998
2011
  }
1999
2012
  }
2000
2013
  if (pausedCount > 0) {
2001
- this.logger.info(`Paused ${pausedCount} popup-dependent jobs (popup closed)`);
2014
+ this.logger.info(
2015
+ `[Scheduler] Paused ${pausedCount} popup-dependent jobs (popup closed): ${pausedJobIds.join(", ")}`
2016
+ );
2017
+ } else {
2018
+ this.logger.info(`[Scheduler] No popup-dependent jobs to pause`);
2002
2019
  }
2003
2020
  }
2004
2021
  /**
@@ -2006,17 +2023,28 @@ class Scheduler {
2006
2023
  */
2007
2024
  resumePopupDependentJobs() {
2008
2025
  const jobs = this.registry.listAll();
2026
+ this.logger.info(`[Scheduler] resumePopupDependentJobs called, total jobs: ${jobs.length}`);
2009
2027
  let resumedCount = 0;
2028
+ const resumedJobIds = [];
2010
2029
  for (const job of jobs) {
2011
- if (job.options?.requiresPopup && this.registry.getContext(job.id)?.isPaused()) {
2012
- this.logger.debug(`Resuming popup-dependent job: ${job.id}`);
2030
+ const hasRequiresPopup = job.options?.requiresPopup;
2031
+ const isPaused = this.registry.getContext(job.id)?.isPaused();
2032
+ this.logger.debug(
2033
+ `[Scheduler] Job ${job.id}: requiresPopup=${hasRequiresPopup}, isPaused=${isPaused}`
2034
+ );
2035
+ if (hasRequiresPopup && isPaused) {
2013
2036
  this.registry.resume(job.id);
2014
2037
  this.schedule(job.id, job.options);
2038
+ resumedJobIds.push(job.id);
2015
2039
  resumedCount++;
2016
2040
  }
2017
2041
  }
2018
2042
  if (resumedCount > 0) {
2019
- this.logger.info(`Resumed ${resumedCount} popup-dependent jobs (popup opened)`);
2043
+ this.logger.info(
2044
+ `[Scheduler] Resumed ${resumedCount} popup-dependent jobs (popup opened): ${resumedJobIds.join(", ")}`
2045
+ );
2046
+ } else {
2047
+ this.logger.info(`[Scheduler] No popup-dependent jobs to resume`);
2020
2048
  }
2021
2049
  }
2022
2050
  schedule(id, options) {
@@ -2711,4 +2739,4 @@ exports.getNonceService = getNonceService;
2711
2739
  exports.getPopupVisibilityService = getPopupVisibilityService;
2712
2740
  exports.isEarlyListenerSetup = isEarlyListenerSetup;
2713
2741
  exports.setupEarlyListener = setupEarlyListener;
2714
- //# sourceMappingURL=boot-CcvC3GTE.js.map
2742
+ //# sourceMappingURL=boot-BMZdye6C.js.map