Closed
Bug 1491397
Opened 6 years ago
Closed 6 years ago
Falsey userScriptOptions.scriptMetadata are not available
Categories
(WebExtensions :: General, defect, P5)
WebExtensions
General
Tracking
(firefox64 fixed, firefox65 verified)
VERIFIED
FIXED
mozilla64
People
(Reporter: robwu, Assigned: robwu)
References
Details
Attachments
(2 files)
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.
Updated•6 years ago
|
Priority: -- → P5
Assignee | ||
Updated•6 years ago
|
Assignee: nobody → rob
Status: NEW → ASSIGNED
Assignee | ||
Comment 1•6 years ago
|
||
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 rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/84ceb42728e4
Correctly forward falsey scriptMetadata in userScripts API r=rpl
Comment 3•6 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox64:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
Comment 4•6 years ago
|
||
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.
Status: RESOLVED → VERIFIED
status-firefox65:
--- → verified
You need to log in
before you can comment on or make changes to this bug.
Description
•