зеркало из https://github.com/mozilla/gecko-dev.git
Bug 580001 - Close console after completion causes error - inputValue is undefined, r=gavin
This commit is contained in:
Родитель
bc14bbd3fe
Коммит
82be36ee85
|
@ -25,6 +25,7 @@
|
|||
* Rob Campbell <rcampbell@mozilla.com>
|
||||
* Johnathan Nightingale <jnightingale@mozilla.com>
|
||||
* Patrick Walton <pcwalton@mozilla.com>
|
||||
* Julian Viereck <jviereck@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -2810,6 +2811,10 @@ JSTerm.prototype = {
|
|||
{
|
||||
let inputNode = this.inputNode;
|
||||
let inputValue = inputNode.value;
|
||||
// If the inputNode has no value, then don't try to complete on it.
|
||||
if (!inputValue) {
|
||||
return;
|
||||
}
|
||||
let selStart = inputNode.selectionStart, selEnd = inputNode.selectionEnd;
|
||||
|
||||
// 'Normalize' the selection so that end is always after start.
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
* Contributor(s):
|
||||
* David Dahl <ddahl@mozilla.com>
|
||||
* Patrick Walton <pcwalton@mozilla.com>
|
||||
* Julian Viereck <jviereck@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -718,7 +719,7 @@ function testErrorOnPageReload() {
|
|||
testLogEntry(outputNode, "fooBazBaz",
|
||||
{ success: successMsg, err: errMsg });
|
||||
|
||||
testEnd();
|
||||
testWebConsoleClose();
|
||||
}, false);
|
||||
|
||||
button.dispatchEvent(clickEvent);
|
||||
|
@ -727,6 +728,33 @@ function testErrorOnPageReload() {
|
|||
content.location.href = TEST_ERROR_URI;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unit test for bug 580001:
|
||||
* 'Close console after completion causes error "inputValue is undefined"'
|
||||
*/
|
||||
function testWebConsoleClose() {
|
||||
let display = HUDService.getDisplayByURISpec(content.location.href);
|
||||
let input = display.querySelector(".jsterm-input-node");
|
||||
|
||||
let errorWhileClosing = false;
|
||||
function errorListener(evt) {
|
||||
errorWhileClosing = true;
|
||||
}
|
||||
window.addEventListener("error", errorListener, false);
|
||||
|
||||
// Focus the inputNode and perform the keycombo to close the WebConsole.
|
||||
input.focus();
|
||||
EventUtils.synthesizeKey("k", { accelKey: true, shiftKey: true });
|
||||
|
||||
// We can't test for errors right away, because the error occures after a
|
||||
// setTimeout(..., 0) in the WebConsole code.
|
||||
executeSoon(function() {
|
||||
window.removeEventListener("error", errorListener, false);
|
||||
is (errorWhileClosing, false, "no error while closing the WebConsole");
|
||||
testEnd();
|
||||
});
|
||||
}
|
||||
|
||||
function testEnd() {
|
||||
// testUnregister();
|
||||
executeSoon(function () {
|
||||
|
|
Загрузка…
Ссылка в новой задаче