Bug 1518559 - Throw error, if page is missing. r=ladybenko,jdescottes
authorOla Gasidlo <ogasidlo@mozilla.com>
Fri, 18 Jan 2019 08:34:01 +0000
changeset 514400 cfc581f4768c3a9424902541747e805749565e13
parent 514377 29dcf30c1cada54e646566966065131f81d0d863
child 514401 15a126eab0979e764c96c01c9083207b2c0aa9a0
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersladybenko, jdescottes
bugs1518559
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1518559 - Throw error, if page is missing. r=ladybenko,jdescottes Throw error and dispatch select page failure action if the page argument is missing Differential Revision: https://phabricator.services.mozilla.com/D16450
devtools/client/aboutdebugging-new/src/actions/ui.js
--- a/devtools/client/aboutdebugging-new/src/actions/ui.js
+++ b/devtools/client/aboutdebugging-new/src/actions/ui.js
@@ -36,21 +36,23 @@ function selectPage(page, runtimeId) {
     try {
       const isSamePage = (oldPage, newPage) => {
         if (newPage === PAGE_TYPES.RUNTIME && oldPage === PAGE_TYPES.RUNTIME) {
           return runtimeId === getState().runtimes.selectedRuntimeId;
         }
         return newPage === oldPage;
       };
 
+      if (!page) {
+        throw new Error("No page provided.");
+      }
+
       const currentPage = getState().ui.selectedPage;
-      // Nothing to dispatch if the page is the same as the current page, or
-      // if we are not providing any page.
-      // TODO: we should dispatch SELECT_PAGE_FAILURE if page is missing. See Bug 1518559.
-      if (!page || isSamePage(currentPage, page)) {
+      // Nothing to dispatch if the page is the same as the current page
+      if (isSamePage(currentPage, page)) {
         return;
       }
 
       // Stop watching current runtime, if currently on a RUNTIME page.
       if (currentPage === PAGE_TYPES.RUNTIME) {
         const currentRuntimeId = getState().runtimes.selectedRuntimeId;
         await dispatch(Actions.unwatchRuntime(currentRuntimeId));
       }