summaryrefslogtreecommitdiffstats
path: root/dom/base/test/browser_bug902350.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/base/test/browser_bug902350.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/base/test/browser_bug902350.js')
-rw-r--r--dom/base/test/browser_bug902350.js66
1 files changed, 66 insertions, 0 deletions
diff --git a/dom/base/test/browser_bug902350.js b/dom/base/test/browser_bug902350.js
new file mode 100644
index 000000000..cce014779
--- /dev/null
+++ b/dom/base/test/browser_bug902350.js
@@ -0,0 +1,66 @@
+/*
+ * Mixed Content Block frame navigates for target="_top" - Test for Bug 902350
+ */
+
+
+const PREF_ACTIVE = "security.mixed_content.block_active_content";
+const gHttpTestRoot = "https://example.com/tests/dom/base/test/";
+var origBlockActive;
+var gTestBrowser = null;
+
+registerCleanupFunction(function() {
+ // Set preferences back to their original values
+ Services.prefs.setBoolPref(PREF_ACTIVE, origBlockActive);
+});
+
+function MixedTestsCompleted() {
+ gBrowser.removeCurrentTab();
+ window.focus();
+ finish();
+}
+
+function test() {
+ waitForExplicitFinish();
+
+ origBlockActive = Services.prefs.getBoolPref(PREF_ACTIVE);
+
+ Services.prefs.setBoolPref(PREF_ACTIVE, true);
+
+ var newTab = gBrowser.addTab();
+ gBrowser.selectedTab = newTab;
+ gTestBrowser = gBrowser.selectedBrowser;
+ newTab.linkedBrowser.stop()
+
+ BrowserTestUtils.browserLoaded(gTestBrowser, true /*includeSubFrames*/).then(MixedTest1A);
+ var url = gHttpTestRoot + "file_bug902350.html";
+ gTestBrowser.loadURI(url);
+}
+
+// Need to capture 2 loads, one for the main page and one for the iframe
+function MixedTest1A() {
+ BrowserTestUtils.browserLoaded(gTestBrowser, true /*includeSubFrames*/).then(MixedTest1B);
+}
+
+// Find the iframe and click the link in it
+function MixedTest1B() {
+ BrowserTestUtils.browserLoaded(gTestBrowser).then(MixedTest1C);
+
+ ContentTask.spawn(gTestBrowser, null, function() {
+ var frame = content.document.getElementById("testing_frame");
+ var topTarget = frame.contentWindow.document.getElementById("topTarget");
+ topTarget.click();
+ });
+
+ // The link click should have caused a load and should not invoke the Mixed Content Blocker
+ let {gIdentityHandler} = gTestBrowser.ownerGlobal;
+ ok (!gIdentityHandler._identityBox.classList.contains("mixedActiveBlocked"),
+ "Mixed Content Doorhanger did not appear when trying to navigate top");
+}
+
+function MixedTest1C() {
+ ContentTask.spawn(gTestBrowser, null, function() {
+ Assert.equal(content.location.href, "http://example.com/",
+ "Navigating to insecure domain through target='_top' failed.")
+ }).then(MixedTestsCompleted);
+}
+