Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/devtools/client/debugger/new/panel.js b/devtools/client/debugger/new/panel.js
- index 0857a5e80b78..26bf8a939894 100644
- --- a/devtools/client/debugger/new/panel.js
- +++ b/devtools/client/debugger/new/panel.js
- @@ -14,6 +14,25 @@ loader.lazyRequireGetter(this, "openContentLink", "devtools/client/shared/link",
- const DBG_STRINGS_URI = "devtools/client/locales/debugger.properties";
- const L10N = new LocalizationHelper(DBG_STRINGS_URI);
- +// Wait until an action of `type` is dispatched. This is different
- +// then `_afterDispatchDone` because it doesn't wait for async actions
- +// to be done/errored. Use this if you want to listen for the "start"
- +// action of an async operation (somewhat rare).
- +function waitForNextDispatch(store, type) {
- + return new Promise(resolve => {
- + store.dispatch({
- + // Normally we would use `services.WAIT_UNTIL`, but use the
- + // internal name here so tests aren't forced to always pass it
- + // in
- + type: "@@service/waitUntil",
- + predicate: action => action.type === type,
- + run: (dispatch, getState, action) => {
- + resolve(action);
- + }
- + });
- + });
- +}
- +
- function DebuggerPanel(iframeWindow, toolbox) {
- this.panelWin = iframeWindow;
- this.panelWin.L10N = L10N;
- @@ -52,6 +71,8 @@ DebuggerPanel.prototype = {
- return Promise.all([onNodeFrontSet, onInspectorUpdated]);
- }.bind(this)
- }
- +
- + waitForNextDispatch(store, "NAVIGATED").then(() => this.emit("reloaded"))
- });
- this._actions = actions;
- diff --git a/devtools/client/debugger/new/src/actions/navigation.js b/devtools/client/debugger/new/src/actions/navigation.js
- index 1d41d974cdf7..d5d70a038c4e 100644
- --- a/devtools/client/debugger/new/src/actions/navigation.js
- +++ b/devtools/client/debugger/new/src/actions/navigation.js
- @@ -81,5 +81,6 @@ export function navigated() {
- const sources = await client.fetchSources();
- dispatch(newSources(sources));
- }
- + dispatch({ type: "NAVIGATED" });
- };
- }
Add Comment
Please, Sign In to add comment