Commit Graph
191 Commits
Author SHA1 Message Date
Masayuki Nakano 6388e58841 Bug 2044523 - Make nsPIDOMWindow.h stop including nsPIDOMWindowInlines.h r=dom-core-reviewers,geckoview-reviewers,media-playback-reviewers,webrtc-reviewers,win-reviewers,layout-reviewers,manuel,aosmond,smaug,bwc,gstoll,dholbert,farre,m_kato
This patch does not make some header files stop including the inline
header because fixing them require more changes.

Note that `#include "nsComponentManagerUtils.h"` is fixing a bustage
caused by "use of undeclared identifier 'do_CreateInstance'" error.

Differential Revision: https://phabricator.services.mozilla.com/D304432
2026-06-09 03:49:55 +00:00
Rob Wu 447c2adaab Bug 2034168 - Gate file access on internal permission r=zombie
This patch introduces the backend to gate file access on an internal
permission. File access to extensions is already limited, to content
scripts only. All calls of CanAccessURI that set aAllowFilePermission to
true have been audited and updated with comments as needed.

The UI to manage this internal permission is part of the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D300598
2026-05-29 23:21:55 +00:00
Kagami Sascha Rosylight c72cf2e6da Bug 2031661 - Part 1: Add missing cycle collection entries in toolkit/ r=extension-reviewers,credential-management-reviewers,ai-platform-reviewers,robwu,dimi
The intent is that cycle collectible members should be cycle collected unless there's a good reason not to.

Differential Revision: https://phabricator.services.mozilla.com/D299779
2026-05-28 09:03:49 +00:00
Tomislav Jovanovic cee0f2d2c0 Bug 2041393 - Apply enterprise guards to content-scripts in MV2 r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D302167
2026-05-26 19:09:23 +00:00
Tomislav Jovanovic f7ecba9837 Bug 1745823 - Implement support for negative permissions with GuardSets r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D298293
2026-05-13 04:03:50 +00:00
Rob Wu 0c0b2f5d79 Bug 2033905 - Permit access to web-accessible resources with <all_urls> r=willdurand
When an extension resource is exposed via web_accessible_resources with
"matches" including "<all_urls>", it should be exposed to any URL.
This did not happen for sandboxed documents, because those have a null
principal that serializes to a URL with the "moz-nullprincipal" scheme.

To get this to work, permit requests from schemes unknown to
MatchPattern when `matches` contains `<all_urls>` (and `*://*/*`).

This patch also includes test coverage for requests from file:-URLs,
because that did not exist before, and a naive implementation (that
accepts any request if MatchesAllWebUrls is true) could inadvertently
permit requests from non-sandboxed file:-URLs. The unit tests ensure
that this does not and will not happen.

Differential Revision: https://phabricator.services.mozilla.com/D298074
2026-05-04 15:12:00 +00:00
Sylvestre Ledru 6be5ec2fff Bug 2023419 - Remove Emacs/Vim modelines from toolkit/ r=emilio,mkaply,extension-reviewers,credential-management-reviewers,desktop-theme-reviewers,win-reviewers,webcompat-reviewers,core-sessionstore-reviewers,profiles-reviewers,ai-platform-reviewers,mconley,twisniewski,gstoll,jhirsch,rpl,dimi,akulyk
Differential Revision: https://phabricator.services.mozilla.com/D287874
2026-04-14 12:56:19 +00:00
agoloman ae99dfb565 Revert "Bug 2023419: apply code formatting via Lando" for causing bc failures @browser_sendQuery.js.
This reverts commit aa15b809d9.

Revert "Bug 2023419 - Remove Emacs/Vim modelines from toolkit/ - follow up r=emilio"

This reverts commit c659385796.

Revert "Bug 2023419 - Remove Emacs/Vim modelines from toolkit/ r=emilio,mkaply,extension-reviewers,credential-management-reviewers,desktop-theme-reviewers,win-reviewers,webcompat-reviewers,core-sessionstore-reviewers,profiles-reviewers,ai-platform-reviewers,mconley,twisniewski,gstoll,jhirsch,rpl,dimi,akulyk"

This reverts commit 1e55e9bf9b.
2026-04-13 13:06:21 +00:00
Sylvestre Ledru 1e55e9bf9b Bug 2023419 - Remove Emacs/Vim modelines from toolkit/ r=emilio,mkaply,extension-reviewers,credential-management-reviewers,desktop-theme-reviewers,win-reviewers,webcompat-reviewers,core-sessionstore-reviewers,profiles-reviewers,ai-platform-reviewers,mconley,twisniewski,gstoll,jhirsch,rpl,dimi,akulyk
Differential Revision: https://phabricator.services.mozilla.com/D287874
2026-04-13 11:30:51 +00:00
rperta f5848b1deb Revert "Bug 2023419: apply code formatting via Lando" for causing bc failures at browser_sendQuery.js and browser_console_to_mozlog.js
This reverts commit f8a9770c7d.

This reverts commit 47e16fbdd2.

This reverts commit 9f363abaef.
2026-03-20 06:37:54 +00:00
Sylvestre Ledru 9f363abaef Bug 2023419 - Remove Emacs/Vim modelines from toolkit/ r=emilio,mkaply,extension-reviewers,credential-management-reviewers,desktop-theme-reviewers,win-reviewers,webcompat-reviewers,profiles-reviewers,ai-ondevice-reviewers,mconley,twisniewski,gstoll,jhirsch,rpl,dimi,akulyk
replaced by .editorconfig
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D287874
2026-03-20 04:55:48 +00:00
Luca Greco 539c7f9ea5 Bug 2011234 - Collect Glean telemetry event on content script matching moz-extension documents. r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D280602
2026-02-10 23:46:57 +00:00
Luca Greco eb46c11336 Bug 2011234 - Log a deprecation warning on content script injection into WebExtensions page or subframes. r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D280600
2026-02-10 23:46:51 +00:00
Luca Greco 2a23653e7c Bug 2011234 - Support restriction on content script moz-extension urls matching and enable restriction by default in Nightly. r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D279865
2026-02-10 23:46:45 +00:00
Andrea Marchesini 670b7ff1e3 Bug 2012484 - Include addon_version in the telemetry ping of the URL-Classifier Harmful Add-on feature, r=rpl,data-stewards
Differential Revision: https://phabricator.services.mozilla.com/D280421
2026-02-02 22:57:54 +00:00
Andrea Marchesini 4ae3a234fb Bug 1986320 - Implement an add-on block URL-Classifier feature - part 4 - Expose the URLClassifier addon feature to non-recommended addons only, r=zombie
Differential Revision: https://phabricator.services.mozilla.com/D263546
2025-12-04 01:26:54 +00:00
Cristian Tuns c99c271730 Revert "Bug 1986320: apply code formatting via Lando" for causing lint failures in browser_ext_urlclassifier.js
This reverts commit 8c2c577a03.

Revert "Bug 1986320 - Implement an add-on block URL-Classifier feature - part 6 - Mobile r=geckoview-reviewers,android-reviewers,geckoview-api-reviewers,tcampbell,ohall"

This reverts commit 7b0c7db7c3.

Revert "Bug 1986320 - Implement an add-on block URL-Classifier feature - part 5 - Block top-level documents when loaded by add-ons, r=extension-reviewers,dimi,fluent-reviewers,robwu,bolsson,android-reviewers,android-l10n-reviewers,delphine,tcampbell"

This reverts commit 9a058ba0d5.

Revert "Bug 1986320 - Implement an add-on block URL-Classifier feature - part 4 - Expose the URLClassifier addon feature to non-recommended addons only, r=zombie"

This reverts commit 41e8a464d9.

Revert "Bug 1986320 - Implement an add-on block URL-Classifier feature - part 3 - devtool support, r=devtools-reviewers,dimi,devtools-backward-compat-reviewers,bomsy"

This reverts commit c0f866931b.

Revert "Bug 1986320 - Implement an add-on block URL-Classifier feature - part 2 - telemetry, r=dimi,extension-reviewers,robwu"

This reverts commit 1bdba2f426.

Revert "Bug 1986320 - Implement an add-on block URL-Classifier feature - part 1, r=dimi,geckoview-reviewers,extension-reviewers,tcampbell,robwu"

This reverts commit f1a3613f44.
2025-12-03 19:15:17 +00:00
Andrea Marchesini 41e8a464d9 Bug 1986320 - Implement an add-on block URL-Classifier feature - part 4 - Expose the URLClassifier addon feature to non-recommended addons only, r=zombie
Differential Revision: https://phabricator.services.mozilla.com/D263546
2025-12-03 18:47:33 +00:00
iulian moraru a5862a7e70 Revert "Bug 1999177 - Support cursor scroll in the composable toolbar r=android-reviewers,moyin" for causing linting failures on browser_ext_urlclassifier.js.
This reverts commit ae35529fab.

Revert "Bug 1986320: apply code formatting via Lando"

This reverts commit 768f3614ff.

Revert "Bug 1986320 - Implement an add-on block URL-Classifier feature - part 5 - Block top-level documents when loaded by add-ons, r=extension-reviewers,dimi,fluent-reviewers,robwu,bolsson,android-reviewers,android-l10n-reviewers,delphine,tcampbell"

This reverts commit 5f2e690d2b.

Revert "Bug 1986320 - Implement an add-on block URL-Classifier feature - part 4 - Expose the URLClassifier addon feature to non-recommended addons only, r=zombie"

This reverts commit 1e7b1753d4.

Revert "Bug 1986320 - Implement an add-on block URL-Classifier feature - part 3 - devtool support, r=devtools-reviewers,dimi,devtools-backward-compat-reviewers,bomsy"

This reverts commit 928a253e9e.

Revert "Bug 1986320 - Implement an add-on block URL-Classifier feature - part 2 - telemetry, r=dimi,extension-reviewers,robwu"

This reverts commit 2a13eb6ec3.

Revert "Bug 1986320 - Implement an add-on block URL-Classifier feature - part 1, r=dimi,geckoview-reviewers,extension-reviewers,tcampbell,robwu"

This reverts commit 1ef88130d9.
2025-12-03 10:26:32 +00:00
Andrea Marchesini 1e7b1753d4 Bug 1986320 - Implement an add-on block URL-Classifier feature - part 4 - Expose the URLClassifier addon feature to non-recommended addons only, r=zombie
Differential Revision: https://phabricator.services.mozilla.com/D263546
2025-12-03 09:47:54 +00:00
Henri SivonenandVincent Hilla 39a8a4171b Bug 543435 - Make initial about:blank not get overwritten by an async about:blank load. r=sessionstore-reviewers,sfoster,timhuang,credential-management-reviewers,issammani,webidl,extension-reviewers,tabbrowser-reviewers,migration-reviewers,home-newtab-reviewers,hsivonen,cookie-reviewers,fxview-reviewers,firefox-desktop-core-reviewers ,dao,valentin,mossop,smaug,geckoview-reviewers,Jamie,mtigley,thecount,media-playback-reviewers,padenot,dom-worker-reviewers,jesup,jdescottes,asuth,robwu,karlt,profiler-reviewers,kpatenio,devtools-reviewers,tcampbell,nchevobbe
Co-authored-by: Vincent Hilla <[email protected]>
Signed-off-by: Vincent Hilla <[email protected]>

Differential Revision: https://phabricator.services.mozilla.com/D155376
2025-11-24 05:34:22 +00:00
James Hay a6dee5b53d Bug 1864284 - Allow localhost origins in temporary MV3 add-ons. r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D269149
2025-11-24 02:22:01 +00:00
serge-sans-paille 7662b3abdc Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.

In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.

One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.

Most of the heavy lifting was done through:

    $ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
    $ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'

Differential Revision: https://phabricator.services.mozilla.com/D268706
2025-10-21 19:36:01 +00:00
Cristina Horotan 8a1b1970b7 Revert "Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch" for causing Gtest failures on AlreadyAddRefed.h
This reverts commit e98adca292.
2025-10-21 16:16:29 +00:00
serge-sans-paille e98adca292 Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.

In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.

One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.

Most of the heavy lifting was done through:

    $ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
    $ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'

Differential Revision: https://phabricator.services.mozilla.com/D268706
2025-10-21 15:05:17 +00:00
Cristina Horotan aab924e90d Revert "Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch" for causing build bustage at nsBrowserApp.cpp
This reverts commit fd0ffa193c.
2025-10-21 10:44:13 +00:00
serge-sans-paille fd0ffa193c Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.

In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.

One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.

Most of the heavy lifting was done through:

    $ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
    $ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'

Differential Revision: https://phabricator.services.mozilla.com/D268706
2025-10-21 09:44:11 +00:00
Narcis Beleuzu e1e6bbb1c9 Revert "Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch" for causing bustages on Document.cpp
This reverts commit b23c15e927.
2025-10-21 06:34:58 +00:00
serge-sans-paille b23c15e927 Bug 1994397 - Remove obsolete Unused.h header r=emilio,tschuster,geckoview-reviewers,extension-reviewers,application-update-reviewers,media-playback-reviewers,webrtc-reviewers,cookie-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,permissions-reviewers,profiles-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,firefox-svg-reviewers,layout-reviewers,timhuang,gstoll,TravisLong,bytesized,mstange,karlt,robwu,pehrsons,m_kato,jari,jhirsch
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.

In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.

One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.

Most of the heavy lifting was done through:

    $ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
    $ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'

Differential Revision: https://phabricator.services.mozilla.com/D268706
2025-10-21 06:01:36 +00:00
Christina Lin d2f488f844 Bug 1679997 - Add cssOrigin to declarative contentScripts API. r=robwu.
Differential Revision: https://phabricator.services.mozilla.com/D251173
2025-08-29 22:52:50 +00:00
Tom Schuster 5c03c67b7d Bug 1962803 - Simplify WebExtensionPolicy::CanAccessWindow. r=zombie
Differential Revision: https://phabricator.services.mozilla.com/D246805
2025-04-28 18:39:21 +00:00
Rob Wu e403867fde Bug 1954067 - Fix typo extensions.backgroundServiceWorkerEnabled.enabled r=rpl
And add clarifying comments in Troubleshoot.sys.mjs to help future
developers with using the lists in the correct way.

Add `extensions.backgroundServiceWorker.enabled` to `PREFS_FOR_DISPLAY`
because it may control extension behavior, currently only on Nightly.
It now shows up in `about:support` iff the pref value was changed.

Differential Revision: https://phabricator.services.mozilla.com/D241614
2025-03-14 12:23:01 +00:00
Rob Wu 7113cec113 Bug 1917000 - Stop injecting after "userScripts" revocation r=zombie
Differential Revision: https://phabricator.services.mozilla.com/D229715
2024-11-22 16:03:11 +00:00
Rob Wu 9e22dc2d32 Bug 1911835 - Add support for multiple USER_SCRIPT worlds r=zombie
Differential Revision: https://phabricator.services.mozilla.com/D228975
2024-11-20 16:50:14 +00:00
Rob Wu cc55e038e0 Bug 1911835 - Accept USER_SCRIPT as world value in internals r=zombie
This patch adds the USER_SCRIPT value as a supported value in the
internal WebExtensionContentScript constructor.

This patch does not introduce a distinct USER_SCRIPT sandbox yet; that
will be done in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D228973
2024-11-20 16:50:14 +00:00
Rob Wu 9127a231cb Bug 1911834 - Implement matches OR includeGlobs semantics for user scripts r=zombie
Differential Revision: https://phabricator.services.mozilla.com/D228350
2024-11-20 16:50:13 +00:00
Andrea Marchesini d9643c3a7d Bug 1916569 - Fix a crash in mozilla::ExtensionPolicyService::ExecuteContentScripts, r=rpl
Differential Revision: https://phabricator.services.mozilla.com/D226742
2024-10-29 09:02:36 +00:00
Andrea Marchesini a58114571d Bug 1856071 - Remove extensions.script_about_blank_without_permission pref, r=rpl
Differential Revision: https://phabricator.services.mozilla.com/D225345
2024-10-12 08:53:06 +00:00
Nika Layzell 44d99735f2 Bug 1906734 - Switch WebExtension resources to use only static protocol flags, r=extension-reviewers,necko-reviewers,kershaw,robwu
Previously, the WebExtension protocol used dynamic protocol flags which
were based on the WebExtension policy in order to enforce things such as
availability in private browsing and the accessibility of certain
resources.

Since the shift to MV3, these checks have required more complex checks
than what was possible to specify with protocol flags, which required
the addition of WEBEXT_URI_WEB_ACCESSIBLE - a security flag which would
trigger further checks with the EPS to determine if the URI can be
loaded.

This was somewhat inefficient, as fetching the URI flags would require
looking up the policy each time dynamic flags were looked up, as well as
when policy specifics were being checked after loading flags. In
addition, it lead to a number of flags which were very specific to
extension protocols.

This patch changes extensions to no longer have dynamic flags, instead
specifying the static `URI_IS_WEBEXTENSION_RESOURCE` security flag. When
this flag is specified, security checks are made by querying the
ExtensionPolicyService to ask if the load should be permitted, combining
the specific security checks for Extension resources into a simpler
code-path, and avoids redundant checks.

Differential Revision: https://phabricator.services.mozilla.com/D216076
2024-07-17 16:02:34 +00:00
Rob Wu 9f6eb950cc Bug 1901894 - Stop scheduling content script injection for initial about:blank of top-level opaque origins r=rpl
The primary change of this patch is to add IsInitialDocument() to the
"is this an about blank document where I should be able to run scripts
despite it not having a matching origin" logic. This is to avoid
scheduling content scripts in top-level about:blank in the parent
process as mentioned in the bug report.

The original use case (supporting execution in top-level about:blank)
continues to be supported, which is demonstrated by the still passing
tests in test_ext_contentscript_about_blank.html. A new regression test
was added (test_toplevel_aboutblank_at_document_start) in the same file,
which fails before the fix  when run with --tag=in-process-webextensions
due to unexpected extra messages like the bug, and passes with the fix.

Differential Revision: https://phabricator.services.mozilla.com/D213439
2024-06-15 00:44:26 +00:00
Sandor Molnar 62676bfbbe Backed out 3 changesets (bug 1900222, bug 1901894) for causing assertion failures @ WebExtensionPolicy.cpp CLOSED TREE
Backed out changeset 51a2aaa49a8d (bug 1900222)
Backed out changeset c018b69d1062 (bug 1900222)
Backed out changeset 9dcb51985a58 (bug 1901894)
2024-06-15 01:20:49 +03:00
Rob Wu 00d6214cea Bug 1901894 - Stop scheduling content script injection for initial about:blank of top-level opaque origins r=rpl
The primary change of this patch is to add IsInitialDocument() to the
"is this an about blank document where I should be able to run scripts
despite it not having a matching origin" logic. This is to avoid
scheduling content scripts in top-level about:blank in the parent
process as mentioned in the bug report.

The original use case (supporting execution in top-level about:blank)
continues to be supported, which is demonstrated by the still passing
tests in test_ext_contentscript_about_blank.html. A new regression test
was added (test_toplevel_aboutblank_at_document_start) in the same file,
which fails before the fix  when run with --tag=in-process-webextensions
due to unexpected extra messages like the bug, and passes with the fix.

Differential Revision: https://phabricator.services.mozilla.com/D213439
2024-06-14 20:24:12 +00:00
Rob Wu e88045481f Bug 1736575 - Support world:"MAIN" in content_scripts r=willdurand
Differential Revision: https://phabricator.services.mozilla.com/D211866
2024-06-03 20:32:11 +00:00
Rob Wu f7a8d7cb3f Bug 1897113 - Require match_origin_as_fallback for blob:-URLs r=rpl
Differential Revision: https://phabricator.services.mozilla.com/D210638
2024-05-27 11:49:15 +00:00
Rob Wu 72e32fbd41 Bug 1475831 - Add match_origin_as_fallback support r=rpl
Adds match_origin_as_fallback support to content_scripts declared
statically in manifest.json.

Support for this option in dynamic registration and execution will be
handled in the next patches.

Differential Revision: https://phabricator.services.mozilla.com/D209368
2024-05-13 17:06:51 +00:00
Rob Wu 0733b12304 Bug 1411641 - Support content scripts on sandboxed http(s)/file:-URLs r=rpl
This patch adds support for matching http(s) (and file:) documents even
if they are sandboxed. Previously, there was no way for extensions to
run content scripts there.

Differential Revision: https://phabricator.services.mozilla.com/D209367
2024-05-13 17:06:49 +00:00
Rob Wu effa0f3dfa Bug 1411641 - Add documentation and test coverage for content script preloading r=rpl
ExtensionPolicyService::InjectContentScripts has two code paths, one
with preloading and one without. The most important case, without
preloading (i.e. executing immediately) is covered extensively by unit
tests. The preloading case had zero test coverage before.

Due to existing implementation limitations (*), the actual behavior of
preloading differs logically from the non-preloading case. Before making
any changes to the area, this patch adds documentation (mainly to
DocInfo::PrincipalURL and DocInfo::Principal) and extensive test
coverage to explicitly confirm the correctness of preloading behavior.

(*) in short: with DOMWindow (non-preloading), the principal is always
known and available, whereas with LoadInfo (preloading), the principal
has to be reconstructed, but without enough information available to
tell the difference for null principals.

Differential Revision: https://phabricator.services.mozilla.com/D209366
2024-05-13 17:06:49 +00:00
Rob Wu aebb66be58 Bug 1863034 - Lock backgroundServiceWorkerEnabled to false on non-Nightly r=rpl
Differential Revision: https://phabricator.services.mozilla.com/D193544
2023-12-05 16:22:09 +00:00
Rob Wu 42801dbcd5 Bug 1853409 - Part 2: Require "all urls" match pattern for top-level match_about_blank r=rpl
This patch changes the behavior as follows:

- match_about_blank in content_scripts in manifest.json will now only
  run in top-level about:blank if its `matches` key specifies a match
  pattern set that is equivalent to all http(s) URLs.

- matchAboutBlank in tabs.executeScript requires activeTab permission
  (as before), or an all-URLs host permission.

Differential Revision: https://phabricator.services.mozilla.com/D189492
2023-10-02 19:07:58 +00:00
Rob Wu a82452fb93 Bug 1853409 - Part 1: Introduce MatchPatternSet::MatchesAllWebUrls r=zombie
Introduce `MatchPatternSet::MatchesAllWebUrls()` and
`MatchPattern::MatchesAllWebUrls()` to serve the purpose of determining
whether a match pattern is going to match any http(s) URL.

Differential Revision: https://phabricator.services.mozilla.com/D189491
2023-10-02 19:07:58 +00:00