From cec873a30333c045d8ccb4f793b8974d5ea812a3 Mon Sep 17 00:00:00 2001 From: saneyuki_s Date: Thu, 3 Jan 2013 09:06:21 +0900 Subject: [PATCH] Define 'prefs' as lazy getter in modules/window.js --- modules/window.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/modules/window.js b/modules/window.js index 44aa96e7..202fcc0e 100644 --- a/modules/window.js +++ b/modules/window.js @@ -40,6 +40,11 @@ const Ci = Components.interfaces; Components.utils.import('resource://gre/modules/XPCOMUtils.jsm'); +XPCOMUtils.defineLazyGetter(this, 'prefs', function() { + Components.utils.import('resource://treestyletab-modules/lib/prefs.js'); + return window['piro.sakura.ne.jp'].prefs; +}); + XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm"); Components.utils.import('resource://treestyletab-modules/base.js'); @@ -379,13 +384,6 @@ TreeStyleTabWindow.prototype = { initUninstallationListener : function TSTWindow_initUninstallationListener() { - var namespace = {}; - Components.utils.import( - 'resource://treestyletab-modules/lib/prefs.js', - namespace - ); - var prefs = namespace.prefs; - namespace = void(0); var self = this; var restorePrefs = function() { if (prefs.getPref('extensions.treestyletab.tabsOnTop.originalState')) { @@ -398,8 +396,6 @@ TreeStyleTabWindow.prototype = { self.window.TabsOnTop.enabled = true; } - if (!prefs) return; - let restorePrefs = [ 'browser.tabs.loadFolderAndReplace', 'browser.tabs.insertRelatedAfterCurrent',