Closed Bug 1576174 Opened 5 years ago Closed 5 years ago

The "TypeError: Cu.import(...).RecipeRunner.checkFilter is not a function" error is returned when testing Normandy filters

Categories

(Firefox :: Normandy Client, defect)

Desktop
All
defect
Not set
normal

Tracking

()

RESOLVED INVALID
Tracking Status
firefox68 --- unaffected
firefox69 --- unaffected
firefox70 --- unaffected

People

(Reporter: cmuresan, Unassigned)

References

Details

(Keywords: regression)

Attachments

(1 file)

[Affected Platforms]:

  • All Windows
  • All Mac
  • All Linux

[Affected Versions]:

  • Firefox Nightly 70.0a1, Build ID 20190822095439

[Prerequisites]:

  • Have the devtools.chrome.enabled set to true.

[Steps to reproduce]:

  1. Open the browser with the profile from prerequisites.
  2. Open the Browser Console and paste the following snippet:
    Cu.import("resource://normandy/lib/RecipeRunner.jsm", {})
    .RecipeRunner.checkFilter({
    id: 1,
    arguments: {},
    filter_expression: ( normandy.country == 'RO' && normandy.channel == 'nightly' && normandy.locale in ['en-US'] ),
    })
    .then(result => console.log(result))
  3. Press enter and observe the output.

[Expected result]:

  • The snippet returns true or false depending if the profile meets the filters.

[Actual result]:

  • TypeError: Cu.import(...).RecipeRunner.checkFilter is not a function is displayed instead.

[Regression Window]:
13:57.51 INFO: Narrowed inbound regression window from [6385ede0, 3e0d79dd] (3 builds) to [8db08682, 3e0d79dd] (2 builds) (~1 steps left)
13:57.52 INFO: No more inbound revisions, bisection finished.
13:57.52 INFO: Last good revision: 8db0868227e62019577296789fea5952810fe7c0
13:57.52 INFO: First bad revision: 3e0d79dd1de284de827b372abd0e89ac0c87eb09
13:57.52 INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=8db0868227e62019577296789fea5952810fe7c0&tochange=3e0d79dd1de284de827b372abd0e89ac0c87eb09

I wasn't able to get to a single bug, but bug 1548631 seems to be related.

[Notes]:

  • I have attached a screenshot of the issue:

@mythmon, could you please take a look at this?

Flags: needinfo?(mcooper)

:cmuresan, since this bug is a regression, could you fill (if possible) the regressed_by field?
For more information, please visit auto_nag documentation.

Flags: needinfo?(cmuresan)

The pasted code is incorrect. As of bug 1431533, Cu.import should be replaced with ChromeUtils.import.

Flags: needinfo?(mcooper)

Sorry, my last message was a but hasty.

The problem is not the ChromeUtils/Cu, like I said in my last comment. The problem is that in bug 1548631, the checking of if a recipe should run got more complicated. The function that should be run is now shouldRunRecipe. Here is a full, modern example:

await ChromeUtils.import("resource://normandy/lib/RecipeRunner.jsm").RecipeRunner.shouldRunRecipe({
  id: 1,
  arguments: {},
  filter_expression: "( normandy.country == 'RO' && normandy.channel == 'nightly' && normandy.locale in ['en-US'] )",
})
Flags: needinfo?(cmuresan)

Can you take this on? Happy to take a patch for 70.

Flags: needinfo?(mcooper)

I don't believe there is a problem with the code here, but with the code sample that Ciprian used. If that's not the case, I'd be happy to reopen this. Ciprian, can you test the code I wrote in comment 3?

Status: NEW → RESOLVED
Closed: 5 years ago
Flags: needinfo?(mcooper) → needinfo?(cmuresan)
Resolution: --- → INVALID

Yes the new code sample works. Thanks! Sorry for not responding sooner, it slipped my mind.
We'll update our docs with this new one.

Flags: needinfo?(cmuresan)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: