Create a test that checks about:cache after private browsing

RESOLVED FIXED in Firefox 25

Status

()

Firefox
Private Browsing
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: Manuela Muntean [Away], Assigned: Manuela Muntean [Away])

Tracking

unspecified
Firefox 25
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Assignee)

Description

4 years ago
This test should cover MozTrap test 6047.

STR:
1. Clear cache through Tools > Clear Recent History
2. Open about:cache
3. Go to the File main menu and select "New Private Window" (or press Ctrl+Shift+P / Cmd+Shift+P).
4. Navigate to www.craigslist.org
5. Open about:cache and click "List cache entries" under Memory Cache
6. Close the private window
7. Check about:cache

Expected Results:
Step 2: Disk cache should report 0KB and have no entries.
Step 5: You should see some entries from the craigslist domain.
Step 7: Disk cache should report no "craigslist" entries.
(Assignee)

Updated

4 years ago
Assignee: nobody → manuela.muntean
(Assignee)

Updated

4 years ago
Status: NEW → ASSIGNED
(Assignee)

Updated

4 years ago
Version: Trunk → unspecified
(Assignee)

Comment 1

4 years ago
Ehsan, I looked through mxr and didn't find an existing test for this. Please let me know if there is one and I just didn't find it. Thanks!
Flags: needinfo?(ehsan)
(In reply to Manuela Muntean [:Manuela] [QA] from comment #1)
> Ehsan, I looked through mxr and didn't find an existing test for this.
> Please let me know if there is one and I just didn't find it. Thanks!

I don't think we have a test for this, but let's give Josh a chance to prove me wrong!
Flags: needinfo?(ehsan) → needinfo?(jsmith)
Sorry, :jdm, not :jsm!
Flags: needinfo?(jsmith) → needinfo?(josh)

Comment 4

4 years ago
I found nothing.
Flags: needinfo?(josh)
To note: about:cache will be broken after the new cache code will land on m-c.  There will be apis to walk private browsing cache content, it will probably be better to use in tests.  Those apis are planned to be used for any newer generations of about:cache anyway.  See [1], [2] and [3] for more info.

[1] https://hg.mozilla.org/projects/gum/file/b52f1831a9e8/netwerk/base/public/nsILoadContextInfo.idl
[2] https://hg.mozilla.org/projects/gum/file/b52f1831a9e8/netwerk/cache2/nsICacheStorageService.idl
[3] https://hg.mozilla.org/projects/gum/file/b52f1831a9e8/netwerk/cache2/nsICacheStorage.idl
(Assignee)

Comment 6

4 years ago
Created attachment 770796 [details] [diff] [review]
Create a browser chrome test that checks about:cache after private browsing

The test passes on Mac OSX, but has one fail on Ubuntu, when checking the number of entries under Memory cache, in the private window.

I don't know what could be the problem on Ubuntu. Ehsan, could you please help me with some feedback? Thanks in advance!
Attachment #770796 - Flags: feedback?(ehsan)
Comment on attachment 770796 [details] [diff] [review]
Create a browser chrome test that checks about:cache after private browsing

Review of attachment 770796 [details] [diff] [review]:
-----------------------------------------------------------------

::: browser/components/privatebrowsing/test/browser/browser_privatebrowsing_cache.js
@@ +39,5 @@
> +  prefs.setBoolPref("formdata", false);
> +  prefs.setBoolPref("offlineApps", false);
> +  prefs.setBoolPref("passwords", false);
> +  prefs.setBoolPref("sessions", false);
> +  prefs.setBoolPref("siteSettings", false);

You need to use clearUserPref when your test is done to make sure that you're not affecting tests run after this one.

@@ +79,5 @@
> +    executeSoon(function() {
> +
> +      ok(true, "The private window got loaded");
> +
> +      let tab = win.gBrowser.addTab("http://example.iana.org/");

Use example.com.  Our tests are not supposed to access external resources.

@@ +89,5 @@
> +
> +        executeSoon(function() {
> +
> +          let nrEntriesP = get_device_entry_count("memory");
> +          is (nrEntriesP, 1, "Memory cache reports some entries from example.iana.org domain");

What does the test failure here look like?
Attachment #770796 - Flags: feedback?(ehsan) → feedback-
(Assignee)

Comment 8

4 years ago
Sorry for this late reply, but I was on PTO. Thanks for the prompt review! :)

> @@ +79,5 @@
> > +    executeSoon(function() {
> > +
> > +      ok(true, "The private window got loaded");
> > +
> > +      let tab = win.gBrowser.addTab("http://example.iana.org/");
> 
> Use example.com.  Our tests are not supposed to access external resources.

I used "example.iana.org" because I observed that both when running the automated test and performing it manually, after typing "example.com" in the adress bar, it redirects me to "example.iana.org". Also, when manually checking the number of entries under Memory cache, in "about:cache" from the private window, I get these 3 entries:

http://example.iana.org/

http://example.iana.org/favicon.ico

http://example.com/


I assume I only need to take into account "http://example.com/", so I'm checking to see if there is this particularly one entry, right?

 
> @@ +89,5 @@
> > +
> > +        executeSoon(function() {
> > +
> > +          let nrEntriesP = get_device_entry_count("memory");
> > +          is (nrEntriesP, 1, "Memory cache reports some entries from example.iana.org domain");
> 
> What does the test failure here look like?

This is the fail that I get on Ubuntu (when testing with both "example.iana.org" and "example.com"): Memory cache reports some entries from example.com domain - Got -1, expected 1
(Assignee)

Updated

4 years ago
Flags: needinfo?(ehsan)
(In reply to Manuela Muntean [:Manuela] [QA] from comment #8)
> Sorry for this late reply, but I was on PTO. Thanks for the prompt review! :)
> 
> > @@ +79,5 @@
> > > +    executeSoon(function() {
> > > +
> > > +      ok(true, "The private window got loaded");
> > > +
> > > +      let tab = win.gBrowser.addTab("http://example.iana.org/");
> > 
> > Use example.com.  Our tests are not supposed to access external resources.
> 
> I used "example.iana.org" because I observed that both when running the
> automated test and performing it manually, after typing "example.com" in the
> adress bar, it redirects me to "example.iana.org". Also, when manually
> checking the number of entries under Memory cache, in "about:cache" from the
> private window, I get these 3 entries:
> 
> http://example.iana.org/
> 
> http://example.iana.org/favicon.ico
> 
> http://example.com/
> 
> 
> I assume I only need to take into account "http://example.com/", so I'm
> checking to see if there is this particularly one entry, right?

Sorry, I should have said example.org.  example.org is redirected to a local web server which runs the mochitests.

> > @@ +89,5 @@
> > > +
> > > +        executeSoon(function() {
> > > +
> > > +          let nrEntriesP = get_device_entry_count("memory");
> > > +          is (nrEntriesP, 1, "Memory cache reports some entries from example.iana.org domain");
> > 
> > What does the test failure here look like?
> 
> This is the fail that I get on Ubuntu (when testing with both
> "example.iana.org" and "example.com"): Memory cache reports some entries
> from example.com domain - Got -1, expected 1

If you open about:cache after the test has run, do you see a memory cache entry for this site?
Flags: needinfo?(ehsan)
(Assignee)

Comment 10

4 years ago
> > > @@ +89,5 @@
> > > > +
> > > > +        executeSoon(function() {
> > > > +
> > > > +          let nrEntriesP = get_device_entry_count("memory");
> > > > +          is (nrEntriesP, 1, "Memory cache reports some entries from example.iana.org domain");
> > > 
> > > What does the test failure here look like?
> > 
> > This is the fail that I get on Ubuntu (when testing with both
> > "example.iana.org" and "example.com"): Memory cache reports some entries
> > from example.com domain - Got -1, expected 1
> 
> If you open about:cache after the test has run, do you see a memory cache
> entry for this site?

Yes
(Assignee)

Comment 11

4 years ago
Created attachment 776325 [details] [diff] [review]
second version of the test

The test passes both on Ubuntu and Mac machines.
Attachment #776325 - Flags: review?(ehsan)
Attachment #776325 - Flags: review?(ehsan) → review+
(Assignee)

Updated

4 years ago
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/269b7a2b7310

Please make sure that future patches have a commit message that summarizes what the patch is doing before requesting checkin.
Flags: in-testsuite+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/269b7a2b7310
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 25
Note: this will break after new cache backend lands.
Better note: this *might* break after new cache lands.  However, we will turn all test to green before it should go to the tree.  However, one of ways to make the tree green is to disable this test.  We will see, maybe I just speak to soon ;)
You need to log in before you can comment on or make changes to this bug.