Closed Bug 1749819 Opened 4 years ago Closed 4 years ago

MOZ_ASSERT failure in mozJSSubScriptLoader::ReadStencil

Categories

(Core :: XPConnect, defect)

defect

Tracking

()

RESOLVED FIXED
98 Branch
Tracking Status
firefox98 --- fixed

People

(Reporter: mtigley, Assigned: mtigley)

References

Details

Attachments

(1 file)

Found this while trying to load a subscript with a "moz-extension" URL into a child actor. I'm getting the following failure on a recent try push.

This is caused by this assertion failing: https://searchfox.org/mozilla-central/rev/83e67336083df9f9a3d1e0c33f2ba19703d57161/js/xpconnect/loader/mozJSSubScriptLoader.cpp#264. This seems to suggests the channel somehow isn't being updated with the new content length by NS_ReadInputStreamToString().

It's not clear to me where the update should happen in NS_ReadInputStreamToString() though.

Assignee: nobody → mtigley
Status: NEW → ASSIGNED
Severity: -- → S3

Minimal test case based on the original test case:

  1. ./mach run --temp-profile.
  2. Visit example.com and open the Browser Content Toolbox.
  3. Run the following snippet:
{
  let { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
  let { WebExtensionPolicy } = Cu.getGlobalForObject(Services);
  let url = WebExtensionPolicy.getByID("pictureinpicture@mozilla.org").getURL("run.js");
  Services.scriptloader.loadSubScript(url, sandbox);
}

Expected output:

  • Uncaught ReferenceError: PictureInPictureOverrides is not defined

Actual result:

  • content process crashes with the following:

Assertion failure: currentLength == len, at /builds/worker/checkouts/gecko/js/xpconnect/loader/mozJSSubScriptLoader.cpp:264
#01: mozJSSubScriptLoader::ReadStencil(js::frontend::CompilationStencil**, nsIURI*, JSContext*, JS::ReadOnlyCompileOptions const&, nsIIOService*, bool)[/path/to/dist/NightlyDebug.app/Contents/MacOS/XUL +0x109f405]
#02: mozJSSubScriptLoader::DoLoadSubScriptWithOptions(nsTSubstring<char16_t> const&, LoadSubScriptOptions&, JSContext*, JS::MutableHandle<JS::Value>)[/path/to/dist/NightlyDebug.app/Contents/MacOS/XUL +0x10a03bc]
#03: mozJSSubScriptLoader::LoadSubScript(nsTSubstring<char16_t> const&, JS::Handle<JS::Value>, JSContext*, JS::MutableHandle<JS::Value>)[/path/to/dist/NightlyDebug.app/Contents/MacOS/XUL +0x109f78e]
#04: NS_InvokeByIndex[/path/to/dist/NightlyDebug.app/Contents/MacOS/XUL +0x33c30e]

This only happens in the content process; the moz-extension:-protocol handler uses a SimpleChannel to retrieve the actual content from the parent.

Blocks: 1750998
Attachment #9258746 - Attachment description: Bug 1749819 - Update channel's content length if it's still unknown after NS_ReadInputStreamToString call. r=#necko-reviewers,kmag → Bug 1749819 - Remove check for channel GetContentLength(). r=#dom-workers-and-storage-reviewers
Pushed by mtigley@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/398dbd0b53ce Remove check for channel GetContentLength(). r=dom-workers-and-storage-reviewers,mccr8,asuth
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 98 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: