Merge f-t to m-c

This commit is contained in:
Phil Ringnalda 2014-04-19 18:20:04 -07:00
commit 98235b0aae
11 changed files with 64 additions and 39 deletions

View File

@ -197,7 +197,7 @@ let gGrid = {
} }
let availSpace = document.documentElement.clientHeight - this._cellMargin - let availSpace = document.documentElement.clientHeight - this._cellMargin -
document.querySelector("#newtab-margin-top").offsetHeight; document.querySelector("#newtab-margin-undo-container").offsetHeight;
let visibleRows = Math.floor(availSpace / this._cellHeight); let visibleRows = Math.floor(availSpace / this._cellHeight);
this._node.style.height = this._computeHeight() + "px"; this._node.style.height = this._computeHeight() + "px";
this._node.style.maxHeight = this._computeHeight(visibleRows) + "px"; this._node.style.maxHeight = this._computeHeight(visibleRows) + "px";

View File

@ -51,16 +51,21 @@ input[type=button] {
-moz-box-orient: vertical; -moz-box-orient: vertical;
} }
#newtab-margin-top { #newtab-margin-undo-container {
display: -moz-box; display: -moz-box;
height: 40px;
-moz-box-align: center;
-moz-box-pack: center; -moz-box-pack: center;
} }
#newtab-horizontal-margin { #newtab-horizontal-margin {
display: -moz-box; display: -moz-box;
-moz-box-flex: 5; -moz-box-flex: 1;
}
#newtab-margin-top,
#newtab-margin-bottom {
display: -moz-box;
-moz-box-flex: 1;
position: relative;
} }
.newtab-side-margin { .newtab-side-margin {

View File

@ -27,7 +27,10 @@
<div id="newtab-scrollbox"> <div id="newtab-scrollbox">
<div id="newtab-vertical-margin"> <div id="newtab-vertical-margin">
<div id="newtab-margin-top">
<div id="newtab-margin-top"/>
<div id="newtab-margin-undo-container">
<div id="newtab-undo-container" undo-disabled="true"> <div id="newtab-undo-container" undo-disabled="true">
<xul:label id="newtab-undo-label" <xul:label id="newtab-undo-label"
value="&newtab.undo.removedLabel;" /> value="&newtab.undo.removedLabel;" />
@ -43,8 +46,6 @@
</div> </div>
</div> </div>
<xul:spacer flex="1"/>
<div id="newtab-horizontal-margin"> <div id="newtab-horizontal-margin">
<div class="newtab-side-margin"/> <div class="newtab-side-margin"/>
@ -54,7 +55,8 @@
<div class="newtab-side-margin"/> <div class="newtab-side-margin"/>
</div> </div>
<xul:spacer flex="1"/> <div id="newtab-margin-bottom"/>
</div> </div>
<input id="newtab-toggle" type="button"/> <input id="newtab-toggle" type="button"/>
</div> </div>

View File

@ -783,7 +783,7 @@ InplaceEditor.prototype = {
_onBlur: function InplaceEditor_onBlur(aEvent, aDoNotClear) _onBlur: function InplaceEditor_onBlur(aEvent, aDoNotClear)
{ {
if (aEvent && this.popup && this.popup.isOpen && if (aEvent && this.popup && this.popup.isOpen &&
this.contentType == CONTENT_TYPES.CSS_MIXED) { this.popup.selectedIndex >= 0) {
let label, preLabel; let label, preLabel;
if (this._selectedIndex === undefined) { if (this._selectedIndex === undefined) {
({label, preLabel}) = this.popup.getItemAtIndex(this.popup.selectedIndex); ({label, preLabel}) = this.popup.getItemAtIndex(this.popup.selectedIndex);
@ -819,6 +819,11 @@ InplaceEditor.prototype = {
}; };
this.popup._panel.addEventListener("popuphidden", onPopupHidden); this.popup._panel.addEventListener("popuphidden", onPopupHidden);
this.popup.hidePopup(); this.popup.hidePopup();
// Content type other than CSS_MIXED is used in rule-view where the values
// are live previewed. So we apply the value before returning.
if (this.contentType != CONTENT_TYPES.CSS_MIXED) {
this._apply();
}
return; return;
} }
this._apply(); this._apply();

View File

@ -1998,7 +1998,8 @@ TextPropertyEditor.prototype = {
get editing() { get editing() {
return !!(this.nameSpan.inplaceEditor || this.valueSpan.inplaceEditor || return !!(this.nameSpan.inplaceEditor || this.valueSpan.inplaceEditor ||
this.ruleEditor.ruleView.colorPicker.tooltip.isShown() || this.ruleEditor.ruleView.colorPicker.tooltip.isShown() ||
this.ruleEditor.ruleView.colorPicker.eyedropperOpen); this.ruleEditor.ruleView.colorPicker.eyedropperOpen) ||
this.popup.isOpen;
}, },
/** /**

View File

@ -343,6 +343,7 @@ Experiments.Experiments = function (policy=new Experiments.Policy()) {
this._log = Log.repository.getLoggerWithMessagePrefix( this._log = Log.repository.getLoggerWithMessagePrefix(
"Browser.Experiments.Experiments", "Browser.Experiments.Experiments",
"Experiments #" + gExperimentsCounter++ + "::"); "Experiments #" + gExperimentsCounter++ + "::");
this._log.trace("constructor");
this._policy = policy; this._policy = policy;
@ -424,9 +425,12 @@ Experiments.Experiments.prototype = {
* The promise is fulfilled when all pending tasks are finished. * The promise is fulfilled when all pending tasks are finished.
*/ */
uninit: Task.async(function* () { uninit: Task.async(function* () {
this._log.trace("uninit: started");
yield this._loadTask; yield this._loadTask;
this._log.trace("uninit: finished with _loadTask");
if (!this._shutdown) { if (!this._shutdown) {
this._log.trace("uninit: no previous shutdown");
this._unregisterWithAddonManager(); this._unregisterWithAddonManager();
gPrefs.ignore(PREF_LOGGING, configureLogging); gPrefs.ignore(PREF_LOGGING, configureLogging);
@ -443,6 +447,7 @@ Experiments.Experiments.prototype = {
this._shutdown = true; this._shutdown = true;
if (this._mainTask) { if (this._mainTask) {
try { try {
this._log.trace("uninit: waiting on _mainTask");
yield this._mainTask; yield this._mainTask;
} catch (e if e instanceof AlreadyShutdownError) { } catch (e if e instanceof AlreadyShutdownError) {
// We error out of tasks after shutdown via that exception. // We error out of tasks after shutdown via that exception.

View File

@ -9,7 +9,8 @@
} }
/* SCROLLBOX */ /* SCROLLBOX */
#newtab-scrollbox:not([page-disabled]) { #newtab-scrollbox:not([page-disabled]),
#newtab-scrollbox:not([page-disabled]) #newtab-margin-bottom {
color: rgb(0,0,0); color: rgb(0,0,0);
background-color: hsl(0,0%,95%); background-color: hsl(0,0%,95%);
} }

View File

@ -9,7 +9,8 @@
} }
/* SCROLLBOX */ /* SCROLLBOX */
#newtab-scrollbox:not([page-disabled]) { #newtab-scrollbox:not([page-disabled]),
#newtab-scrollbox:not([page-disabled]) #newtab-margin-bottom {
color: rgb(0,0,0); color: rgb(0,0,0);
background-color: hsl(0,0%,95%); background-color: hsl(0,0%,95%);
} }

View File

@ -9,7 +9,8 @@
} }
/* SCROLLBOX */ /* SCROLLBOX */
#newtab-scrollbox:not([page-disabled]) { #newtab-scrollbox:not([page-disabled]),
#newtab-scrollbox:not([page-disabled]) #newtab-margin-bottom {
color: rgb(0,0,0); color: rgb(0,0,0);
background-color: hsl(0,0%,95%); background-color: hsl(0,0%,95%);
} }

View File

@ -51,8 +51,7 @@ user_pref("toolkit.telemetry.notifiedOptOut", 999);
user_pref("font.size.inflation.emPerLine", 0); user_pref("font.size.inflation.emPerLine", 0);
user_pref("font.size.inflation.minTwips", 0); user_pref("font.size.inflation.minTwips", 0);
// AddonManager tests require that the experiments feature be enabled. // AddonManager tests require that the experiments provider be present.
user_pref("experiments.enabled", true);
user_pref("experiments.supported", true); user_pref("experiments.supported", true);
user_pref("experiments.logging.level", "Trace"); user_pref("experiments.logging.level", "Trace");
// Point the manifest at something local so we don't risk it hitting production // Point the manifest at something local so we don't risk it hitting production

View File

@ -10,6 +10,8 @@ let gCategoryUtilities;
let gExperiments; let gExperiments;
let gHttpServer; let gHttpServer;
let gSavedManifestURI;
function getExperimentAddons() { function getExperimentAddons() {
let deferred = Promise.defer(); let deferred = Promise.defer();
AddonManager.getAddonsByTypes(["experiment"], (addons) => { AddonManager.getAddonsByTypes(["experiment"], (addons) => {
@ -23,8 +25,16 @@ add_task(function* initializeState() {
gCategoryUtilities = new CategoryUtilities(gManagerWindow); gCategoryUtilities = new CategoryUtilities(gManagerWindow);
registerCleanupFunction(() => { registerCleanupFunction(() => {
Services.prefs.clearUserPref("experiments.enabled");
if (gHttpServer) { if (gHttpServer) {
gHttpServer.stop(() => {}); gHttpServer.stop(() => {});
Services.prefs.clearUserPref("experiments.manifest.cert.checkAttributes");
if (gSavedManifestURI !== undefined) {
Services.prefs.setCharPref("experments.manifest.uri", gSavedManifestURI);
}
}
if (gExperiments) {
gExperiments._policy.ignoreHashes = false;
} }
}); });
@ -167,24 +177,6 @@ add_task(function* testCleanup() {
Assert.equal(addons.length, 0, "No experiment add-ons are installed."); Assert.equal(addons.length, 0, "No experiment add-ons are installed.");
}); });
// We need to initialize the experiments service for the following tests.
add_task(function* initializeExperiments() {
if (!gExperiments) {
return;
}
// We need to remove the cache file to help ensure consistent state.
yield OS.File.remove(gExperiments._cacheFilePath);
info("Initializing experiments service.");
yield gExperiments.init();
info("Experiments service finished first run.");
// Check conditions, just to be sure.
let experiments = yield gExperiments.getExperiments();
Assert.equal(experiments.length, 0, "No experiments known to the service.");
});
// The following tests should ideally live in browser/experiments/. However, // The following tests should ideally live in browser/experiments/. However,
// they rely on some of the helper functions from head.js, which can't easily // they rely on some of the helper functions from head.js, which can't easily
// be consumed from other directories. So, they live here. // be consumed from other directories. So, they live here.
@ -220,15 +212,24 @@ add_task(function* testActivateExperiment() {
}); });
Services.prefs.setBoolPref("experiments.manifest.cert.checkAttributes", false); Services.prefs.setBoolPref("experiments.manifest.cert.checkAttributes", false);
gSavedManifestURI = Services.prefs.getCharPref("experiments.manifest.uri");
Services.prefs.setCharPref("experiments.manifest.uri", root + "manifest"); Services.prefs.setCharPref("experiments.manifest.uri", root + "manifest");
registerCleanupFunction(() => {
Services.prefs.clearUserPref("experiments.manifest.cert.checkAttributes"); // We need to remove the cache file to help ensure consistent state.
Services.prefs.clearUserPref("experiments.manifest.uri"); yield OS.File.remove(gExperiments._cacheFilePath);
});
Services.prefs.setBoolPref("experiments.enabled", true);
info("Initializing experiments service.");
yield gExperiments.init();
info("Experiments service finished first run.");
// Check conditions, just to be sure.
let experiments = yield gExperiments.getExperiments();
Assert.equal(experiments.length, 0, "No experiments known to the service.");
// This makes testing easier. // This makes testing easier.
gExperiments._policy.ignoreHashes = true; gExperiments._policy.ignoreHashes = true;
registerCleanupFunction(() => { gExperiments._policy.ignoreHashes = false; });
info("Manually updating experiments manifest."); info("Manually updating experiments manifest.");
yield gExperiments.updateManifest(); yield gExperiments.updateManifest();
@ -269,6 +270,10 @@ add_task(function testDeactivateExperiment() {
add_task(function* testCleanup() { add_task(function* testCleanup() {
if (gExperiments) { if (gExperiments) {
Services.prefs.clearUserPref("experiments.enabled");
Services.prefs.clearUserPref("experiments.manifest.cert.checkAttributes");
Services.prefs.setCharPref("experiments.manifest.uri", gSavedManifestURI);
// We perform the uninit/init cycle to purge any leftover state. // We perform the uninit/init cycle to purge any leftover state.
yield OS.File.remove(gExperiments._cacheFilePath); yield OS.File.remove(gExperiments._cacheFilePath);
yield gExperiments.uninit(); yield gExperiments.uninit();