Closed Bug 761202 Opened 13 years ago Closed 13 years ago

Marionette unit tests failing in browser environment

Categories

(Remote Protocol :: Marionette, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla16

People

(Reporter: mdas, Assigned: mdas)

References

Details

Attachments

(1 file, 2 obsolete files)

For tests that load xul (like test_click.py), we end up with the following error: ====================================================================== ERROR: test_click (test_click.TestClickChrome) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/mdas/code/mozilla-central/testing/marionette/client/marionette/tests/unit/test_click.py", line 29, in tearDown self.marionette.execute_script("window.close();") File "/Users/mdas/code/mozilla-central/testing/marionette/client/marionette/marionette.py", line 345, in execute_script newSandbox=new_sandbox) File "/Users/mdas/code/mozilla-central/testing/marionette/client/marionette/marionette.py", line 150, in _send_message self._handle_error(response) File "/Users/mdas/code/mozilla-central/testing/marionette/client/marionette/marionette.py", line 208, in _handle_error raise MarionetteException(message=response, status=500) MarionetteException: {u'message': u"error occurred while processing 'executeScript' request: TypeError: Components.utils is undefined", u'from': u'conn4.marionette1', u'error': u'unknownError'} ---------------------------------------------------------------------- This showed up sometime in the last two weeks.
OS: Mac OS X → All
Attached patch fix v0.1 (obsolete) (deleted) — Splinter Review
The problem was that we were loading special powers modules in any chrome sandbox. It appears that if you have a plain chrome window with only a .xul file that doesn't have any overlays or scripts, then you don't have access to the Components object. Trying to load a subscript with a reference to the Components object threw this error. I added a specialpowers flag that can be set when doing any execute script, and it will load the specialpowers modules only if requested. Since our tests expect specialpowers to be there, the marionette python client will set specialpowers to true by default. AutomatedTester, since you've been digging around this code, mind giving this patch a looksee?
Attachment #635817 - Flags: review?(dburns)
Comment on attachment 635817 [details] [diff] [review] fix v0.1 >+++ b/testing/marionette/client/marionette/tests/unit/test_click.py >@@ -26,7 +26,7 @@ > self.marionette.execute_script("window.open('" + xul +"', '_blank', 'chrome,centerscreen');") > You have added the special powers kwarg in other calls like this in setup files but not here. What is different about this one?
Attached patch fix v0.2 (obsolete) (deleted) — Splinter Review
Ah, good eye, I forgot to add it here. Having special powers here doesn't actually cause any problems, since, on this call, we're executing the script against the browser window, and then opening up our custom xul window, so the special powers scripts get loaded into the browser window, and so will have access to the Components object. Since we don't need to load the scripts, I've updated the patch to use special_powers=False.
Attachment #635817 - Attachment is obsolete: true
Attachment #635817 - Flags: review?(dburns)
Attachment #636328 - Flags: review?(dburns)
Attached patch fix v0.3 (deleted) — Splinter Review
This patch defaults special_powers script loading to false, since only scripts that need it should load it, namely marionette JS tests, where it is expected to have these available. I have updated related test cases.
Attachment #636328 - Attachment is obsolete: true
Attachment #636328 - Flags: review?(dburns)
Attachment #636715 - Flags: review?(dburns)
Comment on attachment 636715 [details] [diff] [review] fix v0.3 This looks good. Does this impact any B2G tests?
Attachment #636715 - Flags: review?(dburns) → review+
(In reply to David Burns :automatedtester from comment #5) > Comment on attachment 636715 [details] [diff] [review] > fix v0.3 > > This looks good. Does this impact any B2G tests? Thanks, and no, all the tests on B2G are unaffected.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: