Bug 1498987 - localStorage and sessionStorage display key: key instead of key: value in developer console r=nchevobbe
authorMichael Ratcliffe <mratcliffe@mozilla.com>
Tue, 23 Oct 2018 15:33:29 +0000
changeset 490952 5197974fa161114a0543ef2924b53343d84aae6a
parent 490951 f07a9906ade401077637d96ec3db1d664d4e941a
child 490953 33523dc590feb2d339e4722fdfe1222d341bead4
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersnchevobbe
bugs1498987
milestone65.0a1
Bug 1498987 - localStorage and sessionStorage display key: key instead of key: value in developer console r=nchevobbe Differential Revision: https://phabricator.services.mozilla.com/D9397
devtools/client/webconsole/test/mochitest/browser_webconsole_object_inspector_local_session_storage.js
devtools/server/actors/object.js
--- a/devtools/client/webconsole/test/mochitest/browser_webconsole_object_inspector_local_session_storage.js
+++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_object_inspector_local_session_storage.js
@@ -60,29 +60,34 @@ async function checkValues(oi, storageTy
   entriesNode.querySelector(".arrow").click();
   await onMapOiMutation;
 
   nodes = oi.querySelectorAll(".node");
   // There are now 7 nodes, the 5 original ones, and the 2 entries.
   is(nodes.length, 7, "There is the expected number of nodes in the tree");
 
   const title = nodes[0].querySelector(".objectTitle").textContent;
+  const name1 = nodes[1].querySelector(".object-label").textContent;
+  const value1 = nodes[1].querySelector(".objectBox").textContent;
+
   const length = [...nodes[2].querySelectorAll(".object-label,.objectBox")]
                              .map(node => node.textContent);
   const key2 = [...nodes[4].querySelectorAll(".object-label,.nodeName,.objectBox-string")]
                            .map(node => node.textContent);
   const key = [...nodes[5].querySelectorAll(".object-label,.nodeName,.objectBox-string")]
                           .map(node => node.textContent);
 
   is(title, "Storage", `${storageType} object has the expected title`);
   is(length[0], "length", `${storageType} length property name is correct`);
   is(length[1], "2", `${storageType} length property value is correct`);
   is(key2[0], "0", `1st entry of ${storageType} entry has the correct index`);
   is(key2[1], "key2", `1st entry of ${storageType} entry has the correct key`);
 
   const firstValue = storageType === "localStorage" ? `"value2"` : `"value4"`;
+  is(name1, "key2", "Name of short descriptor is correct");
+  is(value1, firstValue, "Value of short descriptor is correct");
   is(key2[2], firstValue, `1st entry of ${storageType} entry has the correct value`);
   is(key[0], "1", `2nd entry of ${storageType} entry has the correct index`);
   is(key[1], "key", `2nd entry of ${storageType} entry has the correct key`);
 
   const secondValue = storageType === "localStorage" ? `"value1"` : `"value3"`;
   is(key[2], secondValue, `2nd entry of ${storageType} entry has the correct value`);
 }
--- a/devtools/server/actors/object.js
+++ b/devtools/server/actors/object.js
@@ -640,22 +640,17 @@ const proto = {
         value: e.name,
       };
     }
 
     if (isStorage(this.obj)) {
       if (name === "length") {
         return undefined;
       }
-      return {
-        configurable: true,
-        writable: true,
-        enumerable: true,
-        value: name,
-      };
+      return desc;
     }
 
     if (!desc || onlyEnumerable && !desc.enumerable) {
       return undefined;
     }
 
     const retval = {
       configurable: desc.configurable,