Closed Bug 1215606 Opened 4 years ago Closed 4 years ago

DevToolsUtils.assert does not export

Categories

(DevTools :: General, defect)

43 Branch
defect
Not set

Tracking

(firefox44 fixed)

RESOLVED FIXED
Firefox 44
Tracking Status
firefox44 --- fixed

People

(Reporter: jsantell, Assigned: fitzgen)

References

Details

Attachments

(1 file, 3 obsolete files)

Getting:
TypeError: property "assert" is non-configurable and can't be deleted

Changing the lazy getter from `exports` to `this`, matching the other lazy getters in this module, I end up getting an error saying assert is not a valid function.
Well that's not good.
Assignee: nobody → nfitzgerald
Status: NEW → ASSIGNED
s/exports/this/ worked for me, perhaps there were further issues in your setup?

https://treeherder.mozilla.org/#/jobs?repo=try&revision=c27b3efbab37
Comment on attachment 8675133 [details] [diff] [review]
Ensure that DevToolsUtils.assert is properly exported

Review of attachment 8675133 [details] [diff] [review]:
-----------------------------------------------------------------

::: devtools/shared/DevToolsUtils.js
@@ +465,5 @@
>   *
>   * This is an improvement over `dbg_assert`, which doesn't actually cause any
>   * fatal behavior, and is therefore much easier to accidentally ignore.
>   */
> +exports.defineLazyGetter(this, "assert", () => {

I made this change and it didn't fail on importing it atleast, but failed when calling it.

::: devtools/shared/tests/unit/test_assert.js
@@ +17,5 @@
> +    assert(false, "this assertion should fail");
> +  } catch (e) {
> +    // If you catch assertion failures in practice, I will hunt you down. I get
> +    // email notifications every time it happens.
> +    assertionFailed = true;

We should check this is the correct error -- not the error I was running into. And we need a test where `assert(true)` does NOT throw, because I suspect it will.
Attachment #8675133 - Attachment is obsolete: true
Attachment #8675133 - Flags: review?(jsantell)
Comment on attachment 8675153 [details] [diff] [review]
Ensure that DevToolsUtils.assert is properly exported

Review of attachment 8675153 [details] [diff] [review]:
-----------------------------------------------------------------

::: devtools/shared/tests/unit/test_assert.js
@@ +25,5 @@
> +  let assertionFailed = false;
> +  try {
> +    assert(false, "this assertion should fail");
> +  } catch (e) {
> +    assertionFailed = true;

nit: should check this is the expected error from assert, rather than assert being undefined, for example
Attachment #8675153 - Flags: review?(jsantell) → review+
Attachment #8675153 - Attachment is obsolete: true
Attachment #8675159 - Attachment is obsolete: true
https://hg.mozilla.org/integration/fx-team/rev/f65e1d7b2d95433bea4e9c37ae914dcfbedb4c40
Bug 1215606 - Ensure that DevToolsUtils.assert is properly exported; r=jsantell
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/f65e1d7b2d95
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 44
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.