Addon Injection issue in apps other than system app.

RESOLVED FIXED

Status

defect
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: rishav_, Assigned: fabrice)

Tracking

unspecified
ARM
Gonk (Firefox OS)

Firefox Tracking Flags

(firefox45 fixed, b2g-v2.5 fixed)

Details

Attachments

(1 attachment)

I am trying to inject an addon in SMS app, but i have to inject it (enable the addon switch) everytime before i launch the app.

After killing the app and restarting again, addon doesn't exist anymore. I have to enable it again (i.e enable -> disable-> enable), then only addon get injected for that session.

Here is the addon worked on: https://github.com/kumarrishav/sms-setting/blob/master/index.js

Everything works as expected in case of add-on injected in system app.
Might be related to bug 1220700.
See Also: → 1220700
Nope, It's not related i guess. Bug 1220700 is fixed now. Thanks for this.
But this big is still there.
You can test this addon as STR.

Thanks
In https://github.com/kumarrishav/sms-setting/blob/master/manifest.json manifest_version needs to be "2"
Also, you are matching app://sms.gaiamobile.org/index.html but I think the sms app uses hashes when navigating that may prevent your script from being injected. Can you try with app://sms.gaiamobile.org/index.html* instead?
I think this should be an issue.
Anyway i changed it as you said, but still same issue

{
  "manifest_version": 2,
  "name": "SMS Setting Access",
  "description": "Access Messages Settings from conversation thread. Message App > Thread > Conversation > option menu",
  "version": "1.0",
  "author": "Kumar Rishav",
  "package_path": "package.zip",
  "content_scripts": [{
    "matches": [
      "app://sms.gaiamobile.org/index.html*"
    ],
    "css": [],
    "js": ["index.js"]
  }],
  "icons": {
    "128": "icons/messages_settings.png"
  }
}
*should not be an issue
This patch add the add-on to the OOP whitelist before calling extension.startup() to let the extension code correctly load the manifest in child process. This is a fallout of the changes from bug 1214133 where we modified the child process initialization for extensions.
Attachment #8690295 - Flags: review?(ferjmoreno)
Attachment #8690295 - Flags: review?(ferjmoreno) → review+
https://hg.mozilla.org/mozilla-central/rev/7f501ebf62ef
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Comment on attachment 8690295 [details] [diff] [review]
addon-registration.patch

[Triage Comment]
Attachment #8690295 - Flags: approval‑mozilla‑b2g44+
Sorry Fabrice, I am still facing the same issue. I am on today's build.
Assignee: nobody → fabrice
Flags: needinfo?(fabrice)
(In reply to kumar rishav (:rishav_) from comment #10)
> Sorry Fabrice, I am still facing the same issue. I am on today's build.

On the 2.6 (master) branch, not 2.5 right?
Flags: needinfo?(fabrice)
yeah, on nightly-latest (2.6 pre release)
Build Identifier: 20151128150206
git commit info: 2015-11-27 (ee6d8625)
I have several add-ons installed on my build and can't reproduce that anymore. We need better steps to reproduce and a logcat output.
STR: 
Install this add-on: https://github.com/kumarrishav/sms-setting

1) Enable the add-on
2) go to message app, tap on any thread
3) tap on more option button (three dots), you will see third option as 'Settings'

Now close(kill) the message app, and open again and repeat above step. Sometimes(1 out of 10 times) it may work as expected, so repeat 2-3 times to reproduce it.

Also check out this STR Video (Video quality is not good but you will get the STR). https://www.youtube.com/watch?v=ErFXIrY-DSg

Thanks
Hey Fabrice,
Did this help in reproducing the bug?

Thanks
Flags: needinfo?(fabrice)
Kumar,

I tested again, and added a few console.log() in your extension to figure out what's going on. It appears to me that:
- we always inject index.js properly (add a top level console.log() to see that).
- your event handler is properly attached, and renderItems() is called as expected.
- sometimes, the new "Settings" button doesn't appear.

So it's either a bug in your extension, maybe caused by a race between your event listener and the default one?
Flags: needinfo?(fabrice)
Duplicate of this bug: 1230819
You need to log in before you can comment on or make changes to this bug.