[tbb-commits] [tor-browser/tor-browser-60.1.0esr-8.0-1] Bug 1473247 - Part 2: Add a test case for making sure that IP addresses can work properly for the firstPartyDomain. r=arthuredelstein, baku

gk at torproject.org gk at torproject.org
Mon Aug 13 20:00:55 UTC 2018


commit a75945d96b2d8903a86ac1c9016a8d300028b79f
Author: Tim Huang <tihuang at mozilla.com>
Date:   Fri Jul 13 19:55:02 2018 +0000

    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
---
 .../test/browser/browser_firstPartyIsolation.js       | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/browser/components/originattributes/test/browser/browser_firstPartyIsolation.js b/browser/components/originattributes/test/browser/browser_firstPartyIsolation.js
index 560de8c8f572..06bc21255a94 100644
--- a/browser/components/originattributes/test/browser/browser_firstPartyIsolation.js
+++ b/browser/components/originattributes/test/browser/browser_firstPartyIsolation.js
@@ -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);
+});



More information about the tbb-commits mailing list