Ticket #22084: 0002-PATCH-Bug-1372072-Part-2-Add-a-test-case-for-check-w.2.patch

File 0002-PATCH-Bug-1372072-Part-2-Add-a-test-case-for-check-w.2.patch, 2.8 KB (added by igt0, 20 months ago)

Version 3 - Remove superfluous lines

  • browser/components/resistfingerprinting/test/browser/browser.ini

    From 599d8c9755a6dc922c8ee493012f179970ee5a3d Mon Sep 17 00:00:00 2001
    From: Tim Huang <tihuang@mozilla.com>
    Date: Wed, 13 Dec 2017 15:35:50 -0200
    Subject: [PATCH 2/2] [PATCH] Bug 1372072 - Part 2: Add a test case for check
     whether  network information API has been spoofed correctly when 
     'privacy.resistFingerprinting' is true. r=arthuredelstein,baku
    
    This adds a test case to test that network information is correctly spoofed when
    'privacy.resistFingerprinting' is true.
    
    Firefox ESR 52 does not have the navigation object inside workers. Thus, the
    worker test was removed.
    
    MozReview-Commit-ID: Lt6HZlFrcja
    
    --HG--
    extra : rebase_source : 70d44115532549814af9fce3af9fe379e36bca80
    ---
    ---
     .../resistfingerprinting/test/browser/browser.ini  |  1 +
     .../test/browser/browser_netInfo.js                | 32 ++++++++++++++++++++++
     2 files changed, 33 insertions(+)
     create mode 100644 browser/components/resistfingerprinting/test/browser/browser_netInfo.js
    
    diff --git a/browser/components/resistfingerprinting/test/browser/browser.ini b/browser/components/resistfingerprinting/test/browser/browser.ini
    index 4b81c91d8c6c..b596f437caa2 100644
    a b support-files = 
    44  file_dummy.html
    55  head.js
    66
     7[browser_netInfo.js]
    78[browser_roundedWindow_dialogWindow.js]
    89[browser_roundedWindow_newWindow.js]
    910[browser_roundedWindow_open_max.js]
  • new file rowser/components/resistfingerprinting/test/browser/browser_netInfo.js

    diff --git a/browser/components/resistfingerprinting/test/browser/browser_netInfo.js b/browser/components/resistfingerprinting/test/browser/browser_netInfo.js
    new file mode 100644
    index 000000000000..7c6114212ffd
    - +  
     1/**
     2 * Bug 1372072 - A test case for check whether network information API has been
     3 *   spoofed correctly when 'privacy.resistFingerprinting' is true;
     4 */
     5
     6const TEST_PATH = "http://example.net/browser/browser/" +
     7                  "components/resistfingerprinting/test/browser/"
     8
     9async function testWindow() {
     10  // Open a tab to test network information in a content.
     11  let tab = await BrowserTestUtils.openNewForegroundTab(
     12    gBrowser, TEST_PATH + "file_dummy.html");
     13
     14  await ContentTask.spawn(tab.linkedBrowser, null, async function() {
     15    ok("connection" in content.navigator, "navigator.connection should exist");
     16
     17    is(content.navigator.connection.type, "unknown", "The connection type is spoofed correctly");
     18  });
     19
     20  await BrowserTestUtils.removeTab(tab);
     21}
     22
     23add_task(async function runTest() {
     24  await SpecialPowers.pushPrefEnv({"set":
     25    [
     26      ["privacy.resistFingerprinting", true],
     27      ["dom.netinfo.enabled",          true]
     28    ]
     29  });
     30
     31  await testWindow();
     32});