summaryrefslogtreecommitdiff
path: root/browser/extensions/pdfjs/test/head.js
blob: d980bceb14e29e601fdd58924d48c4b279e7a400 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function waitForPdfJS(browser, url) {
  // Runs tests after all 'load' event handlers have fired off
  return ContentTask.spawn(browser, url, function* (url) {
    yield new Promise((resolve) => {
      // NB: Add the listener to the global object so that we receive the
      // event fired from the new window.
      addEventListener("documentload", function listener() {
        removeEventListener("documentload", listener, false);
        resolve();
      }, false, true);

      content.location = url;
    });
  });
}