Bug 892875 - Put background thumbnails behind a preference, and disable that preference during tests. r=adw

This commit is contained in:
Mark Hammond 2013-07-23 17:40:16 +10:00
parent f5ba067d22
commit 09868257b8
3 changed files with 13 additions and 0 deletions

View File

@ -144,3 +144,7 @@ user_pref("media.webaudio.legacy.OscillatorNode", true);
// Always use network provider for geolocation tests
// so we bypass the OSX dialog raised by the corelocation provider
user_pref("geo.provider.testing", true);
// Background thumbnails in particular cause grief, and disabling thumbnails
// in general can't hurt - we re-enable them when tests need them.
user_pref("browser.pageThumbs.enabled", false);

View File

@ -46,6 +46,11 @@ const BackgroundPageThumbs = {
* the queue and started. Defaults to 30000 (30 seconds).
*/
capture: function (url, options={}) {
if (!PageThumbs._prefEnabled()) {
if (options.onDone)
schedule(() => options.onDone(null));
return;
}
this._captureQueue = this._captureQueue || [];
this._capturesByURL = this._capturesByURL || new Map();

View File

@ -10,9 +10,13 @@ let {PageThumbs, PageThumbsStorage, SessionStore, FileUtils, OS} = tmp;
Cu.import("resource://gre/modules/PlacesUtils.jsm");
let oldEnabledPref = Services.prefs.getBoolPref("browser.pageThumbs.enabled");
Services.prefs.setBoolPref("browser.pageThumbs.enabled", true);
registerCleanupFunction(function () {
while (gBrowser.tabs.length > 1)
gBrowser.removeTab(gBrowser.tabs[1]);
Services.prefs.setBoolPref("browser.pageThumbs.enabled", oldEnabledPref)
});
/**