Bug 1147911 Part 4: Fix test to allow for separate file content process. r=ochameau
authorBob Owen <bobowencode@gmail.com>
Thu, 24 Nov 2016 15:08:31 +0000
changeset 324253 bc0845271a6238163be12978a15676e252353c66
parent 324252 abb78de9e86b025e5d015240b70b43d435da18d6
child 324254 19e9ac4bb5ca12a3a60a7109e311c4eca3b94739
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersochameau
bugs1147911
milestone53.0a1
Bug 1147911 Part 4: Fix test to allow for separate file content process. r=ochameau
devtools/client/webconsole/test/browser_webconsole_bug_595223_file_uri.js
devtools/client/webconsole/test/head.js
--- a/devtools/client/webconsole/test/browser_webconsole_bug_595223_file_uri.js
+++ b/devtools/client/webconsole/test/browser_webconsole_bug_595223_file_uri.js
@@ -2,32 +2,33 @@
 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const PREF = "devtools.webconsole.persistlog";
 const TEST_FILE = "test-network.html";
-const TEST_URI = "data:text/html;charset=utf8,<p>test file URI";
 
 var hud;
 
 add_task(function* () {
   Services.prefs.setBoolPref(PREF, true);
 
   let jar = getJar(getRootDirectory(gTestPath));
   let dir = jar ?
             extractJarToTmp(jar) :
             getChromeDir(getResolvedURI(gTestPath));
 
   dir.append(TEST_FILE);
   let uri = Services.io.newFileURI(dir);
 
-  let { browser } = yield loadTab(TEST_URI);
+  // We need a file remote type to make sure we don't switch processes when we
+  // load the file:// URI.
+  let { browser } = yield loadTab("about:blank", "file");
 
   hud = yield openConsole();
   hud.jsterm.clearOutput();
 
   let loaded = loadBrowser(browser);
   BrowserTestUtils.loadURI(gBrowser.selectedBrowser, uri.spec);
   yield loaded;
 
--- a/devtools/client/webconsole/test/head.js
+++ b/devtools/client/webconsole/test/head.js
@@ -41,20 +41,20 @@ const WEBCONSOLE_STRINGS_URI = "devtools
 var WCUL10n = new WebConsoleUtils.L10n(WEBCONSOLE_STRINGS_URI);
 
 const DOCS_GA_PARAMS = "?utm_source=mozilla" +
                        "&utm_medium=firefox-console-errors" +
                        "&utm_campaign=default";
 
 flags.testing = true;
 
-function loadTab(url) {
+function loadTab(url, preferredRemoteType) {
   let deferred = promise.defer();
 
-  let tab = gBrowser.selectedTab = gBrowser.addTab(url);
+  let tab = gBrowser.selectedTab = gBrowser.addTab(url, { preferredRemoteType });
   let browser = gBrowser.getBrowserForTab(tab);
 
   browser.addEventListener("load", function onLoad() {
     browser.removeEventListener("load", onLoad, true);
     deferred.resolve({tab: tab, browser: browser});
   }, true);
 
   return deferred.promise;