mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-30 12:27:29 +09:00
[PALEMOON] Fix "Open Web Location" (Ctrl-L/Alt-D) when nav toolbar hidden
Issue #434
This commit is contained in:
parent
81491f13fe
commit
e619aeed91
1 changed files with 56 additions and 44 deletions
|
|
@ -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,19 +63,30 @@ function doEnabling()
|
|||
|
||||
function open()
|
||||
{
|
||||
getShortcutOrURIAndPostData(dialog.input.value).then(data => {
|
||||
let url;
|
||||
let postData = null;
|
||||
let mayInheritPrincipal = false;
|
||||
|
||||
var openData = {
|
||||
"url": null,
|
||||
"postData": null,
|
||||
"mayInheritPrincipal": false
|
||||
};
|
||||
if (browser) {
|
||||
url = data.url;
|
||||
postData = data.postData;
|
||||
mayInheritPrincipal = data.mayInheritPrincipal;
|
||||
browser.getShortcutOrURIAndPostData(dialog.input.value).then(data => {
|
||||
openData.url = data.url;
|
||||
openData.postData = data.postData;
|
||||
openData.mayInheritPrincipal = data.mayInheritPrincipal;
|
||||
|
||||
openLocation(openData);
|
||||
});
|
||||
} else {
|
||||
url = dialog.input.value;
|
||||
openData.url = dialog.input.value;
|
||||
|
||||
openLocation(openData);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function openLocation(openData)
|
||||
{
|
||||
try {
|
||||
// Whichever target we use for the load, we allow third-party services to
|
||||
// fixup the URI
|
||||
|
|
@ -82,32 +95,31 @@ function open()
|
|||
var webNav = Components.interfaces.nsIWebNavigation;
|
||||
var flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
|
||||
webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
|
||||
if (!mayInheritPrincipal)
|
||||
if (!openData.mayInheritPrincipal)
|
||||
flags |= webNav.LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
|
||||
browser.gBrowser.loadURIWithFlags(url, flags, null, null, postData);
|
||||
browser.gBrowser.loadURIWithFlags(
|
||||
openData.url, flags, null, null, openData.postData);
|
||||
break;
|
||||
case "1":
|
||||
window.opener.delayedOpenWindow(getBrowserURL(), "all,dialog=no",
|
||||
url, postData, null, null, true);
|
||||
openData.url, openData.postData,
|
||||
null, null, true);
|
||||
break;
|
||||
case "3":
|
||||
browser.delayedOpenTab(url, null, null, postData, true);
|
||||
browser.delayedOpenTab(
|
||||
openData.url, null, null, openData.postData, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(exception) {
|
||||
}
|
||||
} catch (ex) {}
|
||||
|
||||
if (pref) {
|
||||
gOpenLocationLastURL.value = dialog.input.value;
|
||||
pref.setIntPref("general.open_location.last_window_choice", dialog.openWhereList.value);
|
||||
pref.setIntPref(
|
||||
"general.open_location.last_window_choice", dialog.openWhereList.value);
|
||||
}
|
||||
|
||||
// Delay closing slightly to avoid timing bug on Linux.
|
||||
window.close();
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function createInstance(contractid, iidName)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue