diff --git a/browser/base/content/test/newtab/head.js b/browser/base/content/test/newtab/head.js index 58a33e1c6dec..3c469ce8a246 100644 --- a/browser/base/content/test/newtab/head.js +++ b/browser/base/content/test/newtab/head.js @@ -51,25 +51,28 @@ Object.keys(requiredSize).forEach(prop => { gBrowser.contentWindow[prop] = requiredSize[prop]; } }); -let (screenHeight = {}, screenWidth = {}) { - Cc["@mozilla.org/gfx/screenmanager;1"]. - getService(Ci.nsIScreenManager). - primaryScreen. - GetAvailRectDisplayPix({}, {}, screenWidth, screenHeight); - screenHeight = screenHeight.value; - screenWidth = screenWidth.value; - if (screenHeight < gBrowser.contentWindow.outerHeight) { - info("Warning: Browser outer height is now " + - gBrowser.contentWindow.outerHeight + ", which is larger than the " + - "available screen height, " + screenHeight + - ". That may cause problems."); - } - if (screenWidth < gBrowser.contentWindow.outerWidth) { - info("Warning: Browser outer width is now " + - gBrowser.contentWindow.outerWidth + ", which is larger than the " + - "available screen width, " + screenWidth + - ". That may cause problems."); - } + +let screenHeight = {}; +let screenWidth = {}; +Cc["@mozilla.org/gfx/screenmanager;1"]. + getService(Ci.nsIScreenManager). + primaryScreen. + GetAvailRectDisplayPix({}, {}, screenWidth, screenHeight); +screenHeight = screenHeight.value; +screenWidth = screenWidth.value; + +if (screenHeight < gBrowser.contentWindow.outerHeight) { + info("Warning: Browser outer height is now " + + gBrowser.contentWindow.outerHeight + ", which is larger than the " + + "available screen height, " + screenHeight + + ". That may cause problems."); +} + +if (screenWidth < gBrowser.contentWindow.outerWidth) { + info("Warning: Browser outer width is now " + + gBrowser.contentWindow.outerWidth + ", which is larger than the " + + "available screen width, " + screenWidth + + ". That may cause problems."); } registerCleanupFunction(function () { diff --git a/browser/components/migration/tests/unit/head_migration.js b/browser/components/migration/tests/unit/head_migration.js index 2f84eac2bb08..1c47a7f94f61 100644 --- a/browser/components/migration/tests/unit/head_migration.js +++ b/browser/components/migration/tests/unit/head_migration.js @@ -20,7 +20,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "MigrationUtils", let gProfD = do_get_profile(); // Create a fake XULAppInfo to satisfy the eventual needs of the migrators. -let (XULAppInfo = { +let XULAppInfo = { // nsIXUlAppInfo get vendor() "Mozilla", get name() "XPCShell", @@ -48,17 +48,17 @@ let (XULAppInfo = { throw Cr.NS_ERROR_NO_INTERFACE; return this; } -}) { - const CONTRACT_ID = "@mozilla.org/xre/app-info;1"; - const CID = Components.ID("7685dac8-3637-4660-a544-928c5ec0e714}"); +}; - let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); - registrar.registerFactory(CID, "XULAppInfo", CONTRACT_ID, { - createInstance: function (aOuter, aIID) { - if (aOuter != null) - throw Cr.NS_ERROR_NO_AGGREGATION; - return XULAppInfo.QueryInterface(aIID); - }, - QueryInterface: XPCOMUtils.generateQI(Ci.nsIFactory) - }); -} +const CONTRACT_ID = "@mozilla.org/xre/app-info;1"; +const CID = Components.ID("7685dac8-3637-4660-a544-928c5ec0e714}"); + +let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); +registrar.registerFactory(CID, "XULAppInfo", CONTRACT_ID, { + createInstance: function (aOuter, aIID) { + if (aOuter != null) + throw Cr.NS_ERROR_NO_AGGREGATION; + return XULAppInfo.QueryInterface(aIID); + }, + QueryInterface: XPCOMUtils.generateQI(Ci.nsIFactory) +}); diff --git a/browser/components/places/tests/browser/head.js b/browser/components/places/tests/browser/head.js index 3d1a339ea3a4..6ca611e7adb0 100644 --- a/browser/components/places/tests/browser/head.js +++ b/browser/components/places/tests/browser/head.js @@ -11,16 +11,16 @@ XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils", // We need to cache this before test runs... let cachedLeftPaneFolderIdGetter; -let (getter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId")) { - if (!cachedLeftPaneFolderIdGetter && typeof(getter) == "function") - cachedLeftPaneFolderIdGetter = getter; +let getter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId"); +if (!cachedLeftPaneFolderIdGetter && typeof(getter) == "function") { + cachedLeftPaneFolderIdGetter = getter; } + // ...And restore it when test ends. registerCleanupFunction(function(){ - let (getter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId")) { - if (cachedLeftPaneFolderIdGetter && typeof(getter) != "function") - PlacesUIUtils.__defineGetter__("leftPaneFolderId", - cachedLeftPaneFolderIdGetter); + let getter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId"); + if (cachedLeftPaneFolderIdGetter && typeof(getter) != "function") { + PlacesUIUtils.__defineGetter__("leftPaneFolderId", cachedLeftPaneFolderIdGetter); } }); diff --git a/browser/components/places/tests/unit/head_bookmarks.js b/browser/components/places/tests/unit/head_bookmarks.js index c8cf9068ab98..a45f4d1428c1 100644 --- a/browser/components/places/tests/unit/head_bookmarks.js +++ b/browser/components/places/tests/unit/head_bookmarks.js @@ -28,7 +28,7 @@ XPCOMUtils.defineLazyGetter(this, "PlacesUIUtils", function() { const ORGANIZER_FOLDER_ANNO = "PlacesOrganizer/OrganizerFolder"; const ORGANIZER_QUERY_ANNO = "PlacesOrganizer/OrganizerQuery"; -// Needed by some test that relies on having an app registered. +// Needed by some test that relies on having an app registered. let XULAppInfo = { vendor: "Mozilla", name: "PlacesTest", diff --git a/browser/components/preferences/applications.js b/browser/components/preferences/applications.js index 7d808b1b8331..3334fbaf7ab1 100644 --- a/browser/components/preferences/applications.js +++ b/browser/components/preferences/applications.js @@ -1841,10 +1841,9 @@ var gApplicationsPane = { return this._getIconURLForSystemDefault(aHandlerInfo); case Ci.nsIHandlerInfo.useHelperApp: - let (preferredApp = aHandlerInfo.preferredApplicationHandler) { - if (this.isValidHandlerApp(preferredApp)) - return this._getIconURLForHandlerApp(preferredApp); - } + let preferredApp = aHandlerInfo.preferredApplicationHandler; + if (this.isValidHandlerApp(preferredApp)) + return this._getIconURLForHandlerApp(preferredApp); break; // This should never happen, but if preferredAction is set to some weird diff --git a/browser/components/sessionstore/test/browser_506482.js b/browser/components/sessionstore/test/browser_506482.js index 77f4084c7b09..6e5bd83bdbd4 100644 --- a/browser/components/sessionstore/test/browser_506482.js +++ b/browser/components/sessionstore/test/browser_506482.js @@ -26,11 +26,10 @@ function test() { } // delete existing sessionstore.js, to make sure we're not reading - // the mtime of an old one initialy - let (sessionStoreJS = getSessionstoreFile()) { - if (sessionStoreJS.exists()) - sessionStoreJS.remove(false); - } + // the mtime of an old one initially. + let sessionStoreJS = getSessionstoreFile(); + if (sessionStoreJS.exists()) + sessionStoreJS.remove(false); // test content URL const TEST_URL = "data:text/html;charset=utf-8," diff --git a/browser/components/sessionstore/test/unit/test_backup_once.js b/browser/components/sessionstore/test/unit/test_backup_once.js index 75d327dafa7d..aac6dde1d11e 100644 --- a/browser/components/sessionstore/test/unit/test_backup_once.js +++ b/browser/components/sessionstore/test/unit/test_backup_once.js @@ -13,7 +13,7 @@ let Paths; let SessionFile; // We need a XULAppInfo to initialize SessionFile -let (XULAppInfo = { +let XULAppInfo = { vendor: "Mozilla", name: "SessionRestoreTest", ID: "{230de50e-4cd1-11dc-8314-0800200c9a66}", @@ -30,20 +30,20 @@ let (XULAppInfo = { Ci.nsIXULAppInfo, Ci.nsIXULRuntime, ]) -}) { - let XULAppInfoFactory = { - createInstance: function (outer, iid) { - if (outer != null) - throw Cr.NS_ERROR_NO_AGGREGATION; - return XULAppInfo.QueryInterface(iid); - } - }; - let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); - registrar.registerFactory(Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}"), - "XULAppInfo", "@mozilla.org/xre/app-info;1", - XULAppInfoFactory); }; +let XULAppInfoFactory = { + createInstance: function (outer, iid) { + if (outer != null) + throw Cr.NS_ERROR_NO_AGGREGATION; + return XULAppInfo.QueryInterface(iid); + } +}; +let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); +registrar.registerFactory(Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}"), + "XULAppInfo", "@mozilla.org/xre/app-info;1", + XULAppInfoFactory); + function run_test() { run_next_test(); }