[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.
This commit is contained in:
parent
9ca504e538
commit
b03ce96605
@ -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,
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user