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);
|
Components.utils.import("resource:///modules/openLocationLastURL.jsm", openLocationModule);
|
||||||
var gOpenLocationLastURL = new openLocationModule.OpenLocationLastURL(window.opener);
|
var gOpenLocationLastURL = new openLocationModule.OpenLocationLastURL(
|
||||||
|
window.opener);
|
||||||
|
|
||||||
function onLoad()
|
function onLoad()
|
||||||
{
|
{
|
||||||
|
|
@ -40,7 +41,8 @@ function onLoad()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var value = pref.getIntPref("general.open_location.last_window_choice");
|
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)
|
if (element)
|
||||||
dialog.openWhereList.selectedItem = element;
|
dialog.openWhereList.selectedItem = element;
|
||||||
dialog.input.value = gOpenLocationLastURL.value;
|
dialog.input.value = gOpenLocationLastURL.value;
|
||||||
|
|
@ -61,55 +63,65 @@ function doEnabling()
|
||||||
|
|
||||||
function open()
|
function open()
|
||||||
{
|
{
|
||||||
getShortcutOrURIAndPostData(dialog.input.value).then(data => {
|
var openData = {
|
||||||
let url;
|
"url": null,
|
||||||
let postData = null;
|
"postData": null,
|
||||||
let mayInheritPrincipal = false;
|
"mayInheritPrincipal": false
|
||||||
|
};
|
||||||
|
if (browser) {
|
||||||
|
browser.getShortcutOrURIAndPostData(dialog.input.value).then(data => {
|
||||||
|
openData.url = data.url;
|
||||||
|
openData.postData = data.postData;
|
||||||
|
openData.mayInheritPrincipal = data.mayInheritPrincipal;
|
||||||
|
|
||||||
if (browser) {
|
openLocation(openData);
|
||||||
url = data.url;
|
});
|
||||||
postData = data.postData;
|
} else {
|
||||||
mayInheritPrincipal = data.mayInheritPrincipal;
|
openData.url = dialog.input.value;
|
||||||
} else {
|
|
||||||
url = dialog.input.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
openLocation(openData);
|
||||||
// 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) {
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
function createInstance(contractid, iidName)
|
function createInstance(contractid, iidName)
|
||||||
{
|
{
|
||||||
var iid = Components.interfaces[iidName];
|
var iid = Components.interfaces[iidName];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue