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

Which location should reload on history.go(0)? #2436

Closed
asajeffrey opened this issue Mar 14, 2017 · 6 comments · Fixed by #6315
Closed

Which location should reload on history.go(0)? #2436

asajeffrey opened this issue Mar 14, 2017 · 6 comments · Fixed by #6315

Comments

@asajeffrey
Copy link

The spec for history.go() at https://html.spec.whatwg.org/multipage/browsers.html#dom-history-go says:

When the go(delta) method is invoked, if delta is zero, the user agent must act as if the location.reload() method was called instead.

This is ambiguous as to which location should be used, the one for the window whose history is being accessed, or the current document. Unfortunately, different browsers behave differently, as shown by:

<html>
  <body>
    <iframe id="child"></iframe>
  </body>
  <script>
    var child = document.getElementById("child");
    setTimeout(function () { console.log("Finished."); }, 1000);
    child.contentWindow.history.go(0);
  </script>
</html>

Under FF, this will loop forever reloading (because the main document is reloaded) whereas in Chrome it will terminate (because the child is reloaded).

@asajeffrey
Copy link
Author

cc @annevk

@asajeffrey
Copy link
Author

IRC chat on #servo with @KiChjang and @bzbarsky: http://logs.glob.uno/?c=mozilla%23servo&s=14+Mar+2017&e=14+Mar+2017#c630800

"The problem is that if you call childWindow.go(0), what if you are same-origin with the child, but x-origin with the parent?"

@annevk
Copy link
Member

annevk commented Mar 15, 2017

This basically depends on #1454 being fixed I think.

@asajeffrey
Copy link
Author

Well it's related to #1454, but orthogonal. Currently the spec special-cases history.go(0), it's the only history traversal that reloads documents that haven't been discarded.

@annevk
Copy link
Member

annevk commented Mar 16, 2017

But making history more of a flat concept should help a lot with deciding what to reload I think.

@annevk
Copy link
Member

annevk commented May 4, 2017

This is also related to #2018 (should history return cross-origin information).

domenic added a commit to web-platform-tests/wpt that referenced this issue Oct 10, 2022
domenic added a commit to web-platform-tests/wpt that referenced this issue Oct 10, 2022
domenic added a commit to web-platform-tests/wpt that referenced this issue Oct 10, 2022
domenic added a commit to web-platform-tests/wpt that referenced this issue Oct 10, 2022
domenic added a commit to web-platform-tests/wpt that referenced this issue Oct 11, 2022
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Oct 21, 2022
…s, a=testonly

Automatic update from web-platform-tests
Test which document history.go(0) reloads

See whatwg/html#2436. Specified in whatwg/html#6315.

--

wpt-commits: df228765793c58a9a7aa25c8b808df529e049122
wpt-pr: 36366
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Oct 26, 2022
…s, a=testonly

Automatic update from web-platform-tests
Test which document history.go(0) reloads

See whatwg/html#2436. Specified in whatwg/html#6315.

--

wpt-commits: df228765793c58a9a7aa25c8b808df529e049122
wpt-pr: 36366
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants