Bug 1396434 - Test that symbols can be stored as global variables in the console. draft
authorOriol Brufau <oriol-bugzilla@hotmail.com>
Mon, 01 Jan 2018 13:17:05 +0100
changeset 716622 843522666afbb3a19466daed4c00a3032bea1330
parent 716619 b84fe2ad1ca27fc30c2e3f609b8f766185652560
child 745062 f38efad64b616ab934778b12058f77c638583d78
push id94467
push userbmo:oriol-bugzilla@hotmail.com
push dateFri, 05 Jan 2018 23:42:28 +0000
bugs1396434
milestone59.0a1
Bug 1396434 - Test that symbols can be stored as global variables in the console. MozReview-Commit-ID: Ba7Ir2BHEzw
devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_context_menu_store_as_global.js
--- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_context_menu_store_as_global.js
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_context_menu_store_as_global.js
@@ -11,24 +11,26 @@
 const TEST_URI = `data:text/html;charset=utf-8,<script>
   window.bar = { baz: 1 };
   console.log("foo");
   console.log("foo", window.bar);
   window.array = ["foo", window.bar, 2];
   console.log(window.array);
   window.longString = "foo" + "a".repeat(1e4);
   console.log(window.longString);
+  window.symbol = Symbol();
+  console.log("foo", window.symbol);
 </script>`;
 
 add_task(async function() {
   let hud = await openNewTabAndConsole(TEST_URI);
 
   let messages = await waitFor(() => findMessages(hud, "foo"));
-  is(messages.length, 4, "Four messages should have appeared");
-  let [msgWithText, msgWithObj, msgNested, msgLongStr] = messages;
+  is(messages.length, 5, "Five messages should have appeared");
+  let [msgWithText, msgWithObj, msgNested, msgLongStr, msgSymbol] = messages;
   let varIdx = 0;
 
   info("Check store as global variable is disabled for text only messages");
   await storeAsVariable(hud, msgWithText, "string");
 
   info("Check store as global variable is disabled for text in complex messages");
   await storeAsVariable(hud, msgWithObj, "string");
 
@@ -39,16 +41,19 @@ add_task(async function() {
   await storeAsVariable(hud, msgNested, "array", varIdx++, "window.array");
 
   info("Check store as global variable is enabled for nested object in nested messages");
   await storeAsVariable(hud, msgNested, "object", varIdx++, "window.bar");
 
   info("Check store as global variable is enabled for long strings");
   await storeAsVariable(hud, msgLongStr, "string", varIdx++, "window.longString");
 
+  info("Check store as global variable is enabled for symbols");
+  await storeAsVariable(hud, msgSymbol, "symbol", varIdx++, "window.symbol");
+
   info("Check store as global variable is enabled for invisible-to-debugger objects");
   let onMessageInvisible = waitForMessage(hud, "foo");
   ContentTask.spawn(gBrowser.selectedBrowser, null, () => {
     let obj = Cu.Sandbox(Cu.getObjectPrincipal(content), {invisibleToDebugger: true});
     content.wrappedJSObject.invisibleToDebugger = obj;
     content.console.log("foo", obj);
   });
   let msgInvisible = (await onMessageInvisible).node;