Closed Bug 491921 Opened 11 years ago Closed 10 years ago

Write tests for different content types for the content policy

Categories

(Thunderbird :: Testing Infrastructure, defect)

defect
Not set

Tracking

(thunderbird3.1 beta1-fixed, blocking-thunderbird3.0 .2+, thunderbird3.0 .2-fixed)

RESOLVED FIXED
Thunderbird 3.1b1
Tracking Status
thunderbird3.1 --- beta1-fixed
blocking-thunderbird3.0 --- .2+
thunderbird3.0 --- .2-fixed

People

(Reporter: standard8, Assigned: standard8)

References

(Blocks 1 open bug)

Details

Attachments

(4 files, 3 obsolete files)

With the various changes we've been making to the content policy, and the new changes becoming available (bug 374578) we need to make sure the content policy is working as we expect it to be.

Therefore we need to extend our existing mozmill tests with new ones to cover as much of the content policy as possible.

Initial thoughts of content types to check with emails in the message pane are:

- data uris
- chrome
- remote content
-- audio
-- video
-- images
-- iframes (with remote content)
-- iframes (with reference to attachments)

If we can, it'd be nice to check iframes in tabs (i.e. not messages but loading about: urls and remote urls).

I think some of this may need remote content - it'd be nice to have httpd server serving that, but for now we could just use some pages on the internet somewhere.

Gary, would you consider taking this (preemptively assigning to you) ? Dan's already got a test for some of this checked in [1], and I've got a draft video test in bug 374578.

[1] http://mxr.mozilla.org/comm-central/source/mail/test/mozmill/
Flags: blocking-thunderbird3+
In an ideal case, the test would exercise all the different possible content types that can be passed into nsMsgContentPolicy::ShouldLoad as documented at <http://zenit.senecac.on.ca/wiki/dxr/?s=mozilla/content/base/public/nsIContentPolicy.idl&l=57>.
Depends on: 492954
(In reply to comment #0)
> Gary, would you consider taking this (preemptively assigning to you) ? Dan's
> already got a test for some of this checked in [1], and I've got a draft video
> test in bug 374578.

Due to various (personal or otherwise) reasons I wasn't able to do much Mozmill work over the summer - won't have time for it in the future either as school starts. Deassigning.
Assignee: gary → nobody
Whiteboard: [no l10n impact]
Assignee: nobody → bugzilla
This fixes up the existing content policy test so that it uses the new test harness and the new facilities to create folders, select messages and wait for selections etc.

I've also renamed it with s/msg/js/ as it is really just testing the js part of the content policy and I'm expecting to use different files for different parts.

The functionality of the test is still the same.
Attachment #395562 - Flags: review?(bugmail)
Attachment #395562 - Flags: review?(bugmail) → review+
Comment on attachment 395562 [details] [diff] [review]
[checked in] Fix js content policy test and include in mozmill tests

Checked in: http://hg.mozilla.org/comm-central/rev/f9965b18fa14
Attachment #395562 - Attachment description: Fix js content policy test and include in mozmill tests → [checked in] Fix js content policy test and include in mozmill tests
Target Milestone: Thunderbird 3.0rc1 → Thunderbird 3.0b4
Target Milestone: Thunderbird 3.0b4 → Thunderbird 3.0rc1
Bug 522019 has a content policy test for video in emails (though it needs extending to tabs, and possibly for contact registration etc).
Depends on: 522019
Whiteboard: [no l10n impact] → [no l10n impact][partial video test on 522019][other tests TBD][needed for confidence in security releases]
Whiteboard: [no l10n impact][partial video test on 522019][other tests TBD][needed for confidence in security releases] → [no l10n impact][partial video test on 522019][other tests TBD][needed for confidence in security releases, probably can land post code freeze]
Whiteboard: [no l10n impact][partial video test on 522019][other tests TBD][needed for confidence in security releases, probably can land post code freeze] → [no l10n impact][partial video test complete][other tests TBD][needed for confidence in security releases, probably can land post code freeze]
Target Milestone: Thunderbird 3.0rc1 → Thunderbird 3
Note: also check exposed protocols in web pages.
This is a checkpoint at a useful step, but I think we're good to get this in.

This expands the existing video tests to cover:

- forwarding emails
- content tabs

and at the same time duplicates the tests for remote images.

This should give us reasonably comprehensive coverage for remote images + video in the simpler circumstances. The other tests will probably need to be more specialised as they contain slightly more complex routes to be implemented (like needing attachments and other things).

I'll be working on the other tests in separate patches.
Attachment #411669 - Flags: review?(dmose)
Whiteboard: [no l10n impact][partial video test complete][other tests TBD][needed for confidence in security releases, probably can land post code freeze] → [no l10n impact][simple image+video needs r dmose][other tests in work][needed for confidence in security releases, probably can land post code freeze]
Attached patch Part 3 - data uris (obsolete) — Splinter Review
Thunderbird 2 didn't actually allow data uris and I think it doesn't hurt to have a test for them anyway. This works (and I checked taking out allowing of the data uri in the content policy and it failed correctly).
Attachment #413316 - Flags: review?(dmose)
Whiteboard: [no l10n impact][simple image+video needs r dmose][other tests in work][needed for confidence in security releases, probably can land post code freeze] → [no l10n impact][simple image+video+data needs r dmose][other tests in work][needed for confidence in security releases, probably can land post code freeze]
Blocks: 532915
As 3.0 is now out, moving to the 3.0.1/3.1 radars.
blocking-thunderbird3.0: --- → .1+
Flags: blocking-thunderbird3+ → blocking-thunderbird3.1+
blocking-thunderbird3.0: .1+ → .2+
Comment on attachment 411669 [details] [diff] [review]
Part 2 - images, content tabs and forwarding messages

stealing review request, since it would be helpful to me to have a start on these tests...
Attachment #411669 - Flags: review?(dmose) → review?(bienvenu)
Comment on attachment 411669 [details] [diff] [review]
Part 2 - images, content tabs and forwarding messages

this seems to have bit-rotted slightly, at least on the trunk
Attachment #411669 - Flags: review?(bienvenu)
Fixes the bitrot which was caused by the changes in bug 539908. I basically took those out, applied the patch and merged back in and then verified we hadn't lost anything.
Attachment #411669 - Attachment is obsolete: true
Attachment #413316 - Attachment is obsolete: true
Attachment #424485 - Flags: review?(bienvenu)
Attachment #413316 - Flags: review?(dmose)
(and I'll update the data uris in part 3 once we get part 2 in).
Whiteboard: [no l10n impact][simple image+video+data needs r dmose][other tests in work][needed for confidence in security releases, probably can land post code freeze] → [simple image+video+data needs r bienvenu][other tests in work][needed for confidence in security releases, probably can land post code freeze]
Component: Build Config → Testing Infrastructure
QA Contact: build-config → testing-infrastructure
w/ a debug build, against the mozilla and comm-central trunks, I get this error:

TEST-PASS |  setupModule
TEST-UNEXPECTED-FAIL |  test_generalContentPolicy
  EXCEPTION: timeout exceeded for waitForEval('subject.busy == false')
    at: controller.js line 300
       Error("timeout exceeded for waitForEval('subject.busy == false')")  0
            controller.js 300
       checkContentTab([object Object]) test-general-content-policy.js 219
       test_generalContentPolicy() test-general-content-policy.js 260
            frame.js 452
            frame.js 504
            frame.js 546
            frame.js 409
            frame.js 557
            server.js 164
            server.js 168
TEST-PASS |  teardownModule
make: *** [mozmill-one] Error 1
on Windows Vista, I should add.
It appears debug mode on windows vista is a little slower than my timeout allowed. Strange how I've got the same timeout on some tests already in there and its working fine. Oh well. Just made it slightly longer.
Attachment #424485 - Attachment is obsolete: true
Attachment #424775 - Flags: review?(bienvenu)
Attachment #424485 - Flags: review?(bienvenu)
Attachment #424775 - Flags: review?(bienvenu) → review+
Comment on attachment 424485 [details] [diff] [review]
Part 2 - images, content tabs and forwarding messages v2

Checked in: http://hg.mozilla.org/comm-central/rev/5b719dc5b99a
Attachment #424485 - Attachment description: Part 2 - images, content tabs and forwarding messages v2 → [checked in] Part 2 - images, content tabs and forwarding messages v2
Whiteboard: [simple image+video+data needs r bienvenu][other tests in work][needed for confidence in security releases, probably can land post code freeze] → [simple data uri needs r bienvenu][other tests TBD][needed for confidence in security releases]
Attachment #424775 - Attachment description: Part 2 - images, content tabs and forwarding messages v3 → [checked in] Part 2 - images, content tabs and forwarding messages v3
(In reply to comment #17)
> (From update of attachment 424485 [details] [diff] [review])
> Checked in: http://hg.mozilla.org/comm-central/rev/5b719dc5b99a

Whoops, it was actually attachment 424775 [details] [diff] [review] that got checked in
Attachment #424485 - Attachment description: [checked in] Part 2 - images, content tabs and forwarding messages v2 → Part 2 - images, content tabs and forwarding messages v2
Thunderbird 2 didn't actually allow data uris and I think it doesn't hurt to
have a test for them anyway.

data uris should never get denied, hence some changes to the generic test to allow checking for denied or not.
Attachment #424843 - Flags: review?(bienvenu)
Attachment #424843 - Flags: review?(bienvenu) → review+
Comment on attachment 424843 [details] [diff] [review]
[checked in] Part 3 - data uris

Checked in: http://hg.mozilla.org/comm-central/rev/eae72b4ffa3f
Attachment #424843 - Attachment description: Part 3 - data uris → [checked in] Part 3 - data uris
Whiteboard: [simple data uri needs r bienvenu][other tests TBD][needed for confidence in security releases] → [other tests TBD][needed for confidence in security releases]
This checks that remote content can't load in messages even if they know the message URI and hence proves the URI protocol is correctly blocked to remote content.

I'm intending that this is the last test for this bug, I think we've covered the general intentions of the content policy and we can add more as needed. I'd certainly be much happier for changes to the content policy with these existing tests and added tests for the changes as necessary.
Attachment #425788 - Flags: review?(bienvenu)
Comment on attachment 425788 [details] [diff] [review]
[checked in] Part 4 - check messages aren't exposed.

+  let folderTab = mc.tabmail.currentTabInfo;

doesn't look used.

and the copyright year looks off.
Attachment #425788 - Flags: review?(bienvenu) → review+
Comment on attachment 425788 [details] [diff] [review]
[checked in] Part 4 - check messages aren't exposed.

Checked in:
http://hg.mozilla.org/comm-central/rev/f9d8f0f44dd9

Changeset addressing review comments:
http://hg.mozilla.org/comm-central/rev/414c8137e925
Attachment #425788 - Attachment description: Part 4 - check messages aren't exposed. → [checked in] Part 4 - check messages aren't exposed.
Attachment #425788 - Flags: approval-thunderbird3.0.2?
This bug is now fixed on trunk we'll deal with any more tests in other bugs. I'll sort out the 1.9.1 landings once the latest tests have cycled a few times.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [other tests TBD][needed for confidence in security releases]
Target Milestone: Thunderbird 3 → Thunderbird 3.1b1
Comment on attachment 424775 [details] [diff] [review]
[checked in] Part 2 - images, content tabs and forwarding messages v3

a=Standard8 on all the three patches which are test-only patches.
Attachment #424775 - Flags: approval-thunderbird3.0.2+
Attachment #424843 - Flags: approval-thunderbird3.0.2+
Attachment #425788 - Flags: approval-thunderbird3.0.2? → approval-thunderbird3.0.2+
Checked into 1.9.1:

Part 2: http://hg.mozilla.org/releases/comm-1.9.1/rev/13e00a145062
Part 3: http://hg.mozilla.org/releases/comm-1.9.1/rev/6f7673b94f19
Part 4: http://hg.mozilla.org/releases/comm-1.9.1/rev/7f7295ccdd88
(part 4 also contained the second set of changes addressing the review comments).
Verifying as fixed for 3.0.2 based on the fact that these are test-only patches and the last 5 runs from MozMill/unit tests have been green with no failures relating to these patches.
You need to log in before you can comment on or make changes to this bug.