Closed Bug 1178536 Opened 9 years ago Closed 7 years ago

Register web activities and system messages for signed packages when they are pinned

Categories

(Core Graveyard :: DOM: Apps, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: pauljt, Assigned: arroway)

References

Details

Attachments

(1 file)

In the new FxOS model, there is no install, and web activities will instead be registered when they are pinned. This bug is the for the implementation of this. (there is an implied dependency here of gecko being made aware of pinning, or moving web activities code into gaia, probably the former)
Assignee: nobody → stephouillon
Stephanie, here's a wip patch for gecko to install permissions when we pin a page. It's mostly to show how we can hook up things, since it's not really what you want to do in this bug.

You will also need this patch on gaia:

diff --git a/apps/system/js/app.js b/apps/system/js/app.js
index af62529..0ac4fba 100644
--- a/apps/system/js/app.js
+++ b/apps/system/js/app.js
@@ -61,6 +61,32 @@
       window.settingsCore = BaseModule.instantiate('SettingsCore');
       window.settingsCore.start();
       window.launcher = BaseModule.instantiate('Launcher');
+
+      LazyLoader.load('shared/js/bookmarks_database.js').then(() => {
+        BookmarksDatabase.addEventListener('added', (e) => {
+          if (e.target.type === 'url') {
+            var event = document.createEvent('CustomEvent');
+            var details = {
+              action: 'added',
+              url: e.target.url
+            }
+            event.initCustomEvent('mozPinContentEvent', true, true, details);
+            window.dispatchEvent(event);
+          }
+        });
+        BookmarksDatabase.addEventListener('removed', (e) => {
+          var event = document.createEvent('CustomEvent');
+          var details = {
+            action: 'removed',
+            url: e.target.id
+          }
+          event.initCustomEvent('mozPinContentEvent', true, true, details);
+          window.dispatchEvent(event);
+        });
+      }).catch((err) => {
+        console.error(err);
+      });
+
       return Promise.all([
         // XXX:
         // See https://bugzilla.mozilla.org/show_bug.cgi?id=1161489
Just a note - we should also register web activities from content which happens to have a manifest (e.g. W3C apps) Maybe a separate bug but just a note so I dont forget. From an email discusison with bfrancis:

>But regardless of what Marketplace does, this situation still exists. There's a Pinterest app in the >Firefox Marketplace which registers for a web activity. Pinterest also host a W3C web manifest. Currently >if I install the app from the Marketplace it will register the web activity but if I pin the same content >from the browser chrome using the web manifest it won't. This is what I'd like to avoid - a different >experience of the same content depending on how you add it to your homescreen.
I don't think the approach in this patch will work as a way to register web activities, it sounds as though it shouldn't be used to register permissions (which should be granted on navigating to a page or with prompts), but it could be used as a signal for Gecko to pin a package in the HTTP cache.

The reason it won't work for web activities is that there's no way to know that a pinned page at a given URL is associated with an Open Web App manifest which specifies web activities. Open Web App manifests don't use a manifest link relation to associate a page with a manifest like W3C web app manifests do.

It's really unfortunate if pinning a web site doesn't get you the same experience as installing an Open Web App for the same content, but other than manually querying the Marketplace API to look for an app associated with the same origin I can't think of a way to be backwards compatible with Open Web Apps in this respect.

We could add a moz-activities property to the W3C manifest, but that would only work for new content and I'm not even sure that's something we'd want to do. That may also require more than just a URL in the mozPinContentEvent.

We may have to accept that the legacy Open Web Apps have to be installed from the Marketplace and that only the new Firefox Apps (hosted package containing a manifest) and web apps (web site linking to a W3C manifest) can be pinned. New apps which want to use web activities would maybe have to create a Firefox App.
Priority: -- → P1
blocking-b2g: --- → 2.5+
Priority: P1 → P2
Summary: Register web activities for signed packages when they are pinned → Register web activities and system messages for signed packages when they are pinned
This depends on pinning so which we won't have support for most likely in 2.5.
blocking-b2g: 2.5+ → ---
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: