Guest User

Untitled

a guest
Jan 16th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. diff --git a/devtools/client/debugger/new/panel.js b/devtools/client/debugger/new/panel.js
  2. index 0857a5e80b78..26bf8a939894 100644
  3. --- a/devtools/client/debugger/new/panel.js
  4. +++ b/devtools/client/debugger/new/panel.js
  5. @@ -14,6 +14,25 @@ loader.lazyRequireGetter(this, "openContentLink", "devtools/client/shared/link",
  6. const DBG_STRINGS_URI = "devtools/client/locales/debugger.properties";
  7. const L10N = new LocalizationHelper(DBG_STRINGS_URI);
  8.  
  9. +// Wait until an action of `type` is dispatched. This is different
  10. +// then `_afterDispatchDone` because it doesn't wait for async actions
  11. +// to be done/errored. Use this if you want to listen for the "start"
  12. +// action of an async operation (somewhat rare).
  13. +function waitForNextDispatch(store, type) {
  14. + return new Promise(resolve => {
  15. + store.dispatch({
  16. + // Normally we would use `services.WAIT_UNTIL`, but use the
  17. + // internal name here so tests aren't forced to always pass it
  18. + // in
  19. + type: "@@service/waitUntil",
  20. + predicate: action => action.type === type,
  21. + run: (dispatch, getState, action) => {
  22. + resolve(action);
  23. + }
  24. + });
  25. + });
  26. +}
  27. +
  28. function DebuggerPanel(iframeWindow, toolbox) {
  29. this.panelWin = iframeWindow;
  30. this.panelWin.L10N = L10N;
  31. @@ -52,6 +71,8 @@ DebuggerPanel.prototype = {
  32. return Promise.all([onNodeFrontSet, onInspectorUpdated]);
  33. }.bind(this)
  34. }
  35. +
  36. + waitForNextDispatch(store, "NAVIGATED").then(() => this.emit("reloaded"))
  37. });
  38.  
  39. this._actions = actions;
  40. diff --git a/devtools/client/debugger/new/src/actions/navigation.js b/devtools/client/debugger/new/src/actions/navigation.js
  41. index 1d41d974cdf7..d5d70a038c4e 100644
  42. --- a/devtools/client/debugger/new/src/actions/navigation.js
  43. +++ b/devtools/client/debugger/new/src/actions/navigation.js
  44. @@ -81,5 +81,6 @@ export function navigated() {
  45. const sources = await client.fetchSources();
  46. dispatch(newSources(sources));
  47. }
  48. + dispatch({ type: "NAVIGATED" });
  49. };
  50. }
Add Comment
Please, Sign In to add comment