private browsing test fails on |cfx testall| with XULRunner 1.9.2

RESOLVED FIXED in 0.4

Status

Add-on SDK
General
RESOLVED FIXED
8 years ago
7 years ago

People

(Reporter: myk, Assigned: zpao)

Tracking

unspecified

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

8 years ago
When I run |cfx testall| with XULRunner 1.9.2 (which the SDK claims to support) installed, a private browsing test throws an exception, causing the tests to fail:

(jetpack-sdk)host-5-12:jetpack-sdk myk$ /Library/Frameworks/XUL.framework/xulrunner-bin --version
Mozilla XULRunner 1.9.2 - 20100222070821
(jetpack-sdk)host-5-12:jetpack-sdk myk$ cfx testall
Testing all available packages: nsjetpack, test-harness, development-mode, jetpack-core.
Traceback (most recent call last):
  File "resource://testall-jetpack-core-tests/test-private-browsing.js", line 40, in 
    pbService = Cc["@mozilla.org/privatebrowsing;1"].
TypeError: Cc['@mozilla.org/privatebrowsing;1'] is undefined
No tests were runFAIL
Total time: 2.210796 seconds
Program terminated unsuccessfully.
ahhhhh right. I forgot these will get run on all apps... As written, the tests will blow up when run on an app without private browsing. I realized this a while back and then forgot :(

I guess I could just skip the PB tests if the app isn't Firefox. Or I could set up a different set of tests for XULRunner (really just that pb.active = false)

Thoughts?
If PB service is not initialized in vanilla xulrunner, then shouldn't run the tests there. See the context menu module tests for how Drew handled that. Same approach should be fine here.
Duplicate of this bug: 564905
Created attachment 444680 [details] [diff] [review]
Patch v0.1

Instead of just not running any tests like I mentioned on IRC, I'm actually testing the functionality of the XULRunner case (where PB should always think it's not active)
Assignee: nobody → paul
Status: NEW → ASSIGNED
Attachment #444680 - Flags: review?(myk)
(Reporter)

Comment 5

8 years ago
Comment on attachment 444680 [details] [diff] [review]
Patch v0.1

(In reply to comment #4)
> Instead of just not running any tests like I mentioned on IRC, I'm actually
> testing the functionality of the XULRunner case (where PB should always think
> it's not active)

Great idea!


>diff --git a/packages/jetpack-core/tests/test-private-browsing.js b/packages/jetpack-core/tests/test-private-browsing.js

>+    test.assert(!pb.active,
>+                "pb.active returns false when private browsing isn't supported");

Nit: this kind of test uses test.assertEqual(conditional, boolean-value) elsewhere in this testcase file, so this test should probably do the same for consistency.

r=myk!
Attachment #444680 - Flags: review?(myk) → review+
(In reply to comment #5)
> >+    test.assert(!pb.active,
> >+                "pb.active returns false when private browsing isn't supported");
> 
> Nit: this kind of test uses test.assertEqual(conditional, boolean-value)
> elsewhere in this testcase file, so this test should probably do the same for
> consistency.

Bah, I changed the other 2 before attaching, forgot this one.

Pushed with nit fixed as http://hg.mozilla.org/labs/jetpack-sdk/rev/f6202555cdc8
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
OS: Mac OS X → All
Hardware: x86 → All
Resolution: --- → FIXED
Target Milestone: -- → 0.4
Version: unspecified → Trunk
(Reporter)

Comment 7

7 years ago
The Add-on SDK is no longer a Mozilla Labs experiment and has become a big enough project to warrant its own Bugzilla product, so the "Add-on SDK" product has been created for it, and I am moving its bugs to that product.

To filter bugmail related to this change, filter on the word "looptid".
Component: Jetpack SDK → General
Product: Mozilla Labs → Add-on SDK
QA Contact: jetpack-sdk → general
Version: Trunk → unspecified
You need to log in before you can comment on or make changes to this bug.