Merge fx-team to m-c.

This commit is contained in:
Ryan VanderMeulen 2014-04-25 16:24:02 -04:00
commit 7d6c465c90
49 changed files with 592 additions and 411 deletions

View File

@ -1211,7 +1211,7 @@ exports.testShowToOpenXToClose = function(assert, done) {
onShow: function() {
assert.ok(isChecked(menuitem), 'menuitem is checked');
let closeButton = window.document.querySelector('#sidebar-header > toolbarbutton.tabs-closebutton');
let closeButton = window.document.querySelector('#sidebar-header > toolbarbutton.close-icon');
simulateCommand(closeButton);
},
onHide: function() {

View File

@ -457,13 +457,6 @@ pref("browser.tabs.drawInTitlebar", false);
pref("browser.tabs.drawInTitlebar", true);
#endif
// Where to show tab close buttons:
// 0 on active tab only
// 1 on all tabs until tabClipWidth is reached, then active tab only
// 2 no close buttons at all
// 3 at the end of the tabstrip
pref("browser.tabs.closeButtons", 1);
// When tabs opened by links in other tabs via a combination of
// browser.link.open_newwindow being set to 3 and target="_blank" etc are
// closed:
@ -1163,7 +1156,6 @@ pref("services.sync.prefs.sync.browser.search.update", true);
pref("services.sync.prefs.sync.browser.sessionstore.restore_on_demand", true);
pref("services.sync.prefs.sync.browser.startup.homepage", true);
pref("services.sync.prefs.sync.browser.startup.page", true);
pref("services.sync.prefs.sync.browser.tabs.closeButtons", true);
pref("services.sync.prefs.sync.browser.tabs.loadInBackground", true);
pref("services.sync.prefs.sync.browser.tabs.warnOnClose", true);
pref("services.sync.prefs.sync.browser.tabs.warnOnOpen", true);

View File

@ -489,10 +489,6 @@ menuitem.spell-suggestion {
font-weight: bold;
}
#sidebar-header > .tabs-closebutton {
-moz-user-focus: normal;
}
/* apply Fitts' law to the notification bar's close button */
window[sizemode="maximized"] #content .notification-inner {
border-right: 0px !important;

View File

@ -549,7 +549,7 @@
iconsize="small"
aria-label="&tabsToolbar.label;"
context="toolbar-context-menu"
defaultset="tabbrowser-tabs,new-tab-button,alltabs-button,tabs-closebutton"
defaultset="tabbrowser-tabs,new-tab-button,alltabs-button"
collapsed="true">
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
@ -600,13 +600,6 @@
</menupopup>
</toolbarbutton>
<toolbarbutton id="tabs-closebutton"
class="close-button tabs-closebutton close-icon"
command="cmd_close"
label="&closeTab.label;"
cui-areatype="toolbar"
tooltiptext="&closeTab.label;"/>
#if !defined(MOZ_WIDGET_GTK) && !defined(MOZ_WIDGET_QT)
<hbox class="private-browsing-indicator" skipintoolbarset="true"/>
#endif
@ -1054,7 +1047,7 @@
<sidebarheader id="sidebar-header" align="center">
<label id="sidebar-title" persist="value" flex="1" crop="end" control="sidebar"/>
<image id="sidebar-throbber"/>
<toolbarbutton class="tabs-closebutton close-icon" tooltiptext="&sidebarCloseButton.tooltip;" oncommand="toggleSidebar();"/>
<toolbarbutton class="close-icon tabbable" tooltiptext="&sidebarCloseButton.tooltip;" oncommand="toggleSidebar();"/>
</sidebarheader>
<browser id="sidebar" flex="1" autoscroll="false" disablehistory="true"
style="min-width: 14em; width: 18em; max-width: 36em;"/>

View File

@ -12,12 +12,11 @@
.tab-close-button {
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-close-tab-button");
display: none;
}
.tabbrowser-tabs[closebuttons="activetab"] > * > * > * > .tab-close-button:not([pinned])[selected="true"],
.tabbrowser-tabs[closebuttons="alltabs"] > * > * > * > .tab-close-button:not([pinned]) {
display: -moz-box;
.tab-close-button[pinned],
.tabbrowser-tabs[closebuttons="activetab"] > * > * > * > .tab-close-button:not([selected="true"]) {
display: none;
}
.tab-label[pinned] {

View File

@ -1913,7 +1913,7 @@
if (this.tabs.length - this._removingTabs.length == 1) {
closeWindow = aCloseWindowWithLastTab != null ? aCloseWindowWithLastTab :
!window.toolbar.visible ||
this.tabContainer._closeWindowWithLastTab;
Services.prefs.getBoolPref("browser.tabs.closeWindowWithLastTab");
// Closing the tab and replacing it with a blank one is notably slower
// than closing the window right away. If the caller opts in, take
@ -3372,16 +3372,12 @@
<constructor>
<![CDATA[
this.mTabClipWidth = Services.prefs.getIntPref("browser.tabs.tabClipWidth");
this.mCloseButtons = Services.prefs.getIntPref("browser.tabs.closeButtons");
this._closeWindowWithLastTab = Services.prefs.getBoolPref("browser.tabs.closeWindowWithLastTab");
var tab = this.firstChild;
tab.label = this.tabbrowser.mStringBundle.getString("tabs.emptyTabTitle");
tab.setAttribute("crop", "end");
tab.setAttribute("onerror", "this.removeAttribute('image');");
this.adjustTabstrip();
Services.prefs.addObserver("browser.tabs.", this._prefObserver, false);
window.addEventListener("resize", this, false);
window.addEventListener("load", this, false);
@ -3394,12 +3390,6 @@
]]>
</constructor>
<destructor>
<![CDATA[
Services.prefs.removeObserver("browser.tabs.", this._prefObserver);
]]>
</destructor>
<field name="tabbrowser" readonly="true">
document.getElementById(this.getAttribute("tabbrowser"));
</field>
@ -3471,22 +3461,6 @@
]]></body>
</method>
<field name="_prefObserver"><![CDATA[({
tabContainer: this,
observe: function (subject, topic, data) {
switch (data) {
case "browser.tabs.closeButtons":
this.tabContainer.mCloseButtons = Services.prefs.getIntPref(data);
this.tabContainer.adjustTabstrip();
break;
case "browser.tabs.closeWindowWithLastTab":
this.tabContainer._closeWindowWithLastTab = Services.prefs.getBoolPref(data);
this.tabContainer.adjustTabstrip();
break;
}
}
});]]></field>
<field name="_blockDblClick">false</field>
<field name="_tabDropIndicator">
@ -3563,42 +3537,23 @@
<body><![CDATA[
let numTabs = this.childNodes.length -
this.tabbrowser._removingTabs.length;
// modes for tabstrip
// 0 - button on active tab only
// 1 - close buttons on all tabs
// 2 - no close buttons at all
// 3 - close button at the end of the tabstrip
switch (this.mCloseButtons) {
case 0:
this.setAttribute("closebuttons", "activetab");
break;
case 1:
if (numTabs <= 2) {
// This is an optimization to avoid layout flushes by calling
// getBoundingClientRect() when we just opened a second tab. In
// this case it's highly unlikely that the tab width is smaller
// than mTabClipWidth and the tab close button obscures too much
// of the tab's label. In the edge case of the window being too
// narrow (or if tabClipWidth has been set to a way higher value),
// we'll correct the 'closebuttons' attribute after the tabopen
// animation has finished.
this.setAttribute("closebuttons", "alltabs");
} else {
let tab = this.tabbrowser.visibleTabs[this.tabbrowser._numPinnedTabs];
if (tab && tab.getBoundingClientRect().width > this.mTabClipWidth)
this.setAttribute("closebuttons", "alltabs");
else
this.setAttribute("closebuttons", "activetab");
if (numTabs > 2) {
// This is an optimization to avoid layout flushes by calling
// getBoundingClientRect() when we just opened a second tab. In
// this case it's highly unlikely that the tab width is smaller
// than mTabClipWidth and the tab close button obscures too much
// of the tab's label. In the edge case of the window being too
// narrow (or if tabClipWidth has been set to a way higher value),
// we'll correct the 'closebuttons' attribute after the tabopen
// animation has finished.
let tab = this.tabbrowser.visibleTabs[this.tabbrowser._numPinnedTabs];
if (tab && tab.getBoundingClientRect().width <= this.mTabClipWidth) {
this.setAttribute("closebuttons", "activetab");
return;
}
break;
case 2:
case 3:
this.setAttribute("closebuttons", "never");
break;
}
var tabstripClosebutton = document.getElementById("tabs-closebutton");
if (tabstripClosebutton && tabstripClosebutton.parentNode == this._container)
tabstripClosebutton.collapsed = this.mCloseButtons != 3;
this.removeAttribute("closebuttons");
]]></body>
</method>
@ -4272,8 +4227,7 @@
return;
if (event.target.localName == "tab") {
if (this.childNodes.length > 1 || !this._closeWindowWithLastTab)
this.tabbrowser.removeTab(event.target, {animate: true, byMouse: true});
this.tabbrowser.removeTab(event.target, {animate: true, byMouse: true});
} else if (event.originalTarget.localName == "box") {
BrowserOpenTab();
} else {

View File

@ -224,7 +224,6 @@ let CustomizableUIInternal = {
"tabbrowser-tabs",
"new-tab-button",
"alltabs-button",
"tabs-closebutton",
],
defaultCollapsed: null,
}, true);

View File

@ -179,10 +179,10 @@ CustomizeMode.prototype = {
// customization mode when pressing ESC.
document.addEventListener("keypress", this);
// Same goes for the menu button - if we're customizing, a mousedown to the
// Same goes for the menu button - if we're customizing, a click on the
// menu button means a quick exit from customization mode.
window.PanelUI.hide();
window.PanelUI.menuButton.addEventListener("mousedown", this);
window.PanelUI.menuButton.addEventListener("command", this);
window.PanelUI.menuButton.open = true;
window.PanelUI.beginBatchUpdate();
@ -331,7 +331,7 @@ CustomizeMode.prototype = {
CustomizableUI.removeListener(this);
this.document.removeEventListener("keypress", this);
this.window.PanelUI.menuButton.removeEventListener("mousedown", this);
this.window.PanelUI.menuButton.removeEventListener("command", this);
this.window.PanelUI.menuButton.open = false;
this.window.PanelUI.beginBatchUpdate();
@ -1181,13 +1181,13 @@ CustomizeMode.prototype = {
case "dragend":
this._onDragEnd(aEvent);
break;
case "mousedown":
if (aEvent.button == 0 &&
(aEvent.originalTarget == this.window.PanelUI.menuButton)) {
case "command":
if (aEvent.originalTarget == this.window.PanelUI.menuButton) {
this.exit();
aEvent.preventDefault();
return;
}
break;
case "mousedown":
this._onMouseDown(aEvent);
break;
case "mouseup":

View File

@ -65,6 +65,19 @@ skip-if = e10s # Bug ?????? - test uses promiseTabLoadEvent() which isn't e10s f
[browser_943683_migration_test.js]
[browser_944887_destroyWidget_should_destroy_in_palette.js]
[browser_945739_showInPrivateBrowsing_customize_mode.js]
[browser_947914_button_addons.js]
[browser_947914_button_copy.js]
[browser_947914_button_cut.js]
[browser_947914_button_find.js]
[browser_947914_button_history.js]
[browser_947914_button_newPrivateWindow.js]
[browser_947914_button_newWindow.js]
[browser_947914_button_paste.js]
[browser_947914_button_print.js]
[browser_947914_button_savePage.js]
[browser_947914_button_zoomIn.js]
[browser_947914_button_zoomOut.js]
[browser_947914_button_zoomReset.js]
[browser_947987_removable_default.js]
[browser_948985_non_removable_defaultArea.js]
[browser_952963_areaType_getter_no_area.js]

View File

@ -0,0 +1,34 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
add_task(function() {
info("Check addons button existence and functionality");
let initialLocation = gBrowser.currentURI.spec;
yield PanelUI.show();
let addonsButton = document.getElementById("add-ons-button");
ok(addonsButton, "Add-ons button exists in Panel Menu");
addonsButton.click();
yield waitForCondition(function() gBrowser.currentURI &&
gBrowser.currentURI.spec == "about:addons");
let addonsPage = gBrowser.selectedBrowser.contentWindow.document.
getElementById("addons-page");
ok(addonsPage, "Add-ons page was opened");
// close the add-ons tab
if(gBrowser.tabs.length > 1) {
gBrowser.removeTab(gBrowser.selectedTab);
}
else {
var tabToRemove = gBrowser.selectedTab;
gBrowser.addTab(initialLocation);
gBrowser.removeTab(tabToRemove);
}
});

View File

@ -0,0 +1,51 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
add_task(function() {
info("Check copy button existence and functionality");
var testText = "copy text test";
let initialLocation = gBrowser.currentURI.spec;
yield PanelUI.show();
let copyButton = document.getElementById("copy-button");
ok(copyButton, "Copy button exists in Panel Menu");
is(copyButton.getAttribute("disabled"), "true", "Copy button is initially disabled");
// copy text from URL bar
gURLBar.value = testText;
gURLBar.focus();
gURLBar.select();
yield PanelUI.show();
ok(!copyButton.hasAttribute("disabled"), "Copy button gets enabled");
copyButton.click();
is(gURLBar.value, testText, "Selected text is unaltered when clicking copy");
// check that the text was added to the clipboard
let clipboard = Services.clipboard;
let transferable = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);
const globalClipboard = clipboard.kGlobalClipboard;
transferable.init(null);
transferable.addDataFlavor("text/unicode");
clipboard.getData(transferable, globalClipboard);
let str = {}, strLength = {};
transferable.getTransferData("text/unicode", str, strLength);
let clipboardValue = "";
if (str.value) {
str.value.QueryInterface(Ci.nsISupportsString);
clipboardValue = str.value.data;
}
is(clipboardValue, testText, "Data was copied to the clipboard.");
// restore the tab location and clear the clipboard
Services.clipboard.emptyClipboard(globalClipboard);
gURLBar.value = initialLocation;
});

View File

@ -0,0 +1,50 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
add_task(function() {
info("Check cut button existence and functionality");
var testText = "cut text test";
let initialLocation = gBrowser.currentURI.spec;
yield PanelUI.show();
let cutButton = document.getElementById("cut-button");
ok(cutButton, "Cut button exists in Panel Menu");
ok(cutButton.getAttribute("disabled"), "Cut button is disabled");
// cut text from URL bar
gURLBar.value = testText;
gURLBar.focus();
gURLBar.select();
yield PanelUI.show();
ok(!cutButton.hasAttribute("disabled"), "Cut button gets enabled");
cutButton.click();
is(gURLBar.value, "", "Selected text is removed from source when clicking on cut");
// check that the text was added to the clipboard
let clipboard = Services.clipboard;
let transferable = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);
const globalClipboard = clipboard.kGlobalClipboard;
transferable.init(null);
transferable.addDataFlavor("text/unicode");
clipboard.getData(transferable, globalClipboard);
let str = {}, strLength = {};
transferable.getTransferData("text/unicode", str, strLength);
let clipboardValue = "";
if (str.value) {
str.value.QueryInterface(Ci.nsISupportsString);
clipboardValue = str.value.data;
}
is(clipboardValue, testText, "Data was copied to the clipboard.");
// restore the tab location and clear the clipboard
gBrowser.value = initialLocation;
Services.clipboard.emptyClipboard(globalClipboard);
});

View File

@ -0,0 +1,20 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
add_task(function() {
info("Check find button existence and functionality");
yield PanelUI.show();
let findButton = document.getElementById("find-button");
ok(findButton, "Find button exists in Panel Menu");
findButton.click();
ok(!gFindBar.hasAttribute("hidden"), "Findbar opened successfully");
// close find bar
gFindBar.close();
});

View File

@ -0,0 +1,22 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
add_task(function() {
info("Check history button existence and functionality");
yield PanelUI.show();
let historyButton = document.getElementById("history-panelmenu");
ok(historyButton, "History button appears in Panel Menu");
historyButton.click();
let historyPanel = document.getElementById("PanelUI-history");
ok(historyPanel.getAttribute("current"), "History Panel is in view");
let panelHiddenPromise = promisePanelHidden(window);
PanelUI.hide();
yield panelHiddenPromise
});

View File

@ -0,0 +1,45 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
add_task(function() {
info("Check private browsing button existence and functionality");
yield PanelUI.show();
var windowWasHandled = false;
let privateWindow = null;
let observerWindowOpened = {
observe: function(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
privateWindow = aSubject.QueryInterface(Components.interfaces.nsIDOMWindow);
privateWindow.addEventListener("load", function newWindowHandler() {
privateWindow.removeEventListener("load", newWindowHandler, false);
is(privateWindow.location.href, "chrome://browser/content/browser.xul",
"A new browser window was opened");
ok(PrivateBrowsingUtils.isWindowPrivate(privateWindow), "Window is private");
windowWasHandled = true;
}, false);
}
}
}
Services.ww.registerNotification(observerWindowOpened);
let privateBrowsingButton = document.getElementById("privatebrowsing-button");
ok(privateBrowsingButton, "Private browsing button exists in Panel Menu");
privateBrowsingButton.click();
try{
yield waitForCondition(() => windowWasHandled);
yield promiseWindowClosed(privateWindow);
}
catch(e) {
ok(false, "The new private browser window was not properly handled");
}
finally {
Services.ww.unregisterNotification(observerWindowOpened);
}
});

View File

@ -0,0 +1,45 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
add_task(function() {
info("Check new window button existence and functionality");
yield PanelUI.show();
var windowWasHandled = false;
var newWindow = null;
let observerWindowOpened = {
observe: function(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
newWindow = aSubject.QueryInterface(Components.interfaces.nsIDOMWindow);
newWindow.addEventListener("load", function newWindowHandler() {
newWindow.removeEventListener("load", newWindowHandler, false);
is(newWindow.location.href, "chrome://browser/content/browser.xul",
"A new browser window was opened");
ok(!PrivateBrowsingUtils.isWindowPrivate(newWindow), "Window is not private");
windowWasHandled = true;
}, false);
}
}
}
Services.ww.registerNotification(observerWindowOpened);
let newWindowButton = document.getElementById("new-window-button");
ok(newWindowButton, "New Window button exists in Panel Menu");
newWindowButton.click();
try{
yield waitForCondition(() => windowWasHandled);
yield promiseWindowClosed(newWindow);
}
catch(e) {
ok(false, "The new browser window was not properly handled");
}
finally {
Services.ww.unregisterNotification(observerWindowOpened);
}
});

View File

@ -0,0 +1,35 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
add_task(function() {
info("Check paste button existence and functionality");
let initialLocation = gBrowser.currentURI.spec;
let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
const globalClipboard = Services.clipboard.kGlobalClipboard;
yield PanelUI.show();
let pasteButton = document.getElementById("paste-button");
ok(pasteButton, "Paste button exists in Panel Menu");
// add text to clipboard
var text = "Sample text for testing";
clipboard.copyString(text);
// test paste button by pasting text to URL bar
gURLBar.focus();
yield PanelUI.show();
ok(!pasteButton.hasAttribute("disabled"), "Paste button is enabled");
pasteButton.click();
is(gURLBar.value, text, "Text pasted successfully");
// clear the clipboard and restore the tab location as it was at the begining of the test
Services.clipboard.emptyClipboard(globalClipboard);
gURLBar.value = initialLocation;
});

View File

@ -0,0 +1,32 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const isOSX = (Services.appinfo.OS === "Darwin");
add_task(function() {
info("Check print button existence and functionality");
yield PanelUI.show();
let printButton = document.getElementById("print-button");
ok(printButton, "Print button exists in Panel Menu");
if(isOSX) {
let panelHiddenPromise = promisePanelHidden(window);
PanelUI.hide();
yield panelHiddenPromise;
}
else {
printButton.click();
yield waitForCondition(() => window.gInPrintPreviewMode);
ok(window.gInPrintPreviewMode, "Entered print preview mode");
// close print preview
PrintUtils.exitPrintPreview();
yield waitForCondition(() => !window.gInPrintPreviewMode);
}
});

View File

@ -0,0 +1,18 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
add_task(function() {
info("Check save page button existence");
yield PanelUI.show();
let savePageButton = document.getElementById("save-page-button");
ok(savePageButton, "Save Page button exists in Panel Menu");
let panelHiddenPromise = promisePanelHidden(window);
PanelUI.hide();
yield panelHiddenPromise;
});

View File

@ -0,0 +1,31 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
add_task(function() {
info("Check zoom in button existence and functionality");
let initialPageZoom = ZoomManager.zoom;
is(initialPageZoom, 1, "Initial zoom factor should be 1");
yield PanelUI.show();
let zoomInButton = document.getElementById("zoom-in-button");
ok(zoomInButton, "Zoom in button exists in Panel Menu");
zoomInButton.click();
let pageZoomLevel = parseInt(ZoomManager.zoom * 100);
let zoomResetButton = document.getElementById("zoom-reset-button");
let expectedZoomLevel = parseInt(zoomResetButton.getAttribute("label"), 10);
ok(pageZoomLevel > 100 && pageZoomLevel == expectedZoomLevel, "Page zoomed in correctly");
// close the Panel
let panelHiddenPromise = promisePanelHidden(window);
PanelUI.hide();
yield panelHiddenPromise;
// reset zoom level
ZoomManager.zoom = initialPageZoom;
});

View File

@ -0,0 +1,32 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
add_task(function() {
info("Check zoom out button existence and functionality");
let initialPageZoom = ZoomManager.zoom;
is(initialPageZoom, 1, "Initial zoom factor should be 1");
yield PanelUI.show();
let zoomOutButton = document.getElementById("zoom-out-button");
ok(zoomOutButton, "Zoom out button exists in Panel Menu");
zoomOutButton.click();
let pageZoomLevel = Math.round(ZoomManager.zoom*100);
let zoomResetButton = document.getElementById("zoom-reset-button");
let expectedZoomLevel = parseInt(zoomResetButton.getAttribute("label"), 10);
ok(pageZoomLevel < 100 && pageZoomLevel == expectedZoomLevel, "Page zoomed out correctly");
// close the panel
let panelHiddenPromise = promisePanelHidden(window);
PanelUI.hide();
yield panelHiddenPromise;
// reset zoom level
ZoomManager.zoom = initialPageZoom;
});

View File

@ -0,0 +1,30 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
add_task(function() {
info("Check zoom reset button existence and functionality");
let initialPageZoom = ZoomManager.zoom;
is(initialPageZoom, 1, "Initial zoom factor should be 1");
ZoomManager.zoom = 0.5;
yield PanelUI.show();
let zoomResetButton = document.getElementById("zoom-reset-button");
ok(zoomResetButton, "Zoom reset button exists in Panel Menu");
zoomResetButton.click();
let pageZoomLevel = parseInt(ZoomManager.zoom * 100);
let expectedZoomLevel = parseInt(zoomResetButton.getAttribute("label"), 10);
ok(pageZoomLevel == expectedZoomLevel && pageZoomLevel == 100, "Page zoom reset correctly");
// close the panel
let panelHiddenPromise = promisePanelHidden(window);
PanelUI.hide();
yield panelHiddenPromise;
//reset the zoom level
ZoomManager.zoom = initialPageZoom;
});

View File

@ -103,6 +103,11 @@ function test() {
value: "MOZLBR",
purpose:"keyword",
},
{
name: "form",
value: "MOZTSB",
purpose: "newtab",
},
],
mozparams: {},
},

View File

@ -67,7 +67,7 @@ function test() {
},
{
name: "new tab search",
searchURL: base,
searchURL: base + "&form=MOZTSB",
run: function () {
function doSearch(doc) {
// Re-add the listener, and perform a search

View File

@ -20,7 +20,7 @@ function test() {
TabView.moveTabTo(newTabs[newTabs.length - 1], null);
ok(gBrowser.visibleTabs[0].getBoundingClientRect().width > gBrowser.tabContainer.mTabClipWidth,
"Tab width is bigger than tab clip width");
is(gBrowser.tabContainer.getAttribute("closebuttons"), "alltabs", "Show button on all tabs.")
is(gBrowser.tabContainer.getAttribute("closebuttons"), "", "Show button on all tabs.")
// clean up and finish
newTabs.forEach(function(tab) {

View File

@ -447,7 +447,6 @@ These should match what Safari and other Apple applications use on OS X Lion. --
<!ENTITY bookmarkThisFrameCmd.accesskey "m">
<!ENTITY emailPageCmd.label "Email Link…">
<!ENTITY emailPageCmd.accesskey "E">
<!ENTITY switchToMetroCmd.label "Relaunch in Windows 8 style &brandShortName;">
<!ENTITY savePageCmd.label "Save Page As…">
<!ENTITY savePageCmd.accesskey "A">
<!-- alternate for content area context menu -->
@ -739,47 +738,7 @@ just addresses the organization to follow, e.g. "This site is run by " -->
<!ENTITY uiTour.infoPanel.close "Close">
<!-- LOCALIZATION NOTE: the following strings are unused in Australis, they're
kept here to avoid warnings from l10n tools like compare-locales on
l10n-central. They will be definitely removed when Australis is ready
for mozilla-aurora. -->
<!ENTITY navbarCmd.accesskey "N">
<!ENTITY addonBarCmd.label "Add-on Bar">
<!ENTITY addonBarCmd.accesskey "A">
<!ENTITY throbberItem.title "Activity Indicator">
<!ENTITY appMenuButton.label "Menu">
<!ENTITY appMenuButton.tooltip "Open &brandShortName; menu">
<!ENTITY feedButton.label "Subscribe">
<!ENTITY feedButton.tooltip "Subscribe to this page…">
<!ENTITY bookmarksButton.tooltip "Display your bookmarks">
<!ENTITY historyButton.tooltip "Display pages you've viewed recently">
<!ENTITY viewTabsOnTop.label "Tabs on Top">
<!ENTITY viewTabsOnTop.accesskey "T">
<!ENTITY appMenuEdit.label "Edit">
<!ENTITY appMenuToolbarLayout.label "Toolbar Layout…">
<!ENTITY appMenuSidebars.label "Sidebars">
<!ENTITY appMenuFind.label "Find…">
<!ENTITY appMenuUnsorted.label "Unsorted Bookmarks">
<!ENTITY appMenuWebDeveloper.label "Web Developer">
<!ENTITY appMenuGettingStarted.label "Getting Started">
<!ENTITY appMenuSafeMode.label "Restart with Add-ons Disabled…">
<!ENTITY appMenuSafeMode.accesskey "R">
<!ENTITY cutButton.tooltip "Cut">
<!ENTITY copyButton.tooltip "Copy">
<!ENTITY pasteButton.tooltip "Paste">
<!ENTITY zoomOutButton.tooltip "Zoom out">
<!ENTITY zoomInButton.tooltip "Zoom in">
<!ENTITY zoomControls.label "Zoom Controls">
<!ENTITY addonBarCloseButton.tooltip "Close Add-on Bar">
<!ENTITY toggleAddonBarCmd.key "/">
<!ENTITY backForwardItem.title "Back/Forward">
<!ENTITY viewBookmarksSidebar.label "Show in Sidebar">
<!ENTITY bookmarksItem.title "Bookmarks">
<!ENTITY openLocationCmd.label "Open Location…">
<!ENTITY openLocationCmd.accesskey "L">
<!ENTITY bookmarksMenuButton.tooltip "Display your bookmarks">
<!ENTITY switchToMetroCmd2.label "Relaunch in &brandShortName; for Windows 8 Touch">
<!ENTITY tabGroupsButton.tooltip "Group your tabs">
<!-- end of strings to be removed post-Australis -->
<!ENTITY switchToMetroCmd2.label "Relaunch in &brandShortName; for Windows 8 Touch">

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -62,7 +62,6 @@ XPCOMUtils.defineLazyGetter(this, "DEFAULT_AREA_PLACEMENTS", function() {
"tabbrowser-tabs",
"new-tab-button",
"alltabs-button",
"tabs-closebutton",
],
"PersonalToolbar": [
"personal-bookmarks",

View File

@ -1772,32 +1772,15 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
z-index: 3;
}
/* In-tab close button */
.tab-close-button > .toolbarbutton-icon {
/* XXX Buttons have padding in widget/ that we don't want here but can't override with good CSS, so we must
use evil CSS to give the impression of smaller content */
margin: -4px;
}
/* Tabstrip close button */
.tabs-closebutton,
.tab-close-button {
-moz-appearance: none;
height: 16px;
width: 16px;
}
.tabs-closebutton:not([selected]):not(:hover),
/* Tab close button */
.tab-close-button:not([selected]):not(:hover) {
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 64, 16, 48);
}
.tabs-closebutton:not([selected]):not(:hover):-moz-lwtheme-brighttext,
.tab-close-button:not([selected]):not(:hover):-moz-lwtheme-brighttext {
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 80, 16, 64);
}
.tabs-closebutton:not([selected]):not(:hover):-moz-lwtheme-darktext,
.tab-close-button:not([selected]):not(:hover):-moz-lwtheme-darktext {
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 96, 16, 80);
}
@ -1810,23 +1793,6 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
-moz-image-region: auto;
}
.customization-tipPanel-closeBox > .close-icon {
-moz-appearance: none;
width: 16px;
height: 16px;
}
/* The :hover:active style from toolkit doesn't seem to work in this panel so just use :active. */
.customization-tipPanel-closeBox > .close-icon:active {
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 48, 16, 32);
}
.tabs-closebutton > .toolbarbutton-icon {
/* XXX Buttons have padding in widget/ that we don't want here but can't override with good CSS, so we must
use evil CSS to give the impression of smaller content */
margin: -2px;
}
/* Tabbrowser arrowscrollbox arrows */
.tabbrowser-arrowscrollbox > .scrollbutton-up,
.tabbrowser-arrowscrollbox > .scrollbutton-down {
@ -1903,11 +1869,6 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
}
/* Sidebar */
#sidebar-header > .tabs-closebutton {
margin-bottom: 0px !important;
padding: 0px 2px 0px 2px !important;
}
#sidebar-throbber[loading="true"] {
list-style-image: url("chrome://global/skin/icons/loading_16.png");
-moz-margin-end: 4px;
@ -2235,6 +2196,11 @@ chatbox {
border-left: 3px solid transparent;
}
/* The :hover:active style from toolkit doesn't seem to work in this panel so just use :active. */
.customization-tipPanel-closeBox > .close-icon:active {
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 48, 16, 32);
}
/* End customization mode */

View File

@ -9,7 +9,7 @@
}
.requests-menu-status-and-method {
width: 7em;
width: 9em;
}
.requests-menu-domain {

View File

@ -228,7 +228,6 @@ browser.jar:
skin/classic/browser/devtools/magnifying-glass@2x.png (../shared/devtools/images/magnifying-glass@2x.png)
skin/classic/browser/devtools/magnifying-glass-light.png (../shared/devtools/images/magnifying-glass-light.png)
skin/classic/browser/devtools/magnifying-glass-light@2x.png (../shared/devtools/images/magnifying-glass-light@2x.png)
skin/classic/browser/devtools/option-icon.png (../shared/devtools/images/option-icon.png)
skin/classic/browser/devtools/itemToggle.png (../shared/devtools/images/itemToggle.png)
skin/classic/browser/devtools/itemToggle-light.png (../shared/devtools/images/itemToggle-light.png)
skin/classic/browser/devtools/itemArrow-dark-rtl.png (../shared/devtools/images/itemArrow-dark-rtl.png)

View File

@ -2623,10 +2623,6 @@ sidebarheader {
list-style-image: url("chrome://global/skin/icons/loading_16.png");
}
sidebarheader > .tabs-closebutton > .toolbarbutton-text {
display: none;
}
/* ----- CONTENT ----- */
.browserContainer > findbar {
@ -3179,18 +3175,6 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
box-shadow: inset -5px 0 ThreeDShadow;
}
/* Tabstrip close button */
.tabs-closebutton {
-moz-padding-end: 4px;
border: none;
}
@media (min-resolution: 2dppx) {
.tabs-closebutton > .toolbarbutton-icon {
width: 16px;
}
}
/* Bookmarks toolbar */
#PlacesToolbarDropIndicator {
list-style-image: url(chrome://browser/skin/places/toolbarDropMarker.png);

View File

@ -349,7 +349,6 @@ browser.jar:
skin/classic/browser/devtools/magnifying-glass@2x.png (../shared/devtools/images/magnifying-glass@2x.png)
skin/classic/browser/devtools/magnifying-glass-light.png (../shared/devtools/images/magnifying-glass-light.png)
skin/classic/browser/devtools/magnifying-glass-light@2x.png (../shared/devtools/images/magnifying-glass-light@2x.png)
skin/classic/browser/devtools/option-icon.png (../shared/devtools/images/option-icon.png)
skin/classic/browser/devtools/itemToggle.png (../shared/devtools/images/itemToggle.png)
skin/classic/browser/devtools/itemToggle-light.png (../shared/devtools/images/itemToggle-light.png)
skin/classic/browser/devtools/itemArrow-dark-rtl.png (../shared/devtools/images/itemArrow-dark-rtl.png)

View File

@ -728,7 +728,7 @@ menuitem.subviewbutton@menuStateHover@,
border-color: hsla(210,4%,10%,.11);
}
panelview .toolbarbutton-1@buttonStateActive@,
panelview .toolbarbutton-1:-moz-any(@buttonStateActive@,[checked=true]),
toolbarbutton.subviewbutton@buttonStateActive@,
menu.subviewbutton@menuStateActive@,
menuitem.subviewbutton@menuStateActive@,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 679 B

View File

@ -119,14 +119,14 @@
.devtools-option-toolbarbutton {
-moz-appearance: none;
list-style-image: url("chrome://browser/skin/devtools/option-icon.png");
-moz-image-region: rect(0px 16px 16px 0px);
list-style-image: url("chrome://browser/skin/devtools/tool-options.svg");
background: none;
opacity: .8;
border: none;
}
.devtools-option-toolbarbutton[open=true] {
-moz-image-region: rect(0px 32px 16px 16px);
opacity: 1;
}
.devtools-menulist > .menulist-label-box {
@ -792,7 +792,6 @@
.theme-light .command-button-invertable[checked=true]:not(:active) > image,
.theme-light .devtools-tab[icon-invertable][selected] > image,
.theme-light .devtools-tab[icon-invertable][highlighted] > image,
.theme-light .devtools-option-toolbarbutton[open] > image,
.theme-light #resume[checked] > image {
filter: none !important;
}

View File

@ -1766,6 +1766,13 @@ toolbarbutton[type="socialmark"] > .toolbarbutton-icon {
-moz-padding-start: 0px;
}
#sidebar-header > .close-icon {
-moz-appearance: none;
padding: 4px 2px;
margin: 0;
border: none;
}
.browserContainer > findbar {
background-color: -moz-dialog;
color: -moz-DialogText;
@ -1997,20 +2004,6 @@ toolbarbutton[type="socialmark"] > .toolbarbutton-icon {
box-shadow: inset -5px 0 ThreeDShadow;
}
/* Tabstrip close button */
.tabs-closebutton {
-moz-appearance: none;
padding: 4px 2px;
margin: 0px;
border: none;
}
.tabs-closebutton > .toolbarbutton-icon {
-moz-margin-end: 0px !important;
-moz-padding-end: 2px !important;
-moz-padding-start: 2px !important;
}
toolbarbutton.chevron {
list-style-image: url("chrome://global/skin/toolbar/chevron.gif") !important;
}

View File

@ -265,7 +265,6 @@ browser.jar:
skin/classic/browser/devtools/magnifying-glass@2x.png (../shared/devtools/images/magnifying-glass@2x.png)
skin/classic/browser/devtools/magnifying-glass-light.png (../shared/devtools/images/magnifying-glass-light.png)
skin/classic/browser/devtools/magnifying-glass-light@2x.png (../shared/devtools/images/magnifying-glass-light@2x.png)
skin/classic/browser/devtools/option-icon.png (../shared/devtools/images/option-icon.png)
skin/classic/browser/devtools/itemToggle.png (../shared/devtools/images/itemToggle.png)
skin/classic/browser/devtools/itemToggle-light.png (../shared/devtools/images/itemToggle-light.png)
skin/classic/browser/devtools/itemArrow-dark-rtl.png (../shared/devtools/images/itemArrow-dark-rtl.png)
@ -628,7 +627,6 @@ browser.jar:
skin/classic/aero/browser/devtools/magnifying-glass@2x.png (../shared/devtools/images/magnifying-glass@2x.png)
skin/classic/aero/browser/devtools/magnifying-glass-light.png (../shared/devtools/images/magnifying-glass-light.png)
skin/classic/aero/browser/devtools/magnifying-glass-light@2x.png (../shared/devtools/images/magnifying-glass-light@2x.png)
skin/classic/aero/browser/devtools/option-icon.png (../shared/devtools/images/option-icon.png)
skin/classic/aero/browser/devtools/itemToggle.png (../shared/devtools/images/itemToggle.png)
skin/classic/aero/browser/devtools/itemToggle-light.png (../shared/devtools/images/itemToggle-light.png)
skin/classic/aero/browser/devtools/itemArrow-dark-rtl.png (../shared/devtools/images/itemArrow-dark-rtl.png)

View File

@ -21,7 +21,6 @@ import android.util.Log;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
public final class TabsAccessor {
private static final String LOGTAG = "GeckoTabsAccessor";
@ -50,7 +49,6 @@ public final class TabsAccessor {
private static final String LOCAL_CLIENT_SELECTION = BrowserContract.Clients.GUID + " IS NULL";
private static final String LOCAL_TABS_SELECTION = BrowserContract.Tabs.CLIENT_GUID + " IS NULL";
private static final Pattern FILTERED_URL_PATTERN = Pattern.compile("^(about|chrome|wyciwyg|file):.*$");
public static class RemoteTab {
public String title;
@ -151,9 +149,9 @@ public final class TabsAccessor {
int position = 0;
for (Tab tab : tabs) {
// Skip this tab if it has a null URL or is in private browsing mode, or is a filtered URL.
// Skip this tab if it has a null URL or is in private browsing mode
String url = tab.getURL();
if (url == null || tab.isPrivate() || isFilteredURL(url))
if (url == null || tab.isPrivate())
continue;
ContentValues values = new ContentValues();
@ -194,13 +192,4 @@ public final class TabsAccessor {
insertLocalTabs(cr, tabs);
updateLocalClient(cr);
}
/**
* Matches the supplied URL string against the set of URLs to filter.
*
* @return true if the supplied URL should be skipped; false otherwise.
*/
private static boolean isFilteredURL(String url) {
return FILTERED_URL_PATTERN.matcher(url).matches();
}
}

View File

@ -347,6 +347,9 @@ public class BrowserContract {
public static final String IMAGE_URL = "image_url";
public static final String CREATED = "created";
public static final String FILTER = "filter";
public static final String[] DEFAULT_PROJECTION =
new String[] { _ID, DATASET_ID, URL, TITLE, DESCRIPTION, IMAGE_URL, FILTER };
}
/*

View File

@ -85,12 +85,17 @@ public class HomeProvider extends SQLiteBridgeContentProvider {
new String[] { datasetId });
// Otherwise, let the SQLiteContentProvider implementation take care of this query for us!
final Cursor c = super.query(uri, projection, selection, selectionArgs, sortOrder);
if (c != null) {
final ContentResolver cr = getContext().getContentResolver();
c.setNotificationUri(cr, getDatasetNotificationUri(datasetId));
Cursor c = super.query(uri, projection, selection, selectionArgs, sortOrder);
// SQLiteBridgeContentProvider may return a null Cursor if the database hasn't been created yet.
// However, we need a non-null cursor in order to listen for notifications.
if (c == null) {
c = new MatrixCursor(projection != null ? projection : HomeItems.DEFAULT_PROJECTION);
}
final ContentResolver cr = getContext().getContentResolver();
c.setNotificationUri(cr, getDatasetNotificationUri(datasetId));
return c;
}
@ -110,17 +115,7 @@ public class HomeProvider extends SQLiteBridgeContentProvider {
return null;
}
final String[] itemsColumns = new String[] {
HomeItems._ID,
HomeItems.DATASET_ID,
HomeItems.URL,
HomeItems.TITLE,
HomeItems.DESCRIPTION,
HomeItems.IMAGE_URL,
HomeItems.FILTER
};
final MatrixCursor c = new MatrixCursor(itemsColumns);
final MatrixCursor c = new MatrixCursor(HomeItems.DEFAULT_PROJECTION);
for (int i = 0; i < items.length(); i++) {
try {
final JSONObject item = items.getJSONObject(i);

View File

@ -19,6 +19,7 @@ import org.mozilla.gecko.home.PanelLayout.PanelView;
import android.content.Context;
import android.database.Cursor;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
@ -30,6 +31,7 @@ public class PanelGridView extends GridView
private final ViewConfig viewConfig;
private final PanelViewAdapter adapter;
private PanelViewItemHandler itemHandler;
private OnItemOpenListener itemOpenListener;
public PanelGridView(Context context, ViewConfig viewConfig) {
super(context, null, R.attr.panelGridViewStyle);
@ -43,6 +45,12 @@ public class PanelGridView extends GridView
setOnItemClickListener(new PanelGridItemClickListener());
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
itemHandler.setOnItemOpenListener(itemOpenListener);
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
@ -51,12 +59,14 @@ public class PanelGridView extends GridView
@Override
public void setDataset(Cursor cursor) {
Log.d(LOGTAG, "Setting dataset: " + viewConfig.getDatasetId());
adapter.swapCursor(cursor);
}
@Override
public void setOnItemOpenListener(OnItemOpenListener listener) {
itemHandler.setOnItemOpenListener(listener);
itemOpenListener = listener;
}
@Override

View File

@ -27,49 +27,57 @@ public class PanelListView extends HomeListView
private static final String LOGTAG = "GeckoPanelListView";
private final PanelViewAdapter mAdapter;
private final ViewConfig mViewConfig;
private final PanelViewItemHandler mItemHandler;
private final ViewConfig viewConfig;
private final PanelViewAdapter adapter;
private final PanelViewItemHandler itemHandler;
private OnItemOpenListener itemOpenListener;
public PanelListView(Context context, ViewConfig viewConfig) {
super(context);
mViewConfig = viewConfig;
mItemHandler = new PanelViewItemHandler(viewConfig);
this.viewConfig = viewConfig;
itemHandler = new PanelViewItemHandler(viewConfig);
mAdapter = new PanelViewAdapter(context, viewConfig);
setAdapter(mAdapter);
adapter = new PanelViewAdapter(context, viewConfig);
setAdapter(adapter);
setOnItemClickListener(new PanelListItemClickListener());
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
itemHandler.setOnItemOpenListener(itemOpenListener);
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
mItemHandler.setOnItemOpenListener(null);
itemHandler.setOnItemOpenListener(null);
}
@Override
public void setDataset(Cursor cursor) {
Log.d(LOGTAG, "Setting dataset: " + mViewConfig.getDatasetId());
mAdapter.swapCursor(cursor);
Log.d(LOGTAG, "Setting dataset: " + viewConfig.getDatasetId());
adapter.swapCursor(cursor);
}
@Override
public void setOnItemOpenListener(OnItemOpenListener listener) {
mItemHandler.setOnItemOpenListener(listener);
itemHandler.setOnItemOpenListener(listener);
itemOpenListener = listener;
}
@Override
public void setFilterManager(FilterManager filterManager) {
mAdapter.setFilterManager(filterManager);
mItemHandler.setFilterManager(filterManager);
adapter.setFilterManager(filterManager);
itemHandler.setFilterManager(filterManager);
}
private class PanelListItemClickListener implements AdapterView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mItemHandler.openItemAtPosition(mAdapter.getCursor(), position);
itemHandler.openItemAtPosition(adapter.getCursor(), position);
}
}
}

View File

@ -32,7 +32,6 @@ skip-if = android_version == "10"
skip-if = android_version == "10" || processor == "x86"
[testDistribution]
[testDoorHanger]
[testFilterOpenTab]
# disabled on 2.3; bug 986172
skip-if = android_version == "10"
[testFindInPage]

View File

@ -1,125 +0,0 @@
package org.mozilla.gecko.tests;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import org.mozilla.gecko.PrivateTab;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.TabsAccessor;
import org.mozilla.gecko.db.BrowserContract;
import org.mozilla.gecko.db.TabsProvider;
import android.content.ContentProvider;
import android.content.Context;
import android.database.Cursor;
/**
* Tests that local tabs are filtered prior to upload.
* - create a set of tabs and perists them through TabsAccessor.
* - verifies that tabs are filtered by querying.
*/
public class testFilterOpenTab extends ContentProviderTest {
private static final String[] TABS_PROJECTION_COLUMNS = new String[] {
BrowserContract.Tabs.TITLE,
BrowserContract.Tabs.URL,
BrowserContract.Clients.GUID,
BrowserContract.Clients.NAME
};
private static final String LOCAL_TABS_SELECTION = BrowserContract.Tabs.CLIENT_GUID + " IS NULL";
/**
* Factory function that makes new ContentProvider instances.
* <p>
* We want a fresh provider each test, so this should be invoked in
* <code>setUp</code> before each individual test.
*/
protected static Callable<ContentProvider> sTabProviderCallable = new Callable<ContentProvider>() {
@Override
public ContentProvider call() {
return new TabsProvider();
}
};
private Cursor getTabsFromLocalClient() throws Exception {
return mProvider.query(BrowserContract.Tabs.CONTENT_URI,
TABS_PROJECTION_COLUMNS,
LOCAL_TABS_SELECTION,
null,
null);
}
private Tab createTab(int id, String url, boolean external, int parentId, String title) {
return new Tab((Context) getActivity(), id, url, external, parentId, title);
}
private Tab createPrivateTab(int id, String url, boolean external, int parentId, String title) {
return new PrivateTab((Context) getActivity(), id, url, external, parentId, title);
}
@Override
public void setUp() throws Exception {
super.setUp(sTabProviderCallable, BrowserContract.TABS_AUTHORITY, "tabs.db");
mTests.add(new TestInsertLocalTabs());
}
public void testFilterOpenTab() throws Exception {
for (int i = 0; i < mTests.size(); i++) {
Runnable test = mTests.get(i);
setTestName(test.getClass().getSimpleName());
test.run();
}
}
private class TestInsertLocalTabs extends TestCase {
@Override
public void test() throws Exception {
final String TITLE1 = "Google";
final String URL1 = "http://www.google.com/";
final String TITLE2 = "Mozilla Start Page";
final String URL2 = "about:home";
final String TITLE3 = "Chrome Weave URL";
final String URL3 = "chrome://weave/";
final String TITLE4 = "What You Cache Is What You Get";
final String URL4 = "wyciwyg://1/test.com";
final String TITLE5 = "Root Folder";
final String URL5 = "file:///";
// Create a list of local tabs.
List<Tab> tabs = new ArrayList<Tab>(6);
Tab tab1 = createTab(1, URL1, false, 0, TITLE1);
Tab tab2 = createTab(2, URL2, false, 0, TITLE2);
Tab tab3 = createTab(3, URL3, false, 0, TITLE3);
Tab tab4 = createTab(4, URL4, false, 0, TITLE4);
Tab tab5 = createTab(5, URL5, false, 0, TITLE5);
Tab tab6 = createPrivateTab(6, URL1, false, 0, TITLE1);
tabs.add(tab1);
tabs.add(tab2);
tabs.add(tab3);
tabs.add(tab4);
tabs.add(tab5);
tabs.add(tab6);
// Persist the created tabs.
TabsAccessor.persistLocalTabs(mResolver, tabs);
// Get the persisted tab and check if urls are filtered.
Cursor c = getTabsFromLocalClient();
assertCountIsAndClose(c, 1, 1 + " tabs entries found");
}
}
/**
* Assert that the provided cursor has the expected number of rows,
* closing the cursor afterwards.
*/
private void assertCountIsAndClose(Cursor c, int expectedCount, String message) {
try {
mAsserter.is(c.getCount(), expectedCount, message);
} finally {
c.close();
}
}
}

View File

@ -310,6 +310,9 @@ notification > button {
/* :::::: Close button icons ::::: */
.close-icon {
-moz-appearance: none;
height: 16px;
width: 16px;
background-image: -moz-image-rect(url("chrome://global/skin/icons/close.svg"), 0, 16, 16, 0);
background-position: center center;
background-repeat: no-repeat;

View File

@ -52,9 +52,6 @@ notification[type="critical"] {
}
.messageCloseButton {
-moz-appearance: none;
width: 16px;
height: 16px;
padding-left: 11px;
padding-right: 11px;
}

View File

@ -17,8 +17,7 @@ NS_IMPL_ISUPPORTS2(nsMIMEInfoAndroid, nsIMIMEInfo, nsIHandlerInfo)
NS_IMETHODIMP
nsMIMEInfoAndroid::LaunchDefaultWithFile(nsIFile* aFile)
{
LaunchWithFile(aFile);
return NS_OK;
return LaunchWithFile(aFile);
}
NS_IMETHODIMP
@ -30,11 +29,18 @@ nsMIMEInfoAndroid::LoadUriInternal(nsIURI * aURI)
nsCString uriScheme;
aURI->GetScheme(uriScheme);
return mozilla::widget::android::GeckoAppShell::OpenUriExternal(NS_ConvertUTF8toUTF16(uriSpec),
(mType.Equals(uriScheme) || mType.Equals(uriSpec)) ?
EmptyString() : NS_ConvertUTF8toUTF16(mType)) ? NS_OK : NS_ERROR_FAILURE;
}
nsAutoString mimeType;
if (mType.Equals(uriScheme) || mType.Equals(uriSpec)) {
mimeType = EmptyString();
} else {
mimeType = NS_ConvertUTF8toUTF16(mType);
}
if (GeckoAppShell::OpenUriExternal(NS_ConvertUTF8toUTF16(uriSpec), mimeType)) {
return NS_OK;
}
return NS_ERROR_FAILURE;
}
bool
nsMIMEInfoAndroid::GetMimeInfoForMimeType(const nsACString& aMimeType,
@ -58,25 +64,25 @@ nsMIMEInfoAndroid::GetMimeInfoForMimeType(const nsACString& aMimeType,
bridge->GetHandlersForMimeType(mimeType,
info->mHandlerApps, &systemDefault);
if (systemDefault)
info->mPrefApp = systemDefault;
nsAutoCString fileExt;
bridge->GetExtensionFromMimeType(aMimeType, fileExt);
info->SetPrimaryExtension(fileExt);
uint32_t len;
info->mHandlerApps->GetLength(&len);
if (len == 1) {
info.forget(aMimeInfo);
return false;
}
info.forget(aMimeInfo);
return true;
}
bool
nsMIMEInfoAndroid::GetMimeInfoForFileExt(const nsACString& aFileExt,
nsMIMEInfoAndroid **aMimeInfo)
@ -85,7 +91,7 @@ nsMIMEInfoAndroid::GetMimeInfoForFileExt(const nsACString& aFileExt,
if (mozilla::AndroidBridge::Bridge())
mozilla::AndroidBridge::Bridge()->
GetMimeTypeFromExtensions(aFileExt, mimeType);
// "*/*" means that the bridge didn't know.
if (mimeType.Equals(nsDependentCString("*/*"), nsCaseInsensitiveCStringComparator()))
return false;
@ -106,7 +112,7 @@ nsMIMEInfoAndroid::GetMimeInfoForURL(const nsACString &aURL,
nsMIMEInfoAndroid *mimeinfo = new nsMIMEInfoAndroid(aURL);
NS_ADDREF(*info = mimeinfo);
*found = true;
mozilla::AndroidBridge* bridge = mozilla::AndroidBridge::Bridge();
if (!bridge) {
// we don't have access to the bridge, so just assume we can handle
@ -117,7 +123,7 @@ nsMIMEInfoAndroid::GetMimeInfoForURL(const nsACString &aURL,
nsIHandlerApp* systemDefault = nullptr;
bridge->GetHandlersForURL(NS_ConvertUTF8toUTF16(aURL),
mimeinfo->mHandlerApps, &systemDefault);
if (systemDefault)
mimeinfo->mPrefApp = systemDefault;
@ -127,7 +133,7 @@ nsMIMEInfoAndroid::GetMimeInfoForURL(const nsACString &aURL,
mimeinfo->GetType(mimeType);
bridge->GetExtensionFromMimeType(mimeType, fileExt);
mimeinfo->SetPrimaryExtension(fileExt);
uint32_t len;
mimeinfo->mHandlerApps->GetLength(&len);
if (len == 1) {
@ -136,7 +142,7 @@ nsMIMEInfoAndroid::GetMimeInfoForURL(const nsACString &aURL,
*found = false;
return NS_OK;
}
return NS_OK;
}
@ -359,8 +365,7 @@ nsMIMEInfoAndroid::LaunchWithFile(nsIFile *aFile)
{
nsCOMPtr<nsIURI> uri;
NS_NewFileURI(getter_AddRefs(uri), aFile);
LoadUriInternal(uri);
return NS_OK;
return LoadUriInternal(uri);
}
nsMIMEInfoAndroid::nsMIMEInfoAndroid(const nsACString& aMIMEType) :