mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 837351 - Log blocked mixed content to the Error and Web Consoles. r=smaug
This commit is contained in:
parent
e1712a3ad0
commit
6c7617d947
@ -795,6 +795,7 @@ public:
|
||||
eBRAND_PROPERTIES,
|
||||
eCOMMON_DIALOG_PROPERTIES,
|
||||
eMATHML_PROPERTIES,
|
||||
eSECURITY_PROPERTIES,
|
||||
PropertiesFile_COUNT
|
||||
};
|
||||
static nsresult ReportToConsole(uint32_t aErrorFlags,
|
||||
|
@ -3224,7 +3224,8 @@ static const char gPropertiesFiles[nsContentUtils::PropertiesFile_COUNT][56] = {
|
||||
"chrome://global/locale/svg/svg.properties",
|
||||
"chrome://branding/locale/brand.properties",
|
||||
"chrome://global/locale/commonDialogs.properties",
|
||||
"chrome://global/locale/mathml/mathml.properties"
|
||||
"chrome://global/locale/mathml/mathml.properties",
|
||||
"chrome://global/locale/security/security.properties"
|
||||
};
|
||||
|
||||
/* static */ nsresult
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "nsIDocumentLoader.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsLoadGroup.h"
|
||||
#include "nsIScriptError.h"
|
||||
|
||||
#include "prlog.h"
|
||||
|
||||
@ -146,6 +147,24 @@ nsMixedContentBlocker::~nsMixedContentBlocker()
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsMixedContentBlocker, nsIContentPolicy)
|
||||
|
||||
void
|
||||
LogBlockingMixedContent(MixedContentTypes classification,
|
||||
nsIURI* aContentLocation,
|
||||
nsIDocument* aRootDoc)
|
||||
{
|
||||
nsAutoCString locationSpec;
|
||||
aContentLocation->GetSpec(locationSpec);
|
||||
NS_ConvertUTF8toUTF16 locationSpecUTF16(locationSpec);
|
||||
|
||||
const PRUnichar* strings[] = { locationSpecUTF16.get() };
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
|
||||
"Mixed Content Blocker",
|
||||
aRootDoc,
|
||||
nsContentUtils::eSECURITY_PROPERTIES,
|
||||
classification == eMixedDisplay ? "BlockMixedDisplayContent" : "BlockMixedActiveContent",
|
||||
strings, ArrayLength(strings));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMixedContentBlocker::ShouldLoad(uint32_t aContentType,
|
||||
nsIURI* aContentLocation,
|
||||
@ -441,6 +460,7 @@ nsMixedContentBlocker::ShouldLoad(uint32_t aContentType,
|
||||
}
|
||||
} else {
|
||||
*aDecision = nsIContentPolicy::REJECT_REQUEST;
|
||||
LogBlockingMixedContent(classification, aContentLocation, rootDoc);
|
||||
if (!rootDoc->GetHasMixedDisplayContentBlocked() && NS_SUCCEEDED(stateRV)) {
|
||||
eventSink->OnSecurityChange(aRequestingContext, (State | nsIWebProgressListener::STATE_BLOCKED_MIXED_DISPLAY_CONTENT));
|
||||
}
|
||||
@ -481,6 +501,7 @@ nsMixedContentBlocker::ShouldLoad(uint32_t aContentType,
|
||||
} else {
|
||||
//User has not overriden the pref by Disabling protection. Reject the request and update the security state.
|
||||
*aDecision = nsIContentPolicy::REJECT_REQUEST;
|
||||
LogBlockingMixedContent(classification, aContentLocation, rootDoc);
|
||||
// See if the pref will change here. If it will, only then do we need to call OnSecurityChange() to update the UI.
|
||||
if (rootDoc->GetHasMixedActiveContentBlocked()) {
|
||||
return NS_OK;
|
||||
|
2
dom/locales/en-US/chrome/security/security.properties
Normal file
2
dom/locales/en-US/chrome/security/security.properties
Normal file
@ -0,0 +1,2 @@
|
||||
BlockMixedDisplayContent = Blocked loading mixed display content "%1$S"
|
||||
BlockMixedActiveContent = Blocked loading mixed active content "%1$S"
|
@ -27,6 +27,7 @@
|
||||
locale/@AB_CD@/global/layout/HtmlForm.properties (%chrome/layout/HtmlForm.properties)
|
||||
locale/@AB_CD@/global/security/caps.properties (%chrome/security/caps.properties)
|
||||
locale/@AB_CD@/global/security/csp.properties (%chrome/security/csp.properties)
|
||||
locale/@AB_CD@/global/security/security.properties (%chrome/security/security.properties)
|
||||
locale/@AB_CD@/global/xml/prettyprint.dtd (%chrome/xml/prettyprint.dtd)
|
||||
locale/@AB_CD@/global-platform/win/accessible.properties (%chrome/accessibility/win/accessible.properties)
|
||||
locale/@AB_CD@/global-platform/mac/accessible.properties (%chrome/accessibility/mac/accessible.properties)
|
||||
|
Loading…
Reference in New Issue
Block a user