test_navigation.py TestBackForwardNavigation.test_certificate_error | AssertionError: InsecureCertificateException not raised

NEW
Unassigned

Status

P3
normal
2 years ago
a year ago

People

(Reporter: whimboo, Unassigned)

Tracking

Version 3
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

2 years ago
Running the Marionette unit test test_navigation.py with the --repeat option the test TestBackForwardNavigation.test_certificate_error is always failing starting with the first repeat.

TEST-UNEXPECTED-FAIL | test_navigation.py TestBackForwardNavigation.test_certificate_error | AssertionError: InsecureCertificateException not raised
Traceback (most recent call last):
  File "/Volumes/data/code/gecko/testing/marionette/harness/marionette_harness/marionette_test/testcases.py", line 166, in run
    testMethod()
  File "/Volumes/data/code/gecko/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py", line 479, in test_certificate_error
    self.run_bfcache_test(test_pages)
  File "/Volumes/data/code/gecko/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py", line 289, in run_bfcache_test
    self.marionette.go_back()
(Reporter)

Comment 1

2 years ago
The page load events look like the following:

1494272590202	Marionette	TRACE	14 -> [0,31,"goBack",{}]
1494272590208	Marionette	DEBUG	Received DOM event "beforeunload" for "http://127.0.0.1:56967/test.html"
1494272590223	Marionette	DEBUG	Received DOM event "pagehide" for "http://127.0.0.1:56967/test.html"
1494272590224	Marionette	DEBUG	Received DOM event "unload" for "http://127.0.0.1:56967/test.html"
++DOMWINDOW == 24 (0x11d674000) [pid = 85778] [serial = 24] [outer = 0x11cbef800]
1494272590241	Marionette	DEBUG	Received DOM event "DOMContentLoaded" for "https://127.0.0.1:56968/test.html"
1494272590248	Marionette	DEBUG	Received DOM event "pageshow" for "https://127.0.0.1:56968/test.html"

So there is indeed no insecure cert error raised because we do not load any error page when `DOMContentLoaded` is received. But the test shows such an error when setting up the test.
(Reporter)

Comment 2

2 years ago
Created attachment 8865599 [details]
minimized testcase

Andreas, here is a minimized testcase for Marionette. As it looks like starting the new session correctly resets `acceptInsecureCerts` to `false`, but we might miss to revert some internal state?

Given that you wrote all this code, could you have a look at this?
Flags: needinfo?(ato)
(In reply to Henrik Skupin (:whimboo) from comment #2)
> Andreas, here is a minimized testcase for Marionette. As it looks like
> starting the new session correctly resets `acceptInsecureCerts` to `false`,
> but we might miss to revert some internal state?

The problem here appears to be that it loads the https: document from bfcache when it calls go_back().  Since this document is already cached, it never hits the network to check if the certificate is valid.  This makes sense, and is the behaviour I would expect.

We probably want to clear the bfcache when a new Marionette session is started so that the effects of a previously loaded https: site where the certificate was ignored would not affect the new session.

I confirmed this theory by adding a time.sleep(100) after the last go_back() call and reloaded the document.  The reloaded document causes it to navigate to about:certerror.  I also checked the capabilities in listener.js, and acceptInsecureCerts is false.
Flags: needinfo?(ato)
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.