mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 596778 - Stop setting cache size with each user keystroke in size input field, by only setting the cache size pref when the field is loses focus. r=mak77
This commit is contained in:
parent
8013b41a02
commit
38676f1ead
@ -48,6 +48,7 @@ var gAdvancedPane = {
|
||||
this.initSubmitHealthReport();
|
||||
#endif
|
||||
|
||||
this.updateCacheSizeInputField();
|
||||
this.updateActualCacheSize();
|
||||
this.updateActualAppCacheSize();
|
||||
|
||||
@ -378,24 +379,31 @@ var gAdvancedPane = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts the cache size from units of KB to units of MB and returns that
|
||||
* value.
|
||||
* Converts the cache size from units of KB to units of MB and stores it in
|
||||
* the textbox element.
|
||||
*/
|
||||
readCacheSize: function ()
|
||||
updateCacheSizeInputField()
|
||||
{
|
||||
var preference = document.getElementById("browser.cache.disk.capacity");
|
||||
return preference.value / 1024;
|
||||
let cacheSizeElem = document.getElementById("cacheSize");
|
||||
let cachePref = document.getElementById("browser.cache.disk.capacity");
|
||||
cacheSizeElem.value = cachePref.value / 1024;
|
||||
if (cachePref.locked)
|
||||
cacheSizeElem.disabled = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts the cache size as specified in UI (in MB) to KB and returns that
|
||||
* value.
|
||||
* Updates the cache size preference once user enters a new value.
|
||||
* We intentionally do not set preference="browser.cache.disk.capacity"
|
||||
* onto the textbox directly, as that would update the pref at each keypress
|
||||
* not only after the final value is entered.
|
||||
*/
|
||||
writeCacheSize: function ()
|
||||
updateCacheSizePref()
|
||||
{
|
||||
var cacheSize = document.getElementById("cacheSize");
|
||||
var intValue = parseInt(cacheSize.value, 10);
|
||||
return isNaN(intValue) ? 0 : intValue * 1024;
|
||||
let cacheSizeElem = document.getElementById("cacheSize");
|
||||
let cachePref = document.getElementById("browser.cache.disk.capacity");
|
||||
// Converts the cache size as specified in UI (in MB) to KB.
|
||||
let intValue = parseInt(cacheSizeElem.value, 10);
|
||||
cachePref.value = isNaN(intValue) ? 0 : intValue * 1024;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -250,9 +250,7 @@
|
||||
accesskey="&limitCacheSizeBefore.accesskey;"
|
||||
value="&limitCacheSizeBefore.label;"/>
|
||||
<textbox id="cacheSize" type="number" size="4" max="1024"
|
||||
preference="browser.cache.disk.capacity"
|
||||
onsyncfrompreference="return gAdvancedPane.readCacheSize();"
|
||||
onsynctopreference="return gAdvancedPane.writeCacheSize();"
|
||||
onchange="gAdvancedPane.updateCacheSizePref();"
|
||||
aria-labelledby="useCacheBefore cacheSize useCacheAfter"/>
|
||||
<label id="useCacheAfter" flex="1">&limitCacheSizeAfter.label;</label>
|
||||
</hbox>
|
||||
|
@ -45,6 +45,7 @@ var gAdvancedPane = {
|
||||
#ifdef MOZ_SERVICES_HEALTHREPORT
|
||||
this.initSubmitHealthReport();
|
||||
#endif
|
||||
this.updateCacheSizeInputField();
|
||||
this.updateActualCacheSize();
|
||||
this.updateActualAppCacheSize();
|
||||
|
||||
@ -413,24 +414,31 @@ var gAdvancedPane = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts the cache size from units of KB to units of MB and returns that
|
||||
* value.
|
||||
* Converts the cache size from units of KB to units of MB and stores it in
|
||||
* the textbox element.
|
||||
*/
|
||||
readCacheSize: function ()
|
||||
updateCacheSizeInputField()
|
||||
{
|
||||
var preference = document.getElementById("browser.cache.disk.capacity");
|
||||
return preference.value / 1024;
|
||||
let cacheSizeElem = document.getElementById("cacheSize");
|
||||
let cachePref = document.getElementById("browser.cache.disk.capacity");
|
||||
cacheSizeElem.value = cachePref.value / 1024;
|
||||
if (cachePref.locked)
|
||||
cacheSizeElem.disabled = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts the cache size as specified in UI (in MB) to KB and returns that
|
||||
* value.
|
||||
* Updates the cache size preference once user enters a new value.
|
||||
* We intentionally do not set preference="browser.cache.disk.capacity"
|
||||
* onto the textbox directly, as that would update the pref at each keypress
|
||||
* not only after the final value is entered.
|
||||
*/
|
||||
writeCacheSize: function ()
|
||||
updateCacheSizePref()
|
||||
{
|
||||
var cacheSize = document.getElementById("cacheSize");
|
||||
var intValue = parseInt(cacheSize.value, 10);
|
||||
return isNaN(intValue) ? 0 : intValue * 1024;
|
||||
let cacheSizeElem = document.getElementById("cacheSize");
|
||||
let cachePref = document.getElementById("browser.cache.disk.capacity");
|
||||
// Converts the cache size as specified in UI (in MB) to KB.
|
||||
let intValue = parseInt(cacheSizeElem.value, 10);
|
||||
cachePref.value = isNaN(intValue) ? 0 : intValue * 1024;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -271,10 +271,8 @@
|
||||
&limitCacheSizeBefore.label;
|
||||
</label>
|
||||
<textbox id="cacheSize" type="number" size="4" max="1024"
|
||||
preference="browser.cache.disk.capacity"
|
||||
onsyncfrompreference="return gAdvancedPane.readCacheSize();"
|
||||
onsynctopreference="return gAdvancedPane.writeCacheSize();"
|
||||
aria-labelledby="useCacheBefore cacheSize useCacheAfter"/>
|
||||
onchange="gAdvancedPane.updateCacheSizePref();"
|
||||
aria-labelledby="useCacheBefore cacheSize useCacheAfter"/>
|
||||
<label id="useCacheAfter" flex="1">&limitCacheSizeAfter.label;</label>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
|
Loading…
Reference in New Issue
Block a user