Merge pull request #12800 from Snuffleupagus/DefaultExternalServices-async-fallback

Convert `DefaultExternalServices.fallback` to an asynchronous method
This commit is contained in:
Tim van der Meij 2020-12-31 13:10:44 +01:00 committed by GitHub
commit f305e042ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 10 deletions

View File

@ -150,7 +150,7 @@ class DefaultExternalServices {
static initPassiveLoading(callbacks) {} static initPassiveLoading(callbacks) {}
static fallback(data, callback) {} static async fallback(data) {}
static reportTelemetry(data) {} static reportTelemetry(data) {}
@ -1102,18 +1102,17 @@ const PDFViewerApplication = {
return; return;
} }
this.fellback = true; this.fellback = true;
this.externalServices.fallback( this.externalServices
{ .fallback({
featureId, featureId,
url: this.baseUrl, url: this.baseUrl,
}, })
function response(download) { .then(download => {
if (!download) { if (!download) {
return; return;
} }
PDFViewerApplication.download({ sourceEventType: "download" }); this.download({ sourceEventType: "download" });
} });
);
}, },
/** /**

View File

@ -344,8 +344,10 @@ class FirefoxExternalServices extends DefaultExternalServices {
FirefoxCom.requestSync("initPassiveLoading", null); FirefoxCom.requestSync("initPassiveLoading", null);
} }
static fallback(data, callback) { static async fallback(data) {
FirefoxCom.request("fallback", data, callback); return new Promise(resolve => {
FirefoxCom.request("fallback", data, resolve);
});
} }
static reportTelemetry(data) { static reportTelemetry(data) {