Closed Bug 1953005 Opened 1 year ago Closed 1 year ago

Fix more tests that fail when New Tab is packaged as a built-in addon

Categories

(Firefox :: New Tab Page, task, P1)

task

Tracking

()

RESOLVED FIXED
138 Branch
Tracking Status
firefox138 --- fixed

People

(Reporter: mconley, Assigned: mconley)

References

Details

(Whiteboard: [hnt-trainhop-project])

Attachments

(7 files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

There are a few tests outside of browser/extensions/newtab that are failing, and upon investigation of this, I have some additional changes to introduce in advance of packaging newtab as a built-in addon.

It looks like attempting to create an nsIChannel / nsILoadInfo right at
the onset of an xpcshell test isn't a great idea and will fail intermittently
with NS_ERROR_NOT_AVAILABLE. This updates the test to create the nsIChannel
and nsILoadInfo in the add_task function instead.

Waiting until the addon database is ready and the addonReady promise resolves
can take far, far too long, and cause regressions in our Talos tests. What
we really care about waiting for is resource-mapping.js having finished its
job to map resource://newtab and chrome://newtab URIs to the right places.

So we just have resource-mapping.js directly inform AboutNewTabRedirector
when that has occurred.

In order to make activity-stream.css accessible to the newtab page, we need to register
it at a chrome URI. We were originally doing this via ComponentManager.addBootstrappedManifestLocation,
which is a holdover from old bootstrapped addons. It turns out that this only works when
the path passed to it is either to an XPI or a "real" directory on the file system. When
packaging newtab as a built-in addon, when not running an out-of-band update, it's hosted
in the omni.ja JAR file, and that's not supported by addBootstrappedManifestLocation.

This patch does two things:

  1. It gets rid of the chrome.manifest file, and
  2. Has resource-mapping.js call into amIAddonManagerStartup's registerChrome instead.

Notably, however, contentaccessible=yes directives for chrome URIs were being ignored
except for testing environments. That was originally added in bug 1451503 when the
reftest addon was ported to a WebExtension. I've gone ahead and removed the NS_ENSURE
check for being in the automation case.

Pushed by mconley@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f1a6b824064a Make test_AboutNewTabRedirector.js more reliable in built-in addon case. r=home-newtab-reviewers,amy https://hg.mozilla.org/integration/autoland/rev/ae06e85459f6 Have AboutNewTabRedirector wait for resource-mapping init rather than addon init to resume channels. r=willdurand,home-newtab-reviewers,amy https://hg.mozilla.org/integration/autoland/rev/babb52cb2c3b Exempt programmatically defined newtab resource and chrome URIs from browser_all_files_referenced.js. r=baku
Pushed by mconley@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/707865adbdb7 Change strategy for chrome URI registration for newtab. r=home-newtab-reviewers,extension-reviewers,robwu,thecount

This allows the tests to have the newtab built-in addon be installed
and enabled properly when running in automation.

Without this preference set in the test, none of the built-in addons
(including the newtab build-in addon) will be available during the
test.

Pushed by mconley@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/59115c6c330a Change how newtab xpcshell tests install built-in newtab addon. r=baku https://hg.mozilla.org/integration/autoland/rev/0fa2c4c68344 Adjust browser_all_files_referenced, browser_parsable_css and allowed-dupes for built-in newtab addon case. r=baku https://hg.mozilla.org/integration/autoland/rev/614f78590327 Make tp5n test work with built-in addons. r=baku,perftest-reviewers,sparky

With bug 1949511 landed and merged, this is done.

Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 138 Branch

Mass moving from [hnt-trainhop] to [hnt-trainhop-project] for better JIRA book-keeping.

Whiteboard: [hnt-trainhop] → [hnt-trainhop-project]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: