fune/toolkit/components/browser
Emilio Cobos Álvarez 5c9f8df90d Bug 1631305 - Remove unnecessary and incorrect content policy check. r=ckerschb
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:

  https://searchfox.org/mozilla-central/rev/a4d62e09a4c46aef918667fa759bf9ae898dc258/docshell/base/nsDocShell.cpp#2532

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.

Differential Revision: https://phabricator.services.mozilla.com/D71489
2020-04-22 09:26:54 +00:00
..
build
moz.build
nsEmbedCID.h
nsIEmbeddingSiteWindow.idl
nsIPrintingPromptService.idl
nsIPrintPreviewNavigation.idl
nsIWebBrowser.idl
nsIWebBrowserChrome.idl
nsIWebBrowserChrome3.idl
nsIWebBrowserChromeFocus.idl
nsIWebBrowserPrint.idl
nsWebBrowser.cpp Bug 1616353 - Part 6.3: Replace many nsILoadContext mutators with assertions, r=smaug 2020-04-07 21:39:16 +00:00
nsWebBrowser.h Bug 1614259 - Ensure BrowisngContexts are detached when nsDocShell is destroyed, r=farre 2020-03-23 13:28:09 +00:00
nsWebBrowserContentPolicy.cpp Bug 1631305 - Remove unnecessary and incorrect content policy check. r=ckerschb 2020-04-22 09:26:54 +00:00
nsWebBrowserContentPolicy.h