Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture page reopening (potential race condition) #149

Open
Yuu-Han opened this issue Feb 19, 2024 · 1 comment
Open

Capture page reopening (potential race condition) #149

Yuu-Han opened this issue Feb 19, 2024 · 1 comment

Comments

@Yuu-Han
Copy link
Collaborator

Yuu-Han commented Feb 19, 2024

(As we talked in Feb 5 meeting) Clicking a closed node on historymap will reopen the page and set its state to open, not adding a new node (see #148). In other words, for a newly opened page, we need to know if it is opened from a closed one in order to determine whether to create a new node.

@Yuu-Han
Copy link
Collaborator Author

Yuu-Han commented Feb 19, 2024

In the latest implementation, the success of the capturing relies on event 1 happening earlier than event 2:

  • Event 1: function chrome.tabs.create callback
    • The tab id is updated in this callback function
  • Event 2: the listener observes page opening (triggered by chrome.tabs.create)
    • It tries to find a page with the same tab id (and other attributes) to decide whether to add a new node

Maybe this works because the page opening event is exposed after the create function (including the callback) is done (but not entirely sure).

@kaidatavis kaidatavis changed the title Capture page reopening Capture page reopening (potential race condition) Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants