From 7aa69f48822967b0688ee0bc5ed8b13b05b79c99 Mon Sep 17 00:00:00 2001 From: saneyuki_s Date: Tue, 18 Sep 2012 11:59:48 +0900 Subject: [PATCH 1/3] Remove TreeStyleTabUtils.Comparator. --- modules/utils.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/modules/utils.js b/modules/utils.js index daa536af..eccee2fd 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -303,17 +303,9 @@ var TreeStyleTabUtils = { }, _FocusManager : null, - get Comparator() { - if (!this._Comparator) { - this._Comparator = Services.vc; - } - return this._Comparator; - }, - _Comparator : null, - get isGecko10OrLater() { - return this.Comparator.compare(Services.appinfo.version, '10.0a') > 0; + return Services.vc.compare(Services.appinfo.version, '10.0a') > 0; }, get treeBundle() { From 4a023989b98c75995ff44fd43495c5e8560ab282 Mon Sep 17 00:00:00 2001 From: saneyuki_s Date: Tue, 18 Sep 2012 12:01:39 +0900 Subject: [PATCH 2/3] Remove TreeStyleTabUtils.WindowMediator. --- modules/utils.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/modules/utils.js b/modules/utils.js index eccee2fd..ff725914 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -277,14 +277,6 @@ var TreeStyleTabUtils = { }, _SessionStore : null, - get WindowMediator() { - if (!this._WindowMediator) { - this._WindowMediator = Services.wm; - } - return this._WindowMediator; - }, - _WindowMediator : null, - get PromptService() { if (!this._PromptService) { @@ -635,18 +627,18 @@ var TreeStyleTabUtils = { }, get topBrowserWindow() { - return this.WindowMediator.getMostRecentWindow('navigator:browser'); + return Services.wm.getMostRecentWindow('navigator:browser'); }, get browserWindows() { var windows = []; - var targets = this.WindowMediator.getZOrderDOMWindowEnumerator('navigator:browser', true); + var targets = Services.wm.getZOrderDOMWindowEnumerator('navigator:browser', true); // By the bug 156333, we cannot find windows by their Z order on Linux. // https://bugzilla.mozilla.org/show_bug.cgi?id=156333 if (!targets.hasMoreElements()) - targets = this.WindowMediator.getEnumerator('navigator:browser'); + targets = Services.wm.getEnumerator('navigator:browser'); while (targets.hasMoreElements()) { From a18738be8f452146e386fa4cf7415c917548988c Mon Sep 17 00:00:00 2001 From: saneyuki_s Date: Tue, 18 Sep 2012 12:10:11 +0900 Subject: [PATCH 3/3] Remove TreeStyleTabUtils.PromptService. --- content/treestyletab/windowHelperHacks.js | 8 ++++--- modules/utils.js | 29 ++++++++--------------- modules/window.js | 6 ++--- 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/content/treestyletab/windowHelperHacks.js b/content/treestyletab/windowHelperHacks.js index 1d5762a1..21be2cf6 100644 --- a/content/treestyletab/windowHelperHacks.js +++ b/content/treestyletab/windowHelperHacks.js @@ -1,3 +1,5 @@ +Components.utils.import('resource://gre/modules/Services.jsm'); + TreeStyleTabWindowHelper.extraProperties = [ TreeStyleTabService.kID, TreeStyleTabService.kCOLLAPSED, @@ -1051,12 +1053,12 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove sv.getPref('extensions.stm.newTabPosition') != 0 ) { let checked = { value : false }; - if (sv.PromptService.confirmEx( + if (Services.prompt.confirmEx( null, sv.treeBundle.getString('compatibility_STM_warning_title'), sv.treeBundle.getString('compatibility_STM_warning_text'), - (sv.PromptService.BUTTON_TITLE_IS_STRING * sv.PromptService.BUTTON_POS_0) + - (sv.PromptService.BUTTON_TITLE_IS_STRING * sv.PromptService.BUTTON_POS_1), + (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0) + + (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_1), sv.treeBundle.getString('compatibility_STM_warning_use_TST'), sv.treeBundle.getString('compatibility_STM_warning_use_STM'), null, diff --git a/modules/utils.js b/modules/utils.js index ff725914..fb6b9cfb 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -277,15 +277,6 @@ var TreeStyleTabUtils = { }, _SessionStore : null, - get PromptService() - { - if (!this._PromptService) { - this._PromptService = Services.prompt; - } - return this._PromptService; - }, - _PromptService : null, - get FocusManager() { if (!this._FocusManager) { @@ -678,11 +669,11 @@ var TreeStyleTabUtils = { if (behavior & this.kDROPLINK_FIXED) return behavior; var checked = { value : false }; - var newChildTab = this.PromptService.confirmEx(this.browserWindow, + var newChildTab = Services.prompt.confirmEx(this.browserWindow, this.treeBundle.getString('dropLinkOnTab.title'), this.treeBundle.getString('dropLinkOnTab.text'), - (this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_0) + - (this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_1), + (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0) + + (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_1), this.treeBundle.getString('dropLinkOnTab.openNewChildTab'), this.treeBundle.getString('dropLinkOnTab.loadInTheTab'), null, @@ -709,12 +700,12 @@ var TreeStyleTabUtils = { var dummyTabFlag = behavior & this.kGROUP_BOOKMARK_USE_DUMMY; var checked = { value : false }; - var button = this.PromptService.confirmEx(this.browserWindow, + var button = Services.prompt.confirmEx(this.browserWindow, this.treeBundle.getString('openGroupBookmarkBehavior.title'), this.treeBundle.getString('openGroupBookmarkBehavior.text'), - (this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_0) + - (this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_1) + - (this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_2), + (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0) + + (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_1) + + (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_2), this.treeBundle.getString('openGroupBookmarkBehavior.subTree'), this.treeBundle.getString('openGroupBookmarkBehavior.separate'), this.treeBundle.getString('openGroupBookmarkBehavior.replace'), @@ -752,11 +743,11 @@ var TreeStyleTabUtils = { if (behavior & this.kBOOKMARK_DROPPED_TABS_FIXED) return behavior; var checked = { value : false }; - var button = this.PromptService.confirmEx(this.browserWindow, + var button = Services.prompt.confirmEx(this.browserWindow, this.treeBundle.getString('bookmarkDroppedTabs.title'), this.treeBundle.getString('bookmarkDroppedTabs.text'), - (this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_0) + - (this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_1), + (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0) + + (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_1), this.treeBundle.getString('bookmarkDroppedTabs.bookmarkAll'), this.treeBundle.getString('bookmarkDroppedTabs.bookmarkOnlyParent'), null, diff --git a/modules/window.js b/modules/window.js index 8715c1a6..86305118 100644 --- a/modules/window.js +++ b/modules/window.js @@ -1388,11 +1388,11 @@ TreeStyleTabWindow.prototype = { var checked = { value:true }; var w = this.window; w.focus(); - var shouldClose = this.PromptService.confirmEx(w, + var shouldClose = Services.prompt.confirmEx(w, this.tabbrowserBundle.getString('tabs.closeWarningTitle'), this.tabbrowserBundle.getFormattedString('tabs.closeWarningMultipleTabs', [aTabsCount]), - (this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_0) + - (this.PromptService.BUTTON_TITLE_CANCEL * this.PromptService.BUTTON_POS_1), + (Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0) + + (Services.prompt.BUTTON_TITLE_CANCEL * Services.prompt.BUTTON_POS_1), this.tabbrowserBundle.getString('tabs.closeButtonMultiple'), null, null, this.tabbrowserBundle.getString('tabs.closeWarningPromptMe'),