From 13f521b842d44547809e6a879cb4512a51a43f5b Mon Sep 17 00:00:00 2001 From: Florent FAYOLLE Date: Tue, 30 Apr 2013 21:52:45 +0200 Subject: [PATCH] issue6133: "Reset all options" should reset the default include() aliases --- .../content/firebug/console/commandLineInclude.js | 15 +++++++++------ extension/modules/storageService.js | 8 +++++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/extension/content/firebug/console/commandLineInclude.js b/extension/content/firebug/console/commandLineInclude.js index 368a01a276..cd982a82ba 100644 --- a/extension/content/firebug/console/commandLineInclude.js +++ b/extension/content/firebug/console/commandLineInclude.js @@ -42,8 +42,9 @@ catch(ex) // Scratchpad does not exists (when using Seamonkey ...) } -var storageScope = {}; +var storageScope = {}, StorageService; Cu.import("resource://firebug/storageService.js", storageScope); +StorageService = storageScope.StorageService; var defaultAliases = { "jquery": "http://code.jquery.com/jquery-latest.js" @@ -345,11 +346,11 @@ var CommandLineInclude = Obj.extend(Firebug.Module, { if (!this.store) { - var isNewStore = !storageScope.StorageService.hasStorage(storeFilename); + var isNewStore = !StorageService.hasStorage(storeFilename); // Pass also the parent window to the new storage. The window will be // used to figure out whether the browser is running in private mode. // If yes, no data will be persisted. - this.store = storageScope.StorageService.getStorage(storeFilename, + this.store = StorageService.getStorage(storeFilename, Firebug.chrome.window); // If the file did not exist, we put in there the default aliases. @@ -512,9 +513,11 @@ var CommandLineInclude = Obj.extend(Firebug.Module, resetAllOptions: function() { - var store = this.getStore(); - if (store) - store.clear(true); + if (StorageService.hasStorage(storeFilename)) + { + StorageService.removeStorage(storeFilename); + this.store = null; + } } }); diff --git a/extension/modules/storageService.js b/extension/modules/storageService.js index d4e1b8a658..10ac1c6301 100644 --- a/extension/modules/storageService.js +++ b/extension/modules/storageService.js @@ -158,7 +158,7 @@ var StorageService = removeStorage: function(leafName) { - ObjectPersister.deleteObject(leafname); + ObjectPersister.deleteObject(leafName); }, hasStorage: function(leafName) @@ -324,6 +324,12 @@ var ObjectPersister = } }, + deleteObject: function(leafName) + { + var file = this.getFile(leafName); + return file.remove(false); + }, + // xxxHonza: this entire method is duplicated from firebug/lib/privacy module // As soon as this JSM is AMD we should just use firebug/lib/privacy. isPrivateBrowsing: function(win)