Bug 1450541 - Show values of non-enumerable symbol properties in object inspector. r=nchevobbe, a=jcristau
authorOriol Brufau <oriol-bugzilla@hotmail.com>
Sun, 01 Apr 2018 15:23:15 +0200
changeset 463322 60f1019b5235bae9fdfe17957a8e90aab09fe1b0
parent 463321 91c3fd61b7cbfdae098597dd6846ae5a04451992
child 463323 d96df858c4b2c0164d94cc2e8a01474419caf759
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnchevobbe, jcristau
bugs1450541
milestone60.0
Bug 1450541 - Show values of non-enumerable symbol properties in object inspector. r=nchevobbe, a=jcristau MozReview-Commit-ID: Ai6q61YVzMk
devtools/server/actors/object.js
devtools/server/tests/unit/test_objectgrips-22.js
devtools/server/tests/unit/xpcshell.ini
--- a/devtools/server/actors/object.js
+++ b/devtools/server/actors/object.js
@@ -1207,17 +1207,17 @@ function SymbolIteratorActor(objectActor
   }
 
   this.iterator = {
     size: symbols.length,
     symbolDescription(index) {
       const symbol = symbols[index];
       return {
         name: symbol.toString(),
-        descriptor: objectActor._propertyDescriptor(symbol, true)
+        descriptor: objectActor._propertyDescriptor(symbol)
       };
     }
   };
 }
 
 SymbolIteratorActor.prototype = {
   actorPrefix: "symbolIterator",
 
new file mode 100644
--- /dev/null
+++ b/devtools/server/tests/unit/test_objectgrips-22.js
@@ -0,0 +1,52 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+/* eslint-disable no-shadow, max-nested-callbacks */
+
+"use strict";
+
+var gDebuggee;
+var gThreadClient;
+
+add_task(async function run_test() {
+  await run_test_with_server(DebuggerServer);
+  await run_test_with_server(WorkerDebuggerServer);
+});
+
+async function run_test_with_server(server) {
+  initTestDebuggerServer(server);
+  let title = "test_enum_symbols";
+  gDebuggee = addTestGlobal(title, server);
+  gDebuggee.eval(function stopMe(arg) {
+    debugger;
+  }.toString());
+  let client = new DebuggerClient(server.connectPipe());
+  await client.connect();
+  [,, gThreadClient] = await attachTestTabAndResume(client, title);
+  await test_enum_symbols();
+  await client.close();
+}
+
+async function test_enum_symbols() {
+  await new Promise(function(resolve) {
+    gThreadClient.addOneTimeListener("paused", async function(event, packet) {
+      let [grip] = packet.frame.arguments;
+      let objClient = gThreadClient.pauseGrip(grip);
+      let {iterator} = await objClient.enumSymbols();
+      let {ownSymbols} = await iterator.slice(0, iterator.count);
+
+      strictEqual(ownSymbols.length, 1, "There is 1 symbol property.");
+      let {name, descriptor} = ownSymbols[0];
+      strictEqual(name, "Symbol(sym)", "Got right symbol name.");
+      deepEqual(descriptor, {
+        configurable: false,
+        enumerable: false,
+        writable: false,
+        value: 1,
+      }, "Got right property descriptor.");
+
+      await gThreadClient.resume();
+      resolve();
+    });
+    gDebuggee.eval(`stopMe(Object.defineProperty({}, Symbol("sym"), {value: 1}));`);
+  });
+}
--- a/devtools/server/tests/unit/xpcshell.ini
+++ b/devtools/server/tests/unit/xpcshell.ini
@@ -172,16 +172,17 @@ reason = only ran on B2G
 [test_objectgrips-14.js]
 [test_objectgrips-15.js]
 [test_objectgrips-16.js]
 [test_objectgrips-17.js]
 [test_objectgrips-18.js]
 [test_objectgrips-19.js]
 [test_objectgrips-20.js]
 [test_objectgrips-21.js]
+[test_objectgrips-22.js]
 [test_objectgrips-array-like-object.js]
 [test_promise_state-01.js]
 [test_promise_state-02.js]
 [test_promise_state-03.js]
 [test_interrupt.js]
 [test_stepping-01.js]
 [test_stepping-02.js]
 [test_stepping-03.js]