Open Bug 1087373 Opened 10 years ago Updated 2 years ago

Allow mochitests that run reftests to handle reftest "<failure-type>" conditions

Categories

(Testing :: Mochitest, defect)

defect

Tracking

(Not tracked)

People

(Reporter: jwatt, Unassigned)

Details

Attachments

(1 file)

Bug 1087224 allowed us to fuzz reftests that are run by mochitests, but we don't have the ability to specify conditions.

For reftest manifests the condition parsing is handled by the code that calls BuildConditionSandbox and Components.utils.evalInSandbox in reftest.js:

https://mxr.mozilla.org/mozilla-central/source/layout/tools/reftest/reftest.js

Unfortunately we don't have access to the BuildConditionSandbox in mochitest land.
With this hacky patch tests can include reftest.js using:

  <script type="text/javascript;version=1."
          src="chrome://mochikit/content/reftest.js"></script>

Note that version=1.8 is needed.

Tests can then create a populated sandbox using:

  gContainingWindow = window.parent;
  InitSimpleGlobals()
  url = gIOService.newURI(document.location.href, null, null);
  gBrowser = document.documentElement
  sandbox = BuildConditionSandbox(url);

I don't intend on pursuing this any further right now since I don't need it any more. Just filing this in cases my experiments are useful for someone else, and so that they aren't lost.
That sounds really terrible. I think we should step back and figure out if we can make these run as actual reftests in some way rather than commit more atrocities in the Mochitest harness.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: