Bug 1320095 Implement forwarder for onFindbarOpen() and other missing methods in the tabbrowser findbar object. r=IanN a=Ratty
authorPhilip Chee <philip.chee@gmail.com>
Mon, 02 Jan 2017 17:00:12 +0100
changeset 26493 0847155e32f1154c7d408e4cd1d89d9b65a04028
parent 26492 56522f871e48bce916715f7951e6e9385ae08408
child 26494 97c6d580f40f551fb830bb12e521be603400c3a0
push id351
push userfrgrahl@gmx.net
push dateMon, 02 Jan 2017 16:01:13 +0000
reviewersIanN, Ratty
bugs1320095
Bug 1320095 Implement forwarder for onFindbarOpen() and other missing methods in the tabbrowser findbar object. r=IanN a=Ratty Also update SeaMonkey's findbar.xml to sync with the toolkit findbar.xmlBug1320095onFindbarOpen. Unified branch patch for SeaMonkey 2.48 and 2.49.
suite/browser/tabbrowser.xml
suite/common/bindings/findbar.xml
--- a/suite/browser/tabbrowser.xml
+++ b/suite/browser/tabbrowser.xml
@@ -2778,45 +2778,69 @@
             return this.finder.clipboardSearchString;
           },
           set clipboardSearchString(val) {
             return this.finder.clipboardSearchString = val;
           },
           set caseSensitive(val) {
             return this.finder.caseSensitive = val;
           },
+          set entireWord(val) {
+            return this.finder.entireWord = val;
+          },
+          get highlighter() {
+            return this.finder.highlighter;
+          },
+          get matchesCountLimit() {
+            return this.finder.matchesCountLimit;
+          },
           fastFind: function(aSearchString, aLinksOnly, aDrawOutline) {
             this.finder.fastFind(aSearchString, aLinksOnly, aDrawOutline);
           },
           findAgain: function(aFindBackwards, aLinksOnly, aDrawOutline) {
             this.finder.findAgain(aFindBackwards, aLinksOnly, aDrawOutline);
           },
           setSearchStringToSelection: function() {
             return this.finder.setSearchStringToSelection();
           },
-          highlight: function(aHighlight, aWord) {
-            this.finder.highlight(aHighlight, aWord);
+          highlight: function(...args) {
+            this.finder.highlight(...args);
           },
           getInitialSelection: function() {
             this.finder.getInitialSelection();
           },
+          getActiveSelectionText: function() {
+            return this.finder.getActiveSelectionText();
+          },
           enableSelection: function() {
             this.finder.enableSelection();
           },
           removeSelection: function() {
             this.finder.removeSelection();
           },
           focusContent: function() {
             this.finder.focusContent();
           },
+          onFindbarClose: function() {
+            this.finder.onFindbarClose();
+          },
+          onFindbarOpen: function() {
+            this.finder.onFindbarOpen();
+          },
+          onModalHighlightChange: function(...args) {
+            return this.finder.onModalHighlightChange(...args);
+          },
+          onHighlightAllChange: function(...args) {
+            return this.finder.onHighlightAllChange(...args);
+          },
           keyPress: function(aEvent) {
             this.finder.keyPress(aEvent);
           },
-          requestMatchesCount: function(aWord, aMatchLimit, aLinksOnly) {
-            this.finder.requestMatchesCount(aWord, aMatchLimit, aLinksOnly);
+          requestMatchesCount: function(...args) {
+            this.finder.requestMatchesCount(...args);
           }
         })
       ]]></field>
 
       <property name="docShell"
                 onget="return this.mCurrentBrowser.docShell"
                 readonly="true"/>
 
--- a/suite/common/bindings/findbar.xml
+++ b/suite/common/bindings/findbar.xml
@@ -87,20 +87,27 @@
 
           var prefsvc =
             Components.classes["@mozilla.org/preferences-service;1"]
                       .getService(Components.interfaces.nsIPrefBranch);
           prefsvc.removeObserver("accessibility.typeaheadfind.linksonly",
                                  this._observer);
           prefsvc.removeObserver("accessibility.typeaheadfind.casesensitive",
                                  this._observer);
+          prefsvc.removeObserver("findbar.entireword", this._observer);
+          prefsvc.removeObserver("findbar.highlightAll", this._observer);
+          prefsvc.removeObserver("findbar.modalHighlight", this._observer);
+
           prefsvc.removeObserver("accessibility.typeaheadfind.usefindbar",
                                  this._suiteObserver);
           prefsvc.removeObserver("accessibility.typeaheadfind.autostart",
                                  this._suiteObserver);
+
+          // Clear all timers that might still be running.
+          this._cancelTimers();
         ]]></body>
       </method>
 
       <method name="_updateBrowserWithState">
         <body><![CDATA[
           window.messageManager.broadcastAsyncMessage("Findbar:UpdateState", {
             findMode: this._findMode,
             findAsYouType: this._findAsYouType,
@@ -114,20 +121,21 @@
           switch (aMessage.name) {
             case "Findbar:Mouseup":
               if (!this.hidden && this._findMode != this.FIND_NORMAL)
                 this.close();
               break;
 
             case "Findbar:Keypress":
               if (this._useFindbar)
-                return this._onBrowserKeypress(aMessage.data);
+                return this._onBrowserKeypress(aMessage.data.fakeEvent,
+                                               aMessage.data.shouldFastFind);
               break;
           }
-          return true;
+          return undefined;
         ]]></body>
       </method>
 
       <method name="startFastFind">
         <parameter name="aMode"/>
         <body><![CDATA[
           if (this._findMode == aMode && this._quickFindTimeout) {
             this._findField.select();