Bug 796523 - Expire the JS timezone cache whenever we create a new compartment. r=waldo

This is a hack/heuristic to ensure that the JS timezone cache remains
fresh (so that if you navigate to a new page or refresh your gmail, you
always get the right timezone), while not interfering with the role the
cache plays in benchmark performance.
This commit is contained in:
Justin Lebar 2012-10-05 11:33:36 -04:00
Родитель 9816e31ab0
Коммит f489e4717d
1 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -6,6 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "jscntxt.h"
#include "jsdate.h"
#include "jscompartment.h"
#include "jsgc.h"
#include "jsiter.h"
@ -92,6 +93,14 @@ JSCompartment::~JSCompartment()
bool
JSCompartment::init(JSContext *cx)
{
/*
* As a hack, we clear our timezone cache every time we create a new
* compartment. This ensures that the cache is always relatively fresh, but
* shouldn't interfere with benchmarks which create tons of date objects
* (unless they also create tons of iframes, which seems unlikely).
*/
js_ClearDateCaches();
activeAnalysis = activeInference = false;
types.init(cx);