Refactor rice page handling and metadata extraction in theme marketplace components

This commit is contained in:
mr. M
2024-12-30 08:09:06 +01:00
parent a2f29cc817
commit f484cb393a
3 changed files with 8 additions and 7 deletions

View File

@@ -417,7 +417,9 @@
frame.call(this);
}
openRicePage({ id, name, author }) {
openRicePage({ name, id, author }) {
console.log("Opening rice page: ", name, id, author);
gBrowser.removeTab(gBrowser.selectedTab);
}
}

View File

@@ -18,8 +18,8 @@ export class ZenThemeMarketplaceChild extends JSWindowActorChild {
verifier.setAttribute('content', 'verified');
}
const possibleRicePage = this.collectRiceMetadata();
if (possibleRicePage) {
this.sendAsyncMessage('ZenThemeMarketplace:RicePage', { data: possibleRicePage });
if (possibleRicePage?.id) {
this.sendAsyncMessage('ZenThemeMarketplace:RicePage', possibleRicePage);
return;
}
this.initiateThemeMarketplace();
@@ -27,11 +27,11 @@ export class ZenThemeMarketplaceChild extends JSWindowActorChild {
}
collectRiceMetadata() {
const meta = this.contentWindow.document.querySelector('meta[name="rize-metadata"]');
const meta = this.contentWindow.document.querySelector('meta[name="zen-rice-data"]');
if (meta) {
return {
id: meta.getAttribute('data-id'),
name: meta.getAttribute('data-title'),
name: meta.getAttribute('data-name'),
author: meta.getAttribute('data-author'),
}
}

View File

@@ -42,8 +42,7 @@ export class ZenThemeMarketplaceParent extends JSWindowActorParent {
}
openRicePage(window, data) {
console.info(this.browsingContext);
window.gZenThemeMarketplaceManager.openRicePage(data);
window.gZenThemePicker.riceManager.openRicePage(data);
}
compareversion(version1, version2) {