diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-04-28 16:17:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-28 16:17:54 +0200 |
commit | 9d1869d98e23162f5bbeffe95c1973e42f2b89d9 (patch) | |
tree | 9fc3fb1291ebb66686d7011c9cbf339bd9f3ce04 /application/palemoon/base/content/openLocation.js | |
parent | 8d6b34f8630d6802e3570e8c6adcd2ad6fe4ddbe (diff) | |
parent | c99c89cb40123d9b37f0e75a9fde6141295acca9 (diff) | |
download | UXP-9d1869d98e23162f5bbeffe95c1973e42f2b89d9.tar UXP-9d1869d98e23162f5bbeffe95c1973e42f2b89d9.tar.gz UXP-9d1869d98e23162f5bbeffe95c1973e42f2b89d9.tar.lz UXP-9d1869d98e23162f5bbeffe95c1973e42f2b89d9.tar.xz UXP-9d1869d98e23162f5bbeffe95c1973e42f2b89d9.zip |
Merge pull request #276 from janekptacijarabaci/pm_url_1
[PALEMOON] [frontend vs backend] Change a function "getShortcutOrURI" to "getShortcutOrURIAndPostData", fix Drag & Drop and a function "Copy Download Link"
Diffstat (limited to 'application/palemoon/base/content/openLocation.js')
-rw-r--r-- | application/palemoon/base/content/openLocation.js | 77 |
1 files changed, 42 insertions, 35 deletions
diff --git a/application/palemoon/base/content/openLocation.js b/application/palemoon/base/content/openLocation.js index 316dfac70..1a10334c7 100644 --- a/application/palemoon/base/content/openLocation.js +++ b/application/palemoon/base/content/openLocation.js @@ -61,45 +61,52 @@ function doEnabling() function open() { - var url; - var postData = {}; - var mayInheritPrincipal = {value: false}; - if (browser) - url = browser.getShortcutOrURI(dialog.input.value, postData, mayInheritPrincipal); - else - url = dialog.input.value; + 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; + } - 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.value) - flags |= webNav.LOAD_FLAGS_DISALLOW_INHERIT_OWNER; - browser.gBrowser.loadURIWithFlags(url, flags, null, null, postData.value); - break; - case "1": - window.opener.delayedOpenWindow(getBrowserURL(), "all,dialog=no", - url, postData.value, null, null, true); - break; - case "3": - browser.delayedOpenTab(url, null, null, postData.value, true); - break; + 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_OWNER; + 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) { } - } - catch(exception) { - } - if (pref) { - gOpenLocationLastURL.value = dialog.input.value; - pref.setIntPref("general.open_location.last_window_choice", dialog.openWhereList.value); - } + if (pref) { + gOpenLocationLastURL.value = dialog.input.value; + pref.setIntPref("general.open_location.last_window_choice", dialog.openWhereList.value); + } + + // Delay closing slightly to avoid timing bug on Linux. + window.close(); + }); - // Delay closing slightly to avoid timing bug on Linux. - window.close(); return false; } |