Closed Bug 676520 Opened 13 years ago Closed 13 years ago

GCLI fails to read from input element when embedded

Categories

(DevTools :: General, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jwalker, Unassigned)

References

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
Closed: 13 years ago
Resolution: --- → FIXED
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.