Bug 1661921 - [devtools] Console Instant Value no refresh after page refresh r=nchevobbe

Differential Revision: https://phabricator.services.mozilla.com/D139770
This commit is contained in:
colin_czb 2022-03-10 07:50:59 +00:00
Родитель a664a6d305
Коммит 2e0db4918d
3 изменённых файлов: 23 добавлений и 0 удалений

Просмотреть файл

@ -348,4 +348,20 @@ add_task(async function() {
"Pref was changed"
);
ok(true, "Eager evaluation element is no longer displayed");
// reset the preference
await pushPref(EAGER_EVALUATION_PREF, true);
});
// Test that the console instant evaluation is updated on page navigation
add_task(async function() {
const start_uri = "data:text/html, Start uri";
const new_uri = "data:text/html, Test console refresh instant value";
const hud = await openNewTabAndConsole(start_uri);
setInputValue(hud, "globalThis.location.href");
await waitForEagerEvaluationResult(hud, `"${start_uri}"`);
await navigateTo(new_uri);
await waitForEagerEvaluationResult(hud, `"${new_uri}"`);
});

Просмотреть файл

@ -414,6 +414,9 @@ class WebConsoleUI {
* object by the page itself.
*/
async handleNavigated({ hasNativeConsoleAPI }) {
// Updates instant evaluation on page navigation
this.wrapper.dispatchUpdateInstantEvaluationResultForCurrentExpression();
// Wait for completion of any async dispatch before notifying that the console
// is fully updated after a page reload
await this.wrapper.waitAsyncDispatches();

Просмотреть файл

@ -290,6 +290,10 @@ class WebConsoleWrapper {
store.dispatch(actions.evaluateExpression(expression));
}
dispatchUpdateInstantEvaluationResultForCurrentExpression() {
store.dispatch(actions.updateInstantEvaluationResultForCurrentExpression());
}
/**
* Returns a Promise that resolves once any async dispatch is finally dispatched.
*/