Commit a5fd1ead authored by Tim Huang's avatar Tim Huang Committed by Georg Koppen
Browse files

Bug 1473247 - Part 2: Add a test case for making sure that IP addresses can...

Bug 1473247 - Part 2: Add a test case for making sure that IP addresses can work properly for the firstPartyDomain. r=arthuredelstein,baku

Differential Revision: https://phabricator.services.mozilla.com/D1978

--HG--
extra : moz-landing-system : lando
parent 0e90e2d5
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -278,3 +278,22 @@ add_task(async function window_open_form_test() {
  gBrowser.removeTab(tab);
  await BrowserTestUtils.closeWindow(win);
});

/**
 * A test for using an IP address as the first party domain.
 */
add_task(async function ip_address_test() {
  const ipAddr = "127.0.0.1";
  const ipHost = `http://${ipAddr}/browser/browser/components/originattributes/test/browser/`;

  let tab = BrowserTestUtils.addTab(gBrowser, ipHost + "test_firstParty.html");
  await BrowserTestUtils.browserLoaded(tab.linkedBrowser, true);

  await ContentTask.spawn(tab.linkedBrowser, { firstPartyDomain: ipAddr }, async function(attrs) {
    info("document principal: " + content.document.nodePrincipal.origin);
    Assert.equal(content.document.nodePrincipal.originAttributes.firstPartyDomain,
                   attrs.firstPartyDomain, "The firstPartyDomain should be set properly for the IP address");
  });

  gBrowser.removeTab(tab);
});