From 0c3c7b11ef7fda5af47149c2851267dd261b8e28 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Thu, 27 Apr 2017 01:10:35 +0800 Subject: [PATCH 1/8] fulltext: support form history for Firefox >= 54 --- chrome/content/scrapbook/scrapbook.js | 41 ++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/chrome/content/scrapbook/scrapbook.js b/chrome/content/scrapbook/scrapbook.js index 6fd0d713..5e831176 100644 --- a/chrome/content/scrapbook/scrapbook.js +++ b/chrome/content/scrapbook/scrapbook.js @@ -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: "", @@ -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 { @@ -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"); + } }, }; @@ -1060,3 +1092,4 @@ window.addEventListener("SidebarFocused", function () { }, false); + From 75f791bacb06605d28e5b0e7815878d17dbe6b12 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Fri, 2 Jun 2017 21:18:20 +0800 Subject: [PATCH 2/8] Update version info. --- doc/releases/1.13.11.txt | 7 +++++++ install.rdf | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 doc/releases/1.13.11.txt diff --git a/doc/releases/1.13.11.txt b/doc/releases/1.13.11.txt new file mode 100644 index 00000000..046290be --- /dev/null +++ b/doc/releases/1.13.11.txt @@ -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. diff --git a/install.rdf b/install.rdf index c0653285..48b37324 100644 --- a/install.rdf +++ b/install.rdf @@ -6,7 +6,7 @@ scrapbookx@addons.mozilla.org 2 - 1.13.10 + 1.13.11 false false false From 240be9812ae419732895e48303e9263bc83583bf Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Thu, 15 Jun 2017 03:02:13 +0800 Subject: [PATCH 3/8] core: fix files with a leading dot loses extension --- modules/common.jsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/common.jsm b/modules/common.jsm index bde7eea1..c5d346fa 100644 --- a/modules/common.jsm +++ b/modules/common.jsm @@ -887,7 +887,7 @@ var sbCommonUtils = { // see also: escapeFileName validateFileName: function(aFileName) { aFileName = aFileName.replace(/[\x00-\x1F\x7F]+|^ +/g, ""); - aFileName = aFileName.replace(/^[. ]+/, "").replace(/[. ]+$/, ""); // leading/trailing spaces and dots are not allowed in Windows + aFileName = aFileName.replace(/^\./, "_.").replace(/^ +/, "").replace(/[. ]+$/, ""); // leading/trailing spaces and dots are not allowed in Windows aFileName = aFileName.replace(/[\"\?\*\\\/\|\:]/g, "_"); aFileName = aFileName.replace(/[\<]/g, "("); aFileName = aFileName.replace(/[\>]/g, ")"); From f9c1f906ef33772e21d57abf9cc676ea8d5ad973 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Sat, 8 Jul 2017 14:17:16 +0800 Subject: [PATCH 4/8] core: escapeFileName() now escapes standalone "%"s - a standalone "%" leads to an error of decodeURI and is bad for other apps to parse the data --- modules/common.jsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/common.jsm b/modules/common.jsm index c5d346fa..cfbc745c 100644 --- a/modules/common.jsm +++ b/modules/common.jsm @@ -880,7 +880,7 @@ var sbCommonUtils = { escapeFileName: function(aString) { // " ": breaks srcset // "#": as the demarcation of main location and hash - return aString.replace(/(?:[ #]|%[0-9A-Fa-f]{2})+/g, function(m){return encodeURIComponent(m);}); + return aString.replace(/[ %#]+/g, function(m){return encodeURIComponent(m);}); }, // Tidy chars that may not be valid in a filename on a platform. From c998e067282599ce603ed9f6cf608eca225ab027 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Sat, 8 Jul 2017 15:01:17 +0800 Subject: [PATCH 5/8] trade: fix duplicated folder creation - if a non-folder item has same name as a folder before it, the item will be marked as the folder to import, which cause an error --- chrome/content/scrapbook/trade.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/chrome/content/scrapbook/trade.js b/chrome/content/scrapbook/trade.js index d7ac7815..a48f15ad 100644 --- a/chrome/content/scrapbook/trade.js +++ b/chrome/content/scrapbook/trade.js @@ -545,8 +545,10 @@ var sbImportService = { if ( this.tarResArray[0] != window.top.sbTreeHandler.TREE.ref ) folder = " [" + item.folder + "] "; } var curRes = sbDataSource.addItem(item, this.tarResArray[0], this.tarResArray[1]); - if (item.container || item.type == "folder") sbDataSource.createEmptySeq(curRes.Value); - this.folderTable[item.title] = curRes.Value; + if (item.container || item.type == "folder") { + sbDataSource.createEmptySeq(curRes.Value); + this.folderTable[item.title] = curRes.Value; + } window.top.sbTreeHandler.TREE.builder.rebuild(); }, From 62bdf6df253bcfd6238792ecdc71aa323e23cedd Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Sat, 8 Jul 2017 15:12:55 +0800 Subject: [PATCH 6/8] Update version info. --- doc/releases/1.13.12.txt | 14 ++++++++++++++ install.rdf | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 doc/releases/1.13.12.txt diff --git a/doc/releases/1.13.12.txt b/doc/releases/1.13.12.txt new file mode 100644 index 00000000..8d95574c --- /dev/null +++ b/doc/releases/1.13.12.txt @@ -0,0 +1,14 @@ +Scrapbook X 1.13.12 +=================== + +Changes since v1.13.11 +---------------------- + + * Fixed an issue that a file named ".foo" be fixed to "foo" and + loses its extension. + + * Persent chars ("%") in a filename are now always encoded in URL. + + * Fixed an issue that a non-folder item with a same name with a + folder before it causes the import wizard to generated a duplicated + folder. diff --git a/install.rdf b/install.rdf index 48b37324..c00506ba 100644 --- a/install.rdf +++ b/install.rdf @@ -6,7 +6,7 @@ scrapbookx@addons.mozilla.org 2 - 1.13.11 + 1.13.12 false false false From ec6f1931be4afc03e784f9ee8599158a05267b97 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Sat, 8 Jul 2017 15:29:46 +0800 Subject: [PATCH 7/8] core: compatible with Firefox 55.* --- install.rdf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.rdf b/install.rdf index c7faf599..a7051b58 100644 --- a/install.rdf +++ b/install.rdf @@ -19,7 +19,7 @@ {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 4.0 - 54.* + 55.* From 823c8d34c3c1745a7521f3a48a21c437f9bc90aa Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Sat, 8 Jul 2017 15:30:03 +0800 Subject: [PATCH 8/8] Update version info. --- doc/releases/1.14.0rc10.txt | 14 ++++++++++++++ install.rdf | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 doc/releases/1.14.0rc10.txt diff --git a/doc/releases/1.14.0rc10.txt b/doc/releases/1.14.0rc10.txt new file mode 100644 index 00000000..b69dc20d --- /dev/null +++ b/doc/releases/1.14.0rc10.txt @@ -0,0 +1,14 @@ +Scrapbook X 1.14.0rc10 +====================== + +Changes since v1.14.0rc9 +------------------------ + + * Fixed an issue that a file named ".foo" be fixed to "foo" and + loses its extension. + + * Persent chars ("%") in a filename are now always encoded in URL. + + * Fixed an issue that a non-folder item with a same name with a + folder before it causes the import wizard to generated a duplicated + folder. diff --git a/install.rdf b/install.rdf index a7051b58..c2239988 100644 --- a/install.rdf +++ b/install.rdf @@ -6,7 +6,7 @@ scrapbookx@addons.mozilla.org 2 - 1.14.0rc9 + 1.14.0rc10 false false false