Bug 741047 - Implement opening in-content preferences to a given view. r=Gijs

This commit is contained in:
Jared Wein 2014-05-11 15:52:33 -04:00
Родитель 0e75633fd5
Коммит 7a8afd9c0f
5 изменённых файлов: 20 добавлений и 13 удалений

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

@ -505,10 +505,13 @@ function openPreferences(paneID, extraArgs)
}
if (newLoad) {
browser.addEventListener("load", function onload() {
browser.removeEventListener("load", onload, true);
Services.obs.addObserver(function advancedPaneLoadedObs(prefWin, topic, data) {
if (prefWin != browser.contentWindow) {
return;
}
Services.obs.removeObserver(advancedPaneLoadedObs, "advanced-pane-loaded");
switchToPane();
}, true);
}, "advanced-pane-loaded", false);
} else {
switchToPane();
}

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

@ -71,6 +71,9 @@ var gAdvancedPane = {
#endif
this.updateActualCacheSize();
this.updateActualAppCacheSize();
// Notify observers that the UI is now ready
Services.obs.notifyObservers(window, "advanced-pane-loaded", null);
},
/**

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

@ -44,6 +44,7 @@ function selectCategory(name) {
let categories = document.getElementById("categories");
let item = categories.querySelector(".category[value=" + name + "]");
categories.selectedItem = item;
gotoPref(name);
}
function gotoPref(page) {

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

@ -134,17 +134,17 @@ add_task(function* testOpenPreferences() {
let deferred = Promise.defer();
Services.obs.addObserver(function observer(prefWin, topic, data) {
Services.obs.removeObserver(observer, "advanced-pane-loaded");
info("Advanced preference pane opened.");
executeSoon(function() {
// We want this test to fail if the preferences pane changes.
let el = prefWin.document.getElementById("dataChoicesPanel");
is_element_visible(el);
// We want this test to fail if the preferences pane changes.
let el = prefWin.document.getElementById("dataChoicesPanel");
is_element_visible(el);
prefWin.close();
info("Closed preferences pane.");
prefWin.close();
info("Closed preferences pane.");
deferred.resolve();
deferred.resolve();
});
}, "advanced-pane-loaded", false);
info("Loading preferences pane.");

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

@ -432,12 +432,12 @@ function is_hidden(aElement) {
function is_element_visible(aElement, aMsg) {
isnot(aElement, null, "Element should not be null, when checking visibility");
ok(!is_hidden(aElement), aMsg);
ok(!is_hidden(aElement), aMsg || (aElement + " should be visible"));
}
function is_element_hidden(aElement, aMsg) {
isnot(aElement, null, "Element should not be null, when checking visibility");
ok(is_hidden(aElement), aMsg);
ok(is_hidden(aElement), aMsg || (aElement + " should be hidden"));
}
/**