diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/mailnews/base/content/newsError.js | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/mailnews/base/content/newsError.js')
-rw-r--r-- | comm/mailnews/base/content/newsError.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/comm/mailnews/base/content/newsError.js b/comm/mailnews/base/content/newsError.js new file mode 100644 index 0000000000..693083a166 --- /dev/null +++ b/comm/mailnews/base/content/newsError.js @@ -0,0 +1,48 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Error url must be formatted like this: +// about:newserror?r=response&m=messageid&k=messagekey&f=folderuri +// "r" is required; "m" and "f" are optional, but "k" always comes with "m". + +var folderUri; + +function initPage() { + let uri = document.documentURI; + let query = uri.slice(uri.indexOf("?") + 1); + let params = {}; + for (let piece of query.split("&")) { + let [key, value] = piece.split("="); + params[key] = decodeURIComponent(value); + } + + document.getElementById("ngResp").textContent = params.r; + + if ("m" in params) { + document.getElementById("msgId").textContent = params.m; + document.getElementById("msgKey").textContent = params.k; + } else { + document.getElementById("messageIdDesc").hidden = true; + } + + if ("f" in params) { + folderUri = params.f; + } else { + document.getElementById("errorTryAgain").hidden = true; + } +} + +function removeExpired() { + document.location.href = folderUri + "?list-ids"; +} + +let errorTryAgain = document.getElementById("errorTryAgain"); +errorTryAgain.addEventListener("click", function () { + removeExpired(); +}); + +// This must be called in this way, +// see mozilla-central/docshell/resources/content/netError.js after which +// this is modelled. +initPage(); |