Skip to content

Commit

Permalink
keep the background script alive while fetching resources (see #1475)
Browse files Browse the repository at this point in the history
  • Loading branch information
gildas-lormeau committed Jul 10, 2024
1 parent 1184435 commit cb9325f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/content/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Source.
*/

/* global browser, document, globalThis, location, setTimeout, URL */
/* global browser, document, globalThis, location, setTimeout, URL, setInterval, clearInterval */

import * as download from "./../common/download.js";
import { fetch, frameFetch } from "./../../lib/single-file/fetch/content/content-fetch.js";
Expand Down Expand Up @@ -148,6 +148,9 @@ async function onMessage(message) {
}

async function savePage(message) {
const pingInterval = setInterval(() => {
browser.runtime.sendMessage({ method: "downloads.ping" }).then(() => { });
}, 5000);
const options = message.options;
let selectionFound;
if (options.selected || options.optionallySelected) {
Expand Down Expand Up @@ -197,6 +200,7 @@ async function savePage(message) {
bootstrap.pageInfo.processing = false;
}
}
clearInterval(pingInterval);
}

async function processPage(options) {
Expand Down

0 comments on commit cb9325f

Please sign in to comment.