Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d3401fa4c |
@@ -192,6 +192,17 @@ async function packageExtension({
|
|||||||
for (const relativePath of archiveFiles) {
|
for (const relativePath of archiveFiles) {
|
||||||
let contents = await readFile(path.join(rootDirectory, relativePath));
|
let contents = await readFile(path.join(rootDirectory, relativePath));
|
||||||
|
|
||||||
|
if (target === "chromium" && relativePath === "content.css") {
|
||||||
|
contents = Buffer.from(
|
||||||
|
contents
|
||||||
|
.toString("utf8")
|
||||||
|
.replaceAll(
|
||||||
|
'url("fonts/',
|
||||||
|
'url("chrome-extension://__MSG_@@extension_id__/fonts/'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (relativePath === "manifest.json") {
|
if (relativePath === "manifest.json") {
|
||||||
const manifest = createManifest(contents, version, target);
|
const manifest = createManifest(contents, version, target);
|
||||||
contents = Buffer.from(`${JSON.stringify(manifest, null, 2)}\n`);
|
contents = Buffer.from(`${JSON.stringify(manifest, null, 2)}\n`);
|
||||||
|
|||||||
@@ -74,6 +74,10 @@ test("builds a deterministic unsigned XPI with the release version and runtime f
|
|||||||
|
|
||||||
assert.equal(first.archiveName, "glagolify-9.8.7.xpi");
|
assert.equal(first.archiveName, "glagolify-9.8.7.xpi");
|
||||||
assert.deepEqual([...entries.keys()], [...FIREFOX_ARCHIVE_FILES]);
|
assert.deepEqual([...entries.keys()], [...FIREFOX_ARCHIVE_FILES]);
|
||||||
|
assert.deepEqual(
|
||||||
|
entries.get("content.css"),
|
||||||
|
await readFile(path.join(rootDirectory, "content.css"))
|
||||||
|
);
|
||||||
const manifest = JSON.parse(entries.get("manifest.json"));
|
const manifest = JSON.parse(entries.get("manifest.json"));
|
||||||
assert.equal(manifest.version, "9.8.7");
|
assert.equal(manifest.version, "9.8.7");
|
||||||
assert.equal(manifest.manifest_version, 2);
|
assert.equal(manifest.manifest_version, 2);
|
||||||
@@ -127,6 +131,22 @@ test("builds a Chromium MV3 ZIP with Chromium manifest fields and raster icons",
|
|||||||
]);
|
]);
|
||||||
assert.equal(manifest.icons["128"], "icons/icon-128.png");
|
assert.equal(manifest.icons["128"], "icons/icon-128.png");
|
||||||
|
|
||||||
|
const contentCss = entries.get("content.css").toString("utf8");
|
||||||
|
const fontUrls = [...contentCss.matchAll(/src: url\("([^"]+)"\)/g)].map(
|
||||||
|
(match) => match[1]
|
||||||
|
);
|
||||||
|
const extensionUrl = "chrome-extension://__MSG_@@extension_id__/";
|
||||||
|
assert.equal(fontUrls.length, 4);
|
||||||
|
for (const fontUrl of fontUrls) {
|
||||||
|
assert.equal(fontUrl.startsWith(extensionUrl), true);
|
||||||
|
const relativePath = fontUrl.slice(extensionUrl.length);
|
||||||
|
assert.equal(entries.has(relativePath), true);
|
||||||
|
assert.equal(
|
||||||
|
manifest.web_accessible_resources[0].resources.includes(relativePath),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
for (const relativePath of CHROMIUM_ARCHIVE_FILES.filter((name) =>
|
for (const relativePath of CHROMIUM_ARCHIVE_FILES.filter((name) =>
|
||||||
name.endsWith(".png")
|
name.endsWith(".png")
|
||||||
)) {
|
)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user