Bug 1278306 - Remove all uses of 'content.location = ' in the webconsole tests. r=bgrins, a=test-only
authormoby <mvonbriesen@mozilla.com>
Mon, 06 Jun 2016 13:35:00 +0200
changeset 339687 bc5cb981f4b84403b49aa5b28c00d20a17db3c1f
parent 339686 106d43cbf4a230c59a6eb66b7538b983c257fd0d
child 339688 153c74d40a43a648d9a60c91af8042f5112be46f
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins, test-only
bugs1278306
milestone49.0a2
Bug 1278306 - Remove all uses of 'content.location = ' in the webconsole tests. r=bgrins, a=test-only
devtools/client/webconsole/test/browser_bug664688_sandbox_update_after_navigation.js
devtools/client/webconsole/test/browser_netmonitor_shows_reqs_in_webconsole.js
devtools/client/webconsole/test/browser_webconsole_bug_582201_duplicate_errors.js
devtools/client/webconsole/test/browser_webconsole_bug_595223_file_uri.js
devtools/client/webconsole/test/browser_webconsole_bug_595934_message_categories.js
devtools/client/webconsole/test/browser_webconsole_bug_630733_response_redirect_headers.js
devtools/client/webconsole/test/browser_webconsole_bug_644419_log_limits.js
devtools/client/webconsole/test/browser_webconsole_bug_653531_highlighter_console_helper.js
devtools/client/webconsole/test/browser_webconsole_bug_737873_mixedcontent.js
devtools/client/webconsole/test/browser_webconsole_bug_770099_violation.js
devtools/client/webconsole/test/browser_webconsole_certificate_messages.js
devtools/client/webconsole/test/browser_webconsole_dont_navigate_on_doubleclick.js
devtools/client/webconsole/test/browser_webconsole_hsts_invalid-headers.js
devtools/client/webconsole/test/browser_webconsole_netlogging_reset_filter.js
devtools/client/webconsole/test/browser_webconsole_shows_reqs_in_netmonitor.js
devtools/client/webconsole/test/browser_webconsole_strict_mode_errors.js
--- a/devtools/client/webconsole/test/browser_bug664688_sandbox_update_after_navigation.js
+++ b/devtools/client/webconsole/test/browser_bug664688_sandbox_update_after_navigation.js
@@ -37,17 +37,17 @@ add_task(function* () {
         category: CATEGORY_OUTPUT,
       },
     ],
   };
 
   yield waitForMessages(msgForLocation1);
 
   // load second url
-  content.location = TEST_URI2;
+  BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URI2);
   yield loadBrowser(gBrowser.selectedBrowser);
 
   is(hud.outputNode.textContent.indexOf("Permission denied"), -1,
      "no permission denied errors");
 
   hud.jsterm.clearOutput();
   hud.jsterm.execute("window.location.href");
 
--- a/devtools/client/webconsole/test/browser_netmonitor_shows_reqs_in_webconsole.js
+++ b/devtools/client/webconsole/test/browser_netmonitor_shows_reqs_in_webconsole.js
@@ -51,17 +51,17 @@ add_task(function* () {
 
 function loadDocument(browser) {
   let deferred = promise.defer();
 
   browser.addEventListener("load", function onLoad() {
     browser.removeEventListener("load", onLoad, true);
     deferred.resolve();
   }, true);
-  content.location = TEST_PATH;
+  BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_PATH);
 
   return deferred.promise;
 }
 
 function testNetmonitor(toolbox) {
   let monitor = toolbox.getCurrentPanel();
   let { RequestsMenu } = monitor.panelWin.NetMonitorView;
   RequestsMenu.lazyUpdate = false;
--- a/devtools/client/webconsole/test/browser_webconsole_bug_582201_duplicate_errors.js
+++ b/devtools/client/webconsole/test/browser_webconsole_bug_582201_duplicate_errors.js
@@ -18,17 +18,17 @@ add_task(function* () {
   let hud = yield openConsole();
 
   // On e10s, the exception is triggered in child process
   // and is ignored by test harness
   if (!Services.appinfo.browserTabsRemoteAutostart) {
     expectUncaughtException();
   }
 
-  content.location = TEST_URI;
+  BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URI);
 
   yield waitForMessages({
     webconsole: hud,
     messages: [{
       text: "fooDuplicateError1",
       category: CATEGORY_JS,
       severity: SEVERITY_ERROR,
     },
--- a/devtools/client/webconsole/test/browser_webconsole_bug_595223_file_uri.js
+++ b/devtools/client/webconsole/test/browser_webconsole_bug_595223_file_uri.js
@@ -23,17 +23,17 @@ add_task(function* () {
   let uri = Services.io.newFileURI(dir);
 
   let { browser } = yield loadTab(TEST_URI);
 
   hud = yield openConsole();
   hud.jsterm.clearOutput();
 
   let loaded = loadBrowser(browser);
-  content.location = uri.spec;
+  BrowserTestUtils.loadURI(gBrowser.selectedBrowser, uri.spec);
   yield loaded;
 
   yield testMessages();
 
   Services.prefs.clearUserPref(PREF);
   hud = null;
 });
 
--- a/devtools/client/webconsole/test/browser_webconsole_bug_595934_message_categories.js
+++ b/devtools/client/webconsole/test/browser_webconsole_bug_595934_message_categories.js
@@ -174,17 +174,17 @@ function testNext() {
         }
       } else {
         pageError = true;
       }
 
       startNextTest();
     }, true);
 
-    content.location = testLocation;
+    BrowserTestUtils.loadURI(gBrowser.selectedBrowser, testLocation);
   } else {
     testEnded = true;
     finishTest();
   }
 }
 
 function testEnd() {
   if (!testEnded) {
--- a/devtools/client/webconsole/test/browser_webconsole_bug_630733_response_redirect_headers.js
+++ b/devtools/client/webconsole/test/browser_webconsole_bug_630733_response_redirect_headers.js
@@ -32,17 +32,17 @@ function consoleOpened(hud) {
   HUDService.lastFinishedRequest.callback = (aHttpRequest) => {
     let status = aHttpRequest.response.status;
     lastFinishedRequests[status] = aHttpRequest;
     if ("301" in lastFinishedRequests &&
         "404" in lastFinishedRequests) {
       deferred.resolve();
     }
   };
-  content.location = TEST_URI2;
+  BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URI2);
 
   return deferred.promise;
 }
 
 function getHeaders() {
   let deferred = promise.defer();
 
   HUDService.lastFinishedRequest.callback = null;
--- a/devtools/client/webconsole/test/browser_webconsole_bug_644419_log_limits.js
+++ b/devtools/client/webconsole/test/browser_webconsole_bug_644419_log_limits.js
@@ -28,17 +28,17 @@ add_task(function* () {
   let loaded = loadBrowser(browser);
 
   // On e10s, the exception is triggered in child process
   // and is ignored by test harness
   if (!Services.appinfo.browserTabsRemoteAutostart) {
     expectUncaughtException();
   }
 
-  content.location = TEST_URI;
+  BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URI);
   yield loaded;
 
   yield testWebDevLimits();
   yield testWebDevLimits2();
   yield testJsLimits();
   yield testJsLimits2();
 
   yield testNetLimits();
--- a/devtools/client/webconsole/test/browser_webconsole_bug_653531_highlighter_console_helper.js
+++ b/devtools/client/webconsole/test/browser_webconsole_bug_653531_highlighter_console_helper.js
@@ -99,11 +99,11 @@ function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = gBrowser.addTab();
   gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
     gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
     waitForFocus(createDocument, content);
   }, true);
 
-  content.location = "data:text/html;charset=utf-8,test for highlighter " +
-                     "helper in web console";
+  BrowserTestUtils.loadURI(gBrowser.selectedBrowser,
+    "data:text/html;charset=utf-8,test for highlighter helper in web console");
 }
--- a/devtools/client/webconsole/test/browser_webconsole_bug_737873_mixedcontent.js
+++ b/devtools/client/webconsole/test/browser_webconsole_bug_737873_mixedcontent.js
@@ -25,17 +25,17 @@ add_task(function* () {
 
   yield testMixedContent(hud);
 
   Services.prefs.clearUserPref("security.mixed_content.block_display_content");
   Services.prefs.clearUserPref("security.mixed_content.block_active_content");
 });
 
 var testMixedContent = Task.async(function* (hud) {
-  content.location = TEST_HTTPS_URI;
+  BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_HTTPS_URI);
 
   let results = yield waitForMessages({
     webconsole: hud,
     messages: [{
       text: "example.com",
       category: CATEGORY_NETWORK,
       severity: SEVERITY_WARNING,
     }],
--- a/devtools/client/webconsole/test/browser_webconsole_bug_770099_violation.js
+++ b/devtools/client/webconsole/test/browser_webconsole_bug_770099_violation.js
@@ -18,17 +18,17 @@ const CSP_VIOLATION_MSG = "Content Secur
 add_task(function* () {
   let { browser } = yield loadTab(TEST_URI);
 
   let hud = yield openConsole();
 
   hud.jsterm.clearOutput();
 
   let loaded = loadBrowser(browser);
-  content.location = TEST_VIOLATION;
+  BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_VIOLATION);
   yield loaded;
 
   yield waitForSuccess({
     name: "CSP policy URI warning displayed successfully",
     validator: function () {
       return hud.outputNode.textContent.indexOf(CSP_VIOLATION_MSG) > -1;
     }
   });
--- a/devtools/client/webconsole/test/browser_webconsole_certificate_messages.js
+++ b/devtools/client/webconsole/test/browser_webconsole_certificate_messages.js
@@ -53,20 +53,20 @@ function runTestLoop(theHud) {
   if (!gHud) {
     gHud = theHud;
   }
   gHud.jsterm.clearOutput();
   gContentBrowser.addEventListener("load", onLoad, true);
   if (gCurrentTest.pref) {
     SpecialPowers.pushPrefEnv({"set": gCurrentTest.pref},
       function () {
-        content.location = gCurrentTest.url;
+        BrowserTestUtils.loadURI(gBrowser.selectedBrowser, gCurrentTest.url);
       });
   } else {
-    content.location = gCurrentTest.url;
+    BrowserTestUtils.loadURI(gBrowser.selectedBrowser, gCurrentTest.url);
   }
 }
 
 function onLoad() {
   gContentBrowser.removeEventListener("load", onLoad, true);
 
   waitForSuccess({
     name: gCurrentTest.name,
--- a/devtools/client/webconsole/test/browser_webconsole_dont_navigate_on_doubleclick.js
+++ b/devtools/client/webconsole/test/browser_webconsole_dont_navigate_on_doubleclick.js
@@ -21,17 +21,17 @@ function test() {
   function* runner() {
     const TEST_PAGE_URI = "http://example.com/browser/devtools/client/" +
                           "webconsole/test/test-console.html" + "?_uniq=" +
                           Date.now();
 
     const {tab} = yield loadTab("data:text/html;charset=utf8,<p>hello</p>");
     const hud = yield openConsole(tab);
 
-    content.location = TEST_PAGE_URI;
+    BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_PAGE_URI);
 
     let messages = yield waitForMessages({
       webconsole: hud,
       messages: [{
         name: "Network request message",
         url: TEST_PAGE_URI,
         category: CATEGORY_NETWORK
       }]
--- a/devtools/client/webconsole/test/browser_webconsole_hsts_invalid-headers.js
+++ b/devtools/client/webconsole/test/browser_webconsole_hsts_invalid-headers.js
@@ -61,17 +61,17 @@ add_task(function* () {
     text: "Strict-Transport-Security: The site specified a header that " +
           "included multiple \u2018max-age\u2019 directives."
   }, hud);
 });
 
 function* checkForMessage(curTest, hud) {
   hud.jsterm.clearOutput();
 
-  content.location = curTest.url;
+  BrowserTestUtils.loadURI(gBrowser.selectedBrowser, curTest.url);
 
   let results = yield waitForMessages({
     webconsole: hud,
     messages: [
       {
         name: curTest.name,
         text: curTest.text,
         category: CATEGORY_SECURITY,
--- a/devtools/client/webconsole/test/browser_webconsole_netlogging_reset_filter.js
+++ b/devtools/client/webconsole/test/browser_webconsole_netlogging_reset_filter.js
@@ -21,17 +21,17 @@ add_task(function* () {
 
   yield pushPrefEnv();
   hud = yield openConsole();
   hud.jsterm.clearOutput();
 
   HUDService.lastFinishedRequest.callback = request => requests.push(request);
 
   let loaded = loadBrowser(browser);
-  content.location = TEST_FILE_URI;
+  BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_FILE_URI);
   yield loaded;
 
   yield testMessages();
   let htmlRequest = requests.find(e => e.request.url.endsWith("html"));
   ok(htmlRequest, "htmlRequest was a html");
 
   yield hud.ui.openNetworkPanel(htmlRequest.actor);
   let toolbox = gDevTools.getToolbox(hud.target);
--- a/devtools/client/webconsole/test/browser_webconsole_shows_reqs_in_netmonitor.js
+++ b/devtools/client/webconsole/test/browser_webconsole_shows_reqs_in_netmonitor.js
@@ -51,17 +51,17 @@ add_task(function* () {
 
 function loadDocument(browser) {
   let deferred = promise.defer();
 
   browser.addEventListener("load", function onLoad() {
     browser.removeEventListener("load", onLoad, true);
     deferred.resolve();
   }, true);
-  content.location = TEST_PATH;
+  BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_PATH);
 
   return deferred.promise;
 }
 
 function testNetmonitor(toolbox) {
   let monitor = toolbox.getCurrentPanel();
   let { RequestsMenu } = monitor.panelWin.NetMonitorView;
   RequestsMenu.lazyUpdate = false;
--- a/devtools/client/webconsole/test/browser_webconsole_strict_mode_errors.js
+++ b/devtools/client/webconsole/test/browser_webconsole_strict_mode_errors.js
@@ -26,49 +26,52 @@ add_task(function* () {
         severity: SEVERITY_ERROR,
       },
     ],
   });
 
   if (!Services.appinfo.browserTabsRemoteAutostart) {
     expectUncaughtException();
   }
-  content.location = "data:text/html;charset=utf8,<script>'use strict';function f(a, a) {};</script>";
+  BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "data:text/html;charset="
+    + "utf8,<script>'use strict';function f(a, a) {};</script>");
 
   yield waitForMessages({
     webconsole: hud,
     messages: [
       {
         text: "SyntaxError: duplicate formal argument a",
         category: CATEGORY_JS,
         severity: SEVERITY_ERROR,
       },
     ],
   });
 
   if (!Services.appinfo.browserTabsRemoteAutostart) {
     expectUncaughtException();
   }
-  content.location = "data:text/html;charset=utf8,<script>'use strict';var o = {get p() {}};o.p = 1;</script>";
+  BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "data:text/html;charset="
+    + "utf8,<script>'use strict';var o = {get p() {}};o.p = 1;</script>");
 
   yield waitForMessages({
     webconsole: hud,
     messages: [
       {
         text: "TypeError: setting a property that has only a getter",
         category: CATEGORY_JS,
         severity: SEVERITY_ERROR,
       },
     ],
   });
 
   if (!Services.appinfo.browserTabsRemoteAutostart) {
     expectUncaughtException();
   }
-  content.location = "data:text/html;charset=utf8,<script>'use strict';v = 1;</script>";
+  BrowserTestUtils.loadURI(gBrowser.selectedBrowser,
+    "data:text/html;charset=utf8,<script>'use strict';v = 1;</script>");
 
   yield waitForMessages({
     webconsole: hud,
     messages: [
       {
         text: "ReferenceError: assignment to undeclared variable v",
         category: CATEGORY_JS,
         severity: SEVERITY_ERROR,