Merge f-t to m-c

This commit is contained in:
Phil Ringnalda 2014-05-17 18:05:32 -07:00
commit f31a524186
20 changed files with 170 additions and 95 deletions

View File

@ -811,11 +811,7 @@ pref("plugin.state.f5 sam inspection host plugin", 2);
// display door hanger if flash not installed
pref("plugins.notifyMissingFlash", true);
#ifdef XP_WIN
pref("browser.preferences.instantApply", false);
#else
pref("browser.preferences.instantApply", true);
#endif
#ifdef XP_MACOSX
pref("browser.preferences.animateFadeIn", true);
#else
@ -823,7 +819,7 @@ pref("browser.preferences.animateFadeIn", false);
#endif
// Toggles between the two Preferences implementations, pop-up window and in-content
pref("browser.preferences.inContent", false);
pref("browser.preferences.inContent", true);
pref("browser.download.show_plugins_in_list", true);
pref("browser.download.hide_plugins_without_extensions", true);

View File

@ -99,10 +99,9 @@ function test_multiple_windows() {
ok(notification2, "2nd window has a global notification box.");
let policy;
let displayCount = 0;
let prefPaneClosed = false;
let childWindowClosed = false;
let prefWindowClosed = false;
let mutationObserversRemoved = false;
function onAlertDisplayed() {
displayCount++;
@ -116,24 +115,26 @@ function test_multiple_windows() {
// We register two independent observers and we need both to clean up
// properly. This handles gating for test completion.
function maybeFinish() {
if (!prefPaneClosed) {
if (!prefWindowClosed) {
dump("Not finishing test yet because pref pane isn't closed.\n");
return;
}
if (!childWindowClosed) {
dump("Not finishing test yet because child window isn't closed.\n");
if (!mutationObserversRemoved) {
dump("Not finishing test yet because mutation observers haven't been removed yet.\n");
return;
}
window2.close();
dump("Finishing multiple window test.\n");
rootLogger.removeAppender(dumpAppender);
delete dumpAppender;
delete rootLogger;
finish();
}
let closeCount = 0;
function onAlertClose() {
closeCount++;
@ -151,8 +152,7 @@ function test_multiple_windows() {
is(notification1.allNotifications.length, 0, "No notifications remain on main window.");
is(notification2.allNotifications.length, 0, "No notifications remain on 2nd window.");
window2.close();
childWindowClosed = true;
mutationObserversRemoved = true;
maybeFinish();
}
@ -170,11 +170,11 @@ function test_multiple_windows() {
Services.obs.addObserver(function observer(prefWin, topic, data) {
Services.obs.removeObserver(observer, "advanced-pane-loaded");
ok(true, "Pref pane opened on info bar button press.");
ok(true, "Advanced preferences opened on info bar button press.");
executeSoon(function soon() {
dump("Closing pref pane.\n");
dump("Closing preferences.\n");
prefWin.close();
prefPaneClosed = true;
prefWindowClosed = true;
maybeFinish();
});
}, "advanced-pane-loaded", false);

View File

@ -38,6 +38,11 @@ function checkPreferences(prefsWin) {
}
function test() {
if (Services.prefs.getBoolPref("browser.preferences.inContent")) {
// Bug 881576 - ensure this works with inContent prefs.
todo(false, "Bug 881576 - this test needs to be updated for inContent prefs");
return;
}
waitForExplicitFinish();
gBrowser.selectedBrowser.addEventListener("load", function onload() {
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
@ -50,18 +55,13 @@ function test() {
// window to open - which we track either via a window watcher (for
// the window-based prefs) or via an "Initialized" event (for
// in-content prefs.)
if (Services.prefs.getBoolPref("browser.preferences.inContent")) {
// Bug 881576 - ensure this works with inContent prefs.
todo(false, "Bug 881576 - this test needs to be updated for inContent prefs");
} else {
Services.ww.registerNotification(function wwobserver(aSubject, aTopic, aData) {
if (aTopic != "domwindowopened")
return;
Services.ww.unregisterNotification(wwobserver);
checkPreferences(aSubject);
});
PopupNotifications.panel.firstElementChild.button.click();
}
Services.ww.registerNotification(function wwobserver(aSubject, aTopic, aData) {
if (aTopic != "domwindowopened")
return;
Services.ww.unregisterNotification(wwobserver);
checkPreferences(aSubject);
});
PopupNotifications.panel.firstElementChild.button.click();
});
};
Services.prefs.setIntPref("offline-apps.quota.warn", 1);

View File

@ -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();
}

View File

@ -772,15 +772,16 @@ let CustomizableUIInternal = {
continue;
}
let container = areaNode.customizationTarget;
let widgetNode = window.document.getElementById(aWidgetId);
if (!widgetNode) {
if (widgetNode && isOverflowable) {
container = areaNode.overflowable.getContainerFor(widgetNode);
}
if (!widgetNode || !container.contains(widgetNode)) {
INFO("Widget not found, unable to remove");
continue;
}
let container = areaNode.customizationTarget;
if (isOverflowable) {
container = areaNode.overflowable.getContainerFor(widgetNode);
}
this.notifyListeners("onWidgetBeforeDOMChange", widgetNode, null, container, true);

View File

@ -108,6 +108,7 @@ skip-if = os == "linux"
[browser_993322_widget_notoolbar.js]
[browser_995164_registerArea_during_customize_mode.js]
[browser_996364_registerArea_different_properties.js]
[browser_996635_remove_non_widgets.js]
[browser_1003588_no_specials_in_panel.js]
[browser_1008559_anchor_undo_restore.js]
[browser_bootstrapped_custom_toolbar.js]

View File

@ -0,0 +1,43 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// NB: This is testing what happens if something that /isn't/ a customizable
// widget gets used in CustomizableUI APIs. Don't use this as an example of
// what should happen in a "normal" case or how you should use the API.
function test() {
// First create a button that isn't customizable, and add it in the nav-bar,
// but not in the customizable part of it (the customization target) but
// next to the main (hamburger) menu button.
const buttonID = "Test-non-widget-non-removable-button";
let btn = document.createElement("toolbarbutton");
btn.id = buttonID;
btn.label = "Hi";
btn.setAttribute("style", "width: 20px; height: 20px; background-color: red");
document.getElementById("nav-bar").appendChild(btn);
registerCleanupFunction(function() {
btn.remove();
});
// Now try to add this non-customizable button to the tabstrip. This will
// update the internal bookkeeping (ie placements) information, but shouldn't
// move the node.
CustomizableUI.addWidgetToArea(buttonID, CustomizableUI.AREA_TABSTRIP);
let placement = CustomizableUI.getPlacementOfWidget(buttonID);
// Check our bookkeeping
ok(placement, "Button should be placed");
is(placement && placement.area, CustomizableUI.AREA_TABSTRIP, "Should be placed on tabstrip.");
// Check we didn't move the node.
is(btn.parentNode && btn.parentNode.id, "nav-bar", "Actual button should still be on navbar.");
// Now remove the node again. This should remove the bookkeeping, but again
// not affect the actual node.
CustomizableUI.removeWidgetFromArea(buttonID);
placement = CustomizableUI.getPlacementOfWidget(buttonID);
// Check our bookkeeping:
ok(!placement, "Button should no longer have a placement.");
// Check our node.
is(btn.parentNode && btn.parentNode.id, "nav-bar", "Actual button should still be on navbar.");
}

View File

@ -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);
},
/**

View File

@ -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) {

View File

@ -3,7 +3,3 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
%include ../../shared/devtools/debugger.inc.css
.devtools-sidebar-tabs > tabs > tab {
min-height: 24px !important;
}

View File

@ -542,7 +542,7 @@
/* Toolbar controls */
.devtools-sidebar-tabs > tabs > tab {
min-height: 1em !important;
min-height: 24px !important;
padding: 0 !important;
}

View File

@ -3,15 +3,3 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
%include ../../shared/devtools/debugger.inc.css
.devtools-sidebar-tabs > tabs > tab {
min-height: 22px !important;
}
#instruments-pane-toggle:hover {
-moz-image-region: rect(0px,32px,16px,16px);
}
#instruments-pane-toggle:hover:active {
-moz-image-region: rect(0px,48px,16px,32px);
}

View File

@ -432,7 +432,7 @@ abstract public class BrowserApp extends GeckoApp
@Override
public void run() {
BrowserDB.removeReadingListItemWithURL(getContentResolver(), url);
showToast(R.string.reading_list_removed, Toast.LENGTH_SHORT);
showToast(R.string.page_removed, Toast.LENGTH_SHORT);
final int count = BrowserDB.getReadingListCount(getContentResolver());
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Reader:ListCountUpdated", Integer.toString(count)));

View File

@ -5,7 +5,6 @@
package org.mozilla.gecko;
import org.mozilla.gecko.mozglue.RobocopTarget;
import org.mozilla.gecko.util.ThreadUtils;
import android.content.Context;
import android.content.SharedPreferences;
@ -19,7 +18,6 @@ import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* {@code GeckoSharedPrefs} provides scoped SharedPreferences instances.
@ -59,9 +57,6 @@ public final class GeckoSharedPrefs {
// For disabling migration when getting a SharedPreferences instance
private static final EnumSet<Flags> disableMigrations = EnumSet.of(Flags.DISABLE_MIGRATIONS);
// Timeout for migration commits to be done (10 seconds)
private static final int MIGRATION_COMMIT_TIMEOUT_MSEC = 10000;
// The keys that have to be moved from ProfileManager's default
// shared prefs to the profile from version 0 to 1.
private static final String[] PROFILE_MIGRATIONS_0_TO_1 = {
@ -254,7 +249,6 @@ public final class GeckoSharedPrefs {
return pmPrefs.edit().clear();
}
@SuppressWarnings("unchecked")
private static void putEntry(Editor to, String key, Object value) {
Log.d(LOGTAG, "Migrating key = " + key + " with value = " + value);

View File

@ -191,21 +191,34 @@ abstract class HomeFragment extends Fragment {
}
if (itemId == R.id.home_remove) {
// Prioritize removing a history entry over a bookmark in the case of a combined item.
if (info.hasHistoryId()) {
new RemoveHistoryTask(context, info.historyId).execute();
return true;
// Track notification queuing of removal so we don't notify multiple times.
boolean notifyQueued = false;
final String url = info.url;
// This might be a reading list item. Try removing it by url.
(new RemoveReadingListItemTask(context, url)).execute();
if (info.isInReadingList()) {
// For reading list, this may still double-notify because reading list is in Gecko.
notifyQueued = true;
}
if (info.hasBookmarkId()) {
new RemoveBookmarkTask(context, info.bookmarkId).execute();
return true;
new RemoveBookmarkTask(context, info.bookmarkId, !notifyQueued).execute();
notifyQueued = true;
} else {
new RemoveBookmarkTask(context, url, false).execute();
}
if (info.isInReadingList()) {
(new RemoveReadingListItemTask(context, info.readingListItemId, info.url)).execute();
return true;
if (info.hasHistoryId()) {
new RemoveHistoryTask(context, info.historyId, !notifyQueued).execute();
notifyQueued = true;
} else {
// We can't know for sure if there is also a history item, but try anyways.
new RemoveHistoryTask(context, url, false).execute();
}
return notifyQueued;
}
return false;
@ -274,36 +287,53 @@ abstract class HomeFragment extends Fragment {
private static class RemoveBookmarkTask extends UiAsyncTask<Void, Void, Void> {
private final Context mContext;
private final int mId;
private final String mUrl;
private final boolean mNotify;
public RemoveBookmarkTask(Context context, int id) {
public RemoveBookmarkTask(Context context, int id, String url, boolean notify) {
super(ThreadUtils.getBackgroundHandler());
mContext = context;
mId = id;
mUrl = url;
mNotify = notify;
}
public RemoveBookmarkTask(Context context, int id, boolean notify) {
this(context, id, null, notify);
}
public RemoveBookmarkTask(Context context, String url, boolean notify) {
this(context, -1, url, notify);
}
@Override
public Void doInBackground(Void... params) {
ContentResolver cr = mContext.getContentResolver();
BrowserDB.removeBookmark(cr, mId);
if (mId > 0) {
BrowserDB.removeBookmark(cr, mId);
} else {
BrowserDB.removeBookmarksWithURL(cr, mUrl);
}
return null;
}
@Override
public void onPostExecute(Void result) {
Toast.makeText(mContext, R.string.bookmark_removed, Toast.LENGTH_SHORT).show();
if (mNotify) {
Toast.makeText(mContext, R.string.page_removed, Toast.LENGTH_SHORT).show();
}
}
}
private static class RemoveReadingListItemTask extends UiAsyncTask<Void, Void, Void> {
private final int mId;
private final String mUrl;
private final Context mContext;
public RemoveReadingListItemTask(Context context, int id, String url) {
public RemoveReadingListItemTask(Context context, String url) {
super(ThreadUtils.getBackgroundHandler());
mId = id;
mUrl = url;
mContext = context;
}
@ -311,7 +341,7 @@ abstract class HomeFragment extends Fragment {
@Override
public Void doInBackground(Void... params) {
ContentResolver cr = mContext.getContentResolver();
BrowserDB.removeReadingListItem(cr, mId);
BrowserDB.removeReadingListItemWithURL(cr, mUrl);
GeckoEvent e = GeckoEvent.createBroadcastEvent("Reader:Remove", mUrl);
GeckoAppShell.sendEventToGecko(e);
@ -323,23 +353,41 @@ abstract class HomeFragment extends Fragment {
private static class RemoveHistoryTask extends UiAsyncTask<Void, Void, Void> {
private final Context mContext;
private final int mId;
private final String mUrl;
private final boolean mNotify;
public RemoveHistoryTask(Context context, int id) {
public RemoveHistoryTask(Context context, int id, boolean notify) {
this(context, id, null, notify);
}
public RemoveHistoryTask(Context context, String url, boolean notify) {
this(context, -1, url, notify);
}
public RemoveHistoryTask(Context context, int id, String url, boolean notify) {
super(ThreadUtils.getBackgroundHandler());
mContext = context;
mId = id;
mUrl = url;
mNotify = notify;
}
@Override
public Void doInBackground(Void... params) {
BrowserDB.removeHistoryEntry(mContext.getContentResolver(), mId);
if (mId > 0) {
BrowserDB.removeHistoryEntry(mContext.getContentResolver(), mId);
} else {
BrowserDB.removeHistoryEntry(mContext.getContentResolver(), mUrl);
}
return null;
}
@Override
public void onPostExecute(Void result) {
Toast.makeText(mContext, R.string.history_removed, Toast.LENGTH_SHORT).show();
if (mNotify) {
Toast.makeText(mContext, R.string.page_removed, Toast.LENGTH_SHORT).show();
}
}
}
}

View File

@ -292,7 +292,10 @@ size. -->
whether or not the dynamic toolbar is enabled. -->
<!ENTITY pref_scroll_title_bar "Scroll title bar">
<!ENTITY history_removed "Page removed">
<!-- Localization note (page_removed): This string appears in a toast message when
any page is removed frome about:home. This includes pages that are in history,
bookmarks, or reading list. -->
<!ENTITY page_removed "Page removed">
<!ENTITY bookmark_edit_title "Edit Bookmark">
<!ENTITY bookmark_edit_name "Name">
@ -307,7 +310,6 @@ size. -->
<!ENTITY site_settings_no_settings "There are no settings to clear.">
<!ENTITY reading_list_added "Page added to your Reading List">
<!ENTITY reading_list_removed "Page removed from your Reading List">
<!ENTITY reading_list_failed "Failed to add page to your Reading List">
<!ENTITY reading_list_duplicate "Page already in your Reading List">

View File

@ -250,7 +250,6 @@
<string name="site_settings_no_settings">&site_settings_no_settings;</string>
<string name="reading_list_added">&reading_list_added;</string>
<string name="reading_list_removed">&reading_list_removed;</string>
<string name="reading_list_failed">&reading_list_failed;</string>
<string name="reading_list_duplicate">&reading_list_duplicate;</string>
@ -279,7 +278,7 @@
<string name="pref_scroll_title_bar">&pref_scroll_title_bar;</string>
<string name="history_removed">&history_removed;</string>
<string name="page_removed">&page_removed;</string>
<string name="bookmark_edit_title">&bookmark_edit_title;</string>
<string name="bookmark_edit_name">&bookmark_edit_name;</string>

View File

@ -34,7 +34,7 @@
</div>
<div id="refreshdiv">
<button id="refreshButton">&aboutNetworking.refresh;</button>
<input id="autorefcheck" type="checkbox" name="Autorefresh" />&aboutNetworking.autoRefresh;
<label><input id="autorefcheck" type="checkbox" name="Autorefresh" />&aboutNetworking.autoRefresh;</label>
</div>
<div id="http" class="tab active">

View File

@ -209,17 +209,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.");

View File

@ -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"));
}
/**