Bug 1543973 - Switch to AppConstants to avoid appinfo conflict. r=mixedpuppy
authorDale Harvey <dale@arandomurl.com>
Tue, 16 Apr 2019 20:56:56 +0000
changeset 469797 ac38a6790d00
parent 469796 aa8babb8b1ee
child 469798 a72c4fef3a4a
push id35882
push usercbrindusan@mozilla.com
push dateWed, 17 Apr 2019 15:54:01 +0000
treeherdermozilla-central@37185c0ae520 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy
bugs1543973
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1543973 - Switch to AppConstants to avoid appinfo conflict. r=mixedpuppy Differential Revision: https://phabricator.services.mozilla.com/D27804
docshell/test/unit/test_nsDefaultURIFixup_info.js
--- a/docshell/test/unit/test_nsDefaultURIFixup_info.js
+++ b/docshell/test/unit/test_nsDefaultURIFixup_info.js
@@ -1,14 +1,19 @@
 const {AddonTestUtils} = ChromeUtils.import("resource://testing-common/AddonTestUtils.jsm");
+const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 
 const kSearchEngineID = "test_urifixup_search_engine";
 const kSearchEngineURL = "http://www.example.org/?search={searchTerms}";
 const kForceHostLookup = "browser.fixup.dns_first_for_single_words";
 
+AddonTestUtils.init(this);
+AddonTestUtils.overrideCertDB();
+AddonTestUtils.createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
+
 // TODO(bug 1522134), this test should also use
 // combinations of the following flags.
 var flagInputs = [
   Services.uriFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP,
   Services.uriFixup.FIXUP_FLAGS_MAKE_ALTERNATE_URI,
   Services.uriFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS,
 ];
 
@@ -460,17 +465,17 @@ var testcases = [ {
     protocolChange: true,
   },
   {
     input: " moz\ti\tlla.org ",
     keywordLookup: true,
   },
 ];
 
-if (Services.appinfo.OS.toLowerCase().startsWith("win")) {
+if (AppConstants.platform == "win") {
   testcases.push({
     input: "C:\\some\\file.txt",
     fixedURI: "file:///C:/some/file.txt",
     protocolChange: true,
   });
   testcases.push({
     input: "//mozilla",
     fixedURI: "http://mozilla/",
@@ -489,20 +494,16 @@ if (Services.appinfo.OS.toLowerCase().st
     protocolChange: true,
   });
 }
 
 function sanitize(input) {
   return input.replace(/\r|\n/g, "").trim();
 }
 
-AddonTestUtils.init(this);
-AddonTestUtils.overrideCertDB();
-AddonTestUtils.createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
-
 add_task(async function setup() {
   var prefList = ["browser.fixup.typo.scheme", "keyword.enabled",
                   "browser.fixup.domainwhitelist.whitelisted"];
   for (let pref of prefList) {
     Services.prefs.setBoolPref(pref, true);
   }
 
   await AddonTestUtils.promiseStartupManager();