Skip to content

Commit

Permalink
Merge branch 'hotfix-1.13.11'
Browse files Browse the repository at this point in the history
* hotfix-1.13.11:
  Update version info.
  fulltext: support form history for Firefox >= 54
  • Loading branch information
danny0838 committed Jun 2, 2017
2 parents b975ba0 + 75f791b commit 9bf5d72
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
41 changes: 37 additions & 4 deletions chrome/content/scrapbook/scrapbook.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,16 @@ var sbSearchService = {

get ELEMENT() { return document.getElementById("sbSearchImage"); },
get FORM_HISTORY() {
return Components.classes["@mozilla.org/satchel/form-history;1"]
.getService(Components.interfaces.nsIFormHistory2 || Components.interfaces.nsIFormHistory);
try {
// Firefox >= ?
Components.utils.import("resource://gre/modules/FormHistory.jsm");
var result = FormHistory;
} catch (ex) {
// not available in Firefox >= 54
var result = Components.classes["@mozilla.org/satchel/form-history;1"]
.getService(Components.interfaces.nsIFormHistory2 || Components.interfaces.nsIFormHistory);
}
return this.FORM_HISTORY = result;
},

type: "",
Expand Down Expand Up @@ -601,7 +609,7 @@ var sbSearchService = {
var query = aInput;
var re = document.getElementById("sbSearchPopupOptionRE").getAttribute("checked");
var mc = document.getElementById("sbSearchPopupOptionCS").getAttribute("checked");
this.FORM_HISTORY.addEntry("sbSearchHistory", query);
this.addFormHistory(query);
if (this.type == "fulltext") {
this.doFullTextSearch(query, re, mc);
} else {
Expand Down Expand Up @@ -722,8 +730,32 @@ var sbSearchService = {
sbDataSource.clearContainer("urn:scrapbook:search");
},

addFormHistory: function(query) {
if (this.FORM_HISTORY.update) {
this.FORM_HISTORY.update({
op: "remove",
fieldname: "sbSearchHistory",
value: query
});
this.FORM_HISTORY.update({
op: "add",
fieldname: "sbSearchHistory",
value: query
});
} else {
this.FORM_HISTORY.addEntry("sbSearchHistory", query);
}
},

clearFormHistory: function() {
this.FORM_HISTORY.removeEntriesForName("sbSearchHistory");
if (this.FORM_HISTORY.update) {
this.FORM_HISTORY.update({
op: "remove",
fieldname: "sbSearchHistory"
});
} else {
this.FORM_HISTORY.removeEntriesForName("sbSearchHistory");
}
},
};

Expand Down Expand Up @@ -1060,3 +1092,4 @@ window.addEventListener("SidebarFocused", function () {
}, false);



7 changes: 7 additions & 0 deletions doc/releases/1.13.11.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Scrapbook X 1.13.11
===================

Changes since v1.13.10
----------------------

* Fixed an issue that fulltext search does not work in Firefox >= 54.
2 changes: 1 addition & 1 deletion install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>[email protected]</em:id>
<em:type>2</em:type>
<em:version>1.13.10</em:version>
<em:version>1.13.11</em:version>
<em:unpack>false</em:unpack>
<em:bootstrap>false</em:bootstrap>
<em:multiprocessCompatible>false</em:multiprocessCompatible>
Expand Down

0 comments on commit 9bf5d72

Please sign in to comment.