Merge isRestrictedPrincipalURI from ExtensionDNR.sys.mjs with ChannelWrapper::CanModify
Categories
(WebExtensions :: Request Handling, task, P3)
Tracking
(Not tracked)
People
(Reporter: robwu, Assigned: robwu)
References
(Depends on 1 open bug)
Details
(Whiteboard: [addons-jira])
After landing the small refactor of WebRequest.jsm (bug 1825882), we should merge the isRestrictedPrincipalURI
logic introduced in bug 1826651 with ChannelWrapper::CanModify
. The result would be logically equivalent, but serves multiple purposes:
ChannelWrapper::CanModify
can very efficiently check schemas (with atoms instead ofnsIURI::SchemeIs
). This is a slight optimization in the DNR evaluation, which already checkschannel.canModify
.- Validation in
CanModify
is more explicit than relying indirectly on implementation details in MatchPattern.cpp + allowedOrigins in Extension.jsm.
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
Note: we should ideally fix view-source:
detection (bug 1828141) because the referenced isRestrictedPrincipalURI
logic [1] currently causes view-source:
-URIs to be ignored.
Assignee | ||
Comment 2•2 years ago
|
||
Another scheme to consider is ws(s) - bug 1828151.
While loadingPrincipal can never have ws(s) (explicitly called out in the source of isRestrictedPrincipalURI), we also use the isRestrictedPrincipalURI
test helper in testMatchOutcome
(source). If we introduce support for "ws"/"wss" in DNR, we should also adjust the logic accordingly.
Description
•