1
0
Fork 0
firefox/testing/web-platform/tests/navigation-api/state/resources/helpers.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

18 lines
485 B
JavaScript

window.updateStateBasedOnTestVariant = (w, state) => {
const usp = new URLSearchParams(location.search);
const method = usp.get("method");
switch (method) {
case "navigate": {
w.navigation.navigate("#", { history: "replace", state });
break;
}
case "updateCurrentEntry": {
w.navigation.updateCurrentEntry({ state });
break;
}
default: {
assert_unreached(`method must be either "navigate" or "updateCurrentEntry"`);
}
}
};