summaryrefslogtreecommitdiffstats
path: root/application/palemoon/base/content/openLocation.js
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-15 09:31:07 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-15 09:31:07 +0200
commit0c6c32a0e6243040360d9dce05af377e95a71a5f (patch)
tree86655f2668b939b2d86c72b84443ef0646855da2 /application/palemoon/base/content/openLocation.js
parent8a95c03dcd2a7f2c6d64b6ee917f6cb363e9ca60 (diff)
downloadUXP-0c6c32a0e6243040360d9dce05af377e95a71a5f.tar
UXP-0c6c32a0e6243040360d9dce05af377e95a71a5f.tar.gz
UXP-0c6c32a0e6243040360d9dce05af377e95a71a5f.tar.lz
UXP-0c6c32a0e6243040360d9dce05af377e95a71a5f.tar.xz
UXP-0c6c32a0e6243040360d9dce05af377e95a71a5f.zip
Bug 846635 - Use asynchronous getCharsetForURI in getShortcutOrURI
Issue #121
Diffstat (limited to 'application/palemoon/base/content/openLocation.js')
-rw-r--r--application/palemoon/base/content/openLocation.js78
1 files changed, 43 insertions, 35 deletions
diff --git a/application/palemoon/base/content/openLocation.js b/application/palemoon/base/content/openLocation.js
index 5b731c7e8..b00dbc571 100644
--- a/application/palemoon/base/content/openLocation.js
+++ b/application/palemoon/base/content/openLocation.js
@@ -16,6 +16,7 @@ try {
}
Components.utils.import("resource:///modules/openLocationLastURL.jsm", openLocationModule);
+Components.utils.import("resource://gre/modules/Task.jsm");
let gOpenLocationLastURL = new openLocationModule.OpenLocationLastURL(window.opener);
function onLoad()
@@ -61,45 +62,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;
+ Task.spawn(function() {
+ let url;
+ let postData = null;
+ let mayInheritPrincipal = false;
+
+ if (browser) {
+ let data = yield browser.getShortcutOrURIAndPostData(dialog.input.value);
+ 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;
+ 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;
}