DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (9b7cd94eaf0a)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
<!DOCTYPE HTML>
<html>
<head>
  <title>Tabs reload Test</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
  <script type="text/javascript" src="head.js"></script>
  <link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
</head>
<body>

<script type="text/javascript">
"use strict";

add_task(async function() {
  let extension = ExtensionTestUtils.loadExtension({
    manifest: {
      "permissions": ["tabs"],
    },

    files: {
      "tab.js": function() {
        browser.runtime.sendMessage("tab-loaded");
      },
      "tab.html":
        `<head>
          <meta charset="utf-8">
          <script src="tab.js"><\/script>
        </head>`,
    },

    async background() {
      let tabLoadedCount = 0;

      let tab = await browser.tabs.create({url: "tab.html", active: true});

      browser.runtime.onMessage.addListener(msg => {
        if (msg == "tab-loaded") {
          tabLoadedCount++;

          if (tabLoadedCount == 1) {
            // Reload the tab once passing no arguments.
            return browser.tabs.reload();
          }

          if (tabLoadedCount == 2) {
            // Reload the tab again with explicit arguments.
            return browser.tabs.reload(tab.id, {
              bypassCache: false,
            });
          }

          if (tabLoadedCount == 3) {
            browser.test.notifyPass("tabs.reload");
          }
        }
      });
    },
  });

  await extension.startup();
  await extension.awaitFinish("tabs.reload");
  await extension.unload();
});
</script>

</body>
</html>