If scriptMetadata is falsey (false, 0, "", null, undefined), then the metadata is always undefined. STR: 1. Load attached extension in Nightly (including patch for bug 1437864). 2. Visit example.com Expected: - "Got expected data: 0" Actual: - "Unexpected metadata, expected 0, got undefined" This is caused by the following: https://searchfox.org/mozilla-central/rev/dd965445ec47fbf3cee566eff93b301666bda0e1/toolkit/components/extensions/ExtensionContent.jsm#650-651 const clonedMetadata = scriptMetadata ? Cu.cloneInto(scriptMetadata, apiScope) : undefined; How about just declaring clonedMetadata and then lazily cloning the metadata when needed? If the metadata is a large, rarely used object, then that would bring performance benefits.
This also adds new test coverage for the previously untested features: - "file" in "js" param to userScripts.register works. - "allFrames" set to true in userScripts.register works. - scriptMetadata accepts primitive values, and in particular falsey values in particular (= bug 1491397 ). - scriptMetadata is the same object in all API script calls.
Pushed by email@example.com: https://hg.mozilla.org/integration/autoland/rev/84ceb42728e4 Correctly forward falsey scriptMetadata in userScripts API r=rpl
Thank you for the test extension and STR. Validated the fix as per expected results from the description using the provided extension on: latest Nightly: 65.0a1 running on Windows 10 x64 and Nightly on Ubuntu 18.04.
You need to log in before you can comment on or make changes to this bug.