Bug 1481833 - Fix expanding getter returning longString; r=Honza.
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Thu, 09 Aug 2018 15:01:45 +0000
changeset 485891 1a03fc28195e1a29978a2cd25ca6e5900f2d59da
parent 485890 20d0116ece9a1b88eceaf1876aabd2a162ca5496
child 485892 bb68137ed8a9714a637f90d197e7837fa8de80f4
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersHonza
bugs1481833
milestone63.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 1481833 - Fix expanding getter returning longString; r=Honza. Differential Revision: https://phabricator.services.mozilla.com/D2949
devtools/client/shared/components/reps/reps.js
devtools/client/webconsole/test/mochitest/browser.ini
devtools/client/webconsole/test/mochitest/browser_webconsole_longstring_getter.js
--- a/devtools/client/shared/components/reps/reps.js
+++ b/devtools/client/shared/components/reps/reps.js
@@ -3391,17 +3391,23 @@ function makeNodesForProperties(objProps
 }
 
 function setNodeFullText(loadedProps, node) {
   if (nodeHasFullText(node)) {
     return node;
   }
 
   if (nodeIsLongString(node)) {
-    node.contents.value.fullText = loadedProps.fullText;
+    const {fullText} = loadedProps;
+
+    if (node.contents.value) {
+      node.contents.value.fullText = fullText;
+    } else if (node.contents.getterValue) {
+      node.contents.getterValue.fullText = fullText;
+    }
   }
 
   return node;
 }
 
 function makeNodeForPrototype(objProps, parent) {
   const { prototype } = objProps || {};
 
--- a/devtools/client/webconsole/test/mochitest/browser.ini
+++ b/devtools/client/webconsole/test/mochitest/browser.ini
@@ -303,16 +303,17 @@ skip-if = true #	Bug 1404382
 [browser_webconsole_inspect_cross_domain_object.js]
 [browser_webconsole_keyboard_accessibility.js]
 [browser_webconsole_location_debugger_link.js]
 [browser_webconsole_location_scratchpad_link.js]
 [browser_webconsole_location_styleeditor_link.js]
 [browser_webconsole_logErrorInPage.js]
 [browser_webconsole_loglimit.js]
 [browser_webconsole_logWarningInPage.js]
+[browser_webconsole_longstring_getter.js]
 [browser_webconsole_longstring.js]
 [browser_webconsole_message_categories.js]
 [browser_webconsole_multiple_windows_and_tabs.js]
 [browser_webconsole_network_attach.js]
 [browser_webconsole_network_exceptions.js]
 [browser_webconsole_network_messages_expand.js]
 skip-if = (os == 'linux') || (os == 'win' && os_version == '10.0' && debug && bits == 64)  # Bug 1429361, disabled on Linux/Win for frequent failures
 [browser_webconsole_network_messages_openinnet.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_longstring_getter.js
@@ -0,0 +1,42 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Test that getter properties that return long strings can be expanded. See Bug 1481833.
+
+"use strict";
+
+const LONGSTRING = "a ".repeat(10000);
+const TEST_URI = `data:text/html,Test expanding longString getter property
+  <svg>
+    <image xlink:href="data:image/png;base64,${LONGSTRING}"></image>
+  </svg>
+  <script>
+    console.dir("Test message", document.querySelector("svg image").href);
+  </script>`;
+
+add_task(async function() {
+  const hud = await openNewTabAndConsole(TEST_URI);
+
+  // Retrieve the logged message.
+  const message = await waitFor(() => findMessage(hud, "Test message"));
+
+  // Wait until the SVGAnimatedString is expanded.
+  await waitFor(() => message.querySelectorAll(".arrow").length > 1);
+
+  const arrow = message.querySelectorAll(".arrow")[1];
+  ok(arrow, "longString expand arrow is shown");
+
+  info("wait for long string expansion");
+  const onLongStringFullTextDisplayed = waitFor(() => findMessage(hud, LONGSTRING));
+  arrow.click();
+  await onLongStringFullTextDisplayed;
+
+  ok(true, "The full text of the longString is displayed");
+
+  info("wait for long string collapse");
+  const onLongStringCollapsed = waitFor(() => !findMessage(hud, LONGSTRING));
+  arrow.click();
+  await onLongStringCollapsed;
+
+  ok(true, "The longString can be collapsed");
+});