Remove unnecessary content policy check to prevent loading scripts.
Categories
(Core :: DOM: Core & HTML, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox77 | --- | fixed |
People
(Reporter: emilio, Assigned: emilio)
References
Details
Attachments
(1 file)
Assignee | ||
Comment 1•5 years ago
|
||
This check is unnecessary. We have a central place to compute whether
scriptability is allowed that already accounts for the docshell flag,
see Scriptability::SetDocShellAllowsScript, from bug 840488:
It is also incorrect, for two reasons:
-
It should really be GetCanExecuteScripts(), so that it works properly
in subframes. -
We have a whitelist of principals that should always be allowed to
execute script (see xpc::PrincipalImmuneToScriptPolicy), which is not
accounted for here. So if we load an add-on document (or pdf.js after
bug 866634) in a docshell with disabled script execution, we still
won't load the out-of-line scripts.
The latter is what's happening in bug 810815, as TB uses the docshell
flag to disable script execution on emails.
This is still a bit of a behavior change in the sense that after this,
IIUC, scripts should download but not execute. I think that's fine and
we have no test that depends on the current behavior.
An alternative to this patch would be to change this check to get the
docshell's document's node principal, and check that against
PrincipalImmuneToScriptPolicy (and while at it fix the check to use
GetCanExecuteScripts()).
But this seems simpler.
Comment 3•5 years ago
|
||
bugherder |
Description
•