mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:17:35 +00:00
LibWeb: Update session history when History
entry is pushed/replaced
With this change `shared_history_push_replace_state()` starts to actually add/replace session history entry.
This commit is contained in:
parent
699ead0939
commit
7cdbd59e92
6 changed files with 55 additions and 13 deletions
|
@ -0,0 +1,20 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
try {
|
||||
const initialHistoryLength = window.history.length;
|
||||
|
||||
history.pushState({}, "hello", "history-pushstate-iframe.html#hello");
|
||||
|
||||
if (window.self !== window.top) {
|
||||
parent.postMessage(
|
||||
"history object length has changed by " +
|
||||
(window.history.length - initialHistoryLength),
|
||||
"*"
|
||||
);
|
||||
} else {
|
||||
test(() => {});
|
||||
}
|
||||
} catch (e) {
|
||||
if (window.self !== window.top) parent.postMessage("ERROR:" + e, "*");
|
||||
}
|
||||
</script>
|
23
Tests/LibWeb/Text/input/navigation/history-pushstate.html
Normal file
23
Tests/LibWeb/Text/input/navigation/history-pushstate.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
<script src="../include.js"></script>
|
||||
<iframe id="testIframe" src="about:blank"></iframe>
|
||||
<script>
|
||||
asyncTest(async done => {
|
||||
const iframe = document.getElementById("testIframe");
|
||||
|
||||
function navigateIframe(src) {
|
||||
return new Promise(resolve => {
|
||||
iframe.addEventListener("load", () => {
|
||||
resolve();
|
||||
});
|
||||
iframe.src = src;
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener("message", event => {
|
||||
println(event.data);
|
||||
done();
|
||||
});
|
||||
|
||||
await navigateIframe("./history-pushstate-iframe.html");
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue