[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-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



commit a75945d96b2d8903a86ac1c9016a8d300028b79f
Author: Tim Huang <tihuang@xxxxxxxxxxx>
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);
+});

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits