mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 838396 - Don't set hasMixedDisplayContentLoaded and hasMixedDisplayContentBlocked flag in nsMixedContentBlocker.cpp. r=smaug, r=bz
This commit is contained in:
parent
dc4adceb5c
commit
3ef3be62a6
@ -192,6 +192,7 @@ MOCHITEST_BROWSER_FILES = \
|
||||
browser_bug882977.js \
|
||||
browser_bug887515.js \
|
||||
browser_canonizeURL.js \
|
||||
browser_mixedcontent_securityflags.js \
|
||||
browser_clearplugindata_noage.html \
|
||||
browser_clearplugindata.html \
|
||||
browser_clearplugindata.js \
|
||||
@ -337,6 +338,7 @@ MOCHITEST_BROWSER_FILES = \
|
||||
test_bug628179.html \
|
||||
test_bug839103.html \
|
||||
test_wyciwyg_copying.html \
|
||||
test-mixedcontent-securityerrors.html \
|
||||
title_test.svg \
|
||||
video.ogg \
|
||||
zoom_test.html \
|
||||
|
@ -0,0 +1,57 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// The test loads a web page with mixed active and display content
|
||||
// on it while the "block mixed content" settings are _on_.
|
||||
// It then checks that the mixed content flags have been set correctly.
|
||||
// The test then overrides the MCB settings and checks that the flags
|
||||
// have been set correctly again.
|
||||
// Bug 838396 - Not setting hasMixedDisplayContentLoaded and
|
||||
// hasMixedDisplayContentBlocked flag in nsMixedContentBlocker.cpp
|
||||
|
||||
const TEST_URI = "https://example.com/browser/browser/base/content/test/test-mixedcontent-securityerrors.html";
|
||||
let gTestBrowser = null;
|
||||
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["security.mixed_content.block_active_content", true],
|
||||
["security.mixed_content.block_display_content", true]]}, blockMixedContentTest);
|
||||
}
|
||||
|
||||
function blockMixedContentTest()
|
||||
{
|
||||
gBrowser.selectedTab = gBrowser.addTab(TEST_URI);
|
||||
let tab = gBrowser.selectedTab;
|
||||
gTestBrowser = gBrowser.getBrowserForTab(tab);
|
||||
|
||||
gTestBrowser.addEventListener("load", function onLoad(aEvent) {
|
||||
gTestBrowser.removeEventListener(aEvent.type, onLoad, true);
|
||||
is(gTestBrowser.docShell.hasMixedDisplayContentBlocked, true, "hasMixedDisplayContentBlocked flag has been set");
|
||||
is(gTestBrowser.docShell.hasMixedActiveContentBlocked, true, "hasMixedActiveContentBlocked flag has been set");
|
||||
is(gTestBrowser.docShell.hasMixedDisplayContentLoaded, false, "hasMixedDisplayContentLoaded flag has been set");
|
||||
is(gTestBrowser.docShell.hasMixedActiveContentLoaded, false, "hasMixedActiveContentLoaded flag has been set");
|
||||
overrideMCB();
|
||||
}, true);
|
||||
}
|
||||
|
||||
function overrideMCB()
|
||||
{
|
||||
gTestBrowser.addEventListener("load", mixedContentOverrideTest, true);
|
||||
var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
|
||||
ok(notification, "Mixed Content Doorhanger didn't appear");
|
||||
// Click on the doorhanger to allow mixed content.
|
||||
notification.secondaryActions[0].callback(mixedContentOverrideTest);
|
||||
}
|
||||
|
||||
function mixedContentOverrideTest()
|
||||
{
|
||||
gTestBrowser.removeEventListener("load", mixedContentOverrideTest, true);
|
||||
|
||||
is(gTestBrowser.docShell.hasMixedDisplayContentLoaded, true, "hasMixedDisplayContentLoaded flag has not been set");
|
||||
is(gTestBrowser.docShell.hasMixedActiveContentLoaded, true, "hasMixedActiveContentLoaded flag has not been set");
|
||||
is(gTestBrowser.docShell.hasMixedDisplayContentBlocked, false, "second hasMixedDisplayContentBlocked flag has been set");
|
||||
is(gTestBrowser.docShell.hasMixedActiveContentBlocked, false, "second hasMixedActiveContentBlocked flag has been set");
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<!--
|
||||
Bug 875456 - Log mixed content messages from the Mixed Content Blocker to the
|
||||
Security Pane in the Web Console
|
||||
-->
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html dir="ltr" xml:lang="en-US" lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf8">
|
||||
<title>Mixed Content test - http on https</title>
|
||||
<script src="testscript.js"></script>
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
</head>
|
||||
<body>
|
||||
<iframe src="http://example.com"></iframe>
|
||||
<img src="http://example.com/tests/image/test/mochitest/blue.png"></img>
|
||||
</body>
|
||||
</html>
|
@ -482,12 +482,14 @@ nsMixedContentBlocker::ShouldLoad(uint32_t aContentType,
|
||||
*aDecision = nsIContentPolicy::ACCEPT;
|
||||
rootDoc->SetHasMixedActiveContentLoaded(true);
|
||||
if (!rootDoc->GetHasMixedDisplayContentLoaded() && NS_SUCCEEDED(stateRV)) {
|
||||
rootDoc->SetHasMixedDisplayContentLoaded(true);
|
||||
eventSink->OnSecurityChange(aRequestingContext, (State | nsIWebProgressListener::STATE_LOADED_MIXED_DISPLAY_CONTENT));
|
||||
}
|
||||
} else {
|
||||
*aDecision = nsIContentPolicy::REJECT_REQUEST;
|
||||
LogMixedContentMessage(classification, aContentLocation, rootDoc, eBlocked);
|
||||
if (!rootDoc->GetHasMixedDisplayContentBlocked() && NS_SUCCEEDED(stateRV)) {
|
||||
rootDoc->SetHasMixedDisplayContentBlocked(true);
|
||||
eventSink->OnSecurityChange(aRequestingContext, (State | nsIWebProgressListener::STATE_BLOCKED_MIXED_DISPLAY_CONTENT));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user