diff --git a/source/chrome/content/allinonegest/gestimp.js b/source/chrome/content/allinonegest/gestimp.js index 161d612..fbbb81e 100644 --- a/source/chrome/content/allinonegest/gestimp.js +++ b/source/chrome/content/allinonegest/gestimp.js @@ -687,27 +687,51 @@ mgsuite.imp = { }, aioFavoriteURL: function(suffix) { - var shortcutURL = null; - var bmsvc = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Components.interfaces.nsINavBookmarksService); + function loadKeywordPage(keyword, url) { + if (!url) { + alert(mgsuite.overlay.aioGetStr("g.keywordMissing") + " " + keyword); + return; + } + + switch (mgsuite.overlay.aioWindowType) { + case "browser": + loadURI(url); + break; + + default: + if (mgsuite.overlay.aioIsFx) { + openNewTabWith(url); + } else { + openNewTabWindowOrExistingWith(Components.interfaces.nsIBrowserDOMWindow.OPEN_NEWTAB, url, null, false); + } + } + } + var keyword = mgsuite.overlay.aioGetStr("g.keywordForGesture") + suffix; - var shortcutURI = bmsvc.getURIForKeyword(keyword); - if (shortcutURI) shortcutURL = shortcutURI.spec; - if (!shortcutURL) { - alert(mgsuite.overlay.aioGetStr("g.keywordMissing") + " " + keyword); + + try { + // try to fetch url keyword using old method (removed in Fx 53) + var url = null; + var bmsvc = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Components.interfaces.nsINavBookmarksService); + var shortcutURI = bmsvc.getURIForKeyword(keyword); + if (shortcutURI) url = shortcutURI.spec; + loadKeywordPage(keyword, url); return; + + } catch (e) { } - switch (mgsuite.overlay.aioWindowType) { - case "browser": - loadURI(shortcutURL); - break; + if (!url) { + // if old method failed, then try new method (since Fx 40) + Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); + XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm"); - default: - if (mgsuite.overlay.aioIsFx) { - openNewTabWith(shortcutURL); - } else { - openNewTabWindowOrExistingWith(Components.interfaces.nsIBrowserDOMWindow.OPEN_NEWTAB, shortcutURL, null, false); - } + PlacesUtils.keywords.fetch(keyword).then(entry => { + /* entry is either null, or a keyword entry */ + loadKeywordPage(keyword, entry ? entry.url.href : null); + }, + e => { /* failure */} + ); } }, diff --git a/source/chrome/content/allinonegest/pref/customize.js b/source/chrome/content/allinonegest/pref/customize.js index 0411953..0266540 100644 --- a/source/chrome/content/allinonegest/pref/customize.js +++ b/source/chrome/content/allinonegest/pref/customize.js @@ -636,6 +636,10 @@ function populateTree(aGesturesString, aFuncsString, aRockerString, customGestur } function ReadFile(file) { + if (typeof Services == 'undefined') { + Components.utils.import('resource://gre/modules/Services.jsm'); + } + var ioService=Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); var scriptableStream=Components @@ -644,7 +648,14 @@ function ReadFile(file) { // newChannel was deprecated in Fx 48 in favour of newChannel2 - var channel = ioService.newChannel2 ? ioService.newChannel2(file,null,null,null,null,null,null,null) + var channel = ioService.newChannel2 ? ioService.newChannel2(file, + null, + null, + null, + Services.scriptSecurityManager.getSystemPrincipal(), + Services.scriptSecurityManager.getSystemPrincipal(), + null, + null) : ioService.newChannel(file,null,null); var input=channel.open(); scriptableStream.init(input); diff --git a/source/install.rdf b/source/install.rdf index 3d6f7b4..0f5cfa2 100644 --- a/source/install.rdf +++ b/source/install.rdf @@ -3,7 +3,7 @@ xmlns:em="http://www.mozilla.org/2004/em-rdf#"> mousegesturessuite@lemon_juice.addons.mozilla.org - 2.5.0 + 2.5.1 2 true true @@ -13,7 +13,7 @@ {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} 2.22 - 2.45.* + 2.49.* @@ -22,7 +22,7 @@ {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 25.0 - 50.* + 56.*