summaryrefslogtreecommitdiffstats
path: root/toolkit/components/places/tests/browser/browser_history_post.js
blob: 91522ae726fef10654f9892128453b3877890965 (plain)
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
const PAGE_URI =
  "http://example.com/tests/toolkit/components/places/tests/browser/history_post.html";
const SJS_URI = NetUtil.newURI(
  "http://example.com/tests/toolkit/components/places/tests/browser/history_post.sjs"
);

add_task(async function() {
  await BrowserTestUtils.withNewTab({ gBrowser, url: PAGE_URI }, async function(
    aBrowser
  ) {
    await SpecialPowers.spawn(aBrowser, [], async function() {
      let doc = content.document;
      let submit = doc.getElementById("submit");
      let iframe = doc.getElementById("post_iframe");
      let p = new Promise((resolve, reject) => {
        iframe.addEventListener(
          "load",
          function() {
            resolve();
          },
          { once: true }
        );
      });
      submit.click();
      await p;
    });
    let visited = await PlacesUtils.history.hasVisits(SJS_URI);
    ok(!visited, "The POST page should not be added to history");
    ok(
      !(await PlacesTestUtils.isPageInDB(SJS_URI.spec)),
      "The page should not be in the database"
    );
  });
});