зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1543190 - Fix console autocomplete throwing for null. r=nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D55391 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
7bd74cb4f0
Коммит
0449ac6039
|
@ -43,6 +43,7 @@ support-files =
|
|||
[browser_jsterm_autocomplete_inside_text.js]
|
||||
[browser_jsterm_autocomplete_native_getters.js]
|
||||
[browser_jsterm_autocomplete_nav_and_tab_key.js]
|
||||
[browser_jsterm_autocomplete_null.js]
|
||||
[browser_jsterm_autocomplete_paste_undo.js]
|
||||
[browser_jsterm_autocomplete_race_on_enter.js]
|
||||
[browser_jsterm_autocomplete_return_key_no_selection.js]
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
add_task(async function() {
|
||||
await pushPref("devtools.chrome.enabled", true);
|
||||
await addTab("about:blank");
|
||||
|
||||
info(`Open browser console with ctrl-shift-j`);
|
||||
const opened = waitForBrowserConsole();
|
||||
EventUtils.synthesizeKey("j", { accelKey: true, shiftKey: true }, window);
|
||||
const hud = await opened;
|
||||
const { jsterm } = hud;
|
||||
const { autocompletePopup: popup } = jsterm;
|
||||
|
||||
info(`Clear existing messages`);
|
||||
const onMessagesCleared = hud.ui.once("messages-cleared");
|
||||
await clearOutput(hud);
|
||||
await onMessagesCleared;
|
||||
|
||||
info(`Create a null variable`);
|
||||
execute(hud, "globalThis.nullVar = null;");
|
||||
|
||||
info(`Check completion suggestions for "null"`);
|
||||
const onPopUpOpen = popup.once("popup-opened");
|
||||
EventUtils.sendString("null", hud.iframeWindow);
|
||||
await onPopUpOpen;
|
||||
ok(popup.isOpen, "popup is open");
|
||||
const expectedPopupItems = ["null", "nullVar"];
|
||||
is(
|
||||
popup.items.map(i => i.label).join("-"),
|
||||
expectedPopupItems.join("-"),
|
||||
"popup has expected items"
|
||||
);
|
||||
|
||||
info(`Check completion suggestions for "null."`);
|
||||
let onAutocompleteUpdated = jsterm.once("autocomplete-updated");
|
||||
EventUtils.sendString(".", hud.iframeWindow);
|
||||
await onAutocompleteUpdated;
|
||||
is(popup.itemCount, 0, "popup has no items");
|
||||
|
||||
info(`Check completion suggestions for "null"`);
|
||||
onAutocompleteUpdated = jsterm.once("autocomplete-updated");
|
||||
EventUtils.synthesizeKey("KEY_Backspace", undefined, hud.iframeWindow);
|
||||
await onAutocompleteUpdated;
|
||||
is(popup.itemCount, 2, "popup has 2 items");
|
||||
|
||||
info(`Check completion suggestions for "nullVar"`);
|
||||
onAutocompleteUpdated = jsterm.once("autocomplete-updated");
|
||||
EventUtils.sendString("Var.", hud.iframeWindow);
|
||||
await onAutocompleteUpdated;
|
||||
is(popup.itemCount, 0, "popup has no items");
|
||||
|
||||
info(`Check that no error was logged`);
|
||||
await waitFor(() => findMessage(hud, "", ".message.error")).then(
|
||||
message => {
|
||||
ok(false, `Got error ${JSON.stringify(message.textContent)}`);
|
||||
},
|
||||
error => {
|
||||
if (!error.includes("waitFor - timed out")) {
|
||||
throw error;
|
||||
}
|
||||
ok(true, `No error was logged`);
|
||||
}
|
||||
);
|
||||
|
||||
info(`Cleanup`);
|
||||
execute(hud, "delete globalThis.nullVar;");
|
||||
});
|
|
@ -980,9 +980,9 @@ var DebuggerEnvironmentSupport = {
|
|||
|
||||
// FIXME: Need actual UI, bug 941287.
|
||||
if (
|
||||
result === undefined ||
|
||||
result.optimizedOut ||
|
||||
result.missingArguments
|
||||
result == null ||
|
||||
(typeof result == "object" &&
|
||||
(result.optimizedOut || result.missingArguments))
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче