The default bug view has changed. See this FAQ.

GCLI fails to read from input element when embedded

RESOLVED FIXED

Status

()

Firefox
Developer Tools
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: jwalker, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [minotaur][best:1d, likely:3d, worst:5d])

HUDService creates a textbox for GCLI (line 6910)

https://hg.mozilla.org/users/jwalker_mozilla.com/gcli-patches/file/451c73812525/bug656666-hudservice.patch#l443

    this.inputNode = this.document.createElement("textbox");
    this.inputNode.setAttribute("class", "gcliterm-input-node");
    this.inputNode.setAttribute("multiline", "true");
    this.inputNode.setAttribute("rows", "1");

This is passed to GCLI (line 6849)

https://hg.mozilla.org/users/jwalker_mozilla.com/gcli-patches/file/451c73812525/bug656666-hudservice.patch#l382

  gcli._internal.createView({
    document: this.document,
    inputElement: this.inputNode,
    completeElement: this.completeNode,
    inputBackgroundElement: this.inputStack,
    completionPrompt: ''
  });

It the inputElement is passed to inputter.js and used as this.element (line 75)

https://github.com/mozilla/gcli/blob/d8fe0b795e13a73633246677ecc6d4ab61a09dfd/lib/gcli/ui/inputter.js#L75

When we read from the element, value is empty even when something has been typed in.
For the sake of posterity some debug code we were using in Inputter.updateCli:

  console.debug('input', input);
  console.debug('this.element', this.element);
  console.debug('gOPDv1', Object.getOwnPropertyDescriptor(this.element, 'value'));
  console.debug('this.completer.element', this.completer.element);
  console.debug('gOPDv2', Object.getOwnPropertyDescriptor(this.completer.element, 'value'));
  console.debug('_lS_v', this.element.__lookupSetter__('value'));

  var textbox = this.element;
  console.debug('textbox.value === undefined', textbox.value === undefined);
  //console.debug('textbox.getAttribute(value).length', textbox.getAttribute('value').length);
  console.debug('textbox.selectionStart', textbox.selectionStart);
  console.debug('textbox.type', textbox.getAttribute('type'));
  console.debug('textbox.size', textbox.getAttribute('size'));
Bug 680453 is the result of some study into this problem.
We have a workaround for now.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.