Open Bug 2089984 Opened 13 days ago

Check the JS_WrapValue result in ChromeScriptLoader.cpp

Categories

(Core :: XPConnect, task)

task

Tracking

()

People

(Reporter: Sylvestre, Unassigned, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, Whiteboard: [lang=c++])

Filing as a good first bug to learn workflows.

JS_WrapValue(aCx, aRval); ignores its return value; it can only fail on OOM, but the failure should be reported. In PrecompiledScript::ExecuteInGlobal, report the failure the same way as the error path just above it (aRv.MightThrowJSException(); aRv.StealExceptionFromJSContext(aCx);).

Current code:


  JS_WrapValue(aCx, aRval);
}

Link to the code:
https://searchfox.org/firefox-main/source/js/xpconnect/loader/ChromeScriptLoader.cpp

To verify the fix:

./mach build
./mach test js/xpconnect/tests --headless

This was reported by Coverity Scan (CID 1518490). The analyzer will stop reporting it once the change lands.

Tutorial to contribute:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
https://firefox-source-docs.mozilla.org/contributing/stack_quickref.html

Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.

You need to log in before you can comment on or make changes to this bug.