summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-06-05 03:25:51 +0200
committerGitHub <noreply@github.com>2018-06-05 03:25:51 +0200
commite0058147fa1d88eaafd57aac50eba31d2600cc96 (patch)
tree106b2c0ddc95c895417e66a83499efee70c5da74 /application
parent669b0174806c5b3427d3cf2ae048dc1bbb80d4d0 (diff)
parent36e5eacbbf027af61294112b47e6cf70684b8981 (diff)
downloadUXP-e0058147fa1d88eaafd57aac50eba31d2600cc96.tar
UXP-e0058147fa1d88eaafd57aac50eba31d2600cc96.tar.gz
UXP-e0058147fa1d88eaafd57aac50eba31d2600cc96.tar.lz
UXP-e0058147fa1d88eaafd57aac50eba31d2600cc96.tar.xz
UXP-e0058147fa1d88eaafd57aac50eba31d2600cc96.zip
Merge pull request #440 from janekptacijarabaci/pm_url_2
[PALEMOON] Fix "Open Web Location" (Ctrl-L/Alt-D) when nav toolbar hidden
Diffstat (limited to 'application')
-rw-r--r--application/palemoon/base/content/openLocation.js93
1 files changed, 51 insertions, 42 deletions
diff --git a/application/palemoon/base/content/openLocation.js b/application/palemoon/base/content/openLocation.js
index f39e34666..7ad2f7c4a 100644
--- a/application/palemoon/base/content/openLocation.js
+++ b/application/palemoon/base/content/openLocation.js
@@ -61,53 +61,62 @@ 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
+ // fix up 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;
+ window.close();
}
function createInstance(contractid, iidName)