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