summaryrefslogtreecommitdiffstats
path: root/dom/filesystem/tests/script_promptHandler.js
blob: 235842b455d62ce925dfb43e28f600ae8e310359 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* eslint-env mozilla/chrome-script */

let dialogObserverTopic = "common-dialog-loaded";

function dialogObserver(subj) {
  subj.document.querySelector("dialog").acceptDialog();
  sendAsyncMessage("promptAccepted");
}

addMessageListener("init", () => {
  Services.obs.addObserver(dialogObserver, dialogObserverTopic);
  sendAsyncMessage("initDone");
});

addMessageListener("cleanup", () => {
  Services.obs.removeObserver(dialogObserver, dialogObserverTopic);
  sendAsyncMessage("cleanupDone");
});