Bug 1547858 - Array values are not shown in preview. r=davidwalsh
authorJason Laster <jlaster@mozilla.com>
Tue, 07 May 2019 22:21:23 +0000
changeset 531874 0ad4726584ec4bdb1786371815c814b3c7b66559
parent 531873 eee17e1b043502d063b1d609bd98750e91c1bc00
child 531875 72f1173462423fe2959e08bc1788e902a3a8d7c8
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidwalsh
bugs1547858
milestone68.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 1547858 - Array values are not shown in preview. r=davidwalsh Differential Revision: https://phabricator.services.mozilla.com/D30104
devtools/client/debugger/src/client/firefox/commands.js
devtools/client/debugger/test/mochitest/browser_dbg-preview.js
devtools/client/debugger/test/mochitest/examples/preview.js
--- a/devtools/client/debugger/src/client/firefox/commands.js
+++ b/devtools/client/debugger/src/client/firefox/commands.js
@@ -72,17 +72,20 @@ function createObjectClient(grip: Grip) 
 }
 
 async function loadObjectProperties(root: Node) {
   const utils = Reps.objectInspector.utils;
   const properties = await utils.loadProperties.loadItemProperties(
     root,
     createObjectClient
   );
-  return utils.node.makeNodesForProperties(properties, root);
+  return utils.node.getChildren({
+    item: root,
+    loadedProperties: new Map([[root.path, properties]])
+  });
 }
 
 function releaseActor(actor: String) {
   if (!actor) {
     return;
   }
 
   return debuggerClient.release(actor);
--- a/devtools/client/debugger/test/mochitest/browser_dbg-preview.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-preview.js
@@ -7,22 +7,40 @@ async function previews(dbg, fnName, pre
   await waitForPaused(dbg);
 
   await assertPreviews(dbg, previews);
   await resume(dbg);
 
   info(`Ran tests for ${fnName}`);
 }
 
+async function testBucketedArray(dbg) {
+  const invokeResult = invokeInTab("largeArray");
+  await waitForPaused(dbg);
+  const preview = await hoverOnToken(dbg, 27, 8, "popup");
+
+  is(
+    preview.properties.map(p => p.name).join(" "),
+    "[0…99] [100…100] length <prototype>",
+    "Popup properties are bucketed"
+  );
+
+  is(preview.properties[0].meta.endIndex, 99, "first bucket ends at 99");
+  is(preview.properties[2].contents.value, 101, "length is 101");
+  await resume(dbg);
+}
+
 // Test hovering on an object, which will show a popup and on a
 // simple value, which will show a tooltip.
 add_task(async function() {
   const dbg = await initDebugger("doc-preview.html", "preview.js");
   await selectSource(dbg, "preview.js");
 
+  await testBucketedArray(dbg);
+
   await previews(dbg, "empties", [
     { line: 2, column: 9, expression: "a", result: '""' },
     { line: 3, column: 9, expression: "b", result: "false" },
     { line: 4, column: 9, expression: "c", result: "undefined" },
     { line: 5, column: 9, expression: "d", result: "null" }
   ]);
 
   await previews(dbg, "smalls", [
--- a/devtools/client/debugger/test/mochitest/examples/preview.js
+++ b/devtools/client/debugger/test/mochitest/examples/preview.js
@@ -17,8 +17,16 @@ function smalls() {
 
 function objects() {
   const obj = {
     foo: 1
   };
 
   debugger;
 }
+
+function largeArray() {
+  let bs = [];
+  for (let i = 0; i <= 100; i++) {
+    bs.push({ a: 2, b: { c: 3 } });
+  }
+  debugger;
+}