Bug 1450541 - Show values of non-enumerable symbol properties in object inspector r=nchevobbe
authorOriol Brufau <oriol-bugzilla@hotmail.com>
Sun, 01 Apr 2018 15:23:15 +0200
changeset 411540 efe04571107d3d2b191fa6a292f9509233d913c7
parent 411539 50a505b2e51fc887c7a33cbd172c2179ea7aae78
child 411541 65bbe1ed20ee9a5ba246617258a9473a679c6be2
push id101686
push useraciure@mozilla.com
push dateTue, 03 Apr 2018 21:59:31 +0000
treeherdermozilla-inbound@8d846598d35d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnchevobbe
bugs1450541
milestone61.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 1450541 - Show values of non-enumerable symbol properties in object inspector r=nchevobbe 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
@@ -169,16 +169,17 @@ reason = bug 1104838
 [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]