lists.torproject.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

tbb-commits

Thread Start a new thread
Threads by month
  • ----- 2026 -----
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2015 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2014 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
tbb-commits@lists.torproject.org

  • 20603 discussions
[tor-browser-bundle-testsuite/master] Bug 40002: Add test for 'Add v3 onion services client authentication prompt' TB patch
by gk@torproject.org 15 Oct '20

15 Oct '20
commit 5c0a4650a88d4b616fb36afc2a57ebb78ab7f539 Author: Alex Catarineu <acat(a)torproject.org> Date: Fri Jul 3 00:53:46 2020 +0200 Bug 40002: Add test for 'Add v3 onion services client authentication prompt' TB patch --- TBBTestSuite/TestSuite/BrowserBundleTests.pm | 7 + TBBTestSuite/Tests/TorBootstrap.pm | 4 + .../tor_browser_tests/test_onion_client_auth.py | 215 +++++++++++++++++++++ 3 files changed, 226 insertions(+) diff --git a/TBBTestSuite/TestSuite/BrowserBundleTests.pm b/TBBTestSuite/TestSuite/BrowserBundleTests.pm index 37efae6..7d6c110 100644 --- a/TBBTestSuite/TestSuite/BrowserBundleTests.pm +++ b/TBBTestSuite/TestSuite/BrowserBundleTests.pm @@ -494,6 +494,13 @@ our @tests = ( use_net => 1, descr => 'Check that onion alias urlbar rewrites work properly', }, + { + name => 'onion_client_auth', + type => 'marionette', + use_net => 1, + descr => 'Check that onion client auth works properly', + run_once => 1, + }, { name => 'security_level_ui', type => 'marionette', diff --git a/TBBTestSuite/Tests/TorBootstrap.pm b/TBBTestSuite/Tests/TorBootstrap.pm index f35b4a2..006be59 100644 --- a/TBBTestSuite/Tests/TorBootstrap.pm +++ b/TBBTestSuite/Tests/TorBootstrap.pm @@ -153,11 +153,15 @@ sub start_tor { } write_file("$tbbinfos->{datadir}/Tor/torrc", ()) unless -f "$tbbinfos->{datadir}/Tor/torrc"; + # These arguments should be kept in sync with tor-launcher + mkdir "$tbbinfos->{datadir}/Tor/onion-auth" unless -d "$tbbinfos->{datadir}/Tor/onion-auth"; my @cmd = (winpath($tbbinfos->{torbin}), '--defaults-torrc', winpath($torrc_file), '-f', winpath("$tbbinfos->{datadir}/Tor/torrc"), 'DataDirectory', winpath("$tbbinfos->{datadir}/Tor"), 'GeoIPFile', winpath($tbbinfos->{torgeoip}), + 'ClientOnionAuthDir', winpath("$tbbinfos->{datadir}/Tor/onion-auth"), + '__SocksPort', "$options->{'tor-socks-port'} ExtendedErrors IPv6Traffic PreferIPv6 KeepAliveIsolateSOCKSAuth", '__OwningControllerProcess', winpid($$)); $tbbinfos->{torpid} = fork; if ($tbbinfos->{torpid} == 0) { diff --git a/marionette/tor_browser_tests/test_onion_client_auth.py b/marionette/tor_browser_tests/test_onion_client_auth.py new file mode 100644 index 0000000..38c8a34 --- /dev/null +++ b/marionette/tor_browser_tests/test_onion_client_auth.py @@ -0,0 +1,215 @@ +from marionette_driver import By, Wait +from marionette_driver.errors import MarionetteException, NoSuchElementException, TimeoutException +from marionette_driver.legacy_actions import Actions +from marionette_harness import MarionetteTestCase, WindowManagerMixin + +import testsuite + +from stem.control import Controller +from stem.process import launch_tor_with_config + +from urlparse import urlparse +from tempfile import mkdtemp +import shutil +import os +import base64 + +import time + + +class Test(WindowManagerMixin, MarionetteTestCase): + def setUp(self): + super(Test, self).setUp() + + self.public_key = 'E4ST65PDZDVZRAW2FLT5RBFKYEM3GW73SRQDMEBLBDHQP3Y4NADQ' + self.private_key = 'B7H4TVVQNEOIENRS3GW3GI4VLVTSZPKS7NVSJAIDTNLBRWKWPHLQ' + + self.tmp_dir = mkdtemp() + fixtures_port = urlparse(self.marionette.absolute_url('')).port + os.mkdir(os.path.join(self.tmp_dir, 'hidden_service'), 0700) + os.mkdir(os.path.join(self.tmp_dir, 'hidden_service', + 'authorized_clients'), 0700) + with open(os.path.join(self.tmp_dir, 'hidden_service', 'authorized_clients', 'alice.auth'), "w") as myfile: + myfile.write("descriptor:x25519:" + self.public_key + '\n') + + # Add tor executable directory to the LD_LIBRARY_PATH + ld_lib_list = filter(len, os.environ.get( + "LD_LIBRARY_PATH", "").split(":")) + tor_dirname = os.path.dirname( + testsuite.TestSuite().t['tbbinfos']['torbin']) + if tor_dirname not in ld_lib_list: + ld_lib_list = [tor_dirname] + ld_lib_list + os.environ["LD_LIBRARY_PATH"] = ":".join(ld_lib_list) + + self.tor_process = launch_tor_with_config( + config={ + 'ControlPort': '9999', + 'SOCKSPort': '0', + 'DataDirectory': self.tmp_dir, + 'HiddenServiceDir': os.path.join(self.tmp_dir, 'hidden_service'), + 'HiddenServicePort': '80 127.0.0.1:' + str(fixtures_port), + }, + take_ownership=True, + tor_cmd=testsuite.TestSuite().t['tbbinfos']['torbin'] + ) + + with open(os.path.join(self.tmp_dir, 'hidden_service', 'hostname'), 'r') as myfile: + self.onion = myfile.read().strip() + + self.controller = Controller.from_port(port=9999) + self.controller.authenticate() + + def is_published(_): + try: + self.controller.get_hidden_service_descriptor(self.onion) + return True + except: + return False + Wait(self.marionette, timeout=10).until(is_published) + # Wait a reasonable amount of time to increase the chances of the service to work + time.sleep(10) + + def tearDown(self): + self.controller.close() + self.tor_process.terminate() + shutil.rmtree(self.tmp_dir, ignore_errors=True) + super(Test, self).tearDown() + + def load_onion(self, onion=None, wait_auth=True): + if not onion: + onion = self.onion + m = self.marionette + with m.using_context('content'): + self.marionette.execute_script( + 'window.location = "http://' + onion + '/dom-objects-enumeration.html";') + if wait_auth: + with m.using_context('chrome'): + Wait(m, timeout=m.timeout.page_load).until(lambda _: m.find_element( + 'id', 'tor-clientauth-notification-key').is_displayed()) + + def check_errors(self, title, short, long): + m = self.marionette + with m.using_context('content'): + Wait(m, timeout=m.timeout.page_load).until(lambda _: m.find_element( + 'css selector', '#text-container .title-text').text != '') + self.assertEqual(m.find_element( + 'css selector', '#text-container .title-text').text, title) + self.assertEqual(m.find_element( + 'id', 'errorShortDescText').text, short) + self.assertEqual(m.find_element('id', 'errorLongDesc').text, long) + + def get_keys(self): + with self.marionette.using_context('content'): + self.marionette.navigate("about:preferences#privacy") + self.marionette.find_element( + 'id', 'torOnionServiceKeys-savedKeys').click() + return self.marionette.execute_script(''' + const dialog = document.querySelector('.dialogFrame'); + const tree = dialog.contentDocument.querySelector('#onionservices-savedkeys-tree'); + const view = tree.view; + const rowCount = view.rowCount; + const result = []; + for (let i = 0; i < rowCount; ++i) { + result.push([ + view.getCellText(i, tree.columns[0]), + view.getCellText(i, tree.columns[1]), + ]); + } + return result; + ''') + + def new_identity(self): + m = self.marionette + with m.using_context('chrome'): + m.set_pref('extensions.torbutton.confirm_newnym', False) + m.find_element('id', 'new-identity-button').click() + # Wait some time for new identity to finish. + time.sleep(2) + # Reload marionette session after new identity. + self.marionette.quit() + self.marionette.start_session() + self.marionette.timeout.implicit = 10 + + def delete_all_keys(self): + with self.marionette.using_context('content'): + self.marionette.navigate("about:preferences#privacy") + self.marionette.find_element( + 'id', 'torOnionServiceKeys-savedKeys').click() + return self.marionette.execute_script(''' + const dialog = document.querySelector('.dialogFrame'); + dialog.contentDocument.querySelector('#onionservices-savedkeys-removeall').click(); + ''') + + def test_client_auth(self): + m = self.marionette + m.timeout.implicit = 10 + + # Cancel auth + self.load_onion() + with m.using_context('chrome'): + cancel = m.find_element( + 'css selector', '#tor-clientauth-notification .popup-notification-secondary-button') + cancel.click() + + self.check_errors('Onionsite Requires Authentication', 'Access to the onionsite requires a key but none was provided.', + u'Details: 0xF4 \u2014 The client downloaded the requested onion service descriptor but was unable to decrypt its content because client authorization information is missing.') + + # Wrong auth + self.load_onion() + with m.using_context('chrome'): + m.find_element('id', 'tor-clientauth-notification-key').send_keys( + 'E4ST65PDZDVZRAW2FLT5RBFKYEM3GW73SRQDMEBLBDHQP3Y4NADQ') + m.find_element( + 'css selector', '#tor-clientauth-notification .popup-notification-primary-button').click() + Wait(m, timeout=m.timeout.page_load).until(lambda _: not m.find_element( + 'id', 'tor-clientauth-notification-key').is_displayed()) + Wait(m, timeout=m.timeout.page_load).until(lambda _: m.find_element( + 'id', 'tor-clientauth-notification-key').is_displayed()) + + # Good auth, don't remember key + with m.using_context('chrome'): + m.find_element( + 'id', 'tor-clientauth-notification-key').send_keys(self.private_key) + m.find_element( + 'css selector', '#tor-clientauth-notification .popup-notification-primary-button').click() + with m.using_context('content'): + m.find_element('id', 'enumeration') + keys = self.get_keys() + self.assertEqual(len(keys), 0) + self.new_identity() + self.load_onion() # This will block if the auth prompt is not displayed + + # Good auth, remember key + with m.using_context('chrome'): + m.find_element( + 'id', 'tor-clientauth-notification-key').send_keys(self.private_key) + m.find_element('id', 'tor-clientauth-persistkey-checkbox').click() + m.find_element( + 'css selector', '#tor-clientauth-notification .popup-notification-primary-button').click() + with m.using_context('content'): + m.find_element('id', 'enumeration') + keys = self.get_keys() + self.assertEqual(len(keys), 1) + self.assertEqual(keys[0][0], self.onion[:-6]) + self.assertEqual(keys[0][1], base64.b64encode( + base64.b32decode(self.private_key + '===='))) + self.new_identity() + with m.using_context('content'): + m.navigate('http://' + self.onion + + '/dom-objects-enumeration.html') # Should not block + + self.delete_all_keys() + # Wait a bit, otherwise it sometimes loads the onion without the auth prompt + time.sleep(5) + with m.using_context('content'): + self.load_onion() # Load and wait for the auth doorgahnger + + # Check invalid onion address error + with m.using_context('content'): + bad_char = 'a' if self.onion[-7:-6] != 'a' else 'b' + self.load_onion( + onion=self.onion[:-7] + bad_char + ".onion", wait_auth=False) + self.check_errors('Invalid Onionsite Address', 'The provided onionsite address is invalid. Please check that you entered it correctly.', + u'Details: 0xF6 \u2014 The provided .onion address is invalid. This error is returned due to one of the following reasons: the address checksum doesn\'t match, the ed25519 public key is invalid, or the encoding is invalid.') + + # TODO: check other onion errors
1 0
0 0
[tor-browser-bundle-testsuite/master] Bug 40004: Add test for 'Implement .onion alias urlbar rewrites' TB patch
by gk@torproject.org 15 Oct '20

15 Oct '20
commit cf696e9f07b8716e8115d59d9651982f3702fa32 Author: Alex Catarineu <acat(a)torproject.org> Date: Mon Jun 29 19:54:14 2020 +0200 Bug 40004: Add test for 'Implement .onion alias urlbar rewrites' TB patch --- TBBTestSuite/TestSuite/BrowserBundleTests.pm | 6 +++ marionette/tor_browser_tests/test_onion_alias.py | 67 ++++++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/TBBTestSuite/TestSuite/BrowserBundleTests.pm b/TBBTestSuite/TestSuite/BrowserBundleTests.pm index 5a642ef..931ab70 100644 --- a/TBBTestSuite/TestSuite/BrowserBundleTests.pm +++ b/TBBTestSuite/TestSuite/BrowserBundleTests.pm @@ -488,6 +488,12 @@ our @tests = ( use_net => 1, descr => 'Check that Onion-Location header handling works correctly', }, + { + name => 'onion_alias', + type => 'marionette', + use_net => 1, + descr => 'Check that onion alias urlbar rewrites work properly', + }, ); sub set_test_prefs { diff --git a/marionette/tor_browser_tests/test_onion_alias.py b/marionette/tor_browser_tests/test_onion_alias.py new file mode 100644 index 0000000..1495906 --- /dev/null +++ b/marionette/tor_browser_tests/test_onion_alias.py @@ -0,0 +1,67 @@ +from marionette_driver import By, Wait +from marionette_driver.errors import MarionetteException, NoSuchElementException, TimeoutException +from marionette_driver.legacy_actions import Actions +from marionette_harness import MarionetteTestCase, WindowManagerMixin + +import time + + +class Test(WindowManagerMixin, MarionetteTestCase): + def get_urlbar_value(self): + with self.marionette.using_context('chrome'): + return self.marionette.execute_script("return gURLBar.value;") + + def test_onion_alias(self): + m = self.marionette + m.timeout.implicit = 10 + + # Wait until .tor.onion rules have been loaded + with m.using_context('chrome'): + Wait(m, timeout=m.timeout.page_load).until( + lambda _: m.execute_script("return OnionAliasStore._onionMap.size;") > 0) + + with m.using_context('content'): + # Navigating to a known .tor.onion should redirect and rewrite the urlbar with the alias. + m.navigate('http://theintercept.securedrop.tor.onion') + self.assertEqual(m.get_url( + ), 'http://xpxduj55x2j27l2qytu2tcetykyfxbjbafin3x4i3ywddzphkbrd3jyd.onion/') + self.assertEqual(self.get_urlbar_value(), + 'theintercept.securedrop.tor.onion') + + # Bookmark should be created with the onion alias URL + with m.using_context('chrome'): + m.find_element('id', 'star-button-box').click() + m.find_element('id', 'editBookmarkPanelDoneButton').click() + recent_bookmarks = m.execute_script( + "return PlacesUtils.bookmarks.getRecent(1);") + self.assertEqual( + recent_bookmarks[0]["url"], "http://theintercept.securedrop.tor.onion/") + + # Opening a same-origin link should keep the onion alias in the urlbar + el = m.find_element('id', 'submit-documents-button') + action = Actions(m) + action.middle_click(el) + action.perform() + Wait(m, timeout=m.timeout.page_load).until( + lambda _: len(m.window_handles) > 1) + m.switch_to_window(m.window_handles[1]) + Wait(m, timeout=m.timeout.page_load).until( + lambda _: m.get_url() != 'about:blank') + self.assertEqual(m.get_url( + ), 'http://xpxduj55x2j27l2qytu2tcetykyfxbjbafin3x4i3ywddzphkbrd3jyd.onion/gener…') + self.assertEqual(self.get_urlbar_value(), + 'theintercept.securedrop.tor.onion/generate') + m.close() + m.switch_to_window(m.window_handles[0]) + + # Going directly to .onion should not rewrite the urlbar + new_tab = self.open_tab() + m.switch_to_window(new_tab) + m.navigate( + 'http://xpxduj55x2j27l2qytu2tcetykyfxbjbafin3x4i3ywddzphkbrd3jyd.onion') + self.assertEqual(m.get_url( + ), 'http://xpxduj55x2j27l2qytu2tcetykyfxbjbafin3x4i3ywddzphkbrd3jyd.onion/') + self.assertEqual(self.get_urlbar_value( + ), 'xpxduj55x2j27l2qytu2tcetykyfxbjbafin3x4i3ywddzphkbrd3jyd.onion') + m.close() + m.switch_to_window(self.start_tab)
1 0
0 0
[tor-browser-bundle-testsuite/master] Bug 40003: Add test for 'Implement Onion-Location' TB patch
by gk@torproject.org 15 Oct '20

15 Oct '20
commit fe257166a6e9a5bb4100a24674f98eed86822572 Author: Alex Catarineu <acat(a)torproject.org> Date: Mon Jun 29 19:41:47 2020 +0200 Bug 40003: Add test for 'Implement Onion-Location' TB patch --- TBBTestSuite/TestSuite/BrowserBundleTests.pm | 6 + .../tor_browser_tests/test_onion_location.py | 135 +++++++++++++++++++++ 2 files changed, 141 insertions(+) diff --git a/TBBTestSuite/TestSuite/BrowserBundleTests.pm b/TBBTestSuite/TestSuite/BrowserBundleTests.pm index 834641e..5a642ef 100644 --- a/TBBTestSuite/TestSuite/BrowserBundleTests.pm +++ b/TBBTestSuite/TestSuite/BrowserBundleTests.pm @@ -482,6 +482,12 @@ our @tests = ( use_net => 1, descr => 'Check onion security expectations', }, + { + name => 'onion_location', + type => 'marionette', + use_net => 1, + descr => 'Check that Onion-Location header handling works correctly', + }, ); sub set_test_prefs { diff --git a/marionette/tor_browser_tests/test_onion_location.py b/marionette/tor_browser_tests/test_onion_location.py new file mode 100644 index 0000000..1188250 --- /dev/null +++ b/marionette/tor_browser_tests/test_onion_location.py @@ -0,0 +1,135 @@ +from marionette_driver import By, Wait +from marionette_driver.errors import MarionetteException, NoSuchElementException, TimeoutException + +from marionette_harness import MarionetteTestCase, WindowManagerMixin + + +class Test(WindowManagerMixin, MarionetteTestCase): + + def test_onion_location(self): + m = self.marionette + m.timeout.implicit = 10 + + self.assertEqual(None, m.get_pref( + 'privacy.prioritizeonions.showNotification')) + + with m.using_context('content'): + m.navigate('https://www.torproject.org/') + + with m.using_context('chrome'): + # Check whether the urlbar badge is displayed + self.assertTrue(m.find_element( + 'id', 'onion-location-box').is_displayed()) + + # Check whether the notification is displayed the first time + notification = m.find_element('id', 'onion-location-notification') + self.assertTrue(notification.is_displayed()) + self.assertFalse(m.get_pref( + 'privacy.prioritizeonions.showNotification')) + always_prioritize = notification.find_element( + 'css selector', '.popup-notification-primary-button') + self.assertEqual(always_prioritize.get_attribute( + 'label'), 'Always Prioritize Onions') + + # Check learn more link + notification.find_element( + 'css selector', '.popup-notification-learnmore-link').click() + with m.using_context('content'): + Wait(m, timeout=m.timeout.page_load).until( + lambda _: len(m.window_handles) > 1) + m.switch_to_window(m.window_handles[1]) + Wait(m, timeout=m.timeout.page_load).until( + lambda _: m.get_url() != "about:blank") + self.assertEqual( + m.get_url(), "https://tb-manual.torproject.org/onion-services/") + m.close() + m.switch_to_window(m.window_handles[0]) + + with m.using_context('chrome'): + # Close the notification and check that it's not displayed anymore. + notification = m.find_element('id', 'onion-location-notification') + not_now = notification.find_element( + 'css selector', '.popup-notification-secondary-button') + self.assertEqual(not_now.get_attribute('label'), 'Not Now') + not_now.click() + try: + self.assertFalse(m.find_element( + 'id', 'onion-location-notification').is_displayed()) + except NoSuchElementException: + pass + + # Show the notification again + m.set_pref('privacy.prioritizeonions.showNotification', None) + new_tab = self.open_tab() + m.switch_to_window(new_tab) + m.close() + m.switch_to_window(self.start_tab) + + # Click "Always prioritize" in the notification + notification = m.find_element('id', 'onion-location-notification') + notification.find_element( + 'css selector', '.popup-notification-primary-button').click() + self.assertTrue(m.get_pref('privacy.prioritizeonions.enabled')) + + with m.using_context('content'): + m.switch_to_window(m.window_handles[1]) + self.assertEqual( + m.get_url(), 'about:preferences#privacy-onionservices') + m.close() + m.switch_to_window(self.start_tab) + + # Check that the original page is redirected to .onion + Wait(m, timeout=m.timeout.page_load).until( + lambda _: m.get_url() != 'https://www.torproject.org/') + self.assertEqual( + m.get_url(), 'http://expyuzz4wqqyqhjn.onion/index.html') + + # Check that auto-redirects work + m.navigate('https://www.torproject.org/') + self.assertEqual(m.get_url(), 'https://www.torproject.org/') + Wait(m, timeout=m.timeout.page_load).until( + lambda _: m.get_url() != 'https://www.torproject.org/') + self.assertEqual( + m.get_url(), 'http://expyuzz4wqqyqhjn.onion/index.html') + + # Go to preferences and disable auto-redirects + new_tab = self.open_tab() + m.switch_to_window(new_tab) + m.navigate('about:preferences#privacy-onionservices') + m.find_element('id', 'onionServicesRadioAsk').click() + self.assertFalse(m.get_pref( + 'privacy.prioritizeonions.enabled')) + m.close() + m.switch_to_window(self.start_tab) + m.navigate('https://www.torproject.org/') + try: + Wait(m, timeout=5).until(lambda _: m.get_url() + != 'https://www.torproject.org/') + self.assertTrue(False, "Should not redirect") + except TimeoutException: + pass + + # Check that the page is redirected when clicking on the urlbar badge + with m.using_context('chrome'): + self.assertTrue(m.find_element( + 'id', 'onion-location-box').is_displayed()) + m.find_element('id', 'onion-location-box').click() + with m.using_context('content'): + Wait(m, timeout=5).until(lambda _: m.get_url() + != 'https://www.torproject.org/') + self.assertEqual( + m.get_url(), 'http://expyuzz4wqqyqhjn.onion/index.html') + + # Check learn more link + with m.using_context('content'): + m.navigate('about:preferences#privacy-onionservices') + m.find_element('id', 'onionServicesLearnMore').click() + Wait(m, timeout=m.timeout.page_load).until( + lambda _: len(m.window_handles) > 1) + m.switch_to_window(m.window_handles[1]) + Wait(m, timeout=m.timeout.page_load).until( + lambda _: m.get_url() != "about:blank") + self.assertEqual( + m.get_url(), "https://tb-manual.torproject.org/onion-services/") + m.close() + m.switch_to_window(m.window_handles[0])
1 0
0 0
[tor-browser-bundle-testsuite/master] Fix onion location test issue in 81
by gk@torproject.org 15 Oct '20

15 Oct '20
commit 120a97eb4b3c0250ce4613a8f314dcd3841430fb Author: Alex Catarineu <acat(a)torproject.org> Date: Thu Aug 27 22:10:27 2020 +0200 Fix onion location test issue in 81 --- .../tor_browser_tests/test_onion_location.py | 36 ++++++++++++++-------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/marionette/tor_browser_tests/test_onion_location.py b/marionette/tor_browser_tests/test_onion_location.py index 1188250..d028d04 100644 --- a/marionette/tor_browser_tests/test_onion_location.py +++ b/marionette/tor_browser_tests/test_onion_location.py @@ -5,6 +5,16 @@ from marionette_harness import MarionetteTestCase, WindowManagerMixin class Test(WindowManagerMixin, MarionetteTestCase): + # To be investigated in #40007: + # In 81, marionette.get_url() sometimes fails with: + # `UnknownException: TypeError: browsingContext.currentWindowGlobal is null` + # It happens when clicking "Always Prioritize Onions" in the doorhanger: + # opens a new tab + refreshes the previous one, then when we close the new tab + # and move to the old one, marionette.get_url() throws the error. + # Until a proper fix, this workaround seems to work fine. + def get_url(self): + with self.marionette.using_context('content'): + return self.marionette.execute_script("return document.location.href;") def test_onion_location(self): m = self.marionette @@ -39,9 +49,9 @@ class Test(WindowManagerMixin, MarionetteTestCase): lambda _: len(m.window_handles) > 1) m.switch_to_window(m.window_handles[1]) Wait(m, timeout=m.timeout.page_load).until( - lambda _: m.get_url() != "about:blank") + lambda _: self.get_url() != "about:blank") self.assertEqual( - m.get_url(), "https://tb-manual.torproject.org/onion-services/") + self.get_url(), "https://tb-manual.torproject.org/onion-services/") m.close() m.switch_to_window(m.window_handles[0]) @@ -74,23 +84,23 @@ class Test(WindowManagerMixin, MarionetteTestCase): with m.using_context('content'): m.switch_to_window(m.window_handles[1]) self.assertEqual( - m.get_url(), 'about:preferences#privacy-onionservices') + self.get_url(), 'about:preferences#privacy-onionservices') m.close() m.switch_to_window(self.start_tab) # Check that the original page is redirected to .onion Wait(m, timeout=m.timeout.page_load).until( - lambda _: m.get_url() != 'https://www.torproject.org/') + lambda _: self.get_url() != 'https://www.torproject.org/') self.assertEqual( - m.get_url(), 'http://expyuzz4wqqyqhjn.onion/index.html') + self.get_url(), 'http://expyuzz4wqqyqhjn.onion/index.html') # Check that auto-redirects work m.navigate('https://www.torproject.org/') - self.assertEqual(m.get_url(), 'https://www.torproject.org/') + self.assertEqual(self.get_url(), 'https://www.torproject.org/') Wait(m, timeout=m.timeout.page_load).until( - lambda _: m.get_url() != 'https://www.torproject.org/') + lambda _: self.get_url() != 'https://www.torproject.org/') self.assertEqual( - m.get_url(), 'http://expyuzz4wqqyqhjn.onion/index.html') + self.get_url(), 'http://expyuzz4wqqyqhjn.onion/index.html') # Go to preferences and disable auto-redirects new_tab = self.open_tab() @@ -103,7 +113,7 @@ class Test(WindowManagerMixin, MarionetteTestCase): m.switch_to_window(self.start_tab) m.navigate('https://www.torproject.org/') try: - Wait(m, timeout=5).until(lambda _: m.get_url() + Wait(m, timeout=5).until(lambda _: self.get_url() != 'https://www.torproject.org/') self.assertTrue(False, "Should not redirect") except TimeoutException: @@ -115,10 +125,10 @@ class Test(WindowManagerMixin, MarionetteTestCase): 'id', 'onion-location-box').is_displayed()) m.find_element('id', 'onion-location-box').click() with m.using_context('content'): - Wait(m, timeout=5).until(lambda _: m.get_url() + Wait(m, timeout=5).until(lambda _: self.get_url() != 'https://www.torproject.org/') self.assertEqual( - m.get_url(), 'http://expyuzz4wqqyqhjn.onion/index.html') + self.get_url(), 'http://expyuzz4wqqyqhjn.onion/index.html') # Check learn more link with m.using_context('content'): @@ -128,8 +138,8 @@ class Test(WindowManagerMixin, MarionetteTestCase): lambda _: len(m.window_handles) > 1) m.switch_to_window(m.window_handles[1]) Wait(m, timeout=m.timeout.page_load).until( - lambda _: m.get_url() != "about:blank") + lambda _: self.get_url() != "about:blank") self.assertEqual( - m.get_url(), "https://tb-manual.torproject.org/onion-services/") + self.get_url(), "https://tb-manual.torproject.org/onion-services/") m.close() m.switch_to_window(m.window_handles[0])
1 0
0 0
[tor-browser-bundle-testsuite/master] Bug 40001: Add test for 'Communicating security expectations TB patch'
by gk@torproject.org 15 Oct '20

15 Oct '20
commit a6c55026833dbdb0a7769d7352579fd796e7573c Author: Alex Catarineu <acat(a)torproject.org> Date: Mon Jun 29 19:37:00 2020 +0200 Bug 40001: Add test for 'Communicating security expectations TB patch' --- TBBTestSuite/TestSuite/BrowserBundleTests.pm | 6 + marionette/setup.py | 1 + .../test_onion_security_expectations.py | 134 +++++++++++++++++++++ test-data/mixed.html | 8 ++ test-data/mixed_active.html | 8 ++ 5 files changed, 157 insertions(+) diff --git a/TBBTestSuite/TestSuite/BrowserBundleTests.pm b/TBBTestSuite/TestSuite/BrowserBundleTests.pm index 4a8908e..834641e 100644 --- a/TBBTestSuite/TestSuite/BrowserBundleTests.pm +++ b/TBBTestSuite/TestSuite/BrowserBundleTests.pm @@ -476,6 +476,12 @@ our @tests = ( # Bug 30432: temporarily disable test enable => sub { undef }, }, + { + name => 'onion_security_expectations', + type => 'marionette', + use_net => 1, + descr => 'Check onion security expectations', + }, ); sub set_test_prefs { diff --git a/marionette/setup.py b/marionette/setup.py index 78f4522..9dc9772 100644 --- a/marionette/setup.py +++ b/marionette/setup.py @@ -5,6 +5,7 @@ PACKAGE_VERSION = '0.3' deps = [ 'marionette_harness == 5.0.0', 'marionette_driver == 3.0.0', + 'stem == 1.8.0', ] setup(name='tor-browser-tests', diff --git a/marionette/tor_browser_tests/test_onion_security_expectations.py b/marionette/tor_browser_tests/test_onion_security_expectations.py new file mode 100644 index 0000000..866ae1e --- /dev/null +++ b/marionette/tor_browser_tests/test_onion_security_expectations.py @@ -0,0 +1,134 @@ +from marionette_driver import By, Wait +from marionette_driver.errors import MarionetteException, NoSuchElementException, TimeoutException +from marionette_driver.legacy_actions import Actions +from marionette_harness import MarionetteTestCase, WindowManagerMixin + +import testsuite + +from stem.control import Controller + +from urlparse import urlparse + +import time + +class OnionFixturesMixin(object): + def setUp(self): + super(OnionFixturesMixin, self).setUp() + tor_control_port = testsuite.TestSuite( + ).t['options']['tor-control-port'] + with Controller.from_port(port=int(tor_control_port)) as controller: + controller.authenticate() + port = urlparse(self.marionette.absolute_url('')).port + response = controller.create_ephemeral_hidden_service( + {80: port}, + key_content='ED25519-V3', + await_publication=True, + detached=True, + ) + self.service_id = response.service_id + + def tearDown(self): + tor_control_port = testsuite.TestSuite( + ).t['options']['tor-control-port'] + with Controller.from_port(port=int(tor_control_port)) as controller: + controller.authenticate() + controller.remove_ephemeral_hidden_service(self.service_id) + super(OnionFixturesMixin, self).tearDown() + + +class Test(OnionFixturesMixin, WindowManagerMixin, MarionetteTestCase): + def get_identity_class(self): + with self.marionette.using_context('chrome'): + return self.marionette.execute_script(''' + return document.getElementById("identity-box").className; + ''') + + def get_identity_icon(self): + with self.marionette.using_context('chrome'): + return self.marionette.execute_script(''' + const el = document.getElementById("identity-icon"); + return document.defaultView.getComputedStyle(el)["list-style-image"]; + ''') + + def get_connection_type(self): + m = self.marionette + with self.marionette.using_context('chrome'): + self.execute_chrome( + 'document.getElementById("identity-popup-more-info").click()') + m.switch_to_window(m.chrome_window_handles[1]) + Wait(m, timeout=m.timeout.page_load).until( + lambda _: m.find_element('id', 'security-technical-shortform').text != '') + text = m.find_element('id', 'security-technical-shortform').text + m.close_chrome_window() + m.switch_to_window(self.start_window) + return text + + def execute_chrome(self, script): + with self.marionette.using_context('chrome'): + return self.marionette.execute_script(script) + + def test_onion_security_expectations(self): + m = self.marionette + m.timeout.implicit = 10 + + # Wait some more time to make sure the onion service is set up + time.sleep(10) + + # Regular onion + with m.using_context('content'): + m.navigate('http://' + self.service_id + '.onion') + self.assertTrue(self.execute_chrome( + "return !!gIdentityHandler._isSecureConnection;")) + self.assertEqual(self.get_identity_class(), 'onionUnknownIdentity') + self.assertEqual(self.get_connection_type(), + 'Connection Encrypted (Onion Service)') + self.assertEqual(self.get_identity_icon(), + 'url("chrome://browser/skin/onion.svg")') + + # Onion with mixed display content + with m.using_context('content'): + m.navigate('http://' + self.service_id + '.onion/mixed.html') + self.assertFalse(self.execute_chrome( + "return !!gIdentityHandler._isSecureConnection;")) + self.assertEqual(self.get_identity_class(), + 'onionUnknownIdentity onionMixedDisplayContent') + self.assertEqual(self.get_connection_type(), + 'Connection Partially Encrypted') + self.assertEqual(self.get_identity_icon(), + 'url("chrome://browser/skin/onion-warning.svg")') + + # Onion with mixed active content + with m.using_context('content'): + m.navigate('http://' + self.service_id + + '.onion/mixed_active.html') + self.assertTrue(self.execute_chrome( + "return !!gIdentityHandler._isSecureConnection;")) + self.assertEqual(self.get_identity_class(), 'onionUnknownIdentity') + self.assertEqual(self.get_connection_type(), + 'Connection Encrypted (Onion Service)') + self.assertEqual(self.get_identity_icon(), + 'url("chrome://browser/skin/onion.svg")') + # Reload with mixed content protection disabled + self.execute_chrome( + 'gIdentityHandler.disableMixedContentProtection();') + Wait(m, timeout=m.timeout.page_load).until( + lambda _: self.get_identity_class() != 'onionUnknownIdentity') + self.assertFalse(self.execute_chrome( + "return !!gIdentityHandler._isSecureConnection;")) + self.assertEqual(self.get_identity_class(), + 'onionUnknownIdentity onionMixedActiveContent') + self.assertEqual(self.get_connection_type(), + 'Connection Partially Encrypted') + self.assertEqual(self.get_identity_icon(), + 'url("chrome://browser/skin/onion-slash.svg")') + + # Onion with valid TLS certificate + with m.using_context('content'): + m.navigate('https://3g2upl4pq6kufc4m.onion/') + self.assertTrue(self.execute_chrome( + "return !!gIdentityHandler._isSecureConnection;")) + self.assertEqual(self.get_identity_class(), 'onionVerifiedDomain') + self.assertEqual(self.get_connection_type( + ), 'Connection Encrypted (Onion Service, TLS_AES_256_GCM_SHA384, 256 bit keys, TLS 1.3)') + self.assertEqual(self.get_identity_icon(), + 'url("chrome://browser/skin/onion.svg")') diff --git a/test-data/mixed.html b/test-data/mixed.html new file mode 100644 index 0000000..3de98a1 --- /dev/null +++ b/test-data/mixed.html @@ -0,0 +1,8 @@ +<!DOCTYPE html> +<html> + <head> + </head> + <body> + <img src="http://www.torproject.org/static/images/tor-logo@2x.png"/> + </body> +</html> diff --git a/test-data/mixed_active.html b/test-data/mixed_active.html new file mode 100644 index 0000000..23430ab --- /dev/null +++ b/test-data/mixed_active.html @@ -0,0 +1,8 @@ +<!DOCTYPE html> +<html> + <head> + </head> + <body> + <iframe src="http://www.torproject.org"></iframe> + </body> +</html>
1 0
0 0
[tor-browser-bundle-testsuite/master] Disable navigation timing test for >= 79
by gk@torproject.org 15 Oct '20

15 Oct '20
commit 0f220abf788eb987e5b158d0b376d2f88c6907e2 Author: Alex Catarineu <acat(a)torproject.org> Date: Mon Aug 3 15:45:25 2020 +0200 Disable navigation timing test for >= 79 --- marionette/tor_browser_tests/test_navigation-timing.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/marionette/tor_browser_tests/test_navigation-timing.py b/marionette/tor_browser_tests/test_navigation-timing.py index 0b0c125..9d38697 100644 --- a/marionette/tor_browser_tests/test_navigation-timing.py +++ b/marionette/tor_browser_tests/test_navigation-timing.py @@ -7,11 +7,12 @@ from marionette_driver import By from marionette_driver.errors import MarionetteException from marionette_harness import MarionetteTestCase +import testsuite -class Test(MarionetteTestCase): +class Test(testsuite.TorBrowserTest): def setUp(self): - MarionetteTestCase.setUp(self) + testsuite.TorBrowserTest.setUp(self) self.TEST_URL = "https://www.mediawiki.org/wiki/MediaWiki" @@ -40,6 +41,9 @@ class Test(MarionetteTestCase): } def test_navigation_timing(self): + if (self.get_version() >= 79): + # Navigation timing was reenabled in 79 (https://bugzilla.mozilla.org/show_bug.cgi?id=1637985) + return with self.marionette.using_context('content'): self.marionette.navigate(self.TEST_URL)
1 0
0 0
[tor-browser-bundle-testsuite/master] Fix slider settings test for 78.2
by gk@torproject.org 15 Oct '20

15 Oct '20
commit 3c2da7d966cf1a2eb02812d5ab05eea774a84359 Author: Alex Catarineu <acat(a)torproject.org> Date: Wed Aug 26 16:24:12 2020 +0200 Fix slider settings test for 78.2 --- marionette/tor_browser_tests/test_slider_settings.py | 1 - 1 file changed, 1 deletion(-) diff --git a/marionette/tor_browser_tests/test_slider_settings.py b/marionette/tor_browser_tests/test_slider_settings.py index 290482e..f61ad21 100644 --- a/marionette/tor_browser_tests/test_slider_settings.py +++ b/marionette/tor_browser_tests/test_slider_settings.py @@ -20,7 +20,6 @@ class Test(MarionetteTestCase): "javascript.options.ion" : [ 0, False, False, False, True ], "javascript.options.baselinejit" : [ 0, False, False, False, True ], "javascript.options.native_regexp" : [ 0, False, False, False, True ], - "media.webaudio.enabled" : [ 0, False, False, False, True ], "mathml.disabled" : [ 0, True, True, True, False], "gfx.font_rendering.opentype_svg.enabled" : [ 0, False, False, True, True ], "svg.disabled" : [ 0, True, False, False, False],
1 0
0 0
[tor-browser-bundle-testsuite/master] Bug 40005: Add test for 'Replace security slider with security level UI' TB patch
by gk@torproject.org 15 Oct '20

15 Oct '20
commit d97948001366242e3baab4d49dd0706cf42aa8ab Author: Alex Catarineu <acat(a)torproject.org> Date: Mon Jun 29 19:56:14 2020 +0200 Bug 40005: Add test for 'Replace security slider with security level UI' TB patch --- TBBTestSuite/TestSuite/BrowserBundleTests.pm | 6 ++ .../tor_browser_tests/test_security_level_ui.py | 72 ++++++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/TBBTestSuite/TestSuite/BrowserBundleTests.pm b/TBBTestSuite/TestSuite/BrowserBundleTests.pm index 931ab70..37efae6 100644 --- a/TBBTestSuite/TestSuite/BrowserBundleTests.pm +++ b/TBBTestSuite/TestSuite/BrowserBundleTests.pm @@ -494,6 +494,12 @@ our @tests = ( use_net => 1, descr => 'Check that onion alias urlbar rewrites work properly', }, + { + name => 'security_level_ui', + type => 'marionette', + use_net => 1, + descr => 'Check that the security level UI is working properly', + }, ); sub set_test_prefs { diff --git a/marionette/tor_browser_tests/test_security_level_ui.py b/marionette/tor_browser_tests/test_security_level_ui.py new file mode 100644 index 0000000..f24e7ea --- /dev/null +++ b/marionette/tor_browser_tests/test_security_level_ui.py @@ -0,0 +1,72 @@ +from marionette_driver import By, Wait +from marionette_driver.errors import MarionetteException + +from marionette_harness import MarionetteTestCase + + +class Test(MarionetteTestCase): + def test_security_level_ui(self): + custom_pref = 'javascript.options.wasm' + m = self.marionette + m.timeout.implicit = 5 + with m.using_context('chrome'): + m.find_element('id', 'security-level-button').click() + m.find_element( + 'id', 'securityLevel-advancedSecuritySettings').click() + with m.using_context('content'): + # Test whether changing the security level value works + self.assertEqual( + m.get_url(), "about:preferences#privacy-securitylevel") + self.assertEqual(4, m.get_pref( + 'extensions.torbutton.security_slider')) + m.find_element( + 'css selector', '#securityLevel-vbox-safer radio').click() + self.assertEqual(2, m.get_pref( + 'extensions.torbutton.security_slider')) + m.find_element( + 'css selector', '#securityLevel-vbox-safest radio').click() + self.assertEqual(1, m.get_pref( + 'extensions.torbutton.security_slider')) + m.find_element( + 'css selector', '#securityLevel-vbox-standard radio').click() + self.assertEqual(4, m.get_pref( + 'extensions.torbutton.security_slider')) + + # Test custom security settings + elem = m.find_element('id', 'securityLevel-restoreDefaults') + self.assertEqual(elem.is_displayed(), False) + m.set_pref(custom_pref, False) + self.assertEqual(elem.is_displayed(), True) + elem.click() + self.assertEqual(True, m.get_pref(custom_pref)) + + # Test Learn More link + m.find_element('id', 'securityLevel-learnMore').click() + Wait(m, timeout=m.timeout.page_load).until( + lambda _: len(m.window_handles) > 1) + m.switch_to_window(m.window_handles[1]) + Wait(m, timeout=m.timeout.page_load).until( + lambda _: m.get_url() != "about:blank") + self.assertTrue( + m.get_url() in ["https://tb-manual.torproject.org/en-US/security-settings/", "https://tb-manual.torproject.org/security-settings/"]) + + # Test Learn More link from panel + m.find_element('id', 'security-level-button').click() + m.find_element('id', 'securityLevel-learnMore').click() + Wait(m, timeout=m.timeout.page_load).until( + lambda _: len(m.window_handles) > 2) + with m.using_context('content'): + m.switch_to_window(m.window_handles[2]) + Wait(m, timeout=m.timeout.page_load).until( + lambda _: m.get_url() != "about:blank") + self.assertTrue( + m.get_url() in ["https://tb-manual.torproject.org/en-US/security-settings/", "https://tb-manual.torproject.org/security-settings/"]) + + # Test custom settings from panel + m.set_pref(custom_pref, False) + elem = m.find_element('id', 'securityLevel-restoreDefaults') + self.assertEqual(elem.is_displayed(), False) + m.find_element('id', 'security-level-button').click() + self.assertEqual(elem.is_displayed(), True) + elem.click() + self.assertEqual(True, m.get_pref(custom_pref))
1 0
0 0
[tor-browser-bundle-testsuite/master] Fix onion alias test for same reason as previous commit
by gk@torproject.org 15 Oct '20

15 Oct '20
commit d582cb8edb59ba625c24586a2b8b202a83440e11 Author: Alex Catarineu <acat(a)torproject.org> Date: Thu Aug 27 22:28:26 2020 +0200 Fix onion alias test for same reason as previous commit --- marionette/tor_browser_tests/test_onion_alias.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/marionette/tor_browser_tests/test_onion_alias.py b/marionette/tor_browser_tests/test_onion_alias.py index 1495906..39dcc49 100644 --- a/marionette/tor_browser_tests/test_onion_alias.py +++ b/marionette/tor_browser_tests/test_onion_alias.py @@ -7,6 +7,10 @@ import time class Test(WindowManagerMixin, MarionetteTestCase): + def get_url(self): + with self.marionette.using_context('content'): + return self.marionette.execute_script("return document.location.href;") + def get_urlbar_value(self): with self.marionette.using_context('chrome'): return self.marionette.execute_script("return gURLBar.value;") @@ -23,7 +27,7 @@ class Test(WindowManagerMixin, MarionetteTestCase): with m.using_context('content'): # Navigating to a known .tor.onion should redirect and rewrite the urlbar with the alias. m.navigate('http://theintercept.securedrop.tor.onion') - self.assertEqual(m.get_url( + self.assertEqual(self.get_url( ), 'http://xpxduj55x2j27l2qytu2tcetykyfxbjbafin3x4i3ywddzphkbrd3jyd.onion/') self.assertEqual(self.get_urlbar_value(), 'theintercept.securedrop.tor.onion') @@ -46,8 +50,8 @@ class Test(WindowManagerMixin, MarionetteTestCase): lambda _: len(m.window_handles) > 1) m.switch_to_window(m.window_handles[1]) Wait(m, timeout=m.timeout.page_load).until( - lambda _: m.get_url() != 'about:blank') - self.assertEqual(m.get_url( + lambda _: self.get_url() != 'about:blank') + self.assertEqual(self.get_url( ), 'http://xpxduj55x2j27l2qytu2tcetykyfxbjbafin3x4i3ywddzphkbrd3jyd.onion/gener…') self.assertEqual(self.get_urlbar_value(), 'theintercept.securedrop.tor.onion/generate') @@ -59,7 +63,7 @@ class Test(WindowManagerMixin, MarionetteTestCase): m.switch_to_window(new_tab) m.navigate( 'http://xpxduj55x2j27l2qytu2tcetykyfxbjbafin3x4i3ywddzphkbrd3jyd.onion') - self.assertEqual(m.get_url( + self.assertEqual(self.get_url( ), 'http://xpxduj55x2j27l2qytu2tcetykyfxbjbafin3x4i3ywddzphkbrd3jyd.onion/') self.assertEqual(self.get_urlbar_value( ), 'xpxduj55x2j27l2qytu2tcetykyfxbjbafin3x4i3ywddzphkbrd3jyd.onion')
1 0
0 0
[tor-browser-bundle-testsuite/master] Fix dom objects enumeration tests for 80
by gk@torproject.org 15 Oct '20

15 Oct '20
commit ab71188e49358619bfe06a2b618200b2f5e5b68f Author: Alex Catarineu <acat(a)torproject.org> Date: Mon Aug 3 12:18:15 2020 +0200 Fix dom objects enumeration tests for 80 --- marionette/tor_browser_tests/lib/testsuite.py | 7 +++++++ .../test_dom-objects-enumeration-worker.py | 15 +++++++++++---- .../tor_browser_tests/test_dom-objects-enumeration.py | 16 ++++++++++++---- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/marionette/tor_browser_tests/lib/testsuite.py b/marionette/tor_browser_tests/lib/testsuite.py index 78713c8..88b1953 100644 --- a/marionette/tor_browser_tests/lib/testsuite.py +++ b/marionette/tor_browser_tests/lib/testsuite.py @@ -1,5 +1,6 @@ import os import json +from marionette_harness import MarionetteTestCase class TestSuite(object): def __init__(self): @@ -24,3 +25,9 @@ class TestSuite(object): output = open(screenshot_file, 'w') output.write(png_data) output.close() + + +class TorBrowserTest(MarionetteTestCase): + def get_version(self): + with self.marionette.using_context("chrome"): + return self.marionette.execute_script("return parseFloat(AppConstants.MOZ_APP_VERSION);") diff --git a/marionette/tor_browser_tests/test_dom-objects-enumeration-worker.py b/marionette/tor_browser_tests/test_dom-objects-enumeration-worker.py index 59d771b..88f5792 100644 --- a/marionette/tor_browser_tests/test_dom-objects-enumeration-worker.py +++ b/marionette/tor_browser_tests/test_dom-objects-enumeration-worker.py @@ -1,9 +1,10 @@ from marionette_harness import MarionetteTestCase +import testsuite -class Test(MarionetteTestCase): +class Test(testsuite.TorBrowserTest): def setUp(self): - MarionetteTestCase.setUp(self) + testsuite.TorBrowserTest.setUp(self) self.marionette.set_pref("network.proxy.allow_hijacking_localhost", False) self.test_page_file_url = self.marionette.absolute_url("dom-objects-enumeration.html?testType=worker") @@ -196,8 +197,14 @@ class Test(MarionetteTestCase): "XMLHttpRequestEventTarget", "XMLHttpRequestUpload", ] + self.expectedObjects80 = self.expectedObjects + ["AggregateError", "FinalizationRegistry", "WeakRef"] + self.expectedObjects80.sort() def test_dom_objects_enumeration_workers(self): + expectedObjects = self.expectedObjects + if self.get_version() >= 80: + expectedObjects = self.expectedObjects80 + with self.marionette.using_context('content'): self.marionette.navigate(self.test_page_file_url) self.marionette.timeout.implicit = 5 @@ -206,7 +213,7 @@ class Test(MarionetteTestCase): err = False unknown_objects = '' for l in r: - if l in self.expectedObjects: + if l in expectedObjects: continue err = True unknown_objects += l + "\n" @@ -214,7 +221,7 @@ class Test(MarionetteTestCase): err_msg = "Unknown objects:\n%s" % unknown_objects self.assertFalse(err, msg=err_msg) - for l in self.expectedObjects: + for l in expectedObjects: if l in r: continue err = True diff --git a/marionette/tor_browser_tests/test_dom-objects-enumeration.py b/marionette/tor_browser_tests/test_dom-objects-enumeration.py index be2ae65..3db4366 100644 --- a/marionette/tor_browser_tests/test_dom-objects-enumeration.py +++ b/marionette/tor_browser_tests/test_dom-objects-enumeration.py @@ -8,10 +8,11 @@ from marionette_driver import By from marionette_driver.errors import MarionetteException from marionette_harness import MarionetteTestCase +import testsuite -class Test(MarionetteTestCase): +class Test(testsuite.TorBrowserTest): def setUp(self): - MarionetteTestCase.setUp(self) + testsuite.TorBrowserTest.setUp(self) self.marionette.set_pref("network.proxy.allow_hijacking_localhost", False) self.test_page_file_url = self.marionette.absolute_url("dom-objects-enumeration.html?testType=window") # The list of expected DOM objects @@ -753,8 +754,15 @@ class Test(MarionetteTestCase): "XPathResult", "XSLTProcessor", ] + self.expectedObjects80 = self.expectedObjects + ["AggregateError", "FinalizationRegistry", "WeakRef"] + self.expectedObjects80.remove("content") + self.expectedObjects80.sort() def test_dom_objects_enumeration(self): + expectedObjects = self.expectedObjects + if self.get_version() >= 80: + expectedObjects = self.expectedObjects80 + with self.marionette.using_context('content'): self.marionette.navigate(self.test_page_file_url) self.marionette.timeout.implicit = 5 @@ -763,7 +771,7 @@ class Test(MarionetteTestCase): err = False unknown_objects = '' for l in r: - if l in self.expectedObjects: + if l in expectedObjects: continue err = True unknown_objects += l + "\n" @@ -771,7 +779,7 @@ class Test(MarionetteTestCase): err_msg = "Unknown objects:\n%s" % unknown_objects self.assertFalse(err, msg=err_msg) - for l in self.expectedObjects: + for l in expectedObjects: if l in r: continue err = True
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 1385
  • 1386
  • 1387
  • 1388
  • 1389
  • 1390
  • 1391
  • ...
  • 2061
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.