Bug 962652 - Autocomplete popup's isOpen getter is too strict, r=msucan
authorGirish Sharma <scrapmachines@gmail.com>
Tue, 28 Jan 2014 20:42:02 +0530
changeset 165575 cbc8854278fbfeb9cf0f3f5603c9da38e384ffae
parent 165574 59cc8ecd78d3204acd5c70eb745a2a2d62428d7e
child 165576 bd1aa4c7fbb5157fb209c7918debbe85e8744192
push id26097
push userryanvm@gmail.com
push dateTue, 28 Jan 2014 21:18:27 +0000
treeherdermozilla-central@128c86a925d7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmsucan
bugs962652
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 962652 - Autocomplete popup's isOpen getter is too strict, r=msucan
browser/devtools/inspector/test/browser_inspector_bug_831693_combinator_suggestions.js
browser/devtools/inspector/test/browser_inspector_bug_831693_input_suggestion.js
browser/devtools/markupview/test/browser_bug896181_css_mixed_completion_new_attribute.js
browser/devtools/shared/autocomplete-popup.js
browser/devtools/sourceeditor/autocomplete.js
browser/devtools/styleeditor/test/browser_styleeditor_autocomplete.js
browser/devtools/styleinspector/test/browser_bug893965_css_property_completion_new_property.js
browser/devtools/styleinspector/test/browser_bug894376_css_value_completion_existing_property_value_pair.js
browser/devtools/styleinspector/test/browser_bug894376_css_value_completion_new_property_value_pair.js
--- a/browser/devtools/inspector/test/browser_inspector_bug_831693_combinator_suggestions.js
+++ b/browser/devtools/inspector/test/browser_inspector_bug_831693_combinator_suggestions.js
@@ -84,18 +84,17 @@ function test()
          JSON.stringify(suggestions));
     EventUtils.synthesizeKey(key, {}, inspector.panelWin);
   }
 
   function checkState(event) {
     inspector.searchSuggestions._lastQuery.then(() => {
       let [key, suggestions] = keyStates[state];
       let actualSuggestions = popup.getItems();
-      is(popup._panel.state == "open" || popup._panel.state == "showing"
-         ? actualSuggestions.length: 0, suggestions.length,
+      is(popup.isOpen ? actualSuggestions.length: 0, suggestions.length,
          "There are expected number of suggestions at " + state + "th step.");
       actualSuggestions = actualSuggestions.reverse();
       for (let i = 0; i < suggestions.length; i++) {
         is(suggestions[i][0], actualSuggestions[i].label,
            "The suggestion at " + i + "th index for " + state +
            "th step is correct.")
         is(suggestions[i][1] || 1, actualSuggestions[i].count,
            "The count for suggestion at " + i + "th index for " + state +
--- a/browser/devtools/inspector/test/browser_inspector_bug_831693_input_suggestion.js
+++ b/browser/devtools/inspector/test/browser_inspector_bug_831693_input_suggestion.js
@@ -85,18 +85,17 @@ function test()
          JSON.stringify(suggestions));
     EventUtils.synthesizeKey(key, {}, inspector.panelWin);
   }
 
   function checkState(event) {
     inspector.searchSuggestions._lastQuery.then(() => {
       let [key, suggestions] = keyStates[state];
       let actualSuggestions = popup.getItems();
-      is(popup._panel.state == "open" || popup._panel.state == "showing"
-         ? actualSuggestions.length: 0, suggestions.length,
+      is(popup.isOpen ? actualSuggestions.length: 0, suggestions.length,
          "There are expected number of suggestions at " + state + "th step.");
       actualSuggestions = actualSuggestions.reverse();
       for (let i = 0; i < suggestions.length; i++) {
         is(suggestions[i][0], actualSuggestions[i].label,
            "The suggestion at " + i + "th index for " + state +
            "th step is correct.")
         is(suggestions[i][1] || 1, actualSuggestions[i].count,
            "The count for suggestion at " + i + "th index for " + state +
--- a/browser/devtools/markupview/test/browser_bug896181_css_mixed_completion_new_attribute.js
+++ b/browser/devtools/markupview/test/browser_bug896181_css_mixed_completion_new_attribute.js
@@ -125,19 +125,17 @@ function test() {
       if (selEnd != -1) {
         is(editor.input.value, completion,
            "Correct value is autocompleted for state " + state);
         is(editor.input.selectionStart, selStart,
            "Selection is starting at the right location for state " + state);
         is(editor.input.selectionEnd, selEnd,
            "Selection is ending at the right location for state " + state);
         if (popupOpen) {
-          ok(editor.popup._panel.state == "open" ||
-             editor.popup._panel.state == "showing",
-             "Popup is open for state " + state);
+          ok(editor.popup.isOpen, "Popup is open for state " + state);
         }
         else {
           ok(editor.popup._panel.state != "open" &&
              editor.popup._panel.state != "showing",
              "Popup is closed for state " + state);
         }
       }
       else {
--- a/browser/devtools/shared/autocomplete-popup.js
+++ b/browser/devtools/shared/autocomplete-popup.js
@@ -154,17 +154,17 @@ AutocompletePopup.prototype = {
   {
     this._panel.hidePopup();
   },
 
   /**
    * Check if the autocomplete popup is open.
    */
   get isOpen() {
-    return this._panel.state == "open";
+    return this._panel.state == "open" || this._panel.state == "showing";
   },
 
   /**
    * Destroy the object instance. Please note that the panel DOM elements remain
    * in the DOM, because they might still be in use by other instances of the
    * same code. It is the responsability of the client code to perform DOM
    * cleanup.
    */
--- a/browser/devtools/sourceeditor/autocomplete.js
+++ b/browser/devtools/sourceeditor/autocomplete.js
@@ -25,25 +25,25 @@ function setupAutoCompletion(ctx, walker
     position: "after_start",
     fixedWidth: true,
     theme: "auto",
     autoSelect: true
   });
 
   let keyMap = {
     "Tab": cm => {
-      if (popup && (popup.isOpen || popup._panel.state == "showing")) {
+      if (popup && popup.isOpen) {
         cycleSuggestions(ed);
         return;
       }
 
       return win.CodeMirror.Pass;
     },
     "Shift-Tab": cm => {
-      if (popup && (popup.isOpen || popup._panel.state == "showing")) {
+      if (popup && popup.isOpen) {
         cycleSuggestions(ed, true);
         return;
       }
 
       return win.CodeMirror.Pass;
     },
   };
   keyMap[Editor.accel("Space")] = cm => autoComplete(ctx);
--- a/browser/devtools/styleeditor/test/browser_styleeditor_autocomplete.js
+++ b/browser/devtools/styleeditor/test/browser_styleeditor_autocomplete.js
@@ -120,18 +120,17 @@ function testState() {
   EventUtils.synthesizeKey(key, mods, gPanelWindow);
 }
 
 function checkState() {
   executeSoon(() => {
     info("After keypress for index " + index);
     let [key, total, current, inserted] = TEST_CASES[index];
     if (total != -1) {
-      ok(gPopup._panel.state == "open" || gPopup._panel.state == "showing",
-         "Popup is open for index " + index);
+      ok(gPopup.isOpen, "Popup is open for index " + index);
       is(total, gPopup.itemCount,
          "Correct total suggestions for index " + index);
       is(current, gPopup.selectedIndex,
          "Correct index is selected for index " + index);
       if (inserted) {
         let { preLabel, label } = gPopup.getItemAtIndex(current);
         let { line, ch } = gEditor.getCursor();
         let lineText = gEditor.getText(line);
--- a/browser/devtools/styleinspector/test/browser_bug893965_css_property_completion_new_property.js
+++ b/browser/devtools/styleinspector/test/browser_bug893965_css_property_completion_new_property.js
@@ -100,19 +100,17 @@ function checkState(event) {
       is(editor.input.value, completion,
          "Correct value is autocompleted for state " + state);
     }
     if (total == 0) {
       ok(!(editor.popup && editor.popup.isOpen), "Popup is closed for state " +
          state);
     }
     else {
-      ok(editor.popup._panel.state == "open" ||
-         editor.popup._panel.state == "showing",
-         "Popup is open for state " + state);
+      ok(editor.popup.isOpen, "Popup is open for state " + state);
       is(editor.popup.getItems().length, total,
          "Number of suggestions match for state " + state);
       is(editor.popup.selectedIndex, index,
          "Correct item is selected for state " + state);
     }
     checkStateAndMoveOn(state + 1);
   });
 }
--- a/browser/devtools/styleinspector/test/browser_bug894376_css_value_completion_existing_property_value_pair.js
+++ b/browser/devtools/styleinspector/test/browser_bug894376_css_value_completion_existing_property_value_pair.js
@@ -112,19 +112,17 @@ function checkState(event) {
       is(editor.input.value, completion,
          "Correct value is autocompleted for state " + state);
     }
     if (total == 0) {
       ok(!(editor.popup && editor.popup.isOpen), "Popup is closed for state " +
          state);
     }
     else {
-      ok(editor.popup._panel.state == "open" ||
-         editor.popup._panel.state == "showing",
-         "Popup is open for state " + state);
+      ok(editor.popup.isOpen, "Popup is open for state " + state);
       is(editor.popup.getItems().length, total,
          "Number of suggestions match for state " + state);
       is(editor.popup.selectedIndex, index,
          "Correct item is selected for state " + state);
     }
     checkStateAndMoveOn(state + 1);
   });
 }
--- a/browser/devtools/styleinspector/test/browser_bug894376_css_value_completion_new_property_value_pair.js
+++ b/browser/devtools/styleinspector/test/browser_bug894376_css_value_completion_new_property_value_pair.js
@@ -109,19 +109,17 @@ function checkState(event) {
       is(editor.input.value, completion,
          "Correct value is autocompleted for state " + state);
     }
     if (total == 0) {
       ok(!(editor.popup && editor.popup.isOpen), "Popup is closed for state " +
          state);
     }
     else {
-      ok(editor.popup._panel.state == "open" ||
-         editor.popup._panel.state == "showing",
-         "Popup is open for state " + state);
+      ok(editor.popup.isOpen, "Popup is open for state " + state);
       is(editor.popup.getItems().length, total,
          "Number of suggestions match for state " + state);
       is(editor.popup.selectedIndex, index,
          "Correct item is selected for state " + state);
     }
     checkStateAndMoveOn(state + 1);
   });
 }