Skip to content
This repository has been archived by the owner on Nov 24, 2018. It is now read-only.

added actions history, back, forward and refresh #59

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

added actions history, back, forward and refresh #59

wants to merge 2 commits into from

Conversation

aw31n
Copy link

@aw31n aw31n commented Jul 27, 2017

No description provided.

if (history && history.currentIndex > 0) {
const {Page} = this.client
await Page.navigateToHistoryEntry({entryId: history.entries[history.currentIndex - 1].id})
await Page.loadEventFired()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does loadEventFired() get triggered when navigating back on a hash URL? E.g. From blah.html#section2 back to blah.html#section1?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhm, no, it does not. You're right.

It also doesn't get triggered when you navigate from blah.html to blah.html#somewhere, which means the current goto-function is buggy, too - if I'm not mistaken.

Guess I just evaluate window.history.back(), etc. instead. Should have done that in the first place...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's indeed a good point with the hash location. Another option might be Page.frameNavigated, we should try that out.
Regarding just evaluating window.history.back() - we try to stay as "native" as possible to prevent side effects with the JS runtime, you never know what weird stuff people do in their global scope...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, substituting Page.loadEventFired with Page.frameNavigated seems to work, I tried it locally. But I would still wait with this change before we have tests as it could break stuff that we don't understand yet

@adieuadieu
Copy link
Collaborator

adieuadieu commented Jul 27, 2017

Hi @aw31n thank you for raising this PR! We'll take a look shortly.

@@ -197,6 +205,36 @@ export default class LocalRuntime {
}
}

private async history(): Promise<NavigationHistory> {
const {Page} = this.client
await Promise.all([Page.enable()])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better place to enable Page? Seems like we'd want to do that at constructor time

@adieuadieu
Copy link
Collaborator

adieuadieu commented Aug 1, 2017

Hi @aw31n thank you again for raising this PR! I'm sorry about the delay. We haven't forgotten about you! Due to the proposed change from Page.loadEventFired to Page.frameNavigated, we're just a bit uncomfortable merging your PR without some better testing in place. We're actively working on getting some tests in place so soon we can come back to this. In the meantime, would you be able to incorporate the feedback from @timsuchanek & @joelgriffith?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants