Closed Bug 1664725 Opened 4 years ago Closed 4 years ago

Getting expecting rejection to match gets <unknown> instead of actual expectation.

Categories

(WebExtensions :: General, defect, P5)

defect

Tracking

(firefox-esr78 wontfix, firefox81 wontfix, firefox82 fixed)

RESOLVED FIXED
82 Branch
Tracking Status
firefox-esr78 --- wontfix
firefox81 --- wontfix
firefox82 --- fixed

People

(Reporter: masterwayz, Assigned: masterwayz, Mentored)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(1 file)

This seems to be caused by this commit: https://hg.mozilla.org/mozilla-central/rev/9ae69a2f818d
When removing .toSource() on here: https://searchfox.org/mozilla-central/source/toolkit/components/extensions/child/ext-test.js#89 then it works normally again.

It makes debugging harder as instead of reporting what is expected to match, for example:
Promise rejected, expecting rejection to match 'matching string here', we get:
Promise rejected, expecting rejection to match <unknown>.

A way to trigger this bug is as follows:

browser.test.assertRejects(
  Promise.reject("dummy"),
  /not-dummy/,
  "intentional failure"
);

.toSource is not available any more because of bug 1565170.
That code path can be reached through https://searchfox.org/mozilla-central/rev/0c97a6410ff018c22e65a0cbe4e5f2ca4581b22e/toolkit/components/extensions/child/ext-test.js#209-211,231-233
depending on the value of expectedError.

Potential values for expectedError are specified by the JSON schema at https://searchfox.org/mozilla-central/rev/0c97a6410ff018c22e65a0cbe4e5f2ca4581b22e/toolkit/components/extensions/schemas/test.json#145-149,165-169,180-185

toSource was removed in bug 1565170, and its purpose was to create a human-readable serialization of a value. In these cases, String(value) should probably have the desired result.

Do you want to submit a patch?

Blocks: 1608430
Type: task → defect
Keywords: regression
Regressed by: 1565170
Has Regression Range: --- → yes

Sure, I'll take it.

Assignee: nobody → michael
Status: NEW → ASSIGNED
Mentor: rob
Severity: -- → S4
Priority: -- → P5
Pushed by cbrindusan@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4e97b14b6493
Fix expecting rejection to match unknown to actual expectation r=robwu
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.