1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-28 21:42:26 +01:00

protocol: make RedirectChannel compatible with PM 28.5

The sketchy meta-redirect previously used was no longer working with
Palemoon 28.5. This is an even more sketchy version that uses a
JavaScript redirect, but seems to work.

This redirect screws up the history, so this introduces a new bug as
well :/

My XPCOM-fu isn't quite good enough to figure out a nice way to
redirect a channel without this crap, so open to suggestions on a more
elegant way to solve this.

BUG=madand#9
TEST=visited dactyl://help-tag/starting and got to the correct page

Signed-off-by: Jack Rosenthal <jack@rosenth.al>
This commit is contained in:
Jack Rosenthal
2019-05-12 08:38:16 -06:00
parent 00536f5feb
commit 0a05e0089b

View File

@@ -56,10 +56,15 @@ function NetError(orig, error) {
function RedirectChannel(to, orig, time, message) {
let html = DOM.toXML(
["html", {},
["head", {},
["meta", { "http-equiv": "Refresh", content: (time || 0) + ";" + to }]],
["body", {},
["h2", { style: "text-align: center" }, message || ""]]]);
["head", {},
["script", {},
"setTimeout(function () { window.location = '"
+ to
+ "'; }, "
+ ((time || 0) * 1000)
+ ");"]],
["body", {},
["h2", { style: "text-align: center" }, message || ""]]]);
return StringChannel(html, "text/html", services.io.newURI(to, null, null));
}