diff --git a/devtools/server/actors/object.js b/devtools/server/actors/object.js index c23e239fd688..2f3c35844682 100644 --- a/devtools/server/actors/object.js +++ b/devtools/server/actors/object.js @@ -1212,7 +1212,7 @@ function SymbolIteratorActor(objectActor) { const symbol = symbols[index]; return { name: symbol.toString(), - descriptor: objectActor._propertyDescriptor(symbol, true) + descriptor: objectActor._propertyDescriptor(symbol) }; } }; diff --git a/devtools/server/tests/unit/test_objectgrips-22.js b/devtools/server/tests/unit/test_objectgrips-22.js new file mode 100644 index 000000000000..9ac21f2c40cc --- /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}));`); + }); +} diff --git a/devtools/server/tests/unit/xpcshell.ini b/devtools/server/tests/unit/xpcshell.ini index 9a4640dcfb54..a24b8f3bdc7b 100644 --- a/devtools/server/tests/unit/xpcshell.ini +++ b/devtools/server/tests/unit/xpcshell.ini @@ -174,6 +174,7 @@ reason = bug 1104838 [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]