Closed Bug 1789543 Opened 2 years ago Closed 2 years ago

Provide better error message when loading missing JSM

Categories

(Core :: XPConnect, task, P1)

task

Tracking

()

RESOLVED FIXED
106 Branch
Tracking Status
firefox106 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(3 files)

When the JSM-to-ESM shim fails, the error message for .sys.mjs URL is printed, instead of the .jsm URL, which is confusing when investigating the issue. (see bug 1786667)

The error message should take the redirect into account and print better message that mentions the existence of the redirect, and possible old URL or something.

currently, the error message for JSM is suppressed (bug 1777641), and the error message is not suppressed for redirected ESM,
that leads to the confusing error message when the ESM is also not found.

possible workaround is to suppress the error message for redirected ESM, and if the redirect fails, load the JSM again with the error message not-suppressed.
so that the error or crash-on-automation happens for the original URL happens when both are missing.

the other simple option is to mention the possible redirect in the actual error message string:

https://searchfox.org/mozilla-central/rev/9f8e74292115b4fbbb41698bfe9a7d8cc12b31cf/netwerk/base/nsNetUtil.cpp#3891-3901

  if (xpc::IsInAutomation()) {
#ifdef DEBUG
    if (NS_IsMainThread()) {
      nsCOMPtr<nsIXPConnect> xpc = nsIXPConnect::XPConnect();
      Unused << xpc->DebugDumpJSStack(false, false, false);
    }
#endif
    MOZ_CRASH_UNSAFE_PRINTF("Missing chrome or resource URLs: %s", spec.get());
  } else {
    printf_stderr("Missing chrome or resource URL: %s\n", spec.get());
  }
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/4444217fdc0c Part 1: Pass ModuleLoadRequest to mozJSModuleLoader::LoadSingleModuleScript. r=yulia https://hg.mozilla.org/integration/autoland/rev/364b5631681a Part 2: Pass ModuleLoadRequest to ModuleLoaderInfo constructor. r=yulia https://hg.mozilla.org/integration/autoland/rev/04dc31eaa8ed Part 3: Trigger missing chrome/resource URL error handling with original JSM URL when fallback to ESMified URL also fails. r=yulia
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 106 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: