Bug 1481833 - Fix expanding getter returning longString; r=Honza.

Differential Revision: https://phabricator.services.mozilla.com/D2949

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Chevobbe 2018-08-09 15:01:45 +00:00
parent adf0b6d294
commit 29c135b563
3 changed files with 50 additions and 1 deletions

View File

@ -3396,7 +3396,13 @@ function setNodeFullText(loadedProps, 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;

View File

@ -308,6 +308,7 @@ skip-if = true # Bug 1404382
[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]

View File

@ -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");
});