From b03ce966051a85a5f0f2ceb267667e65beab5ee0 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 26 Nov 2023 12:18:23 +0100 Subject: [PATCH] [Firefox] Remove the `FirefoxCom.requestSync` method, since it's unused After the two previous commits, which removed the remaining call-sites, this method is no longer used and can thus be removed. As mentioned in the JSDocs for the now removed method, synchronous communication between the viewer and the platform code isn't really a good idea. Once this patch has landed in mozilla-central some additional clean-up of the platform code will also be possible. --- web/firefoxcom.js | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/web/firefoxcom.js b/web/firefoxcom.js index b31ea75cc..a411d2723 100644 --- a/web/firefoxcom.js +++ b/web/firefoxcom.js @@ -26,35 +26,6 @@ if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) { } class FirefoxCom { - /** - * Creates an event that the extension is listening for and will - * synchronously respond to. - * NOTE: It is recommended to use requestAsync() instead since one day we may - * not be able to synchronously reply. - * @param {string} action - The action to trigger. - * @param {Object|string} [data] - The data to send. - * @returns {*} The response. - */ - static requestSync(action, data) { - const request = document.createTextNode(""); - document.documentElement.append(request); - - const sender = new CustomEvent("pdf.js.message", { - bubbles: true, - cancelable: false, - detail: { - action, - data, - sync: true, - }, - }); - request.dispatchEvent(sender); - const response = sender.detail.response; - request.remove(); - - return response; - } - /** * Creates an event that the extension is listening for and will * asynchronously respond to. @@ -96,7 +67,6 @@ class FirefoxCom { detail: { action, data, - sync: false, responseExpected: !!callback, }, });