Closed
Bug 1825881
Opened 2 years ago
Closed 1 year ago
Simplify ChannelWrapper::IsSystemLoad
Categories
(WebExtensions :: Request Handling, task, P3)
WebExtensions
Request Handling
Tracking
(firefox117 fixed)
RESOLVED
FIXED
117 Branch
Tracking | Status | |
---|---|---|
firefox117 | --- | fixed |
People
(Reporter: robwu, Assigned: robwu)
References
(Blocks 1 open bug)
Details
(Whiteboard: [addons-jira])
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
ChannelWrapper::IsSystemLoad
has the following logic:
- If a loadingPrincipal is available, return whether that is the system principal.
- Otherwise, if a browsing context is unavailable or if it is the top level, return false.
- Otherwise, if principalToInherit is available, return whether it is the system principal.
- Otherwise, if triggeringPrincipal is available, return whether it is the system principal.
- Otherwise return false.
The logic above is misleading. Steps 3-5 can be skipped.
- loadingPrincipal is always set for non-top-level loads (source: documentation of loadingPrincipal in nsILoadInfo.idl), so after step 1 we only have top-level loads.
- Step 2 consists of two steps:
!bc
- in theory, it is possible for theBrowsingContext
to have disappeared at the time of checkingloadInfo.browsingContext
, so this check is reasonable.bc->IsTop()
- since we only have a top-level load at this point, we would return unconditionally now.
- The remaining steps are skipped, but here is my remaining analysis for completeness:
- Step 3: principalToInherit is always null for document requests and might be non-null for document requests. I can imagine the principal being inherit for
about:blank
and (when opted in via pref) data:-URL requests. But these don't pass through WebRequest (data:-URL support was removed in bug 1631933). - Step 4: triggeringPrincipal can be a system principal for user-triggered top-level navigations. But we do really want to allow interception of these in the webRequest API (bug 1318800).
So, clearly, ChannelWrapper::IsSystemLoad()
can be simplified to only check whether the loading principal is a system principal.
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
After the simplification and further analysis, it appears that ChannelWrapper::IsSystemLoad()
can be removed and its only use be replaced with ChannelWrapper::CanModify()
. For details, see the last paragraph of bug 1825882.
Blocks: 1825882
Assignee | ||
Updated•2 years ago
|
Severity: -- → N/A
Priority: -- → P3
Assignee | ||
Comment 2•2 years ago
|
||
Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/9f498a41967b
Simplify ChannelWrapper::IsSystemLoad r=rpl
Comment 4•1 year ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 1 year ago
status-firefox117:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 117 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•