-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Moves DEFAULT_PREFENCES into JSON format. #7317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
f9308d3
to
91166b5
Compare
this._readFromStorage(DEFAULT_PREFERENCES).then(function(prefObj) { | ||
return this.initializedPromise = defaultPreferences.then( | ||
function (defaults) { | ||
this.defaults = defaults; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the defaults
are now exposed on Preferences
, can we use Object.freeze(defaults)
here to prevent outside tampering with the default values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can do that
91166b5
to
f4bf183
Compare
/botio-windows preview |
From: Bot.io (Windows)ReceivedCommand cmd_preview from @yurydelendik received. Current queue size: 0 Live output at: http://107.22.172.223:8877/cfa637fe8eff645/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/cfa637fe8eff645/output.txt Total script time: 1.77 mins Published |
@@ -82,8 +102,8 @@ var Preferences = { | |||
*/ | |||
reset: function preferencesReset() { | |||
return this.initializedPromise.then(function() { | |||
this.prefs = Object.create(DEFAULT_PREFERENCES); | |||
return this._writeToStorage(DEFAULT_PREFERENCES); | |||
this.prefs = Object.create(this.defaults); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that my previous comment causes issues here, since after a reset
, attempting to set
a new value fails.
I still think that it makes a certain amount of sense to freeze the defaults
, so could we instead change this line to this.prefs = Object.assign({}, this.defaults);
, to fix this issue?
r=me, with the comment addressed. |
|
f4bf183
to
df10513
Compare
Makes it easier to address #7192 , e.g.
PDFJSDev.json('file.json')
will be inlining loaded object.