Fix browser_ext_tabs_content.js and browser_ext_windows_create_popup_cookieStoreId.js tests, to not rely on a deprecated pref
Categories
(Thunderbird :: Add-Ons: General, task)
Tracking
(Not tracked)
People
(Reporter: robwu, Assigned: john)
References
Details
Attachments
(8 external files)
To get tests that broke by bug 2011234 to pass, bug 2016020 flipped a newly introduced preference in the affected unit tests.
That preference is temporary, and going to be removed in the 152 cycle (in bug 2015559), so the tests should be updated to not require the pref flip.
I left a comment with pointers in the patch at https://phabricator.services.mozilla.com/D282760#inline-1540690
| Reporter | ||
Updated•8 months ago
|
| Assignee | ||
Comment 1•8 months ago
|
||
Hey Rob, thanks for your feedback, we will follow your suggestion shortly. However, we have one remaining puzzle to solve, which I described in https://phabricator.services.mozilla.com/D282760#inline-1541035.
We keep investigating, but are open to any ideas you might have.
| Assignee | ||
Comment 2•8 months ago
|
||
As observed in https://phabricator.services.mozilla.com/D282760#inline-1541035, our behavior
differs from Firefox when for loading about:blank. As pointed out by Rob Wu, we use the wrong
principal when opening about pages or moz-extension pages.
This patch fixes the principal used by the windows API to allow content scripts in
about:blank without using the preference which re-enabled the deprecated behavior.
Updated•8 months ago
|
| Assignee | ||
Comment 3•8 months ago
•
|
||
After disallowing content script injections into moz-extension://* pages in Bug 2011234,
most of the tasks in browser_ext_tabs_content.js are obsolete since they test deprecated
behavior.
The last task in that test is testing to load content pages via WebExtension APIs into tabs,
and has nothing to do with content scripts. All other tasks are removed and the file is
renamed.
A new test for the deprecated behavior will be added in a follow-up (Part 5 of this stack).
| Assignee | ||
Comment 4•8 months ago
•
|
||
While investigating our remaining content script tests in browser_ext_contentScripts.js
we learned that it is only testing tabs which have been created by Thunderbird itself via
window.openContentTab(). This is insufficient and needs to be extended to also test tabs
and popups which have been created by the WebExtension API.
This patch refactors the test to de-duplicate code and extend its testing capabilities to
WebExtension tabs and popups, while injecting content scripts into web-pages and also into
about:blank.
The triggering principal used by the tabs API is fixed in the same way as the first patch
in this stack is fixing it for the windows API, allowing the updated test to pass when
injecting into about:blank.
| Assignee | ||
Comment 5•8 months ago
|
||
Extend the new test file added in the parent patch to also test WebExtension popups.
Updated•8 months ago
|
| Assignee | ||
Updated•8 months ago
|
| Assignee | ||
Comment 6•8 months ago
|
||
Test that injecting content scripts into moz-extension://* pages fails,
after it had been deprecated in bug 2011234.
| Assignee | ||
Comment 7•8 months ago
|
||
The tests in browser_ext_contentScripts_mv3.js should test the same as the updated
Manifest V2 variant in browser_ext_contentScripts.js, but with the modularized approach
it is now much easier to to run all tests in the same file.
The tests for registering content scripts in the manifest remain and the file is renamed.
| Assignee | ||
Comment 8•8 months ago
|
||
| Assignee | ||
Comment 9•8 months ago
|
||
- log the manifest version of each sub test
| Assignee | ||
Comment 10•8 months ago
•
|
||
| Assignee | ||
Updated•8 months ago
|
Updated•8 months ago
|
Comment 11•8 months ago
|
||
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/2c536968336a
Part 1: Fix browser_ext_windows_create_popup_cookieStoreId.js by using the correct triggeringPrincipal. r=darktrojan,robwu
https://hg.mozilla.org/comm-central/rev/7791e966854e
Part 2: Remove content script tests from browser_ext_tabs_content.js. r=darktrojan
https://hg.mozilla.org/comm-central/rev/c65f2bd8c063
Part 3: Extend tests in browser_ext_content_pages.js. r=darktrojan
https://hg.mozilla.org/comm-central/rev/e933e3dc11fb
Part 4: Extend content script tests in browser_ext_contentScripts.js. r=darktrojan
https://hg.mozilla.org/comm-central/rev/de5d86b31ada
Part 5: Extend browser_ext_contentScripts.js to test deprecated behavior. r=darktrojan
https://hg.mozilla.org/comm-central/rev/9f298f73edb9
Part 6: De-duplicate MV3 tests from browser_ext_contentScripts_mv3.js into browser_ext_contentScripts.js. r=darktrojan
https://hg.mozilla.org/comm-central/rev/b4f823632b84
Part 7: Move Manifest V2 content script register tests into browser_ext_contentScripts_register.js. r=darktrojan
https://hg.mozilla.org/comm-central/rev/1785d4a7a06b
Part 8: Cleanup. r=darktrojan
Description
•