summaryrefslogtreecommitdiffstats
path: root/toolkit/components/reader/ReaderMode.jsm
diff options
context:
space:
mode:
authorAscrod <32915892+Ascrod@users.noreply.github.com>2019-04-25 20:31:18 -0400
committerAscrod <32915892+Ascrod@users.noreply.github.com>2019-04-27 07:43:13 -0400
commit952e65590368931781327d1662061d46fa15ddd2 (patch)
treeabd034f3cce0a3aaf216c2f1f83dc688e2d6e46f /toolkit/components/reader/ReaderMode.jsm
parent945b03265637bc8bf5bcd960909d1e8a4ddd5440 (diff)
downloadUXP-952e65590368931781327d1662061d46fa15ddd2.tar
UXP-952e65590368931781327d1662061d46fa15ddd2.tar.gz
UXP-952e65590368931781327d1662061d46fa15ddd2.tar.lz
UXP-952e65590368931781327d1662061d46fa15ddd2.tar.xz
UXP-952e65590368931781327d1662061d46fa15ddd2.zip
Replace explicit pref observer with lazy preference getters. Tag #361.
Diffstat (limited to 'toolkit/components/reader/ReaderMode.jsm')
-rw-r--r--toolkit/components/reader/ReaderMode.jsm14
1 files changed, 5 insertions, 9 deletions
diff --git a/toolkit/components/reader/ReaderMode.jsm b/toolkit/components/reader/ReaderMode.jsm
index ebc333495..030205446 100644
--- a/toolkit/components/reader/ReaderMode.jsm
+++ b/toolkit/components/reader/ReaderMode.jsm
@@ -38,15 +38,6 @@ this.ReaderMode = {
DEBUG: 0,
- // Don't try to parse the page if it has too many elements (for memory and
- // performance reasons)
- get maxElemsToParse() {
- delete this.parseNodeLimit;
-
- Services.prefs.addObserver("reader.parse-node-limit", this, false);
- return this.parseNodeLimit = Services.prefs.getIntPref("reader.parse-node-limit");
- },
-
/**
* Enter the reader mode by going forward one step in history if applicable,
* if not, append the about:reader page in the history instead.
@@ -548,3 +539,8 @@ this.ReaderMode = {
return readingSpeed.get(lang) || readingSpeed.get("en");
},
};
+
+// Don't try to parse the page if it has too many elements (for memory and
+// performance reasons)
+XPCOMUtils.defineLazyPreferenceGetter(
+ ReaderMode, "maxElemsToParse", "reader.parse-node-limit", 0);