Bug 1404883 - Enable browser_webconsole_ineffective_iframe_sandbox_warning.js in new console frontend; r=Honza. draft
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Mon, 22 Jan 2018 16:01:31 +0100
changeset 723100 5b2f72670ec723669d5f682044e3e5e626053557
parent 723064 3d23e6d98a09a3395bf2b0d9cb03dd4be358c715
child 746774 ef2fae9309a36a0ab5ef32acf84b853357d5a47a
push id96333
push userbmo:nchevobbe@mozilla.com
push dateMon, 22 Jan 2018 15:59:47 +0000
reviewersHonza
bugs1404883
milestone60.0a1
Bug 1404883 - Enable browser_webconsole_ineffective_iframe_sandbox_warning.js in new console frontend; r=Honza. MozReview-Commit-ID: 46OaPZHvJ7Z
devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_ineffective_iframe_sandbox_warning.js
devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning-inner.html
devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning-nested1.html
devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning-nested2.html
devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning0.html
devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning1.html
devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning2.html
devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning3.html
devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning4.html
devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning5.html
devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning-inner.html
devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning-nested1.html
devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning-nested2.html
devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning0.html
devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning1.html
devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning2.html
devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning3.html
devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning4.html
devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning5.html
--- a/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
@@ -29,25 +29,16 @@ support-files =
   test-bug-601177-log-levels.html
   test-bug-601177-log-levels.js
   test-bug-630733-response-redirect-headers.sjs
   test-bug-632275-getters.html
   test-bug-644419-log-limits.html
   test-bug-646025-console-file-location.html
   test-bug-658368-time-methods.html
   test-bug-737873-mixedcontent.html
-  test-bug-752559-ineffective-iframe-sandbox-warning-inner.html
-  test-bug-752559-ineffective-iframe-sandbox-warning-nested1.html
-  test-bug-752559-ineffective-iframe-sandbox-warning-nested2.html
-  test-bug-752559-ineffective-iframe-sandbox-warning0.html
-  test-bug-752559-ineffective-iframe-sandbox-warning1.html
-  test-bug-752559-ineffective-iframe-sandbox-warning2.html
-  test-bug-752559-ineffective-iframe-sandbox-warning3.html
-  test-bug-752559-ineffective-iframe-sandbox-warning4.html
-  test-bug-752559-ineffective-iframe-sandbox-warning5.html
   test-bug-762593-insecure-passwords-about-blank-web-console-warning.html
   test-bug-762593-insecure-passwords-web-console-warning.html
   test-bug-766001-console-log.js
   test-bug-766001-js-console-links.html
   test-bug-766001-js-errors.js
   test-bug-782653-css-errors-1.css
   test-bug-782653-css-errors-2.css
   test-bug-782653-css-errors.html
@@ -104,16 +95,25 @@ support-files =
   test-iframe-762593-insecure-form-action.html
   test-iframe-762593-insecure-frame.html
   test-iframe1.html
   test-iframe2.html
   test-iframe3.html
   test-iframe-wrong-hud-iframe.html
   test-iframe-wrong-hud.html
   test-image.png
+  test-ineffective-iframe-sandbox-warning-inner.html
+  test-ineffective-iframe-sandbox-warning-nested1.html
+  test-ineffective-iframe-sandbox-warning-nested2.html
+  test-ineffective-iframe-sandbox-warning0.html
+  test-ineffective-iframe-sandbox-warning1.html
+  test-ineffective-iframe-sandbox-warning2.html
+  test-ineffective-iframe-sandbox-warning3.html
+  test-ineffective-iframe-sandbox-warning4.html
+  test-ineffective-iframe-sandbox-warning5.html
   test-inspect-cross-domain-objects-frame.html
   test-inspect-cross-domain-objects-top.html
   test-jsterm-dollar.html
   test-location-debugger-link-console-log.js
   test-location-debugger-link-errors.js
   test-location-debugger-link.html
   test-location-styleeditor-link-1.css
   test-location-styleeditor-link-2.css
@@ -279,18 +279,16 @@ skip-if = true #	Bug 1404382
 [browser_webconsole_filters.js]
 [browser_webconsole_filters_persist.js]
 [browser_webconsole_highlighter_console_helper.js]
 [browser_webconsole_history_arrow_keys.js]
 [browser_webconsole_hpkp_invalid-headers.js]
 [browser_webconsole_hsts_invalid-headers.js]
 [browser_webconsole_iframe_wrong_hud.js]
 [browser_webconsole_ineffective_iframe_sandbox_warning.js]
-skip-if = true #	Bug 1404883
-# old console skip-if = (os == 'win' && bits == 64) # Bug 1390001
 [browser_webconsole_init.js]
 [browser_webconsole_input_field_focus_on_panel_select.js]
 skip-if = true #	Bug 1405343
 [browser_webconsole_input_focus.js]
 [browser_webconsole_insecure_passwords_about_blank_web_console_warning.js]
 skip-if = true #	Bug 1404884
 [browser_webconsole_insecure_passwords_web_console_warning.js]
 skip-if = true #	Bug 1404888
--- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_ineffective_iframe_sandbox_warning.js
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_ineffective_iframe_sandbox_warning.js
@@ -5,79 +5,47 @@
 
 // Tests that warnings about ineffective iframe sandboxing are logged to the
 // web console when necessary (and not otherwise). See Bug 752559.
 
 "use strict";
 
 requestLongerTimeout(2);
 
-const TEST_URI_WARNING = "http://example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning0.html";
+const TEST_PATH = "http://example.com/browser/devtools/client/webconsole/" +
+                  "new-console-output/test/mochitest/";
+const TEST_URI_WARNING = `${TEST_PATH}test-ineffective-iframe-sandbox-warning0.html`;
 const TEST_URI_NOWARNING = [
-  "http://example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning1.html",
-  "http://example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning2.html",
-  "http://example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning3.html",
-  "http://example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning4.html",
-  "http://example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning5.html"
+  `${TEST_PATH}test-ineffective-iframe-sandbox-warning1.html`,
+  `${TEST_PATH}test-ineffective-iframe-sandbox-warning2.html`,
+  `${TEST_PATH}test-ineffective-iframe-sandbox-warning3.html`,
+  `${TEST_PATH}test-ineffective-iframe-sandbox-warning4.html`,
+  `${TEST_PATH}test-ineffective-iframe-sandbox-warning5.html`
 ];
 
 const INEFFECTIVE_IFRAME_SANDBOXING_MSG = "An iframe which has both " +
   "allow-scripts and allow-same-origin for its sandbox attribute can remove " +
   "its sandboxing.";
 const SENTINEL_MSG = "testing ineffective sandboxing message";
 
-add_task(function* () {
-  yield testYesWarning();
+add_task(async function () {
+  await testWarningMessageVisibility(TEST_URI_WARNING, true);
 
-  for (let id = 0; id < TEST_URI_NOWARNING.length; id++) {
-    yield testNoWarning(id);
+  for (const testUri of TEST_URI_NOWARNING) {
+    await testWarningMessageVisibility(testUri, false);
   }
 });
 
-function* testYesWarning() {
-  yield loadTab(TEST_URI_WARNING);
-  let hud = yield openConsole();
+async function testWarningMessageVisibility(uri, visible) {
+  const hud = await openNewTabAndConsole(uri, true);
 
-  ContentTask.spawn(gBrowser.selectedBrowser, SENTINEL_MSG, function* (msg) {
+  const sentinel = SENTINEL_MSG + Date.now();
+  const onSentinelMessage = waitForMessage(hud, sentinel);
+
+  ContentTask.spawn(gBrowser.selectedBrowser, sentinel, function (msg) {
     content.console.log(msg);
   });
-
-  yield waitForMessages({
-    webconsole: hud,
-    messages: [
-      {
-        name: "Ineffective iframe sandboxing warning displayed successfully",
-        text: INEFFECTIVE_IFRAME_SANDBOXING_MSG,
-        category: CATEGORY_SECURITY,
-        severity: SEVERITY_WARNING
-      },
-      {
-        text: SENTINEL_MSG,
-        severity: SEVERITY_LOG
-      }
-    ]
-  });
-
-  let msgs = hud.outputNode.querySelectorAll(".message[category=security]");
-  is(msgs.length, 1, "one security message");
-}
+  await onSentinelMessage;
 
-function* testNoWarning(id) {
-  yield loadTab(TEST_URI_NOWARNING[id]);
-  let hud = yield openConsole();
-
-  ContentTask.spawn(gBrowser.selectedBrowser, SENTINEL_MSG, function* (msg) {
-    content.console.log(msg);
-  });
-
-  yield waitForMessages({
-    webconsole: hud,
-    messages: [
-      {
-        text: SENTINEL_MSG,
-        severity: SEVERITY_LOG
-      }
-    ]
-  });
-
-  let msgs = hud.outputNode.querySelectorAll(".message[category=security]");
-  is(msgs.length, 0, "no security messages (case " + id + ")");
+  const warning = findMessage(hud, INEFFECTIVE_IFRAME_SANDBOXING_MSG, ".message.warn");
+  is(!!warning, visible,
+    `The warning message is${visible ? "": " not"} visible on ${uri}`);
 }
rename from devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning-inner.html
rename to devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning-inner.html
rename from devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning-nested1.html
rename to devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning-nested1.html
--- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning-nested1.html
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning-nested1.html
@@ -4,11 +4,11 @@
     <meta charset="utf8">
     <title>Bug 752559 - print warning to error console when iframe sandbox
       is being used ineffectively</title>
       <!-- Any copyright is dedicated to the Public Domain.
         http://creativecommons.org/publicdomain/zero/1.0/ -->
   </head>
   <body>
     <iframe
-src="http://www.example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning-inner.html"></iframe>
+src="http://www.example.com/browser/devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning-inner.html"></iframe>
   </body>
 </html>
rename from devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning-nested2.html
rename to devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning-nested2.html
--- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning-nested2.html
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning-nested2.html
@@ -4,11 +4,11 @@
     <meta charset="utf8">
     <title>Bug 752559 - print warning to error console when iframe sandbox
       is being used ineffectively</title>
       <!-- Any copyright is dedicated to the Public Domain.
         http://creativecommons.org/publicdomain/zero/1.0/ -->
   </head>
   <body>
     <iframe
-src="http://www.example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning-inner.html" sandbox="allow-scripts allow-same-origin"></iframe>
+src="http://www.example.com/browser/devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning-inner.html" sandbox="allow-scripts allow-same-origin"></iframe>
   </body>
 </html>
rename from devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning0.html
rename to devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning0.html
--- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning0.html
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning0.html
@@ -3,11 +3,11 @@
   <head>
     <meta charset="utf8">
     <title>Bug 752559 - print warning to error console when iframe sandbox
       is being used ineffectively (allow-scripts, allow-same-origin)</title>
       <!-- Any copyright is dedicated to the Public Domain.
         http://creativecommons.org/publicdomain/zero/1.0/ -->
   </head>
   <body>
-    <iframe src="test-bug-752559-ineffective-iframe-sandbox-warning-inner.html" sandbox="allow-scripts allow-same-origin"></iframe>
+    <iframe src="test-ineffective-iframe-sandbox-warning-inner.html" sandbox="allow-scripts allow-same-origin"></iframe>
   </body>
 </html>
rename from devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning1.html
rename to devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning1.html
--- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning1.html
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning1.html
@@ -3,11 +3,11 @@
   <head>
     <meta charset="utf8">
     <title>Bug 752559 - print warning to error console when iframe sandbox
       is being used ineffectively (allow-scripts, no allow-same-origin)</title>
       <!-- Any copyright is dedicated to the Public Domain.
         http://creativecommons.org/publicdomain/zero/1.0/ -->
   </head>
   <body>
-    <iframe src="test-bug-752559-ineffective-iframe-sandbox-warning-inner.html" sandbox="allow-scripts"></iframe>
+    <iframe src="test-ineffective-iframe-sandbox-warning-inner.html" sandbox="allow-scripts"></iframe>
   </body>
 </html>
rename from devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning2.html
rename to devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning2.html
--- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning2.html
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning2.html
@@ -3,11 +3,11 @@
   <head>
     <meta charset="utf8">
     <title>Bug 752559 - print warning to error console when iframe sandbox
       is being used ineffectively (no allow-scripts, allow-same-origin)</title>
       <!-- Any copyright is dedicated to the Public Domain.
         http://creativecommons.org/publicdomain/zero/1.0/ -->
   </head>
   <body>
-    <iframe src="test-bug-752559-ineffective-iframe-sandbox-warning-inner.html" sandbox="allow-same-origin"></iframe>
+    <iframe src="test-ineffective-iframe-sandbox-warning-inner.html" sandbox="allow-same-origin"></iframe>
   </body>
 </html>
rename from devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning3.html
rename to devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning3.html
--- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning3.html
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning3.html
@@ -4,11 +4,11 @@
     <meta charset="utf8">
     <title>Bug 752559 - print warning to error console when iframe sandbox
       is being used ineffectively (allow-scripts, allow-same-origin)</title>
       <!-- Any copyright is dedicated to the Public Domain.
         http://creativecommons.org/publicdomain/zero/1.0/ -->
   </head>
   <body>
     <iframe
-src="http://www.example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning-inner.html" sandbox="allow-scripts allow-same-origin"></iframe>
+src="http://www.example.com/browser/devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning-inner.html" sandbox="allow-scripts allow-same-origin"></iframe>
   </body>
 </html>
rename from devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning4.html
rename to devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning4.html
--- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning4.html
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning4.html
@@ -4,11 +4,11 @@
     <meta charset="utf8">
     <title>Bug 752559 - print warning to error console when iframe sandbox
       is being used ineffectively (allow-scripts, allow-same-origin, nested)</title>
       <!-- Any copyright is dedicated to the Public Domain.
         http://creativecommons.org/publicdomain/zero/1.0/ -->
   </head>
   <body>
     <iframe
-src="http://www.example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning-nested1.html" sandbox="allow-scripts allow-same-origin"></iframe>
+src="http://www.example.com/browser/devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning-nested1.html" sandbox="allow-scripts allow-same-origin"></iframe>
   </body>
 </html>
rename from devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning5.html
rename to devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning5.html
--- a/devtools/client/webconsole/new-console-output/test/mochitest/test-bug-752559-ineffective-iframe-sandbox-warning5.html
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning5.html
@@ -4,11 +4,11 @@
     <meta charset="utf8">
     <title>Bug 752559 - print warning to error console when iframe sandbox
       is being used ineffectively (nested, allow-scripts, allow-same-origin)</title>
       <!-- Any copyright is dedicated to the Public Domain.
         http://creativecommons.org/publicdomain/zero/1.0/ -->
   </head>
   <body>
     <iframe
-src="http://www.example.com/browser/devtools/client/webconsole/test/test-bug-752559-ineffective-iframe-sandbox-warning-nested2.html"></iframe>
+src="http://www.example.com/browser/devtools/client/webconsole/new-console-output/test/mochitest/test-ineffective-iframe-sandbox-warning-nested2.html"></iframe>
   </body>
 </html>