Closed Bug 1483600 Opened 6 years ago Closed 6 years ago

Raptor webext content script is not injected into geckoview example app page after updating URL

Categories

(GeckoView :: General, defect, P1)

defect

Tracking

(firefox-esr52 wontfix, firefox-esr60 wontfix, firefox61 wontfix, firefox62 wontfix, firefox63 fixed)

RESOLVED FIXED
mozilla63
Tracking Status
firefox-esr52 --- wontfix
firefox-esr60 --- wontfix
firefox61 --- wontfix
firefox62 --- wontfix
firefox63 --- fixed

People

(Reporter: rwood, Assigned: mbrubeck)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

When using a webext in geckoview (example app), the background scripts defined in the extension manifest are injected into the page, however it looks like content_scripts defined in the manifest are not loading after browsing to a URL. The geckoview_example app starts up (I have it start with about:blank instead of the default, using the 'url' cmd line option when launching the activity). Then I use browser.tabs.update and change the URL to the speedometer benchmark URL. The URL changes and the benchmark starts running, however the 'benchmark_relay.js' webext content script [1] is not injected into the benchmark page (which causes the benchmark results to never be received by raptor). The page name is in the 'matches' list in the 'content_scripts' webext section. Tried setting it to '<all_urls>' anyway but still it wouldn't load. On Firefox Desktop raptor creates a new tab first (about:blank) and then uses browser.tabs.update to change to the benchmark URL. I'm wondering if maybe in geckoview since there's no new tab created, maybe browsing to the URL via tabs.update is for some reason causing the extension content_scripts not to be injected - but totally just guessing. [1] https://searchfox.org/mozilla-central/source/testing/raptor/webext/raptor/
Matt can you take a look at this one too?
Flags: needinfo?(mbrubeck)
Assignee: nobody → mbrubeck
Status: NEW → ASSIGNED
Flags: needinfo?(mbrubeck)
`ExtensionProcessScript.loadContentScript` is called as expected, but it does not inject the content script because `DocumentManager.globals.has(window.docShell.messageManager)` returns false here: https://dxr.mozilla.org/mozilla-central/rev/4e56a2f51ad739ca52046723448f3129a58f1666/toolkit/components/extensions/extension-process-script.js#510
This happens because `DocumentManager.initGlobal` isn't called because GeckoView doesn't dispatch the "tab-content-frameloader-created" notification during content process initialization.
Comment on attachment 9001750 [details] Bug 1483600 - Notify "tab-content-frameloader-created" in GeckoView content script. r=jchen Jim Chen [:jchen] [:darchons] has approved the revision.
Attachment #9001750 - Flags: review+
With the geckoview_example app from your try push (comment 5) I verified that the raptor extension content script (benchmark-relay.js) is now injected into the speedometer page (and the benchmark results are now received successfully). AWESOME, thank you! :)
Pushed by mbrubeck@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cc1ffa88e12c Notify "tab-content-frameloader-created" in GeckoView content script. r=jchen
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 63
Product: Firefox for Android → GeckoView
Target Milestone: Firefox 63 → mozilla63
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: