summaryrefslogtreecommitdiffstats
path: root/application/palemoon/base/content
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-06-03 20:08:31 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-06-03 20:08:31 +0200
commit40ad43a8ad22416d5350e854aeeac14622c037e8 (patch)
treea7e8068c131621173c8ce52593dd24679c707420 /application/palemoon/base/content
parent13168ba15b63ccdd4b34e0a20bcb4deb37ab29f3 (diff)
downloadUXP-40ad43a8ad22416d5350e854aeeac14622c037e8.tar
UXP-40ad43a8ad22416d5350e854aeeac14622c037e8.tar.gz
UXP-40ad43a8ad22416d5350e854aeeac14622c037e8.tar.lz
UXP-40ad43a8ad22416d5350e854aeeac14622c037e8.tar.xz
UXP-40ad43a8ad22416d5350e854aeeac14622c037e8.zip
[PALEMOON] Fix "Open Web Location" (Ctrl-L/Alt-D) when nav toolbar hidden
Issue #434
Diffstat (limited to 'application/palemoon/base/content')
-rw-r--r--application/palemoon/base/content/openLocation.js100
1 files changed, 56 insertions, 44 deletions
diff --git a/application/palemoon/base/content/openLocation.js b/application/palemoon/base/content/openLocation.js
index f39e34666..f4338c992 100644
--- a/application/palemoon/base/content/openLocation.js
+++ b/application/palemoon/base/content/openLocation.js
@@ -16,7 +16,8 @@ try {
}
Components.utils.import("resource:///modules/openLocationLastURL.jsm", openLocationModule);
-var gOpenLocationLastURL = new openLocationModule.OpenLocationLastURL(window.opener);
+var gOpenLocationLastURL = new openLocationModule.OpenLocationLastURL(
+ window.opener);
function onLoad()
{
@@ -40,7 +41,8 @@ function onLoad()
try {
var value = pref.getIntPref("general.open_location.last_window_choice");
- var element = dialog.openWhereList.getElementsByAttribute("value", value)[0];
+ var element = dialog.openWhereList.getElementsByAttribute(
+ "value", value)[0];
if (element)
dialog.openWhereList.selectedItem = element;
dialog.input.value = gOpenLocationLastURL.value;
@@ -61,53 +63,63 @@ function doEnabling()
function open()
{
- getShortcutOrURIAndPostData(dialog.input.value).then(data => {
- let url;
- let postData = null;
- let mayInheritPrincipal = false;
-
- if (browser) {
- url = data.url;
- postData = data.postData;
- mayInheritPrincipal = data.mayInheritPrincipal;
- } else {
- url = dialog.input.value;
- }
+ var openData = {
+ "url": null,
+ "postData": null,
+ "mayInheritPrincipal": false
+ };
+ if (browser) {
+ browser.getShortcutOrURIAndPostData(dialog.input.value).then(data => {
+ openData.url = data.url;
+ openData.postData = data.postData;
+ openData.mayInheritPrincipal = data.mayInheritPrincipal;
+
+ openLocation(openData);
+ });
+ } else {
+ openData.url = dialog.input.value;
+
+ openLocation(openData);
+ }
- try {
- // Whichever target we use for the load, we allow third-party services to
- // fixup the URI
- switch (dialog.openWhereList.value) {
- case "0":
- var webNav = Components.interfaces.nsIWebNavigation;
- var flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
- webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
- if (!mayInheritPrincipal)
- flags |= webNav.LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
- browser.gBrowser.loadURIWithFlags(url, flags, null, null, postData);
- break;
- case "1":
- window.opener.delayedOpenWindow(getBrowserURL(), "all,dialog=no",
- url, postData, null, null, true);
- break;
- case "3":
- browser.delayedOpenTab(url, null, null, postData, true);
- break;
- }
- }
- catch(exception) {
- }
+ return false;
+}
- if (pref) {
- gOpenLocationLastURL.value = dialog.input.value;
- pref.setIntPref("general.open_location.last_window_choice", dialog.openWhereList.value);
+function openLocation(openData)
+{
+ try {
+ // Whichever target we use for the load, we allow third-party services to
+ // fixup the URI
+ switch (dialog.openWhereList.value) {
+ case "0":
+ var webNav = Components.interfaces.nsIWebNavigation;
+ var flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
+ webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
+ if (!openData.mayInheritPrincipal)
+ flags |= webNav.LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
+ browser.gBrowser.loadURIWithFlags(
+ openData.url, flags, null, null, openData.postData);
+ break;
+ case "1":
+ window.opener.delayedOpenWindow(getBrowserURL(), "all,dialog=no",
+ openData.url, openData.postData,
+ null, null, true);
+ break;
+ case "3":
+ browser.delayedOpenTab(
+ openData.url, null, null, openData.postData, true);
+ break;
}
+ } catch (ex) {}
- // Delay closing slightly to avoid timing bug on Linux.
- window.close();
- });
+ if (pref) {
+ gOpenLocationLastURL.value = dialog.input.value;
+ pref.setIntPref(
+ "general.open_location.last_window_choice", dialog.openWhereList.value);
+ }
- return false;
+ // Delay closing slightly to avoid timing bug on Linux.
+ window.close();
}
function createInstance(contractid, iidName)