Skip to content

Instantly share code, notes, and snippets.

@caisui
Created May 3, 2011 16:21
Show Gist options
  • Save caisui/953652 to your computer and use it in GitHub Desktop.
Save caisui/953652 to your computer and use it in GitHub Desktop.
# HG changeset patch
# Parent 2183248b822c8bd6792990e0d52c7b25c63644d1
diff --git a/common/modules/storage.jsm b/common/modules/storage.jsm
--- a/common/modules/storage.jsm
+++ b/common/modules/storage.jsm
@@ -274,6 +274,11 @@
var storage = {
alwaysReload: {},
newObject: function newObject(key, constructor, params) {
+ if (!params.reload && !params.store) {
+ let enumerator = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator).getEnumerator("navigator:browser");
+ params.reload = enumerator.hasMoreElements() && enumerator.getNext() && !enumerator.hasMoreElements();
+ }
+
if (!(key in keys) || params.reload || this.alwaysReload[key]) {
if (key in this && !(params.reload || this.alwaysReload[key]))
throw Error();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment