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

add window message notifications for embeds: (fixes #333) #335

Merged
merged 4 commits into from
Jun 19, 2024

Conversation

ikreymer
Copy link
Member

@ikreymer ikreymer commented Jun 18, 2024

  • add 'replayNotFoundError' field to 'urlchange' (propagating 'archive-not-found' from wabac.js) to embed frame, with url/ts, for 404 pages
  • propagate 'page-loading' with loading true/false, to indicate when a page started/finished loading

The page-loading message does not have the URL that is being loaded, as that is only available when loading is finished (via other messages like urlchange). The 'archive-not-found' message is initially sent from wabac.js to the immediate iframe, and then the 'replayNotFoundError' field is added to the urlchange event.

Only send one urlchange event per URL change (keep track of change).
Also ensure multi timestamp change uses replaceHistory to avoid an extra navigation.

Fixes #333

@ikreymer ikreymer requested a review from SuaYoo June 18, 2024 03:05
@ikreymer
Copy link
Member Author

ikreymer commented Jun 18, 2024

Message sequence for 404 page:

{type: 'page-loading', loading: true}
{type: 'page-loading', loading: false}
{type: 'urlchange', url: 'https://example.com/', ts: '20221002034558', 'replayNotFoundError': true}

For valid page:

{type: 'page-loading', loading: true}
{type: 'page-loading', loading: false}
{type: 'urlchange', url: 'https://example.com/', ts: '20221002034558', 'replayNotFoundError': false}

Only difference should be the replayNotFoundError field.

package.json Outdated Show resolved Hide resolved
@SuaYoo
Copy link
Member

SuaYoo commented Jun 19, 2024

What do you think about dispatching a wr-page-loading event from Embed? It may be more straightforward for <replay-web-page> embeds, to call like:

<replay-web-page
  replayBase="/js/"
  source="/wacz/example.wacz"
  url="https://webrecorder.net"
  @wr-page-loading=${handlePageLoading}
></replay-web-page>

@ikreymer
Copy link
Member Author

ikreymer commented Jun 19, 2024

What do you think about dispatching a wr-page-loading event from Embed? It may be more straightforward for <replay-web-page> embeds, to call like:

<replay-web-page
  replayBase="/js/"
  source="/wacz/example.wacz"
  url="https://webrecorder.net"
  @wr-page-loading=${handlePageLoading}
></replay-web-page>

yeah, that could work, though would be in addition to the postMessage messages (at least initially), since its sending between multiple window frames. I guess could have a @rwp-page-loading and @rwp-url-changed maybe?

ikreymer added 3 commits June 18, 2024 21:10
- propagate 'archive-not-found' (from wabac.js) to embed frame, with url/ts, for 404 pages
- propagate 'page-loading' with loading true/false, to indicate when a page started/finished loading
…h replayNotFoundError bool to indicate the 404 page

- ensure updating multi-ts list uses replaceLoc
- add some missing types, types cleanup
…ustom events in response to window message

from internal iframe
@ikreymer ikreymer force-pushed the issue-333-load-messages branch from cfb19df to 61e3854 Compare June 19, 2024 04:20
@SuaYoo SuaYoo self-requested a review June 19, 2024 16:01
@ikreymer ikreymer changed the base branch from main to 2.1.0-work June 19, 2024 21:03
@ikreymer ikreymer merged commit 7478217 into 2.1.0-work Jun 19, 2024
5 of 6 checks passed
@ikreymer ikreymer deleted the issue-333-load-messages branch June 19, 2024 21:06
ikreymer added a commit that referenced this pull request Jun 19, 2024
… instead of tracked in location. multiple timestamps are always looked up and never used directly from userinput
ikreymer added a commit that referenced this pull request Jun 21, 2024
- add 'replayNotFoundError' field to 'urlchange' (propagating
'archive-not-found' postMessage message from wabac.js) to embed frame, with url/ts, for 404
pages
- propagate 'page-loading' with loading true/false, to indicate when a
page started/finished loading. (URL not available here)
- Only send one urlchange event per URL change (keep track of change).
- Also ensure multi timestamp change uses replaceHistory to avoid an extra
navigation.
- replay-web-page embed: send rwp-url-change and rwp-page-loading custom events from webcomponent

Fixes #333
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Additional navigation events for embeds
2 participants