Merge cedar with mozilla-central.

This commit is contained in:
Mounir Lamouri 2011-04-18 17:16:20 +02:00
commit 2bac0b7762
142 changed files with 2144 additions and 1608 deletions

View File

@ -89,7 +89,7 @@ nsOuterDocAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
nsAccessible* child = GetChildAt(0);
NS_ENSURE_TRUE(child, nsnull);
if (aWhichChild = eDeepestChild)
if (aWhichChild == eDeepestChild)
return child->GetChildAtPoint(aX, aY, eDeepestChild);
return child;
}

View File

@ -4034,16 +4034,19 @@ var FullScreen = {
// controls on nav bar.
var fullscreenflex = document.getElementById("fullscreenflex");
var fullscreenctls = document.getElementById("window-controls");
var ctlsOnTabbar = TabsOnTop.enabled &&
!gPrefService.getBoolPref("browser.tabs.autoHide");
if (fullscreenctls.parentNode.id == "nav-bar" && ctlsOnTabbar) {
var navbar = document.getElementById("nav-bar");
var ctlsOnTabbar = window.toolbar.visible &&
(navbar.collapsed ||
(TabsOnTop.enabled &&
!gPrefService.getBoolPref("browser.tabs.autoHide")));
if (fullscreenctls.parentNode == navbar && ctlsOnTabbar) {
document.getElementById("TabsToolbar").appendChild(fullscreenctls);
// we don't need this space in tabs-on-top mode, so prevent it from
// being shown
fullscreenflex.removeAttribute("fullscreencontrol");
}
else if (fullscreenctls.parentNode.id == "TabsToolbar" && !ctlsOnTabbar) {
document.getElementById("nav-bar").appendChild(fullscreenctls);
navbar.appendChild(fullscreenctls);
fullscreenflex.setAttribute("fullscreencontrol", "true");
}

View File

@ -96,8 +96,7 @@ let gOpenLocationLastURL = {
}
},
reset: function() {
if (prefSvc.prefHasUserValue(LAST_URL_PREF))
prefSvc.clearUserPref(LAST_URL_PREF);
prefSvc.clearUserPref(LAST_URL_PREF);
gOpenLocationLastURLData = "";
}
};

View File

@ -814,7 +814,7 @@
}
} catch (e) {}
if (window.TabView) {
if ("TabView" in window) {
let groupName = TabView.getActiveGroupName();
if (groupName)
newTitle = groupName + sep + newTitle;
@ -828,7 +828,7 @@
<method name="updateTitlebar">
<body>
<![CDATA[
if (window.TabView && TabView.isVisible()) {
if ("TabView" in window && TabView.isVisible()) {
// ToDo: this will be removed when we gain ability to draw to the menu bar.
// Bug 586175
this.ownerDocument.title = TabView.windowTitle;

View File

@ -1147,7 +1147,9 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
let $icon = iQ(icon);
if ($icon.data("xulTab") == event.target) {
$icon.attr("src", Utils.defaultFaviconURL);
return false;
}
return true;
});
},
@ -1193,9 +1195,10 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
iQ(".appTabIcon", this.$appTabTray).each(function(icon) {
let $icon = iQ(icon);
if ($icon.data("xulTab") != xulTab)
return;
return true;
$icon.remove();
return false;
});
// adjust the tray
@ -1215,7 +1218,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
elements.each(function(icon) {
let $icon = iQ(icon);
if ($icon.data("xulTab") != xulTab)
return;
return true;
let targetIndex = xulTab._tPos;
@ -1226,6 +1229,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
iQ(".appTabIcon:nth-child(" + (targetIndex + 1) + ")", self.$appTabTray)[0]);
else
$icon.appendTo(self.$appTabTray);
return false;
});
},
@ -1668,13 +1672,12 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
// Create new tab and zoom in on it after a double click
container.mousedown(function(e) {
if (!Utils.isLeftClick(e))
if (!Utils.isLeftClick(e) || self.$titlebar[0] == e.target ||
self.$titlebar.contains(e.target)) {
self._lastClick = 0;
self._lastClickPositions = null;
return;
// clicking in the title bar shouldn't create new tabs
if (self.$titlebar[0] == e.target || self.$titlebar.contains(e.target))
return;
}
if (Date.now() - self._lastClick <= UI.DBLCLICK_INTERVAL &&
(self._lastClickPositions.x - UI.DBLCLICK_OFFSET) <= e.clientX &&
(self._lastClickPositions.x + UI.DBLCLICK_OFFSET) >= e.clientX &&
@ -2038,10 +2041,11 @@ let GroupItems = {
iQ(".appTabIcon", groupItem.$appTabTray).each(function(icon) {
let $icon = iQ(icon);
if ($icon.data("xulTab") != xulTab)
return;
return true;
if (iconUrl != $icon.attr("src"))
$icon.attr("src", iconUrl);
return false;
});
});
},

View File

@ -217,9 +217,7 @@ iQClass.prototype = {
Utils.assert(false, "each's argument must be a function");
return null;
}
for (let i = 0; this[i] != null; i++) {
callback(this[i]);
}
for (let i = 0; this[i] != null && callback(this[i]) !== false; i++) {}
return this;
},

View File

@ -661,7 +661,7 @@ Item.prototype = {
.unbind('mousemove', handleMouseMove)
.unbind('mouseup', handleMouseUp);
if (dropTarget) {
if (startSent && dropTarget) {
var dropOptions = dropTarget.dropOptions;
if (dropOptions && typeof dropOptions.drop == "function")
dropOptions.drop.apply(dropTarget, [e]);

View File

@ -13,6 +13,7 @@ body {
}
#content {
overflow: -moz-hidden-unscrollable;
position: absolute;
top: 0;
left: 0;

View File

@ -183,36 +183,41 @@ let UI = {
});
}
if (e.originalTarget.id == "content") {
// Create an orphan tab on double click
if (Date.now() - self._lastClick <= self.DBLCLICK_INTERVAL &&
(self._lastClickPositions.x - self.DBLCLICK_OFFSET) <= e.clientX &&
(self._lastClickPositions.x + self.DBLCLICK_OFFSET) >= e.clientX &&
(self._lastClickPositions.y - self.DBLCLICK_OFFSET) <= e.clientY &&
(self._lastClickPositions.y + self.DBLCLICK_OFFSET) >= e.clientY) {
GroupItems.setActiveGroupItem(null);
TabItems.creatingNewOrphanTab = true;
let newTab =
gBrowser.loadOneTab("about:blank", { inBackground: true });
let box =
new Rect(e.clientX - Math.floor(TabItems.tabWidth/2),
e.clientY - Math.floor(TabItems.tabHeight/2),
TabItems.tabWidth, TabItems.tabHeight);
newTab._tabViewTabItem.setBounds(box, true);
newTab._tabViewTabItem.pushAway(true);
UI.setActiveTab(newTab._tabViewTabItem);
TabItems.creatingNewOrphanTab = false;
newTab._tabViewTabItem.zoomIn(true);
if (!Utils.isLeftClick(e)) {
self._lastClick = 0;
self._lastClickPositions = null;
gTabView.firstUseExperienced = true;
} else {
self._lastClick = Date.now();
self._lastClickPositions = new Point(e.clientX, e.clientY);
self._createGroupItemOnDrag(e);
// Create an orphan tab on double click
if (Date.now() - self._lastClick <= self.DBLCLICK_INTERVAL &&
(self._lastClickPositions.x - self.DBLCLICK_OFFSET) <= e.clientX &&
(self._lastClickPositions.x + self.DBLCLICK_OFFSET) >= e.clientX &&
(self._lastClickPositions.y - self.DBLCLICK_OFFSET) <= e.clientY &&
(self._lastClickPositions.y + self.DBLCLICK_OFFSET) >= e.clientY) {
GroupItems.setActiveGroupItem(null);
TabItems.creatingNewOrphanTab = true;
let newTab =
gBrowser.loadOneTab("about:blank", { inBackground: true });
let box =
new Rect(e.clientX - Math.floor(TabItems.tabWidth/2),
e.clientY - Math.floor(TabItems.tabHeight/2),
TabItems.tabWidth, TabItems.tabHeight);
newTab._tabViewTabItem.setBounds(box, true);
newTab._tabViewTabItem.pushAway(true);
UI.setActiveTab(newTab._tabViewTabItem);
TabItems.creatingNewOrphanTab = false;
newTab._tabViewTabItem.zoomIn(true);
self._lastClick = 0;
self._lastClickPositions = null;
gTabView.firstUseExperienced = true;
} else {
self._lastClick = Date.now();
self._lastClickPositions = new Point(e.clientX, e.clientY);
self._createGroupItemOnDrag(e);
}
}
}
});

View File

@ -130,6 +130,7 @@ _BROWSER_FILES = \
browser_tabview_bug641802.js \
browser_tabview_bug644097.js \
browser_tabview_bug645653.js \
browser_tabview_bug649006.js \
browser_tabview_dragdrop.js \
browser_tabview_exit_button.js \
browser_tabview_expander.js \

View File

@ -4,84 +4,61 @@
let originalTab;
let orphanedTab;
let contentWindow;
let contentElement;
function test() {
waitForExplicitFinish();
window.addEventListener("tabviewshown", onTabViewWindowLoaded, false);
TabView.show();
}
function onTabViewWindowLoaded() {
window.removeEventListener("tabviewshown", onTabViewWindowLoaded, false);
contentWindow = document.getElementById("tab-view").contentWindow;
originalTab = gBrowser.visibleTabs[0];
test1();
showTabView(function() {
contentWindow = TabView.getContentWindow();
contentElement = contentWindow.document.getElementById("content");
originalTab = gBrowser.visibleTabs[0];
test1();
});
}
function test1() {
is(contentWindow.GroupItems.getOrphanedTabs().length, 0, "No orphaned tabs");
let onTabViewHidden = function() {
window.removeEventListener("tabviewhidden", onTabViewHidden, false);
let onTabViewShown = function() {
window.removeEventListener("tabviewshown", onTabViewShown, false);
is(contentWindow.GroupItems.getOrphanedTabs().length, 1,
whenTabViewIsHidden(function() {
showTabView(function() {
is(contentWindow.GroupItems.getOrphanedTabs().length, 1,
"An orphaned tab is created");
orphanedTab = contentWindow.GroupItems.getOrphanedTabs()[0].tab;
test2();
};
window.addEventListener("tabviewshown", onTabViewShown, false);
TabView.show();
};
window.addEventListener("tabviewhidden", onTabViewHidden, false);
});
});
// first click
EventUtils.sendMouseEvent(
{ type: "mousedown" }, contentWindow.document.getElementById("content"),
contentWindow);
EventUtils.sendMouseEvent(
{ type: "mouseup" }, contentWindow.document.getElementById("content"),
contentWindow);
mouseClick(contentElement, 0);
// second click
EventUtils.sendMouseEvent(
{ type: "mousedown" }, contentWindow.document.getElementById("content"),
contentWindow);
EventUtils.sendMouseEvent(
{ type: "mouseup" }, contentWindow.document.getElementById("content"),
contentWindow);
mouseClick(contentElement, 0);
}
function test2() {
let groupItem = createEmptyGroupItem(contentWindow, 300, 300, 200);
is(groupItem.getChildren().length, 0, "The group is empty");
let onTabViewHidden = function() {
window.removeEventListener("tabviewhidden", onTabViewHidden, false);
hideTabView(function() {
is(groupItem.getChildren().length, 1, "A tab is created inside the group");
gBrowser.selectedTab = originalTab;
gBrowser.removeTab(orphanedTab);
gBrowser.removeTab(groupItem.getChildren()[0].tab);
finish();
};
window.addEventListener("tabviewhidden", onTabViewHidden, false);
});
// first click
EventUtils.sendMouseEvent(
{ type: "mousedown" }, groupItem.container, contentWindow);
EventUtils.sendMouseEvent(
{ type: "mouseup" }, groupItem.container, contentWindow);
mouseClick(groupItem.container, 0);
// second click
EventUtils.sendMouseEvent(
{ type: "mousedown" }, groupItem.container, contentWindow);
EventUtils.sendMouseEvent(
{ type: "mouseup" }, groupItem.container, contentWindow);
mouseClick(groupItem.container, 0);
}
function mouseClick(targetElement, buttonCode) {
EventUtils.sendMouseEvent(
{ type: "mousedown", button: buttonCode }, targetElement, contentWindow);
EventUtils.sendMouseEvent(
{ type: "mouseup", button: buttonCode }, targetElement, contentWindow);
}

View File

@ -0,0 +1,94 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
let contentWindow;
let contentElement;
let groupItem;
function test() {
waitForExplicitFinish();
registerCleanupFunction(function () {
hideTabView(function () {});
});
showTabView(function() {
contentWindow = TabView.getContentWindow();
contentElement = contentWindow.document.getElementById("content");
test1();
});
}
function test1() {
is(gBrowser.tabs.length, 1,
"Total number of tabs is 1 before right button double click");
// first click
mouseClick(contentElement, 2);
// second click
mouseClick(contentElement, 2);
is(gBrowser.tabs.length, 1,
"Total number of tabs is 1 after right button double click");
test2();
}
function test2() {
is(gBrowser.tabs.length, 1,
"Total number of tabs is 1 before left, right and left mouse clicks");
// first click
mouseClick(contentElement, 0);
// second click
mouseClick(contentElement, 2);
// third click
mouseClick(contentElement, 0);
is(gBrowser.tabs.length, 1,
"Total number of tabs is 1 before left, right and left mouse clicks");
test3();
}
function test3() {
ok(contentWindow.GroupItems.groupItems.length, 1, "Only one group item exists");
groupItem = contentWindow.GroupItems.groupItems[0];
is(groupItem.getChildren().length, 1,
"The number of tab items in the group is 1 before right button double click");
// first click
mouseClick(groupItem.container, 2);
// second click
mouseClick(groupItem.container, 2);
is(groupItem.getChildren().length, 1,
"The number of tab items in the group is 1 after right button double click");
test4();
}
function test4() {
is(groupItem.getChildren().length, 1,
"The number of tab items in the group is 1 before left, right, left mouse clicks");
// first click
mouseClick(groupItem.container, 0);
// second click
mouseClick(groupItem.container, 2);
// third click
mouseClick(groupItem.container, 0);
is(groupItem.getChildren().length, 1,
"The number of tab items in the group is 1 before left, right, left mouse clicks");
hideTabView(function() {
is(gBrowser.tabs.length, 1, "Total number of tabs is 1 after all tests");
finish();
});
}
function mouseClick(targetElement, buttonCode) {
EventUtils.sendMouseEvent(
{ type: "mousedown", button: buttonCode }, targetElement, contentWindow);
EventUtils.sendMouseEvent(
{ type: "mouseup", button: buttonCode }, targetElement, contentWindow);
}

View File

@ -457,10 +457,7 @@ var MigrationWizard = {
var prefBranch = prefSvc.getBranch(null);
if (this._newHomePage == "DEFAULT") {
try {
prefBranch.clearUserPref("browser.startup.homepage");
}
catch (e) { }
prefBranch.clearUserPref("browser.startup.homepage");
}
else {
var str = Components.classes["@mozilla.org/supports-string;1"]

View File

@ -261,6 +261,14 @@ BrowserGlue.prototype = {
else if (data == "force-ui-migration") {
this._migrateUI();
}
else if (data == "force-distribution-customization") {
this._distributionCustomizer.applyPrefDefaults();
this._distributionCustomizer.applyCustomizations();
// To apply distribution bookmarks use "places-init-complete".
}
else if (data == "force-places-init") {
this._initPlaces();
}
break;
}
},

View File

@ -84,11 +84,11 @@ function searchHistory(aInput)
case "visited":
resultType = NHQO.RESULTS_AS_URI;
sortingMode = NHQO.SORT_BY_VISITCOUNT_DESCENDING;
break;
break;
case "lastvisited":
resultType = NHQO.RESULTS_AS_URI;
sortingMode = NHQO.SORT_BY_DATE_DESCENDING;
break;
break;
case "dayandsite":
resultType = NHQO.RESULTS_AS_DATE_SITE_QUERY;
break;
@ -105,7 +105,7 @@ function searchHistory(aInput)
if (aInput) {
query.searchTerms = aInput;
if (gHistoryGrouping != "visited" && gHistoryGrouping != "lastvisited") {
sortingMode = NHQO.SORT_BY_TITLE_ASCENDING;
sortingMode = NHQO.SORT_BY_FRECENCY_DESCENDING;
resultType = NHQO.RESULTS_AS_URI;
}
}

View File

@ -1,62 +1,20 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Places Unit Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Marco Bonardo <mak77@bonardo.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that nsBrowserGlue does not overwrite bookmarks imported from the
* migrators. They usually run before nsBrowserGlue, so if we find any
* bookmark on init, we should not try to import.
* Tests that nsBrowserGlue correctly imports bookmarks from distribution.ini.
*/
const PREF_SMART_BOOKMARKS_VERSION = "browser.places.smartBookmarksVersion";
const PREF_BMPROCESSED = "distribution.516444.bookmarksProcessed";
const PREF_DISTRIBUTION_ID = "distribution.id";
const TOPIC_FINAL_UI_STARTUP = "final-ui-startup";
const TOPICDATA_DISTRIBUTION_CUSTOMIZATION = "force-distribution-customization";
const TOPIC_CUSTOMIZATION_COMPLETE = "distribution-customization-complete";
const TOPIC_BROWSERGLUE_TEST = "browser-glue-test";
function run_test() {
// This is needed but we still have to investigate the reason, could just be
// we try to act too late in the game, moving our shutdown earlier will help.
let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
// TODO: re-enable when bug 523936 is fixed.
return;
function run_test()
{
do_test_pending();
// Copy distribution.ini file to our app dir.
@ -68,82 +26,67 @@ function run_test() {
iniFile.remove(false);
print("distribution.ini already exists, did some test forget to cleanup?");
}
let testDistributionFile = gTestDir.clone();
testDistributionFile.append("distribution.ini");
testDistributionFile.copyTo(distroDir, "distribution.ini");
do_check_true(testDistributionFile.exists());
// Disable Smart Bookmarks creation.
let ps = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
ps.setIntPref(PREF_SMART_BOOKMARKS_VERSION, -1);
// Avoid migrateUI, we are just simulating a partial startup.
ps.setIntPref("browser.migration.version", 4);
Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, -1);
// Initialize Places through the History Service.
let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
// Check a new database has been created.
// nsBrowserGlue will use databaseStatus to manage initialization.
do_check_eq(hs.databaseStatus, hs.DATABASE_STATUS_CREATE);
// Initialize Places through the History Service and check that a new
// database has been created.
do_check_eq(PlacesUtils.history.databaseStatus,
PlacesUtils.history.DATABASE_STATUS_CREATE);
// Initialize nsBrowserGlue.
let bg = Cc["@mozilla.org/browser/browserglue;1"].
getService(Ci.nsIBrowserGlue);
// Force distribution.
Cc["@mozilla.org/browser/browserglue;1"].
getService(Ci.nsIObserver).observe(null,
TOPIC_BROWSERGLUE_TEST,
TOPICDATA_DISTRIBUTION_CUSTOMIZATION);
let os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
let observer = {
observe: function(aSubject, aTopic, aData) {
os.removeObserver(this, PlacesUtils.TOPIC_INIT_COMPLETE);
// Simulate browser startup.
bg.QueryInterface(Ci.nsIObserver).observe(null,
TOPIC_FINAL_UI_STARTUP,
null);
// Test will continue on customization complete notification.
let cObserver = {
observe: function(aSubject, aTopic, aData) {
os.removeObserver(this, TOPIC_CUSTOMIZATION_COMPLETE);
do_execute_soon(continue_test);
}
}
os.addObserver(cObserver, TOPIC_CUSTOMIZATION_COMPLETE, false);
}
}
os.addObserver(observer, PlacesUtils.TOPIC_INIT_COMPLETE, false);
// Test will continue on customization complete notification.
Services.obs.addObserver(function(aSubject, aTopic, aData) {
Services.obs.removeObserver(arguments.callee,
TOPIC_CUSTOMIZATION_COMPLETE,
false);
do_execute_soon(onCustomizationComplete);
}, TOPIC_CUSTOMIZATION_COMPLETE, false);
}
function continue_test() {
let bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
dump_table("moz_bookmarks");
function onCustomizationComplete()
{
// Check the custom bookmarks exist on menu.
let menuItemId = bs.getIdForItemAt(bs.bookmarksMenuFolder, 0);
let menuItemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId, 0);
do_check_neq(menuItemId, -1);
do_check_eq(bs.getItemTitle(menuItemId), "Menu Link Before");
menuItemId = bs.getIdForItemAt(bs.bookmarksMenuFolder, 1 + DEFAULT_BOOKMARKS_ON_MENU);
do_check_eq(PlacesUtils.bookmarks.getItemTitle(menuItemId),
"Menu Link Before");
menuItemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId,
1 + DEFAULT_BOOKMARKS_ON_MENU);
do_check_neq(menuItemId, -1);
do_check_eq(bs.getItemTitle(menuItemId), "Menu Link After");
do_check_eq(PlacesUtils.bookmarks.getItemTitle(menuItemId),
"Menu Link After");
// Check the custom bookmarks exist on toolbar.
let toolbarItemId = bs.getIdForItemAt(bs.toolbarFolder, 0);
let toolbarItemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
do_check_neq(toolbarItemId, -1);
do_check_eq(bs.getItemTitle(toolbarItemId), "Toolbar Link Before");
toolbarItemId = bs.getIdForItemAt(bs.toolbarFolder, 1 + DEFAULT_BOOKMARKS_ON_TOOLBAR);
do_check_eq(PlacesUtils.bookmarks.getItemTitle(toolbarItemId),
"Toolbar Link Before");
toolbarItemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId,
1 + DEFAULT_BOOKMARKS_ON_TOOLBAR);
do_check_neq(toolbarItemId, -1);
do_check_eq(bs.getItemTitle(toolbarItemId), "Toolbar Link After");
do_check_eq(PlacesUtils.bookmarks.getItemTitle(toolbarItemId),
"Toolbar Link After");
// Check the bmprocessed pref has been created.
let ps = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
do_check_true(ps.getBoolPref(PREF_BMPROCESSED));
do_check_true(Services.prefs.getBoolPref(PREF_BMPROCESSED));
// Check distribution prefs have been created.
do_check_eq(ps.getCharPref(PREF_DISTRIBUTION_ID), "516444");
do_check_eq(Services.prefs.getCharPref(PREF_DISTRIBUTION_ID), "516444");
do_test_finished();
}

View File

@ -1,40 +1,5 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Places Unit Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Marco Bonardo <mak77@bonardo.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that nsBrowserGlue does not overwrite bookmarks imported from the
@ -42,39 +7,13 @@
* bookmark on init, we should not try to import.
*/
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "bs",
"@mozilla.org/browser/nav-bookmarks-service;1",
"nsINavBookmarksService");
XPCOMUtils.defineLazyServiceGetter(this, "anno",
"@mozilla.org/browser/annotation-service;1",
"nsIAnnotationService");
let bookmarksObserver = {
onBeginUpdateBatch: function() {},
onEndUpdateBatch: function() {
let itemId = bs.getIdForItemAt(bs.toolbarFolder, 0);
do_check_neq(itemId, -1);
if (anno.itemHasAnnotation(itemId, "Places/SmartBookmark"))
continue_test();
},
onItemAdded: function() {},
onBeforeItemRemoved: function(id) {},
onItemRemoved: function(id, folder, index, itemType) {},
onItemChanged: function() {},
onItemVisited: function(id, visitID, time) {},
onItemMoved: function() {},
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver])
};
const PREF_SMART_BOOKMARKS_VERSION = "browser.places.smartBookmarksVersion";
function run_test() {
do_test_pending();
// Create our bookmarks.html copying bookmarks.glue.html to the profile
// folder. It will be ignored.
// folder. It should be ignored.
create_bookmarks_html("bookmarks.glue.html");
// Remove current database file.
@ -85,35 +24,61 @@ function run_test() {
do_check_false(db.exists());
}
// Initialize Places through the History Service.
let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
// Check a new database has been created.
// nsBrowserGlue uses databaseStatus to manage initialization.
do_check_eq(hs.databaseStatus, hs.DATABASE_STATUS_CREATE);
// Initialize Places through the History Service and check that a new
// database has been created.
do_check_eq(PlacesUtils.history.databaseStatus,
PlacesUtils.history.DATABASE_STATUS_CREATE);
// A migrator would run before nsBrowserGlue, so we mimic that behavior
// adding a bookmark.
bs.insertBookmark(bs.bookmarksMenuFolder, uri("http://mozilla.org/"),
bs.DEFAULT_INDEX, "migrated");
PlacesUtils.bookmarks.insertBookmark(PlacesUtils.bookmarks.bookmarksMenuFolder, uri("http://mozilla.org/"),
PlacesUtils.bookmarks.DEFAULT_INDEX, "migrated");
// Initialize nsBrowserGlue.
let bg = Cc["@mozilla.org/browser/browserglue;1"].
getService(Ci.nsIBrowserGlue);
let bookmarksObserver = {
onBeginUpdateBatch: function() {},
onEndUpdateBatch: function() {
// Check if the currently finished batch created the smart bookmarks.
let itemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
do_check_neq(itemId, -1);
if (PlacesUtils.annotations
.itemHasAnnotation(itemId, "Places/SmartBookmark")) {
do_execute_soon(onSmartBookmarksCreation);
}
},
onItemAdded: function() {},
onBeforeItemRemoved: function(id) {},
onItemRemoved: function(id, folder, index, itemType) {},
onItemChanged: function() {},
onItemVisited: function(id, visitID, time) {},
onItemMoved: function() {},
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver])
};
// The test will continue once import has finished and smart bookmarks
// have been created.
bs.addObserver(bookmarksObserver, false);
PlacesUtils.bookmarks.addObserver(bookmarksObserver, false);
}
function continue_test() {
function onSmartBookmarksCreation() {
// Check the created bookmarks still exist.
let itemId = bs.getIdForItemAt(bs.bookmarksMenuFolder, SMART_BOOKMARKS_ON_MENU);
do_check_eq(bs.getItemTitle(itemId), "migrated");
let itemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId,
SMART_BOOKMARKS_ON_MENU);
do_check_eq(PlacesUtils.bookmarks.getItemTitle(itemId), "migrated");
// Check that we have not imported any new bookmark.
do_check_eq(bs.getIdForItemAt(bs.bookmarksMenuFolder, SMART_BOOKMARKS_ON_MENU + 1), -1);
do_check_eq(bs.getIdForItemAt(bs.toolbarFolder, SMART_BOOKMARKS_ON_MENU), -1);
itemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId,
SMART_BOOKMARKS_ON_MENU + 1)
do_check_eq(itemId, -1);
itemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId,
SMART_BOOKMARKS_ON_MENU)
do_check_eq(itemId, -1);
remove_bookmarks_html();

View File

@ -1,287 +1,265 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Places Unit Test code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Marco Bonardo <mak77@bonardo.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that nsBrowserGlue is correctly interpreting the preferences settable
* by the user or by other components.
*/
/** Bug 539067
* Test is disabled due to random failures and timeouts, see run_test.
* This is commented out to avoid leaks.
// Initialize browserGlue.
let bg = Cc["@mozilla.org/browser/browserglue;1"].
getService(Ci.nsIBrowserGlue);
*/
// Initialize Places through Bookmarks Service.
let bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
// Get other services.
let ps = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
let os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
const PREF_IMPORT_BOOKMARKS_HTML = "browser.places.importBookmarksHTML";
const PREF_RESTORE_DEFAULT_BOOKMARKS = "browser.bookmarks.restore_default_bookmarks";
const PREF_SMART_BOOKMARKS_VERSION = "browser.places.smartBookmarksVersion";
const PREF_AUTO_EXPORT_HTML = "browser.bookmarks.autoExportHTML";
let tests = [];
//------------------------------------------------------------------------------
const TOPIC_BROWSERGLUE_TEST = "browser-glue-test";
const TOPICDATA_FORCE_PLACES_INIT = "force-places-init";
tests.push({
description: "Import from bookmarks.html if importBookmarksHTML is true.",
exec: function() {
let bg = Cc["@mozilla.org/browser/browserglue;1"].
getService(Ci.nsIBrowserGlue);
let gTests = [
// This test must be the first one.
function test_checkPreferences() {
// Initialize Places through the History Service and check that a new
// database has been created.
do_check_eq(PlacesUtils.history.databaseStatus,
PlacesUtils.history.DATABASE_STATUS_CREATE);
// Wait for Places init notification.
Services.obs.addObserver(function(aSubject, aTopic, aData) {
Services.obs.removeObserver(arguments.callee,
PlacesUtils.TOPIC_INIT_COMPLETE);
do_execute_soon(function () {
// Ensure preferences status.
do_check_false(Services.prefs.getBoolPref(PREF_AUTO_EXPORT_HTML));
try {
do_check_false(Services.prefs.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
do_throw("importBookmarksHTML pref should not exist");
}
catch(ex) {}
try {
do_check_false(Services.prefs.getBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS));
do_throw("importBookmarksHTML pref should not exist");
}
catch(ex) {}
run_next_test();
});
}, PlacesUtils.TOPIC_INIT_COMPLETE, false);
},
function test_import()
{
do_log_info("Import from bookmarks.html if importBookmarksHTML is true.");
remove_all_bookmarks();
// Sanity check: we should not have any bookmark on the toolbar.
do_check_eq(bs.getIdForItemAt(bs.toolbarFolder, 0), -1);
let itemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
do_check_eq(itemId, -1);
// Set preferences.
ps.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
Services.prefs.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
// Force nsBrowserGlue::_initPlaces().
print("Simulate Places init");
bg.QueryInterface(Ci.nsIObserver).observe(null,
PlacesUtils.TOPIC_INIT_COMPLETE,
null);
TOPIC_BROWSERGLUE_TEST,
TOPICDATA_FORCE_PLACES_INIT);
// Check bookmarks.html has been imported, and a smart bookmark has been
// created.
let itemId = bs.getIdForItemAt(bs.toolbarFolder,
SMART_BOOKMARKS_ON_TOOLBAR);
do_check_eq(bs.getItemTitle(itemId), "example");
itemId = PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId,
SMART_BOOKMARKS_ON_TOOLBAR);
do_check_eq(PlacesUtils.bookmarks.getItemTitle(itemId), "example");
// Check preferences have been reverted.
do_check_false(ps.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
do_check_false(Services.prefs.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
next_test();
}
});
run_next_test();
},
//------------------------------------------------------------------------------
function test_import_noSmartBookmarks()
{
do_log_info("import from bookmarks.html, but don't create smart bookmarks \
if they are disabled");
tests.push({
description: "import from bookmarks.html, but don't create smart bookmarks if they are disabled",
exec: function() {
remove_all_bookmarks();
// Sanity check: we should not have any bookmark on the toolbar.
do_check_eq(bs.getIdForItemAt(bs.toolbarFolder, 0), -1);
let itemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
do_check_eq(itemId, -1);
// Set preferences.
ps.setIntPref(PREF_SMART_BOOKMARKS_VERSION, -1);
ps.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, -1);
Services.prefs.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
// Force nsBrowserGlue::_initPlaces().
print("Simulate Places init");
bg.QueryInterface(Ci.nsIObserver).observe(null,
PlacesUtils.TOPIC_INIT_COMPLETE,
null);
TOPIC_BROWSERGLUE_TEST,
TOPICDATA_FORCE_PLACES_INIT);
// Check bookmarks.html has been imported, but smart bookmarks have not
// been created.
let itemId = bs.getIdForItemAt(bs.toolbarFolder, 0);
do_check_eq(bs.getItemTitle(itemId), "example");
itemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
do_check_eq(PlacesUtils.bookmarks.getItemTitle(itemId), "example");
// Check preferences have been reverted.
do_check_false(ps.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
do_check_false(Services.prefs.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
next_test();
}
});
run_next_test();
},
//------------------------------------------------------------------------------
function test_import_autoExport_updatedSmartBookmarks()
{
do_log_info("Import from bookmarks.html, but don't create smart bookmarks \
if autoExportHTML is true and they are at latest version");
tests.push({
description: "Import from bookmarks.html, but don't create smart bookmarks if autoExportHTML is true and they are at latest version",
exec: function() {
remove_all_bookmarks();
// Sanity check: we should not have any bookmark on the toolbar.
do_check_eq(bs.getIdForItemAt(bs.toolbarFolder, 0), -1);
let itemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
do_check_eq(itemId, -1);
// Set preferences.
ps.setIntPref(PREF_SMART_BOOKMARKS_VERSION, 999);
ps.setBoolPref(PREF_AUTO_EXPORT_HTML, true);
ps.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, 999);
Services.prefs.setBoolPref(PREF_AUTO_EXPORT_HTML, true);
Services.prefs.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
// Force nsBrowserGlue::_initPlaces()
print("Simulate Places init");
bg.QueryInterface(Ci.nsIObserver).observe(null,
PlacesUtils.TOPIC_INIT_COMPLETE,
null);
TOPIC_BROWSERGLUE_TEST,
TOPICDATA_FORCE_PLACES_INIT);
// Check bookmarks.html has been imported, but smart bookmarks have not
// been created.
let itemId = bs.getIdForItemAt(bs.toolbarFolder, 0);
do_check_eq(bs.getItemTitle(itemId), "example");
do_check_false(ps.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
itemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
do_check_eq(PlacesUtils.bookmarks.getItemTitle(itemId), "example");
do_check_false(Services.prefs.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
// Check preferences have been reverted.
ps.setBoolPref(PREF_AUTO_EXPORT_HTML, false);
Services.prefs.setBoolPref(PREF_AUTO_EXPORT_HTML, false);
next_test();
}
});
run_next_test();
},
//------------------------------------------------------------------------------
function test_import_autoExport_oldSmartBookmarks()
{
do_log_info("Import from bookmarks.html, and create smart bookmarks if \
autoExportHTML is true and they are not at latest version.");
tests.push({
description: "Import from bookmarks.html, and create smart bookmarks if autoExportHTML is true and they are not at latest version.",
exec: function() {
remove_all_bookmarks();
// Sanity check: we should not have any bookmark on the toolbar.
do_check_eq(bs.getIdForItemAt(bs.toolbarFolder, 0), -1);
let itemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
do_check_eq(itemId, -1);
// Set preferences.
ps.setIntPref(PREF_SMART_BOOKMARKS_VERSION, 0);
ps.setBoolPref(PREF_AUTO_EXPORT_HTML, true);
ps.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, 0);
Services.prefs.setBoolPref(PREF_AUTO_EXPORT_HTML, true);
Services.prefs.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
// Force nsBrowserGlue::_initPlaces()
print("Simulate Places init");
bg.QueryInterface(Ci.nsIObserver).observe(null,
PlacesUtils.TOPIC_INIT_COMPLETE,
null);
TOPIC_BROWSERGLUE_TEST,
TOPICDATA_FORCE_PLACES_INIT);
// Check bookmarks.html has been imported, but smart bookmarks have not
// been created.
let itemId = bs.getIdForItemAt(bs.toolbarFolder, SMART_BOOKMARKS_ON_TOOLBAR);
do_check_eq(bs.getItemTitle(itemId), "example");
do_check_false(ps.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
itemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId,
SMART_BOOKMARKS_ON_TOOLBAR);
do_check_eq(PlacesUtils.bookmarks.getItemTitle(itemId), "example");
do_check_false(Services.prefs.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
// Check preferences have been reverted.
ps.setBoolPref(PREF_AUTO_EXPORT_HTML, false);
Services.prefs.setBoolPref(PREF_AUTO_EXPORT_HTML, false);
next_test();
}
});
run_next_test();
},
//------------------------------------------------------------------------------
tests.push({
description: "restore from default bookmarks.html if restore_default_bookmarks is true.",
exec: function() {
function test_restore()
{
do_log_info("restore from default bookmarks.html if \
restore_default_bookmarks is true.");
remove_all_bookmarks();
// Sanity check: we should not have any bookmark on the toolbar.
do_check_eq(bs.getIdForItemAt(bs.toolbarFolder, 0), -1);
let itemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
do_check_eq(itemId, -1);
// Set preferences.
ps.setBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS, true);
Services.prefs.setBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS, true);
// Force nsBrowserGlue::_initPlaces()
print("Simulate Places init");
bg.QueryInterface(Ci.nsIObserver).observe(null,
PlacesUtils.TOPIC_INIT_COMPLETE,
null);
TOPIC_BROWSERGLUE_TEST,
TOPICDATA_FORCE_PLACES_INIT);
// Check bookmarks.html has been restored.
let itemId = bs.getIdForItemAt(bs.toolbarFolder, SMART_BOOKMARKS_ON_TOOLBAR + 1);
itemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId,
SMART_BOOKMARKS_ON_TOOLBAR + 1);
do_check_true(itemId > 0);
// Check preferences have been reverted.
do_check_false(ps.getBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS));
do_check_false(Services.prefs.getBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS));
next_test();
}
});
run_next_test();
},
//------------------------------------------------------------------------------
function test_restore_import()
{
do_log_info("setting both importBookmarksHTML and \
restore_default_bookmarks should restore defaults.");
tests.push({
description: "setting both importBookmarksHTML and restore_default_bookmarks should restore defaults.",
exec: function() {
remove_all_bookmarks();
// Sanity check: we should not have any bookmark on the toolbar.
do_check_eq(bs.getIdForItemAt(bs.toolbarFolder, 0), -1);
let itemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
do_check_eq(itemId, -1);
// Set preferences.
ps.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
ps.setBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS, true);
Services.prefs.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
Services.prefs.setBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS, true);
// Force nsBrowserGlue::_initPlaces()
print("Simulate Places init");
bg.QueryInterface(Ci.nsIObserver).observe(null,
PlacesUtils.TOPIC_INIT_COMPLETE,
null);
TOPIC_BROWSERGLUE_TEST,
TOPICDATA_FORCE_PLACES_INIT);
// Check bookmarks.html has been restored.
let itemId = bs.getIdForItemAt(bs.toolbarFolder, SMART_BOOKMARKS_ON_TOOLBAR + 1);
itemId =
PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId,
SMART_BOOKMARKS_ON_TOOLBAR + 1);
do_check_true(itemId > 0);
// Check preferences have been reverted.
do_check_false(ps.getBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS));
do_check_false(ps.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
do_check_false(Services.prefs.getBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS));
do_check_false(Services.prefs.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
do_test_finished();
run_next_test();
}
});
//------------------------------------------------------------------------------
];
function finish_test() {
// Clean up database from all bookmarks.
do_register_cleanup(function () {
remove_all_bookmarks();
remove_bookmarks_html();
remove_all_JSON_backups();
});
do_test_finished();
}
var testIndex = 0;
function next_test() {
// Clean up database from all bookmarks.
remove_all_bookmarks();
// nsBrowserGlue stops observing topics after first notification,
// so we add back the observer to test additional runs.
os.addObserver(bg.QueryInterface(Ci.nsIObserver),
PlacesUtils.TOPIC_INIT_COMPLETE, false);
os.addObserver(bg.QueryInterface(Ci.nsIObserver),
PlacesUtils.TOPIC_DATABASE_LOCKED, false);
// Execute next test.
let test = tests.shift();
print("\nTEST " + (++testIndex) + ": " + test.description);
test.exec();
}
function run_test() {
// Bug 539067: disabled due to random failures and timeouts.
return;
do_test_pending();
// Enqueue test, so it will consume the default places-init-complete
// notification created at Places init.
do_timeout(0, start_tests);
}
function start_tests() {
// Clean up database from all bookmarks.
remove_all_bookmarks();
// Ensure preferences status.
do_check_false(ps.getBoolPref(PREF_AUTO_EXPORT_HTML));
try {
do_check_false(ps.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
do_throw("importBookmarksHTML pref should not exist");
}
catch(ex) {}
do_check_false(ps.getBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS));
function run_test()
{
// Create our bookmarks.html from bookmarks.glue.html.
create_bookmarks_html("bookmarks.glue.html");
// Create our JSON backup from bookmarks.glue.json.
create_JSON_backup("bookmarks.glue.json");
// Kick-off tests.
next_test();
run_next_test();
}

View File

@ -54,8 +54,7 @@ function test() {
function setupCleanSlate() {
gLastOpenDirectory.reset();
if (gPrefService.prefHasUserValue(kPrefName))
gPrefService.clearUserPref(kPrefName);
gPrefService.clearUserPref(kPrefName);
}
setupCleanSlate();

View File

@ -77,10 +77,7 @@ function test() {
// close tab, restore default values and finish the test
gBrowser.removeTab(tab);
// we need this if-statement because if there is no user set value,
// clearUserPref throws a uncatched exception and finish is not called
if (gPrefService.prefHasUserValue("browser.startup.page"))
gPrefService.clearUserPref("browser.startup.page");
gPrefService.clearUserPref("browser.startup.page");
gPrefService.clearUserPref("browser.startup.homepage");
finish();
}, true);

View File

@ -58,10 +58,11 @@ PROGRAM = crashinject$(BIN_SUFFIX)
USE_STATIC_LIBS = 1
CPPSRCS = crashinject.cpp
endif
endif # ENABLE_TESTS
include $(topsrcdir)/config/rules.mk
ifndef MOZ_MEMORY
ifdef WIN32_REDIST_DIR
ifeq (1400,$(_MSC_VER))
@ -89,11 +90,11 @@ REDIST_FILES = \
$(NULL)
endif
endif
ifdef REDIST_FILES
libs::
mkdir -p $(FINAL_TARGET)
install --preserve-timestamps $(foreach f,$(REDIST_FILES),"$(WIN32_REDIST_DIR)"/$(f)) $(FINAL_TARGET)
endif
endif # WIN32_REDIST_DIR
endif # ! MOZ_MEMORY

View File

@ -72,7 +72,6 @@ endif
CFLAGS += \
-DVC_PATH='"$(subst \,\\,$(VCINSTALLDIR))\\"' \
-DWM_SDK_PATH='"$(subst \,\\,$(WINCE_SDK_DIR))\\"' \
-DOGLES_SDK_PATH='"$(subst \,\\,$(OGLES_SDK_DIR))\\"' \
-DMOZCE_DEVENV='"$(MOZCE_DEVENV)"' \
-DTOPSRCDIR='"$(TOPSRCDIR)"' \
$(NULL)

View File

@ -24,7 +24,6 @@ void addLinkArgs(int k, int s, int *i, int *j, char** args, char** argv) {
args[(*i)++] = "/LIBPATH:\"" WCE_LIB "\"";
args[(*i)++] = "/LIBPATH:\"" WCE_CRT "\"";
args[(*i)++] = "/LIBPATH:\"" ATL_LIB "\"";
args[(*i)++] = "/LIBPATH:\"" OGLES_SDK_LIB "\"";
args[(*i)++] = "/NODEFAULTLIB";
args[(*i)++] = "/MAP";

View File

@ -199,8 +199,8 @@ DWORD run(char** args)
_putenv("LIBPATH=");
_putenv("CC=");
_putenv("INCLUDE=" SHUNT_INC ";" WM_SDK_INC ";" OGLES_SDK_INC ";" WCE_INC);
_putenv("LIB=" WCE_LIB ";" OGLES_SDK_LIB ";" WCE_CRT);
_putenv("INCLUDE=" SHUNT_INC ";" WM_SDK_INC ";" WCE_INC);
_putenv("LIB=" WCE_LIB ";" WCE_CRT);
i = strlen(args[0]);
for (j=0; j<i; j++)

View File

@ -5,8 +5,6 @@
#include <stdio.h>
#include <process.h>
#define OGLES_SDK_INC OGLES_SDK_PATH "inc"
#define OGLES_SDK_LIB OGLES_SDK_PATH "lib\\wince\\nvap\\release"
#define WCE_BIN VC_PATH "ce\\bin\\x86_arm\\"
#define WCE_RC_BIN WIN_SDK_PATH "bin\\"
#define WCE_CRT VC_PATH "ce\\lib\\armv4i"

View File

@ -573,7 +573,6 @@ FT2_LIBS = @FT2_LIBS@
MOZ_PANGO_CFLAGS = @MOZ_PANGO_CFLAGS@
MOZ_PANGO_LIBS = @MOZ_PANGO_LIBS@
MOZ_XIE_LIBS = @MOZ_XIE_LIBS@
XT_LIBS = @XT_LIBS@
MOZ_LIBPROXY_CFLAGS = @MOZ_LIBPROXY_CFLAGS@
@ -626,8 +625,6 @@ AIX_OBJMODEL = @AIX_OBJMODEL@
MOZ_OS2_TOOLS = @MOZ_OS2_TOOLS@
MOZ_OS2_HIGH_MEMORY = @MOZ_OS2_HIGH_MEMORY@
HAVE_XIE=@HAVE_XIE@
MOZ_PSM=@MOZ_PSM@
# Gssapi (krb5) libraries and headers for the Negotiate auth method
@ -660,12 +657,9 @@ MOZ_PHOENIX = @MOZ_PHOENIX@
MOZ_XULRUNNER = @MOZ_XULRUNNER@
WINCE = @WINCE@
WINCE_SDK_DIR = @WINCE_SDK_DIR@
OGLES_SDK_DIR = @OGLES_SDK_DIR@
WINCE_WINDOWS_MOBILE = @WINCE_WINDOWS_MOBILE@
HAS_OGLES = @HAS_OGLES@
MOZ_DISTRIBUTION_ID = @MOZ_DISTRIBUTION_ID@
MOZ_PLATFORM_MAEMO = @MOZ_PLATFORM_MAEMO@

View File

@ -992,7 +992,7 @@ endif
else # !WINNT || GNU_CC
ifeq ($(CPP_PROG_LINK),1)
$(EXPAND_CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB) $(EXE_DEF_FILE)
$(call CHECK_STDCXX,$@)
@$(call CHECK_STDCXX,$@)
else # ! CPP_PROG_LINK
$(EXPAND_CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
endif # CPP_PROG_LINK
@ -1058,7 +1058,7 @@ endif # MSVC with manifest tool
else
ifeq ($(CPP_PROG_LINK),1)
$(EXPAND_CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(BIN_FLAGS)
$(call CHECK_STDCXX,$@)
@$(call CHECK_STDCXX,$@)
else
$(EXPAND_CC) $(WRAP_MALLOC_CFLAGS) $(CFLAGS) $(OUTOPTION)$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(BIN_FLAGS)
endif # CPP_PROG_LINK
@ -1179,7 +1179,7 @@ endif
else # ! DTRACE_LIB_DEPENDENT
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
endif # DTRACE_LIB_DEPENDENT
$(call CHECK_STDCXX,$@)
@$(call CHECK_STDCXX,$@)
ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
ifdef MSMANIFEST_TOOL

View File

@ -895,7 +895,6 @@ X11/cursorfont.h
X11/extensions/Print.h
X11/extensions/shape.h
X11/extensions/scrnsaver.h
X11/extensions/XIElib.h
X11/extensions/XShm.h
X11/extensions/Xrender.h
X11/extensions/Xdamage.h

View File

@ -366,11 +366,6 @@ case "$target" in
The path to the Windows CE SDK],
WINCE_SDK_DIR=$withval)
MOZ_ARG_WITH_STRING(ogles-sdk,
[ --with-ogles-sdk=OGLES_SDK_DIR
The path to the OGLES SDK],
OGLES_SDK_DIR=$withval)
AC_DEFINE(WINCE)
export WINCE=1
@ -384,9 +379,9 @@ case "$target" in
_pwd=`pwd -W`
_topsrcdirwin=`cd \`dirname $0\`; pwd -W`
make OGLES_SDK_DIR="$OGLES_SDK_DIR" WINCE_SDK_DIR="$WINCE_SDK_DIR" \
TOPSRCDIR="$_topsrcdirwin" OBJDIR="$_pwd" target="$target" \
-C $srcdir/build/wince/tools
make WINCE_SDK_DIR="$WINCE_SDK_DIR" \
TOPSRCDIR="$_topsrcdirwin" OBJDIR="$_pwd" target="$target" \
-C $srcdir/build/wince/tools
CC="$_pwd/dist/sdk/bin/$target-gcc.exe"
CXX="$_pwd/dist/sdk/bin/$target-gcc.exe"
@ -686,7 +681,10 @@ case "$target" in
AC_DEFINE(HAVE_SEH_EXCEPTIONS)
if test -n "$WIN32_REDIST_DIR"; then
WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
if test ! -d "$WIN32_REDIST_DIR"; then
AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
fi
WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
fi
dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
@ -3524,26 +3522,6 @@ else
[XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
dnl ========================================================
dnl = Check for XIE
dnl ========================================================
AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
$XLIBS $XEXT_LIBS)
MOZ_CHECK_HEADER(X11/extensions/XIElib.h)
if test "$MOZ_XIE_LIBS"; then
dnl ====================================================
dnl = If XIE is present and is desired, turn it on
dnl ====================================================
case $target in
*-hpux*)
;;
*)
HAVE_XIE=1
;;
esac
fi
LDFLAGS="$_SAVE_LDFLAGS"
dnl ========================================================
@ -5108,6 +5086,16 @@ else
AC_MSG_RESULT([no])
fi
# Allow someone to change MOZ_APP_NAME in mozconfig
MOZ_ARG_WITH_STRING(app-name,
[--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
WITH_APP_NAME=$withval,
)
if test -n "$WITH_APP_NAME" ; then
MOZ_APP_NAME="$WITH_APP_NAME"
fi
# Now is a good time to test for logic errors, define mismatches, etc.
case "$MOZ_BUILD_APP" in
xulrunner)
@ -7430,8 +7418,15 @@ if test "$NS_TRACE_MALLOC"; then
MOZ_MEMORY=
fi
if test "$MOZ_MEMORY"; then
if test -z "$MOZ_MEMORY"; then
case "${target}" in
*-mingw*)
if test -z "$WIN32_REDIST_DIR"; then
AC_MSG_WARN([When not building jemalloc, you need to set WIN32_REDIST_DIR to the path to the Visual C++ Redist (usually VCINSTALLDIR\redist\x86\Microsoft.VC80.CRT, for VC++ v8) if you intend to distribute your build.])
fi
;;
esac
else
dnl Don't try to run compiler tests on Windows
if test "$OS_ARCH" = "WINNT"; then
if test -z "$HAVE_64BIT_OS"; then
@ -7545,7 +7540,7 @@ if test "$MOZ_MEMORY"; then
AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
fi
fi
fi # MOZ_MEMORY
AC_SUBST(MOZ_MEMORY)
AC_SUBST(MOZ_MEMORY_LDFLAGS)
AC_SUBST(WIN32_CRT_SRC_DIR)
@ -7721,21 +7716,10 @@ dnl ========================================================
dnl = libstdc++ compatibility hacks
dnl ========================================================
STDCXX_COMPAT=stdc++compat.cpp
MOZ_ARG_DISABLE_BOOL(stdcxx-compat,
[ --disable-stdcxx-compat Disable libstdc++ compatibility],
STDCXX_COMPAT=)
# Disable on platforms where it doesn't make sense
if test -n "$STDCXX_COMPAT"; then
case "${OS_TARGET}" in
Linux)
;;
*)
STDCXX_COMPAT=
;;
esac
fi
STDCXX_COMPAT=
MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
[ --enable-stdcxx-compat Enable compatibility with older libstdc++],
STDCXX_COMPAT=stdc++compat.cpp)
AC_SUBST(STDCXX_COMPAT)
@ -8606,15 +8590,16 @@ if test "$MOZ_TREE_CAIRO"; then
MOZ_ENABLE_CAIRO_FT=1
CAIRO_FT_CFLAGS="$FT2_CFLAGS"
fi
if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
case "$MOZ_WIDGET_TOOLKIT" in
qt)
QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
fi
if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
;;
cocoa)
QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
fi
if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
;;
windows)
WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
if test -z "$WINCE"; then
WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
@ -8639,15 +8624,15 @@ if test "$MOZ_TREE_CAIRO"; then
if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
fi
fi
if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
;;
os2)
OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
MOZ_ENABLE_CAIRO_FT=1
CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
fi
;;
esac
if test "$USE_FC_FREETYPE"; then
FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
fi
@ -8657,7 +8642,6 @@ if test "$MOZ_TREE_CAIRO"; then
AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
AC_SUBST(CAIRO_FT_CFLAGS)
AC_SUBST(HAS_OGLES)
if test "$MOZ_DEBUG"; then
SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
@ -8998,9 +8982,6 @@ AC_SUBST(JAR)
AC_SUBST(MOZ_PROFILELOCKING)
AC_SUBST(HAVE_XIE)
AC_SUBST(MOZ_XIE_LIBS)
AC_SUBST(BUILD_STATIC_LIBS)
AC_SUBST(MOZ_ENABLE_LIBXUL)
AC_SUBST(ENABLE_TESTS)
@ -9043,7 +9024,6 @@ AC_SUBST(MOZ_OS2_TOOLS)
AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
AC_SUBST(MOZ_TIMELINE)
AC_SUBST(OGLES_SDK_DIR)
AC_SUBST(MOZ_APP_NAME)
AC_SUBST(MOZ_APP_DISPLAYNAME)

View File

@ -6173,30 +6173,12 @@ nsDocument::AdoptNode(nsIDOMNode *aAdoptedNode, nsIDOMNode **aResult)
return CallQueryInterface(adoptedNode, aResult);
}
NS_IMETHODIMP
nsDocument::GetDomConfig(nsIDOMDOMConfiguration **aConfig)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDocument::NormalizeDocument()
{
// We don't support DOMConfigurations yet, so this just
// does a straight shot of normalization.
return Normalize();
}
NS_IMETHODIMP
nsDocument::RenameNode(nsIDOMNode *aNode,
const nsAString& namespaceURI,
const nsAString& qualifiedName,
nsIDOMNode **aReturn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDocument::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
{

View File

@ -475,6 +475,7 @@ _TEST_FILES2 = \
test_bug604592.html \
test_bug628938.html \
test_bug626262.html \
test_plugin_freezing.html \
$(NULL)
# This test fails on the Mac for some reason
@ -483,9 +484,6 @@ _TEST_FILES2 += test_copyimage.html \
$(NULL)
endif
# Disabled; see bug 492181
# test_plugin_freezing.html
# Disabled for now. Mochitest isn't reliable enough for these.
# test_bug444546.html \
# bug444546.sjs \

View File

@ -38,10 +38,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=430050
document.getElementById('b').loadURI('data:text/plain,succeeded',
null,
'UTF-8');
setTimeout(endTest, 0);
}
}, true);
document.documentElement.setAttribute("foo", "bar");
setTimeout(endTest, 100);
}
SimpleTest.waitForExplicitFinish();

View File

@ -13,7 +13,7 @@ function handleRequest(request, response) {
' parent.done();' +
' document.close();' +
'}' +
'setTimeout(doWrite, 1);' +
'setTimeout(doWrite, 0);' +
'</script>'
);

View File

@ -35,10 +35,10 @@ document.addEventListener('readystatechange', function(event) {
window.addEventListener('readystatechange', function(event) {
ok(false, 'window listener', 'readystatechange event should not bubble to window');
}, false);
setTimeout(function() {
addLoadEvent(function() {
is(i, states.length, 'readystatechange event count');
SimpleTest.finish();
}, 1000);
});
</script>
</pre>

View File

@ -40,7 +40,7 @@ catch(ex){
setTimeout(function(){
ok(true,"setTimeout still executes after bogus script insertion");
window.error = errorHandler;
SimpleTest.finish();}, 200);
SimpleTest.finish();}, 0);

View File

@ -64,7 +64,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=513194
consoleListener.finish();
consoleService.unregisterListener(consoleListener);
}
setTimeout(done, 1);
setTimeout(done, 0);
</script>
</pre>
</body>

View File

@ -19,14 +19,16 @@ var tests;
window.addEventListener("unload", function() {
e1.stopWatchingInstanceCount();
if (w) {
w.close();
}
}, false);
function nextTest() {
if (testIndex == tests.length) {
SimpleTest.finish();
if (w) {
w.close();
}
SimpleTest.waitForFocus(function() {
SimpleTest.finish();
});
return;
}
@ -41,7 +43,7 @@ function waitForInstanceCount(n) {
nextTest();
return;
}
setTimeout(function() { waitForInstanceCount(n); }, 100);
setTimeout(function() { waitForInstanceCount(n); }, 0);
}
tests = [
@ -53,7 +55,7 @@ tests = [
try {
e1.startWatchingInstanceCount();
var w = window.open("data:text/html,<embed id='e2' type='application/x-test'></embed>");
w.onload = nextTest;
SimpleTest.waitForFocus(nextTest, w);
SimpleTest.waitForExplicitFinish();
} catch (err) {
todo(false, "Instances already being watched?");

View File

@ -864,7 +864,6 @@ nsContentEventHandler::OnQueryDOMWidgetHittest(nsQueryContentEvent* aEvent)
}
if (aEvent->widget == targetWidget)
aEvent->mReply.mWidgetIsHit = PR_TRUE;
nsIWidget* pEventWidget = aEvent->widget.get();
}
aEvent->mSucceeded = PR_TRUE;

View File

@ -41,9 +41,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=238987
var prefs = Components.classes[prefSvcContractID].getService(prefSvcIID)
.getBranch("accessibility.");
if (!newValue) {
try {
prefs.clearUserPref("tabfocus");
} catch(ex) {}
prefs.clearUserPref("tabfocus");
} else {
prefs.setIntPref("tabfocus", newValue);
}

View File

@ -99,9 +99,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=409604
var prefs = Components.classes[prefSvcContractID].getService(prefSvcIID)
.getBranch("ui.key.");
if (!newValue) {
try {
prefs.clearUserPref("contentAccess");
} catch(ex) {}
prefs.clearUserPref("contentAccess");
} else {
prefs.setIntPref("contentAccess", newValue);
}

View File

@ -29,9 +29,7 @@ function setUserPref(reset) {
var prefs = Components.classes[prefSvcContractID].getService(prefSvcIID)
.getBranch("browser.link.");
if (reset) {
try {
prefs.clearUserPref("open_newwindow");
} catch (ex) {}
prefs.clearUserPref("open_newwindow");
} else {
prefs.setIntPref("open_newwindow", 3);
}

View File

@ -1,6 +0,0 @@
<!DOCTYPE html>
<html>
<body">
<div>pass</div>
</body>
</html>

View File

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html class=reftest-wait>
<script>
function onLoadHandler()
{
var v = document.createElement("input");
v.setAttribute("onclick", "document.getElementById('result').innerHTML += 'pass';\
document.documentElement.removeAttribute('class');");
v.click();
}
</script>
<body onload="onLoadHandler();">
<div id="result"></div>
</body>
</html>

View File

@ -1,3 +0,0 @@
<body>
<input>
<div>Results: div clicked body clicked input clicked div clicked body clicked input focused

View File

@ -1,24 +0,0 @@
<head>
<script>
function test()
{
document.getElementById("a").click();
document.getElementById("b").click();
document.getElementById("a").focus();
document.getElementById("b").focus();
// unfocus input to avoid failing due to caret
document.getElementById("b").blur();
}
function log(text)
{
document.getElementById("c").innerHTML+=text;
}
</script>
</head>
<body id="body" onload='javascript:test()' onclick='log("body clicked");'>
<div id=a onclick='log(" div clicked ");' onfocus='log(" div focused ");'>
<input id=b onclick='log(" input clicked ");' onfocus='log(" input focused ");'></div>
<div id="c">Results:

View File

@ -1,2 +0,0 @@
<!DOCTYPE html>
Pass

View File

@ -1,13 +0,0 @@
<!DOCTYPE html>
<head>
<script>
function test() {
var elem = document.createElement("input");
elem.setAttribute("onclick","document.getElementById('result').innerHTML = 'Pass'");
elem.click();
}
</script>
</head>
<body onload="test()">
<div id="result">Fail</div>
</body>

View File

@ -21,9 +21,6 @@ include autofocus/reftest.list
== 596455-2a.html 596455-ref-2.html
== 596455-2b.html 596455-ref-2.html
== 610935.html 610935-ref.html
== 583514-1.html 583514-1-ref.html
== 583514-2.html 583514-2-ref.html
== 409604-1.html 409604-1-ref.html
== hidden-1a.html hidden-1-ref.html
== hidden-1b.html hidden-1-ref.html
== hidden-1c.html hidden-1-ref.html

View File

@ -261,6 +261,7 @@ _TEST_FILES = \
test_bug633058.html \
test_bug641219.html \
test_bug643051.html \
test_bug583514.html \
$(NULL)
libs:: $(_TEST_FILES)

View File

@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=562932
https://bugzilla.mozilla.org/show_bug.cgi?id=583514
-->
<head>
<title>Test for Bug 583514</title>
@ -13,47 +13,58 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=562932
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=583514">Mozilla Bug 583514</a>
<p id="display"></p>
<div id="content">
<div id="a" accesskey="a" onfocus="divfocus = true;" onclick="divclicked = true;">
<input id="b" accesskey = "b" onfocus="inputfocus = true;" onclick="inputclicked = true;">
</div>
<input>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 583514 **/
/** Test for Bug 583514 **/
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var gExpectDivClick = false;
var gExpectInputClick = false;
var Cc = Components.classes;
var Ci = Components.interfaces;
var div = document.getElementById('content');
var input = document.getElementsByTagName('input')[0];
var modifier = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch).
getIntPref("ui.key.contentAccess");
div.addEventListener('click', function() {
ok(gExpectDivClick, "click event received on div and expected status was: " +
gExpectDivClick);
}, false);
var divfocus = false;
var divclicked = false;
var inputfocus = false;
var inputclicked = false;
input.addEventListener('click', function() {
ok(gExpectInputClick, "click event received on input and expected status was: " +
gExpectInputClick);
}, false);
var utils = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
//utils.sendNativeKeyEvent(0, 65, modifier, "a", "a");
SimpleTest.waitForExplicitFinish();
utils.sendKeyEvent("keypress", "a", 65, modifier);
SimpleTest.waitForFocus(function() {
var body = document.body;
is(divfocus, false, "accesskey does not focus div");
is(divclicked, true, "accesskey fires click at div");
is(inputfocus, false, "input was not targeted");
is(inputclicked, false, "inpt was not targeted");
body.addEventListener('click', function(aEvent) {
if (aEvent.target == input) {
body.removeEventListener('click', arguments.callee, false);
}
divclicked = false;
ok(true, "click event received on body");
utils.sendKeyEvent("keypress", "b", 66, modifier);
SimpleTest.executeSoon(function() {
isnot(document.activeElement, input, "input shouldn't have been focused");
isnot(document.activeElement, div, "div shouldn't have been focused");
is(divfocus, false, "focus cannot bubble to div");
is(divclicked, true, "click bubbles to div");
is(inputfocus, true, "accesskey focuses input");
is(inputclicked, true, "accesskey clicks input");
if (aEvent.target == input) {
SimpleTest.finish();
} else {
gExpectDivClick = true;
gExpectInputClick = true;
input.click();
}
});
}, false);
gExpectDivClick = true;
div.click();
});
</script>
</pre>

View File

@ -1398,27 +1398,12 @@ nsHTMLDocument::AdoptNode(nsIDOMNode* aSource, nsIDOMNode** aRetval)
return nsDocument::AdoptNode(aSource, aRetval);
}
NS_IMETHODIMP
nsHTMLDocument::GetDomConfig(nsIDOMDOMConfiguration** aDomConfig)
{
return nsDocument::GetDomConfig(aDomConfig);
}
NS_IMETHODIMP
nsHTMLDocument::NormalizeDocument()
{
return nsDocument::NormalizeDocument();
}
NS_IMETHODIMP
nsHTMLDocument::RenameNode(nsIDOMNode* aNode,
const nsAString& aNamespaceURI,
const nsAString& aQualifiedName,
nsIDOMNode** aRetval)
{
return nsDocument::RenameNode(aNode, aNamespaceURI, aQualifiedName, aRetval);
}
//
// nsIDOMHTMLDocument interface implementation
//
@ -2334,58 +2319,6 @@ nsHTMLDocument::GetNumFormsSynchronous()
return mNumForms;
}
nsresult
nsHTMLDocument::GetBodySize(PRInt32* aWidth,
PRInt32* aHeight)
{
*aWidth = *aHeight = 0;
FlushPendingNotifications(Flush_Layout);
// Find the <body> element: this is what we'll want to use for the
// document's width and height values.
Element* body = GetBodyElement();
if (!body) {
return NS_OK;
}
// Now grab its frame
nsIFrame* frame = body->GetPrimaryFrame();
if (!frame)
return NS_OK;
nsSize size = frame->GetSize();
*aWidth = nsPresContext::AppUnitsToIntCSSPixels(size.width);
*aHeight = nsPresContext::AppUnitsToIntCSSPixels(size.height);
return NS_OK;
}
NS_IMETHODIMP
nsHTMLDocument::GetWidth(PRInt32* aWidth)
{
NS_ENSURE_ARG_POINTER(aWidth);
if (!mWarnedWidthHeight) {
ReportUseOfDeprecatedMethod(this, "UseOfDocumentWidthWarning");
mWarnedWidthHeight = true;
}
PRInt32 height;
return GetBodySize(aWidth, &height);
}
NS_IMETHODIMP
nsHTMLDocument::GetHeight(PRInt32* aHeight)
{
NS_ENSURE_ARG_POINTER(aHeight);
if (!mWarnedWidthHeight) {
ReportUseOfDeprecatedMethod(this, "UseOfDocumentHeightWarning");
mWarnedWidthHeight = true;
}
PRInt32 width;
return GetBodySize(&width, aHeight);
}
NS_IMETHODIMP
nsHTMLDocument::GetAlinkColor(nsAString& aAlinkColor)
{

View File

@ -88,11 +88,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=369370
kidWin.close();
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
try {
prefs.clearUserPref("browser.enable_automatic_image_resizing");
} catch (ex) {
// throws if it wasn't already set because app default was true
}
prefs.clearUserPref("browser.enable_automatic_image_resizing");
SimpleTest.finish();
}

View File

@ -67,7 +67,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=233643
}
function do_test() {
setTimeout(test_233643, 1000);
setTimeout(test_233643, 0);
}
addLoadEvent(do_test);
]]>

View File

@ -189,7 +189,7 @@ function xpcWaitForFinishedFrames(callback, numFrames) {
if (finishedFrameCount == numFrames) {
clearInterval(frameWaitInterval);
setTimeout(callback, 1);
setTimeout(callback, 0);
return;
}

View File

@ -196,9 +196,11 @@ nsFocusManager::Init()
nsContentUtils::GetBoolPref("accessibility.mouse_focuses_formcontrol", PR_FALSE);
nsIPrefBranch2* prefBranch = nsContentUtils::GetPrefBranch();
prefBranch->AddObserver("accessibility.browsewithcaret", fm, PR_TRUE);
prefBranch->AddObserver("accessibility.tabfocus_applies_to_xul", fm, PR_TRUE);
prefBranch->AddObserver("accessibility.mouse_focuses_formcontrol", fm, PR_TRUE);
if (prefBranch) {
prefBranch->AddObserver("accessibility.browsewithcaret", fm, PR_TRUE);
prefBranch->AddObserver("accessibility.tabfocus_applies_to_xul", fm, PR_TRUE);
prefBranch->AddObserver("accessibility.mouse_focuses_formcontrol", fm, PR_TRUE);
}
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {

View File

@ -5119,9 +5119,9 @@ nsGlobalWindow::Print()
printSettingsService->GetNewPrintSettings(getter_AddRefs(printSettings));
}
EnterModalState();
nsCOMPtr<nsIDOMWindow> callerWin = EnterModalState();
webBrowserPrint->Print(printSettings, nsnull);
LeaveModalState(nsnull);
LeaveModalState(callerWin);
PRBool savePrintSettings =
nsContentUtils::GetBoolPref("print.save_print_settings", PR_FALSE);
@ -6480,8 +6480,6 @@ nsGlobalWindow::LeaveModalState(nsIDOMWindow *aCallerWin)
}
}
JSContext *cx = nsContentUtils::GetCurrentJSContext();
if (aCallerWin) {
nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryInterface(aCallerWin));
nsIScriptContext *scx = sgo->GetContext();
@ -6833,7 +6831,7 @@ nsGlobalWindow::ShowModalDialog(const nsAString& aURI, nsIVariant *aArgs,
options.AppendLiteral(",scrollbars=1,centerscreen=1,resizable=0");
EnterModalState();
nsCOMPtr<nsIDOMWindow> callerWin = EnterModalState();
nsresult rv = OpenInternal(aURI, EmptyString(), options,
PR_FALSE, // aDialog
PR_TRUE, // aContentModal
@ -6843,7 +6841,7 @@ nsGlobalWindow::ShowModalDialog(const nsAString& aURI, nsIVariant *aArgs,
GetPrincipal(), // aCalleePrincipal
nsnull, // aJSCallerContext
getter_AddRefs(dlgWin));
LeaveModalState(nsnull);
LeaveModalState(callerWin);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -76,7 +76,6 @@ XPIDLSRCS = \
nsIDOMNSDocument.idl \
nsIDOMXMLDocument.idl \
nsIDOMUserDataHandler.idl \
nsIDOMDOMConfiguration.idl \
nsIDOMNSEditableElement.idl \
nsIDOMNSElement.idl \
nsIDOMNodeSelector.idl \

View File

@ -1,61 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org Code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Christopher A. Aillon <christopher@aillon.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "domstubs.idl"
interface nsIVariant;
/**
* The nsIDOMDOMConfiguration interface represents the configuration
* of a document and maintains a table of recognized parameters.
*
* For more information on this interface, please see
* http://www.w3.org/TR/DOM-Level-3-Core/
*/
// Introduced in DOM Level 3:
[scriptable, uuid(cfb5b821-9016-4a79-9d98-87b57c3ea0c7)]
interface nsIDOMDOMConfiguration : nsISupports
{
void setParameter(in DOMString name,
in nsIVariant value)
raises(DOMException);
nsIVariant getParameter(in DOMString name)
raises(DOMException);
boolean canSetParameter(in DOMString name,
in nsIVariant value);
};

View File

@ -39,8 +39,6 @@
#include "nsIDOMNode.idl"
interface nsIDOMDOMConfiguration;
/**
* The nsIDOMDocument interface represents the entire HTML or XML document.
* Conceptually, it is the root of the document tree, and provides the
@ -54,7 +52,7 @@ interface nsIDOMDOMConfiguration;
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
*/
[scriptable, uuid(3e7421c4-9964-4184-8c75-d291eecdba35)]
[scriptable, uuid(1ae51729-c57c-43cd-91f4-2ffee5c5d493)]
interface nsIDOMDocument : nsIDOMNode
{
readonly attribute nsIDOMDocumentType doctype;
@ -111,12 +109,5 @@ interface nsIDOMDocument : nsIDOMNode
nsIDOMNode adoptNode(in nsIDOMNode source)
raises(DOMException);
// Introduced in DOM Level 3:
readonly attribute nsIDOMDOMConfiguration domConfig;
// Introduced in DOM Level 3:
void normalizeDocument();
// Introduced in DOM Level 3:
nsIDOMNode renameNode(in nsIDOMNode node,
in DOMString namespaceURI,
in DOMString qualifiedName)
raises(DOMException);
};

View File

@ -38,7 +38,7 @@
#include "nsIDOMDocument.idl"
[scriptable, uuid(9f07f216-b3a3-4a08-81f1-a48075b91d1c)]
[scriptable, uuid(38708cf6-d055-4618-9d8f-a8731834d63f)]
interface nsIDOMXMLDocument : nsIDOMDocument
{
// DOM Level 3 Load & Save, DocumentLS

View File

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(0d3bef04-a890-4dbc-8571-b8e96ff5426b)]
[scriptable, uuid(42de381d-1535-4223-b7d9-a9d7c250f9a7)]
interface nsIDOMHTMLDocument : nsIDOMDocument
{
attribute DOMString title;

View File

@ -39,11 +39,9 @@
#include "domstubs.idl"
[scriptable, uuid(95cd5ad4-ae8a-4f0e-b168-35e03d5e0b9a)]
[scriptable, uuid(386e9eee-1f06-40a6-a1a7-ed986646b793)]
interface nsIDOMNSHTMLDocument : nsISupports
{
readonly attribute long width;
readonly attribute long height;
attribute DOMString alinkColor;
attribute DOMString linkColor;
attribute DOMString vlinkColor;

View File

@ -39,7 +39,7 @@
interface nsIDOMSVGSVGElement;
[scriptable, uuid(fc52bd3f-850c-4d80-819f-5bd8321b4b59)]
[scriptable, uuid(b0cb0f05-6fd4-4f2c-8a6c-aac63bc90cad)]
interface nsIDOMSVGDocument : nsIDOMDocument
/* , nsIDOMDocumentEvent */
{

View File

@ -75,5 +75,3 @@ FormValidationInvalidURL=Please enter a URL.
FormValidationPatternMismatch=Please match the requested format.
# LOCALIZATION NOTE (FormValidationPatternMismatchWithTitle): %S is the (possibly truncated) title attribute value.
FormValidationPatternMismatchWithTitle=Please match the requested format: %S.
UseOfDocumentWidthWarning=Non-standard document.width was used. Use standard document.body.clientWidth instead.
UseOfDocumentHeightWarning=Non-standard document.height was used. Use standard document.body.clientHeight instead.

View File

@ -48,11 +48,11 @@ SimpleTest.waitForFocus(function() {
newInput.focus();
newInput.dispatchEvent(event);
setTimeout(function() {
hitEventLoop(function() {
ok(!popupShown, "Popup must not be opened");
SpecialPowers.removeAutoCompletePopupEventListener(window, listener);
SimpleTest.finish();
}, 1000);
}, 100);
}, 0);
}, false);
@ -61,6 +61,14 @@ SimpleTest.waitForFocus(function() {
synthesizeKey("VK_ENTER", {});
});
function hitEventLoop(func, times) {
if (times > 0) {
setTimeout(hitEventLoop, 0, func, times - 1);
} else {
setTimeout(func, 0);
}
}
</script>
</pre>
</body>

View File

@ -56,7 +56,7 @@ nsAutoWindowStateHelper::nsAutoWindowStateHelper(nsIDOMWindow *aWindow)
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(aWindow));
if (window) {
window->EnterModalState();
mCallerWindow = window->EnterModalState();
}
}
@ -65,7 +65,7 @@ nsAutoWindowStateHelper::~nsAutoWindowStateHelper()
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(mWindow));
if (window) {
window->LeaveModalState(nsnull);
window->LeaveModalState(mCallerWindow);
}
if (mDefaultEnabled) {

View File

@ -62,6 +62,7 @@ protected:
PRBool DispatchCustomEvent(const char *aEventName);
nsIDOMWindow *mWindow;
nsCOMPtr<nsIDOMWindow> mCallerWindow;
PRBool mDefaultEnabled;
};

View File

@ -179,5 +179,5 @@ function runTest() {
is(count, gExpectedCookies, "total number of cookies");
cs.removeAll();
setTimeout(finishTest, 5000);
finishTest();
}

View File

@ -163,28 +163,42 @@ BasicPlanarYCbCrImage::SetData(const Data& aData)
// 'prescale' is true if the scaling is to be done as part of the
// YCbCr to RGB conversion rather than on the RGB data when rendered.
// We don't prescale if the image has an offset. See bug 639415.
PRBool prescale = mScaleHint.width > 0 && mScaleHint.height > 0 &&
aData.mPicX == 0 && aData.mPicY == 0;
mScaleHint != aData.mPicSize;
if (format == gfxASurface::ImageFormatRGB16_565) {
#if defined(HAVE_YCBCR_TO_RGB565)
if (prescale && gfx::IsConvertYCbCrToRGB565Fast(aData.mPicX,
aData.mPicY,
aData.mPicSize.width,
aData.mPicSize.height,
type)) {
// yuv2rgb16 with scale function not yet available for NEON
if (prescale &&
!gfx::IsScaleYCbCrToRGB565Fast(aData.mPicX,
aData.mPicY,
aData.mPicSize.width,
aData.mPicSize.height,
mScaleHint.width,
mScaleHint.height,
type,
gfx::FILTER_BILINEAR) &&
gfx::IsConvertYCbCrToRGB565Fast(aData.mPicX,
aData.mPicY,
aData.mPicSize.width,
aData.mPicSize.height,
type)) {
prescale = PR_FALSE;
} else
#endif
{
// yuv2rgb16 function not yet available for non-NEON, and currently
// using it requires a number of extra graphics operations, so it's
// probably better to fall back to 24-bit RGB.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=641196
format = gfxASurface::ImageFormatRGB24;
}
#else
// yuv2rgb16 function not available
format = gfxASurface::ImageFormatRGB24;
#endif
}
else if (format != gfxASurface::ImageFormatRGB24) {
// No other formats are currently supported.
format = gfxASurface::ImageFormatRGB24;
}
if (format == gfxASurface::ImageFormatRGB24) {
/* ScaleYCbCrToRGB32 does not support a picture offset, nor 4:4:4 data.
See bugs 639415 and 640073. */
if (aData.mPicX != 0 || aData.mPicY != 0 || type == gfx::YV24)
prescale = PR_FALSE;
}
gfxIntSize size(prescale ? mScaleHint.width : aData.mPicSize.width,
prescale ? mScaleHint.height : aData.mPicSize.height);
@ -197,7 +211,25 @@ BasicPlanarYCbCrImage::SetData(const Data& aData)
// Convert from YCbCr to RGB now, scaling the image if needed.
if (size != aData.mPicSize) {
if (format == gfxASurface::ImageFormatRGB24) {
#if defined(HAVE_YCBCR_TO_RGB565)
if (format == gfxASurface::ImageFormatRGB16_565) {
gfx::ScaleYCbCrToRGB565(aData.mYChannel,
aData.mCbChannel,
aData.mCrChannel,
mBuffer,
aData.mPicX,
aData.mPicY,
aData.mPicSize.width,
aData.mPicSize.height,
size.width,
size.height,
aData.mYStride,
aData.mCbCrStride,
mStride,
type,
gfx::FILTER_BILINEAR);
} else
#endif
gfx::ScaleYCbCrToRGB32(aData.mYChannel,
aData.mCbChannel,
aData.mCrChannel,
@ -212,9 +244,6 @@ BasicPlanarYCbCrImage::SetData(const Data& aData)
type,
gfx::ROTATE_0,
gfx::FILTER_BILINEAR);
} else {
NS_ERROR("Fail, ScaleYCbCrToRGB format not supported\n");
}
} else { // no prescale
#if defined(HAVE_YCBCR_TO_RGB565)
if (format == gfxASurface::ImageFormatRGB16_565) {

View File

@ -76,8 +76,12 @@ endif # linux
endif # windows
ifeq (arm,$(findstring arm,$(OS_TEST)))
ifdef HAVE_ARM_NEON
CPPSRCS += yuv_convert_arm.cpp \
$(NULL)
ASFILES = yuv_row_arm.$(ASM_SUFFIX) \
$(NULL)
endif
endif
EXTRA_DSO_LDOPTS += \

View File

@ -38,16 +38,72 @@
*
* ***** END LICENSE BLOCK ***** */
#include <stdlib.h>
#include <limits.h>
#include "nsDebug.h"
#include "ycbcr_to_rgb565.h"
#ifdef HAVE_YCBCR_TO_RGB565
namespace mozilla {
namespace gfx {
/*This contains all of the parameters that are needed to convert a row.
Passing them in a struct instead of as individual parameters saves the need
to continually push onto the stack the ones that are fixed for every row.*/
struct yuv2rgb565_row_scale_bilinear_ctx{
PRUint16 *rgb_row;
const PRUint8 *y_row;
const PRUint8 *u_row;
const PRUint8 *v_row;
int y_yweight;
int y_pitch;
int width;
int source_x0_q16;
int source_dx_q16;
/*Not used for 4:4:4, except with chroma-nearest.*/
int source_uv_xoffs_q16;
/*Not used for 4:4:4 or chroma-nearest.*/
int uv_pitch;
/*Not used for 4:2:2, 4:4:4, or chroma-nearest.*/
int uv_yweight;
};
/*This contains all of the parameters that are needed to convert a row.
Passing them in a struct instead of as individual parameters saves the need
to continually push onto the stack the ones that are fixed for every row.*/
struct yuv2rgb565_row_scale_nearest_ctx{
PRUint16 *rgb_row;
const PRUint8 *y_row;
const PRUint8 *u_row;
const PRUint8 *v_row;
int width;
int source_x0_q16;
int source_dx_q16;
/*Not used for 4:4:4.*/
int source_uv_xoffs_q16;
};
typedef void (*yuv2rgb565_row_scale_bilinear_func)(
const yuv2rgb565_row_scale_bilinear_ctx *ctx, int dither);
typedef void (*yuv2rgb565_row_scale_nearest_func)(
const yuv2rgb565_row_scale_nearest_ctx *ctx, int dither);
# if defined(MOZILLA_MAY_SUPPORT_NEON)
extern "C" void ScaleYCbCr42xToRGB565_BilinearY_Row_NEON(
const yuv2rgb565_row_scale_bilinear_ctx *ctx, int dither);
void __attribute((noinline)) yuv42x_to_rgb565_row_neon(uint16 *dst,
const uint8 *y,
const uint8 *u,
@ -57,17 +113,502 @@ void __attribute((noinline)) yuv42x_to_rgb565_row_neon(uint16 *dst,
#endif
/*Convert a single pixel from Y'CbCr to RGB565.*/
static PRUint16 yu2rgb565(int y, int u, int v) {
/*Bilinear interpolation of a single value.
This uses the exact same formulas as the asm, even though it adds some extra
shifts that do nothing but reduce accuracy.*/
static int bislerp(const PRUint8 *row,
int pitch,
int source_x,
int xweight,
int yweight) {
int a;
int b;
int c;
int d;
a = row[source_x];
b = row[source_x+1];
c = row[source_x+pitch];
d = row[source_x+pitch+1];
a = ((a<<8)+(c-a)*yweight+128)>>8;
b = ((b<<8)+(d-b)*yweight+128)>>8;
return ((a<<8)+(b-a)*xweight+128)>>8;
}
/*Convert a single pixel from Y'CbCr to RGB565.
This uses the exact same formulas as the asm, even though we could make the
constants a lot more accurate with 32-bit wide registers.*/
static PRUint16 yu2rgb565(int y, int u, int v, int dither) {
/*This combines the constant offset that needs to be added during the Y'CbCr
conversion with a rounding offset that depends on the dither parameter.*/
static const int DITHER_BIAS[4][3]={
{-14240, 8704, -17696},
{-14240+128,8704+64, -17696+128},
{-14240+256,8704+128,-17696+256},
{-14240+384,8704+192,-17696+384}
};
int r;
int g;
int b;
r = NS_CLAMP((74*y+102*v-14240+256)>>9, 0, 31);
g = NS_CLAMP((74*y-25*u-52*v+8704+128)>>8, 0, 63);
b = NS_CLAMP((74*y+129*u-17696+256)>>9, 0, 31);
r = NS_CLAMP((74*y+102*v+DITHER_BIAS[dither][0])>>9, 0, 31);
g = NS_CLAMP((74*y-25*u-52*v+DITHER_BIAS[dither][1])>>8, 0, 63);
b = NS_CLAMP((74*y+129*u+DITHER_BIAS[dither][2])>>9, 0, 31);
return (PRUint16)(r<<11 | g<<5 | b);
}
static void ScaleYCbCr420ToRGB565_Bilinear_Row_C(
const yuv2rgb565_row_scale_bilinear_ctx *ctx, int dither){
int x;
int source_x_q16;
source_x_q16 = ctx->source_x0_q16;
for (x = 0; x < ctx->width; x++) {
int source_x;
int xweight;
int y;
int u;
int v;
xweight = ((source_x_q16&0xFFFF)+128)>>8;
source_x = source_x_q16>>16;
y = bislerp(ctx->y_row, ctx->y_pitch, source_x, xweight, ctx->y_yweight);
xweight = (((source_x_q16+ctx->source_uv_xoffs_q16)&0x1FFFF)+256)>>9;
source_x = (source_x_q16+ctx->source_uv_xoffs_q16)>>17;
source_x_q16 += ctx->source_dx_q16;
u = bislerp(ctx->u_row, ctx->uv_pitch, source_x, xweight, ctx->uv_yweight);
v = bislerp(ctx->v_row, ctx->uv_pitch, source_x, xweight, ctx->uv_yweight);
ctx->rgb_row[x] = yu2rgb565(y, u, v, dither);
dither ^= 3;
}
}
static void ScaleYCbCr422ToRGB565_Bilinear_Row_C(
const yuv2rgb565_row_scale_bilinear_ctx *ctx, int dither){
int x;
int source_x_q16;
source_x_q16 = ctx->source_x0_q16;
for (x = 0; x < ctx->width; x++) {
int source_x;
int xweight;
int y;
int u;
int v;
xweight = ((source_x_q16&0xFFFF)+128)>>8;
source_x = source_x_q16>>16;
y = bislerp(ctx->y_row, ctx->y_pitch, source_x, xweight, ctx->y_yweight);
xweight = (((source_x_q16+ctx->source_uv_xoffs_q16)&0x1FFFF)+256)>>9;
source_x = (source_x_q16+ctx->source_uv_xoffs_q16)>>17;
source_x_q16 += ctx->source_dx_q16;
u = bislerp(ctx->u_row, ctx->uv_pitch, source_x, xweight, ctx->y_yweight);
v = bislerp(ctx->v_row, ctx->uv_pitch, source_x, xweight, ctx->y_yweight);
ctx->rgb_row[x] = yu2rgb565(y, u, v, dither);
dither ^= 3;
}
}
static void ScaleYCbCr444ToRGB565_Bilinear_Row_C(
const yuv2rgb565_row_scale_bilinear_ctx *ctx, int dither){
int x;
int source_x_q16;
source_x_q16 = ctx->source_x0_q16;
for (x = 0; x < ctx->width; x++) {
int source_x;
int xweight;
int y;
int u;
int v;
xweight = ((source_x_q16&0xFFFF)+128)>>8;
source_x = source_x_q16>>16;
source_x_q16 += ctx->source_dx_q16;
y = bislerp(ctx->y_row, ctx->y_pitch, source_x, xweight, ctx->y_yweight);
u = bislerp(ctx->u_row, ctx->y_pitch, source_x, xweight, ctx->y_yweight);
v = bislerp(ctx->v_row, ctx->y_pitch, source_x, xweight, ctx->y_yweight);
ctx->rgb_row[x] = yu2rgb565(y, u, v, dither);
dither ^= 3;
}
}
static void ScaleYCbCr42xToRGB565_BilinearY_Row_C(
const yuv2rgb565_row_scale_bilinear_ctx *ctx, int dither){
int x;
int source_x_q16;
source_x_q16 = ctx->source_x0_q16;
for (x = 0; x < ctx->width; x++) {
int source_x;
int xweight;
int y;
int u;
int v;
xweight = ((source_x_q16&0xFFFF)+128)>>8;
source_x = source_x_q16>>16;
y = bislerp(ctx->y_row, ctx->y_pitch, source_x, xweight, ctx->y_yweight);
source_x = (source_x_q16+ctx->source_uv_xoffs_q16)>>17;
source_x_q16 += ctx->source_dx_q16;
u = ctx->u_row[source_x];
v = ctx->v_row[source_x];
ctx->rgb_row[x] = yu2rgb565(y, u, v, dither);
dither ^= 3;
}
}
static void ScaleYCbCr444ToRGB565_BilinearY_Row_C(
const yuv2rgb565_row_scale_bilinear_ctx *ctx, int dither){
int x;
int source_x_q16;
source_x_q16 = ctx->source_x0_q16;
for (x = 0; x < ctx->width; x++) {
int source_x;
int xweight;
int y;
int u;
int v;
xweight = ((source_x_q16&0xFFFF)+128)>>8;
source_x = source_x_q16>>16;
y = bislerp(ctx->y_row, ctx->y_pitch, source_x, xweight, ctx->y_yweight);
source_x = (source_x_q16+ctx->source_uv_xoffs_q16)>>16;
source_x_q16 += ctx->source_dx_q16;
u = ctx->u_row[source_x];
v = ctx->v_row[source_x];
ctx->rgb_row[x] = yu2rgb565(y, u, v, dither);
dither ^= 3;
}
}
static void ScaleYCbCr42xToRGB565_Nearest_Row_C(
const yuv2rgb565_row_scale_nearest_ctx *ctx, int dither){
int y;
int u;
int v;
int x;
int source_x_q16;
int source_x;
source_x_q16 = ctx->source_x0_q16;
for (x = 0; x < ctx->width; x++) {
source_x = source_x_q16>>16;
y = ctx->y_row[source_x];
source_x = (source_x_q16+ctx->source_uv_xoffs_q16)>>17;
source_x_q16 += ctx->source_dx_q16;
u = ctx->u_row[source_x];
v = ctx->v_row[source_x];
ctx->rgb_row[x] = yu2rgb565(y, u, v, dither);
dither ^= 3;
}
}
static void ScaleYCbCr444ToRGB565_Nearest_Row_C(
const yuv2rgb565_row_scale_nearest_ctx *ctx, int dither){
int y;
int u;
int v;
int x;
int source_x_q16;
int source_x;
source_x_q16 = ctx->source_x0_q16;
for (x = 0; x < ctx->width; x++) {
source_x = source_x_q16>>16;
source_x_q16 += ctx->source_dx_q16;
y = ctx->y_row[source_x];
u = ctx->u_row[source_x];
v = ctx->v_row[source_x];
ctx->rgb_row[x] = yu2rgb565(y, u, v, dither);
dither ^= 3;
}
}
NS_GFX_(void) ScaleYCbCrToRGB565(const PRUint8 *y_buf,
const PRUint8 *u_buf,
const PRUint8 *v_buf,
PRUint8 *rgb_buf,
int source_x0,
int source_y0,
int source_width,
int source_height,
int width,
int height,
int y_pitch,
int uv_pitch,
int rgb_pitch,
YUVType yuv_type,
ScaleFilter filter) {
int source_x0_q16;
int source_y0_q16;
int source_dx_q16;
int source_dy_q16;
int source_uv_xoffs_q16;
int source_uv_yoffs_q16;
int x_shift;
int y_shift;
int ymin;
int ymax;
int uvmin;
int uvmax;
int dither;
/*We don't support negative destination rectangles (just flip the source
instead), and for empty ones there's nothing to do.*/
if (width <= 0 || height <= 0)
return;
/*These bounds are required to avoid 16.16 fixed-point overflow.*/
NS_ASSERTION(source_x0 > (INT_MIN>>16) && source_x0 < (INT_MAX>>16),
"ScaleYCbCrToRGB565 source X offset out of bounds.");
NS_ASSERTION(source_x0+source_width > (INT_MIN>>16)
&& source_x0+source_width < (INT_MAX>>16),
"ScaleYCbCrToRGB565 source width out of bounds.");
NS_ASSERTION(source_y0 > (INT_MIN>>16) && source_y0 < (INT_MAX>>16),
"ScaleYCbCrToRGB565 source Y offset out of bounds.");
NS_ASSERTION(source_y0+source_height > (INT_MIN>>16)
&& source_y0+source_height < (INT_MAX>>16),
"ScaleYCbCrToRGB565 source height out of bounds.");
/*We require the same stride for Y' and Cb and Cr for 4:4:4 content.*/
NS_ASSERTION(yuv_type != YV24 || y_pitch == uv_pitch,
"ScaleYCbCrToRGB565 luma stride differs from chroma for 4:4:4 content.");
/*We assume we can read outside the bounds of the input, because it makes
the code much simpler (and in practice is true: both Theora and VP8 return
padded reference frames).
In practice, we do not even _have_ the actual bounds of the source, as
we are passed a crop rectangle from it, and not the dimensions of the full
image.
This assertion will not guarantee our out-of-bounds reads are safe, but it
should at least catch the simple case of passing in an unpadded buffer.*/
NS_ASSERTION(abs(y_pitch) >= abs(source_width)+16,
"ScaleYCbCrToRGB565 source image unpadded?");
/*The NEON code requires the pointers to be aligned to a 16-byte boundary at
the start of each row.
This should be true for all of our sources.
We could try to fix this up if it's not true by adjusting source_x0, but
that would require the mis-alignment to be the same for the U and V
planes.*/
NS_ASSERTION((y_pitch&15) == 0 && (uv_pitch&15) == 0 &&
((y_buf-NULL)&15) == 0 && ((u_buf-NULL)&15) == 0 && ((v_buf-NULL)&15) == 0,
"ScaleYCbCrToRGB565 source image unaligned");
/*We take an area-based approach to pixel coverage to avoid shifting by small
amounts (or not so small, when up-scaling or down-scaling by a large
factor).
An illustrative example: scaling 4:2:0 up by 2, using JPEG chroma cositing^.
+ = RGB destination locations
* = Y' source locations
- = Cb, Cr source locations
+ + + + + + + +
* * * *
+ + + + + + + +
- -
+ + + + + + + +
* * * *
+ + + + + + + +
+ + + + + + + +
* * * *
+ + + + + + + +
- -
+ + + + + + + +
* * * *
+ + + + + + + +
So, the coordinates of the upper-left + (first destination site) should
be (-0.25,-0.25) in the source Y' coordinate system.
Similarly, the coordinates should be (-0.375,-0.375) in the source Cb, Cr
coordinate system.
Note that the origin and scale of these two coordinate systems is not the
same!
^JPEG cositing is required for Theora; VP8 doesn't specify cositing rules,
but nearly all software converters in existence (at least those that are
open source, and many that are not) use JPEG cositing instead of MPEG.*/
source_dx_q16 = (source_width<<16) / width;
source_x0_q16 = (source_x0<<16)+(source_dx_q16>>1)-0x8000;
source_dy_q16 = (source_height<<16) / height;
source_y0_q16 = (source_y0<<16)+(source_dy_q16>>1)-0x8000;
x_shift = (yuv_type != YV24);
y_shift = (yuv_type == YV12);
/*These two variables hold the difference between the origins of the Y' and
the Cb, Cr coordinate systems, using the scale of the Y' coordinate
system.*/
source_uv_xoffs_q16 = -(x_shift<<15);
source_uv_yoffs_q16 = -(y_shift<<15);
/*Compute the range of source rows we'll actually use.
This doesn't guarantee we won't read outside this range.*/
ymin = source_height >= 0 ? source_y0 : source_y0+source_height-1;
ymax = source_height >= 0 ? source_y0+source_height-1 : source_y0;
uvmin = ymin>>y_shift;
uvmax = ((ymax+1+y_shift)>>y_shift)-1;
/*Pick a dithering pattern.
The "&3" at the end is just in case RAND_MAX is lying.*/
dither = (rand()/(RAND_MAX>>2))&3;
/*Nearest-neighbor scaling.*/
if (filter == FILTER_NONE) {
yuv2rgb565_row_scale_nearest_ctx ctx;
yuv2rgb565_row_scale_nearest_func scale_row;
int y;
/*Add rounding offsets once, in advance.*/
source_x0_q16 += 0x8000;
source_y0_q16 += 0x8000;
source_uv_xoffs_q16 += (x_shift<<15);
source_uv_yoffs_q16 += (y_shift<<15);
if (yuv_type == YV12)
scale_row = ScaleYCbCr42xToRGB565_Nearest_Row_C;
else
scale_row = ScaleYCbCr444ToRGB565_Nearest_Row_C;
ctx.width = width;
ctx.source_x0_q16 = source_x0_q16;
ctx.source_dx_q16 = source_dx_q16;
ctx.source_uv_xoffs_q16 = source_uv_xoffs_q16;
for (y=0; y<height; y++) {
int source_y;
ctx.rgb_row = (PRUint16 *)(rgb_buf + y*rgb_pitch);
source_y = source_y0_q16>>16;
source_y = NS_CLAMP(source_y, ymin, ymax);
ctx.y_row = y_buf + source_y*y_pitch;
source_y = (source_y0_q16+source_uv_yoffs_q16)>>(16+y_shift);
source_y = NS_CLAMP(source_y, uvmin, uvmax);
source_y0_q16 += source_dy_q16;
ctx.u_row = u_buf + source_y*uv_pitch;
ctx.v_row = v_buf + source_y*uv_pitch;
(*scale_row)(&ctx, dither);
dither ^= 2;
}
}
/*Bilinear scaling.*/
else {
yuv2rgb565_row_scale_bilinear_ctx ctx;
yuv2rgb565_row_scale_bilinear_func scale_row;
int uvxscale_min;
int uvxscale_max;
int uvyscale_min;
int uvyscale_max;
int y;
/*Check how close the chroma scaling is to unity.
If it's close enough, we can get away with nearest-neighbor chroma
sub-sampling, and only doing bilinear on luma.
If a given axis is subsampled, we use bounds on the luma step of
[0.67...2], which is equivalent to scaling chroma by [1...3].
If it's not subsampled, we use bounds of [0.5...1.33], which is
equivalent to scaling chroma by [0.75...2].
The lower bound is chosen as a trade-off between speed and how terrible
nearest neighbor looks when upscaling.*/
# define CHROMA_NEAREST_SUBSAMP_STEP_MIN 0xAAAA
# define CHROMA_NEAREST_NORMAL_STEP_MIN 0x8000
# define CHROMA_NEAREST_SUBSAMP_STEP_MAX 0x20000
# define CHROMA_NEAREST_NORMAL_STEP_MAX 0x15555
uvxscale_min = yuv_type != YV24 ?
CHROMA_NEAREST_SUBSAMP_STEP_MIN : CHROMA_NEAREST_NORMAL_STEP_MIN;
uvxscale_max = yuv_type != YV24 ?
CHROMA_NEAREST_SUBSAMP_STEP_MAX : CHROMA_NEAREST_NORMAL_STEP_MAX;
uvyscale_min = yuv_type == YV12 ?
CHROMA_NEAREST_SUBSAMP_STEP_MIN : CHROMA_NEAREST_NORMAL_STEP_MIN;
uvyscale_max = yuv_type == YV12 ?
CHROMA_NEAREST_SUBSAMP_STEP_MAX : CHROMA_NEAREST_NORMAL_STEP_MAX;
if (uvxscale_min <= abs(source_dx_q16)
&& abs(source_dx_q16) <= uvxscale_max
&& uvyscale_min <= abs(source_dy_q16)
&& abs(source_dy_q16) <= uvyscale_max) {
/*Add the rounding offsets now.*/
source_uv_xoffs_q16 += 1<<(15+x_shift);
source_uv_yoffs_q16 += 1<<(15+y_shift);
if (yuv_type != YV24) {
scale_row =
# if defined(MOZILLA_MAY_SUPPORT_NEON)
supports_neon() ? ScaleYCbCr42xToRGB565_BilinearY_Row_NEON :
# endif
ScaleYCbCr42xToRGB565_BilinearY_Row_C;
}
else
scale_row = ScaleYCbCr444ToRGB565_BilinearY_Row_C;
}
else {
if (yuv_type == YV12)
scale_row = ScaleYCbCr420ToRGB565_Bilinear_Row_C;
else if (yuv_type == YV16)
scale_row = ScaleYCbCr422ToRGB565_Bilinear_Row_C;
else
scale_row = ScaleYCbCr444ToRGB565_Bilinear_Row_C;
}
ctx.width = width;
ctx.y_pitch = y_pitch;
ctx.source_x0_q16 = source_x0_q16;
ctx.source_dx_q16 = source_dx_q16;
ctx.source_uv_xoffs_q16 = source_uv_xoffs_q16;
ctx.uv_pitch = uv_pitch;
for (y=0; y<height; y++) {
int source_y;
int yweight;
int uvweight;
ctx.rgb_row = (PRUint16 *)(rgb_buf + y*rgb_pitch);
source_y = (source_y0_q16+128)>>16;
yweight = ((source_y0_q16+128)>>8)&0xFF;
if (source_y < ymin) {
source_y = ymin;
yweight = 0;
}
if (source_y > ymax) {
source_y = ymax;
yweight = 0;
}
ctx.y_row = y_buf + source_y*y_pitch;
source_y = source_y0_q16+source_uv_yoffs_q16+(128<<y_shift);
source_y0_q16 += source_dy_q16;
uvweight = source_y>>(8+y_shift)&0xFF;
source_y >>= 16+y_shift;
if (source_y < uvmin) {
source_y = uvmin;
uvweight = 0;
}
if (source_y > uvmax) {
source_y = uvmax;
uvweight = 0;
}
ctx.u_row = u_buf + source_y*uv_pitch;
ctx.v_row = v_buf + source_y*uv_pitch;
ctx.y_yweight = yweight;
ctx.uv_yweight = uvweight;
(*scale_row)(&ctx, dither);
dither ^= 2;
}
}
}
NS_GFX_(bool) IsScaleYCbCrToRGB565Fast(int source_x0,
int source_y0,
int source_width,
int source_height,
int width,
int height,
YUVType yuv_type,
ScaleFilter filter)
{
// Very fast.
if (width <= 0 || height <= 0)
return true;
# if defined(MOZILLA_MAY_SUPPORT_NEON)
if (filter != FILTER_NONE) {
int source_dx_q16;
int source_dy_q16;
int uvxscale_min;
int uvxscale_max;
int uvyscale_min;
int uvyscale_max;
source_dx_q16 = (source_width<<16) / width;
source_dy_q16 = (source_height<<16) / height;
uvxscale_min = yuv_type != YV24 ?
CHROMA_NEAREST_SUBSAMP_STEP_MIN : CHROMA_NEAREST_NORMAL_STEP_MIN;
uvxscale_max = yuv_type != YV24 ?
CHROMA_NEAREST_SUBSAMP_STEP_MAX : CHROMA_NEAREST_NORMAL_STEP_MAX;
uvyscale_min = yuv_type == YV12 ?
CHROMA_NEAREST_SUBSAMP_STEP_MIN : CHROMA_NEAREST_NORMAL_STEP_MIN;
uvyscale_max = yuv_type == YV12 ?
CHROMA_NEAREST_SUBSAMP_STEP_MAX : CHROMA_NEAREST_NORMAL_STEP_MAX;
if (uvxscale_min <= abs(source_dx_q16)
&& abs(source_dx_q16) <= uvxscale_max
&& uvyscale_min <= abs(source_dy_q16)
&& abs(source_dy_q16) <= uvyscale_max) {
if (yuv_type != YV24)
return supports_neon();
}
}
# endif
return false;
}
void yuv_to_rgb565_row_c(uint16 *dst,
@ -83,7 +624,8 @@ void yuv_to_rgb565_row_c(uint16 *dst,
{
dst[x] = yu2rgb565(y[pic_x+x],
u[(pic_x+x)>>x_shift],
v[(pic_x+x)>>x_shift]);
v[(pic_x+x)>>x_shift],
2); // Disable dithering for now.
}
}

View File

@ -36,6 +36,33 @@ NS_GFX_(bool) IsConvertYCbCrToRGB565Fast(int pic_x,
int pic_width,
int pic_height,
YUVType yuv_type);
// Scale a frame of YUV to 16 bit RGB565.
NS_GFX_(void) ScaleYCbCrToRGB565(const PRUint8 *yplane,
const PRUint8 *uplane,
const PRUint8 *vplane,
PRUint8 *rgbframe,
int source_x0,
int source_y0,
int source_width,
int source_height,
int width,
int height,
int ystride,
int uvstride,
int rgbstride,
YUVType yuv_type,
ScaleFilter filter);
// Used to test if we have an accelerated version.
NS_GFX_(bool) IsScaleYCbCrToRGB565Fast(int source_x0,
int source_y0,
int source_width,
int source_height,
int width,
int height,
YUVType yuv_type,
ScaleFilter filter);
#endif // HAVE_YCBCR_TO_RGB565
} // namespace gfx

329
gfx/ycbcr/yuv_row_arm.s Normal file
View File

@ -0,0 +1,329 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is NEON YUV-to-RGB565 scaling code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Timothy B. Terriberry <tterriberry@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
.arch armv7-a
.fpu neon
.text
.align
.balign 64
YCbCr42xToRGB565_DITHER03_CONSTS_NEON:
.short -14240
.short -14240+384
.short 8672
.short 8672+192
.short -17696
.short -17696+384
.byte 102
.byte 25
.byte 52
.byte 129
YCbCr42xToRGB565_DITHER12_CONSTS_NEON:
.short -14240+128
.short -14240+256
.short 8672+64
.short 8672+128
.short -17696+128
.short -17696+256
.byte 102
.byte 25
.byte 52
.byte 129
YCbCr42xToRGB565_DITHER21_CONSTS_NEON:
.short -14240+256
.short -14240+128
.short 8672+128
.short 8672+64
.short -17696+256
.short -17696+128
.byte 102
.byte 25
.byte 52
.byte 129
YCbCr42xToRGB565_DITHER30_CONSTS_NEON:
.short -14240+384
.short -14240
.short 8672+192
.short 8672
.short -17696+384
.short -17696
.byte 102
.byte 25
.byte 52
.byte 129
@ void ScaleYCbCr42xToRGB565_BilinearY_Row_NEON(
@ yuv2rgb565_row_scale_bilinear_ctx *ctx, int dither);
@
@ ctx = {
@ PRUint16 *rgb_row; /*r0*/
@ const PRUint8 *y_row; /*r1*/
@ const PRUint8 *u_row; /*r2*/
@ const PRUint8 *v_row; /*r3*/
@ int y_yweight; /*r4*/
@ int y_pitch; /*r5*/
@ int width; /*r6*/
@ int source_x0_q16; /*r7*/
@ int source_dx_q16; /*r8*/
@ int source_uv_xoffs_q16; /*r9*/
@ };
.global ScaleYCbCr42xToRGB565_BilinearY_Row_NEON
.type ScaleYCbCr42xToRGB565_BilinearY_Row_NEON, %function
.balign 64
.fnstart
ScaleYCbCr42xToRGB565_BilinearY_Row_NEON:
STMFD r13!,{r4-r9,r14} @ 8 words.
ADR r14,YCbCr42xToRGB565_DITHER03_CONSTS_NEON
VPUSH {Q4-Q7} @ 16 words.
ADD r14,r14,r1, LSL #4 @ Select the dither table to use
LDMIA r0, {r0-r9}
@ Set up image index registers.
ADD r12,r8, r8
VMOV.I32 D16,#0 @ Q8 = < 2| 2| 0| 0>*source_dx_q16
VDUP.32 D17,r12
ADD r12,r12,r12
VTRN.32 D16,D17 @ Q2 = < 2| 0| 2| 0>*source_dx_q16
VDUP.32 D19,r12 @ Q9 = < 4| 4| ?| ?>*source_dx_q16
ADD r12,r12,r12
VDUP.32 Q0, r7 @ Q0 = < 1| 1| 1| 1>*source_x0_q16
VADD.I32 D17,D17,D19 @ Q8 = < 6| 4| 2| 0>*source_dx_q16
CMP r8, #0 @ If source_dx_q16 is negative...
VDUP.32 Q9, r12 @ Q9 = < 8| 8| 8| 8>*source_dx_q16
ADDLT r7, r7, r8, LSL #4 @ Make r7 point to the end of the block
VADD.I32 Q0, Q0, Q8 @ Q0 = < 6| 4| 2| 0>*source_dx_q16+source_x0_q16
SUBLT r7, r7, r8 @ (i.e., the lowest address we'll use)
VADD.I32 Q1, Q0, Q9 @ Q1 = <14|12|10| 8>*source_dx_q16+source_x0_q16
VDUP.I32 Q9, r8 @ Q8 = < 1| 1| 1| 1>*source_dx_q16
VADD.I32 Q2, Q0, Q9 @ Q2 = < 7| 5| 3| 1>*source_dx_q16+source_x0_q16
VADD.I32 Q3, Q1, Q9 @ Q3 = <15|13|11| 9>*source_dx_q16+source_x0_q16
VLD1.64 {D30,D31},[r14,:128] @ Load some constants
VMOV.I8 D28,#52
VMOV.I8 D29,#129
@ The basic idea here is to do aligned loads of a block of data and then
@ index into it using VTBL to extract the data from the source X
@ coordinate corresponding to each destination pixel.
@ This is significantly less code and significantly fewer cycles than doing
@ a series of single-lane loads, but it means that the X step between
@ pixels must be limited to 2.0 or less, otherwise we couldn't guarantee
@ that we could read 8 pixels from a single aligned 32-byte block of data.
@ Q0...Q3 contain the 16.16 fixed-point X coordinates of each pixel,
@ separated into even pixels and odd pixels to make extracting offsets and
@ weights easier.
@ We then pull out two bytes from the middle of each coordinate: the top
@ byte corresponds to the integer part of the X coordinate, and the bottom
@ byte corresponds to the weight to use for bilinear blending.
@ These are separated out into different registers with VTRN.
@ Then by subtracting the integer X coordinate of the first pixel in the
@ data block we loaded, we produce an index register suitable for use by
@ VTBL.
s42xbily_neon_loop:
@ Load the Y' data.
MOV r12,r7, ASR #16
VRSHRN.S32 D16,Q0, #8
AND r12,r12,#~15 @ Read 16-byte aligned blocks
VDUP.I8 D20,r12
ADD r12,r1, r12 @ r12 = y_row+(source_x&~7)
VRSHRN.S32 D17,Q1, #8
PLD [r12,#64]
VLD1.64 {D8, D9, D10,D11},[r12,:128],r5 @ Load Y' top row
ADD r14,r7, r8, LSL #3
VRSHRN.S32 D18,Q2, #8
MOV r14,r14,ASR #16
VRSHRN.S32 D19,Q3, #8
AND r14,r14,#~15 @ Read 16-byte aligned blocks
VLD1.64 {D12,D13,D14,D15},[r12,:128] @ Load Y' bottom row
PLD [r12,#64]
VDUP.I8 D21,r14
ADD r14,r1, r14 @ r14 = y_row+(source_x&~7)
VMOV.I8 Q13,#1
PLD [r14,#64]
VTRN.8 Q8, Q9 @ Q8 = <wFwEwDwCwBwAw9w8w7w6w5w4w3w2w1w0>
@ Q9 = <xFxExDxCxBxAx9x8x7x6x5x4x3x2x1x0>
VSUB.S8 Q9, Q9, Q10 @ Make offsets relative to the data we loaded.
@ First 8 Y' pixels
VTBL.8 D20,{D8, D9, D10,D11},D18 @ Index top row at source_x
VTBL.8 D24,{D12,D13,D14,D15},D18 @ Index bottom row at source_x
VADD.S8 Q13,Q9, Q13 @ Add 1 to source_x
VTBL.8 D22,{D8, D9, D10,D11},D26 @ Index top row at source_x+1
VTBL.8 D26,{D12,D13,D14,D15},D26 @ Index bottom row at source_x+1
@ Next 8 Y' pixels
VLD1.64 {D8, D9, D10,D11},[r14,:128],r5 @ Load Y' top row
VLD1.64 {D12,D13,D14,D15},[r14,:128] @ Load Y' bottom row
PLD [r14,#64]
VTBL.8 D21,{D8, D9, D10,D11},D19 @ Index top row at source_x
VTBL.8 D25,{D12,D13,D14,D15},D19 @ Index bottom row at source_x
VTBL.8 D23,{D8, D9, D10,D11},D27 @ Index top row at source_x+1
VTBL.8 D27,{D12,D13,D14,D15},D27 @ Index bottom row at source_x+1
@ Blend Y'.
VDUP.I16 Q9, r4 @ Load the y weights.
VSUBL.U8 Q4, D24,D20 @ Q5:Q4 = c-a
VSUBL.U8 Q5, D25,D21
VSUBL.U8 Q6, D26,D22 @ Q7:Q6 = d-b
VSUBL.U8 Q7, D27,D23
VMUL.S16 Q4, Q4, Q9 @ Q5:Q4 = (c-a)*yweight
VMUL.S16 Q5, Q5, Q9
VMUL.S16 Q6, Q6, Q9 @ Q7:Q6 = (d-b)*yweight
VMUL.S16 Q7, Q7, Q9
VMOVL.U8 Q12,D16 @ Promote the x weights to 16 bits.
VMOVL.U8 Q13,D17 @ Sadly, there's no VMULW.
VRSHRN.S16 D8, Q4, #8 @ Q4 = (c-a)*yweight+128>>8
VRSHRN.S16 D9, Q5, #8
VRSHRN.S16 D12,Q6, #8 @ Q6 = (d-b)*yweight+128>>8
VRSHRN.S16 D13,Q7, #8
VADD.I8 Q10,Q10,Q4 @ Q10 = a+((c-a)*yweight+128>>8)
VADD.I8 Q11,Q11,Q6 @ Q11 = b+((d-b)*yweight+128>>8)
VSUBL.U8 Q4, D22,D20 @ Q5:Q4 = b-a
VSUBL.U8 Q5, D23,D21
VMUL.S16 Q4, Q4, Q12 @ Q5:Q4 = (b-a)*xweight
VMUL.S16 Q5, Q5, Q13
VRSHRN.S16 D8, Q4, #8 @ Q4 = (b-a)*xweight+128>>8
ADD r12,r7, r9
VRSHRN.S16 D9, Q5, #8
MOV r12,r12,ASR #17
VADD.I8 Q8, Q10,Q4 @ Q8 = a+((b-a)*xweight+128>>8)
@ Start extracting the chroma x coordinates, and load Cb and Cr.
AND r12,r12,#~15 @ Read 16-byte aligned blocks
VDUP.I32 Q9, r9 @ Q9 = source_uv_xoffs_q16 x 4
ADD r14,r2, r12
VADD.I32 Q10,Q0, Q9
VLD1.64 {D8, D9, D10,D11},[r14,:128] @ Load Cb
PLD [r14,#64]
VADD.I32 Q11,Q1, Q9
ADD r14,r3, r12
VADD.I32 Q12,Q2, Q9
VLD1.64 {D12,D13,D14,D15},[r14,:128] @ Load Cr
PLD [r14,#64]
VADD.I32 Q13,Q3, Q9
VRSHRN.S32 D20,Q10,#9 @ Q10 = <xEwExCwCxAwAx8w8x6w6x4w4x2w2x0w0>
VRSHRN.S32 D21,Q11,#9
VDUP.I8 Q9, r12
VRSHRN.S32 D22,Q12,#9 @ Q11 = <xFwFxDwDxBwBx9w9x7w7x5w5x3w3x1w1>
VRSHRN.S32 D23,Q13,#9
@ We don't actually need the x weights, but we get them for free.
@ Free ALU slot
VTRN.8 Q10,Q11 @ Q10 = <wFwEwDwCwBwAw9w8w7w6w5w4w3w2w1w0>
@ Free ALU slot @ Q11 = <xFxExDxCxBxAx9x8x7x6x5x4x3x2x1x0>
VSUB.S8 Q11,Q11,Q9 @ Make offsets relative to the data we loaded.
VTBL.8 D18,{D8, D9, D10,D11},D22 @ Index Cb at source_x
VMOV.I8 D24,#74
VTBL.8 D19,{D8, D9, D10,D11},D23
VMOV.I8 D26,#102
VTBL.8 D20,{D12,D13,D14,D15},D22 @ Index Cr at source_x
VMOV.I8 D27,#25
VTBL.8 D21,{D12,D13,D14,D15},D23
@ We now have Y' in Q8, Cb in Q9, and Cr in Q10
@ We use VDUP to expand constants, because it's a permute instruction, so
@ it can dual issue on the A8.
SUBS r6, r6, #16 @ width -= 16
VMULL.U8 Q4, D16,D24 @ Q5:Q4 = Y'*74
VDUP.32 Q6, D30[1] @ Q7:Q6 = bias_G
VMULL.U8 Q5, D17,D24
VDUP.32 Q7, D30[1]
VMLSL.U8 Q6, D18,D27 @ Q7:Q6 = -25*Cb+bias_G
VDUP.32 Q11,D30[0] @ Q12:Q11 = bias_R
VMLSL.U8 Q7, D19,D27
VDUP.32 Q12,D30[0]
VMLAL.U8 Q11,D20,D26 @ Q12:Q11 = 102*Cr+bias_R
VDUP.32 Q8, D31[0] @ Q13:Q8 = bias_B
VMLAL.U8 Q12,D21,D26
VDUP.32 Q13,D31[0]
VMLAL.U8 Q8, D18,D29 @ Q13:Q8 = 129*Cb+bias_B
VMLAL.U8 Q13,D19,D29
VMLSL.U8 Q6, D20,D28 @ Q7:Q6 = -25*Cb-52*Cr+bias_G
VMLSL.U8 Q7, D21,D28
VADD.S16 Q11,Q4, Q11 @ Q12:Q11 = 74*Y'+102*Cr+bias_R
VADD.S16 Q12,Q5, Q12
VQADD.S16 Q8, Q4, Q8 @ Q13:Q8 = 74*Y'+129*Cr+bias_B
VQADD.S16 Q13,Q5, Q13
VADD.S16 Q6, Q4, Q6 @ Q7:Q6 = 74*Y'-25*Cb-52*Cr+bias_G
VADD.S16 Q7, Q5, Q7
@ Push each value to the top of its word and saturate it.
VQSHLU.S16 Q11,Q11,#2
VQSHLU.S16 Q12,Q12,#2
VQSHLU.S16 Q6, Q6, #2
VQSHLU.S16 Q7, Q7, #2
VQSHLU.S16 Q8, Q8, #2
VQSHLU.S16 Q13,Q13,#2
@ Merge G and B into R.
VSRI.U16 Q11,Q6, #5
VSRI.U16 Q12,Q7, #5
VSRI.U16 Q11,Q8, #11
MOV r14,r8, LSL #4
VSRI.U16 Q12,Q13,#11
BLT s42xbily_neon_tail
VDUP.I32 Q13,r14
@ Store the result.
VST1.16 {D22,D23,D24,D25},[r0]!
BEQ s42xbily_neon_done
@ Advance the x coordinates.
VADD.I32 Q0, Q0, Q13
VADD.I32 Q1, Q1, Q13
ADD r7, r14
VADD.I32 Q2, Q2, Q13
VADD.I32 Q3, Q3, Q13
B s42xbily_neon_loop
s42xbily_neon_tail:
@ We have between 1 and 15 pixels left to write.
@ -r6 == the number of pixels we need to skip writing.
@ Adjust r0 to point to the last one we need to write, because we're going
@ to write them in reverse order.
ADD r0, r0, r6, LSL #1
MOV r14,#-2
ADD r0, r0, #30
@ Skip past the ones we don't need to write.
SUB PC, PC, r6, LSL #2
ORR r0, r0, r0
VST1.16 {D25[3]},[r0,:16],r14
VST1.16 {D25[2]},[r0,:16],r14
VST1.16 {D25[1]},[r0,:16],r14
VST1.16 {D25[0]},[r0,:16],r14
VST1.16 {D24[3]},[r0,:16],r14
VST1.16 {D24[2]},[r0,:16],r14
VST1.16 {D24[1]},[r0,:16],r14
VST1.16 {D24[0]},[r0,:16],r14
VST1.16 {D23[3]},[r0,:16],r14
VST1.16 {D23[2]},[r0,:16],r14
VST1.16 {D23[1]},[r0,:16],r14
VST1.16 {D23[0]},[r0,:16],r14
VST1.16 {D22[3]},[r0,:16],r14
VST1.16 {D22[2]},[r0,:16],r14
VST1.16 {D22[1]},[r0,:16],r14
VST1.16 {D22[0]},[r0,:16]
s42xbily_neon_done:
VPOP {Q4-Q7} @ 16 words.
LDMFD r13!,{r4-r9,PC} @ 8 words.
.fnend
.size ScaleYCbCr42xToRGB565_BilinearY_Row_NEON, .-ScaleYCbCr42xToRGB565_BilinearY_Row_NEON

View File

@ -46,7 +46,6 @@
#include "nsICharsetConverterManager.h"
#include "nsEncoderDecoderUtils.h"
#include "nsIStringBundle.h"
#include "nsUConvDll.h"
#include "prmem.h"
#include "nsCRT.h"
#include "nsTArray.h"

View File

@ -41,7 +41,6 @@
#include "nsReadableUtils.h"
#include "nsITextToSubURI.h"
#include "nsIServiceManager.h"
#include "nsUConvDll.h"
#include "nsEscape.h"
#include "prmem.h"
#include "nsTextToSubURI.h"

View File

@ -1,54 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIComponentManager.h"
#include "nsCOMPtr.h"
#include "nsICharsetConverterManager.h"
#include "nsIPlatformCharset.h"
#include "nsPlatformCharsetFactory.h"
#include "nsICharsetAlias.h"
#include "nsCharsetAliasFactory.h"
#include "nsITextToSubURI.h"
#include "nsTextToSubURI.h"
#include "nsIServiceManager.h"
#include "rdf.h"
#include "nsUConvDll.h"
//----------------------------------------------------------------------
// Global functions and data [declaration]

View File

@ -1,46 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsUConvDll_h___
#define nsUConvDll_h___
#include "nsISupports.h"
class nsIComponentManager;
class nsIFile;
struct nsModuleComponentInfo;
#endif /* nsUConvDll_h___ */

View File

@ -58,7 +58,6 @@
#include "nsITextToSubURI.h"
#include "nsUConvDll.h"
#include "nsIFile.h"
#include "nsCRT.h"

View File

@ -1,43 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsUCvMinDll_h___
#define nsUCvMinDll_h___
#include "prtypes.h"
#endif /* nsUCvMinDll_h___ */

View File

@ -41,7 +41,6 @@
#include "nsICharsetConverterManager.h"
#include "nsReadableUtils.h"
#include "nsIServiceManager.h"
#include "nsUConvDll.h"
#include "prmem.h"
#include "nsUTF8ConverterService.h"
#include "nsEscape.h"

View File

@ -27,7 +27,9 @@ function test()
SimpleTest.finish();
}
setTimeout(test, 100);
addLoadEvent(function() {
setTimeout(test, 0);
});
SimpleTest.waitForExplicitFinish();
</script>
</pre>

View File

@ -316,7 +316,6 @@ MOZ_BROWSE_INFO = @MOZ_BROWSE_INFO@
MOZ_TOOLS_DIR = @MOZ_TOOLS_DIR@
MOZ_QUANTIFY = @MOZ_QUANTIFY@
MSMANIFEST_TOOL = @MSMANIFEST_TOOL@
WIN32_REDIST_DIR = @WIN32_REDIST_DIR@
MOZ_MEMORY_LDFLAGS = @MOZ_MEMORY_LDFLAGS@
# Codesighs tools option, enables win32 mapfiles.

View File

@ -992,7 +992,7 @@ endif
else # !WINNT || GNU_CC
ifeq ($(CPP_PROG_LINK),1)
$(EXPAND_CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB) $(EXE_DEF_FILE)
$(call CHECK_STDCXX,$@)
@$(call CHECK_STDCXX,$@)
else # ! CPP_PROG_LINK
$(EXPAND_CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
endif # CPP_PROG_LINK
@ -1058,7 +1058,7 @@ endif # MSVC with manifest tool
else
ifeq ($(CPP_PROG_LINK),1)
$(EXPAND_CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(BIN_FLAGS)
$(call CHECK_STDCXX,$@)
@$(call CHECK_STDCXX,$@)
else
$(EXPAND_CC) $(WRAP_MALLOC_CFLAGS) $(CFLAGS) $(OUTOPTION)$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(BIN_FLAGS)
endif # CPP_PROG_LINK
@ -1179,7 +1179,7 @@ endif
else # ! DTRACE_LIB_DEPENDENT
$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
endif # DTRACE_LIB_DEPENDENT
$(call CHECK_STDCXX,$@)
@$(call CHECK_STDCXX,$@)
ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
ifdef MSMANIFEST_TOOL

View File

@ -895,7 +895,6 @@ X11/cursorfont.h
X11/extensions/Print.h
X11/extensions/shape.h
X11/extensions/scrnsaver.h
X11/extensions/XIElib.h
X11/extensions/XShm.h
X11/extensions/Xrender.h
X11/extensions/Xdamage.h

View File

@ -674,10 +674,6 @@ case "$target" in
_MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
_MOZ_EXCEPTIONS_FLAGS_OFF=''
if test -n "$WIN32_REDIST_DIR"; then
WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
fi
dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
dnl not something else like "magnetic tape manipulation utility".
MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
@ -5696,7 +5692,6 @@ dnl win32 options
AC_SUBST(MOZ_MAPINFO)
AC_SUBST(MOZ_BROWSE_INFO)
AC_SUBST(MOZ_TOOLS_DIR)
AC_SUBST(WIN32_REDIST_DIR)
AC_SUBST(PYTHON)
AC_SUBST(WINCE)

View File

@ -108,7 +108,6 @@ members = [
'nsIDOMDocument.createTextNode',
'nsIDOMDocument.documentURI',
'nsIDOMDocument.adoptNode',
'nsIDOMDocument.renameNode',
'nsIDOMElement.removeAttributeNS',
'nsIDOMElement.removeAttribute',
'nsIDOMElement.getAttribute',
@ -330,8 +329,6 @@ members = [
'nsIDOMHTMLCanvasElement.height',
'nsIDOMHTMLCanvasElement.getContext',
'nsIDOMHTMLCanvasElement.toDataURL',
'nsIDOMNSHTMLDocument.width',
'nsIDOMNSHTMLDocument.height',
'nsIDOMNSHTMLDocument.domain',
'nsIDOMNSHTMLDocument.getSelection',
'nsIDOMNSHTMLDocument.designMode',

View File

@ -34,9 +34,7 @@ function setOrRestoreTabFocus(newValue) {
var prefs = Components.classes[prefSvcContractID].getService(prefSvcIID)
.getBranch("accessibility.");
if (!newValue) {
try {
prefs.clearUserPref("tabfocus");
} catch(ex) {}
prefs.clearUserPref("tabfocus");
} else {
prefs.setIntPref("tabfocus", newValue);
}

View File

@ -1891,11 +1891,11 @@ static const char kIconLoadPrefs[][40] = {
nsImageFrame::IconLoad::IconLoad()
{
nsIPrefBranch2* prefBranch = nsContentUtils::GetPrefBranch();
// register observers
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(kIconLoadPrefs); ++i)
prefBranch->AddObserver(kIconLoadPrefs[i], this, PR_FALSE);
if (prefBranch) {
// register observers
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(kIconLoadPrefs); ++i)
prefBranch->AddObserver(kIconLoadPrefs[i], this, PR_FALSE);
}
GetPrefs();
}

View File

@ -38,12 +38,8 @@ function setPrefs(eat_space, stop_at_punctuation) {
}
function restorePrefs() {
try {
getPrefs().clearUserPref("eat_space_to_next_word");
} catch(ex) {}
try {
getPrefs().clearUserPref("stop_at_punctuation");
} catch(ex) {}
getPrefs().clearUserPref("eat_space_to_next_word");
getPrefs().clearUserPref("stop_at_punctuation");
}
function test() {

View File

@ -52,7 +52,7 @@ random-if(cocoaWidget) == mirroring-02.html mirroring-02-ref.html
== 263359-3.html 263359-3-ref.html
== 263359-4.html 263359-4-ref.html
random-if(winWidget) == 267459-1.html 267459-1-ref.html # depends on windows version, see bug 590101
== 267459-2.html 267459-2-ref.html
fails-if(Android) == 267459-2.html 267459-2-ref.html # bug 650567
== 299065-1.html 299065-1-ref.html
random-if(winWidget) == 305643-1.html 305643-1-ref.html # depends on windows version, see bug 590101
== 332655-1.html 332655-1-ref.html

View File

@ -37,7 +37,7 @@ random == corner-2.html corner-2-ref.svg # right corners different radius than l
fails == clipping-1.html clipping-1-ref.html # background color should completely fill box; bug 466572
!= clipping-2.html about:blank # background color clipped to inner/outer border, can't get
# great tests for this due to antialiasing problems described in bug 466572
== clipping-3.html clipping-3-ref.xhtml # edge of border-radius clips an underlying object's background
fails-if(Android) == clipping-3.html clipping-3-ref.xhtml # edge of border-radius clips an underlying object's background, Android failure is bug 650569
# Tests for clipping the contents of replaced elements and overflow!=visible
!= clipping-4-ref.html clipping-4-notref.html

View File

@ -104,7 +104,7 @@ HTTP(..) == load-badfullname.html load-badfullname-ref.html
HTTP(..) != 507960-1-nofont.html 507960-1-ref.html
# check that the WOFF version loads, with and without a format hint
HTTP(..) == 507960-1-woff.html 507960-1-ref.html
fails-if(Android) HTTP(..) == 507960-1-woff-hint.html 507960-1-ref.html
HTTP(..) == 507960-1-woff-hint.html 507960-1-ref.html
# try damaged fonts that should still load (bad checksums)
HTTP(..) == 507960-1-bad-checksums-ttf.html 507960-1-ref.html
HTTP(..) == 507960-1-bad-checksums-woff.html 507960-1-ref.html

View File

@ -7,13 +7,13 @@
# check that Turkish language causes a change in rendering (no fi ligature)
# (also works via Pango)
fails-if(Android) HTTP(..) != font-features-turkish.html font-features-ref.html
HTTP(..) != font-features-turkish.html font-features-ref.html
# check that disabling ligatures causes a change
fails-if(Android) HTTP(..) != font-features-noliga.html font-features-ref.html
HTTP(..) != font-features-noliga.html font-features-ref.html
# check that enabling optional ligatures causes a change
fails-if(Android) HTTP(..) != font-features-hlig.html font-features-ref.html
HTTP(..) != font-features-hlig.html font-features-ref.html
# compare Turkish rendering with reference using ZWNJ to break the ligature
# (also works via Pango)

View File

@ -16,7 +16,7 @@ random-if(d2d) == element-paint-transform-02.html element-paint-transform-02-ref
== element-paint-background-size-02.html element-paint-background-size-02-ref.html
== element-paint-transform-repeated.html element-paint-transform-repeated-ref.html
== element-paint-transform-03.html element-paint-transform-03-ref.html
== element-paint-native-widget.html element-paint-native-widget-ref.html
fails-if(Android) == element-paint-native-widget.html element-paint-native-widget-ref.html # bug 650589
== element-paint-subimage-sampling-restriction.html about:blank
== element-paint-clippath.html element-paint-clippath-ref.html
== element-paint-sharpness-01a.html element-paint-sharpness-01b.html

View File

@ -1,24 +1,24 @@
== simpleHeight100.html greenbox.html
== simpleAbsHeight.html greenbox.html
== hScrollSimpleHeight.html greenboxhbar.html
== hScrollSimpleHeightQuirks-1.html greenboxhbar.html
== hScrollSimpleHeightQuirks-2.html greenboxhbar.html
== hScrollSimpleHeightQuirks-3.html greenboxhbar.html
== hScrollAbsHeight.html greenboxhbar.html
== hScrollAbsHeightQuirks.html greenboxhbar.html
fails-if(Android) == hScrollSimpleHeight.html greenboxhbar.html # bug 650591
fails-if(Android) == hScrollSimpleHeightQuirks-1.html greenboxhbar.html # bug 650591
fails-if(Android) == hScrollSimpleHeightQuirks-2.html greenboxhbar.html # bug 650591
fails-if(Android) == hScrollSimpleHeightQuirks-3.html greenboxhbar.html # bug 650591
fails-if(Android) == hScrollAbsHeight.html greenboxhbar.html # bug 650591
fails-if(Android) == hScrollAbsHeightQuirks.html greenboxhbar.html # bug 650591
== simpleHeight100D.html greenbox.html
== simpleAbsHeightD.html greenbox.html
== hScrollSimpleHeightD.html greenboxhbar.html
== hScrollSimpleHeightQuirks-1D.html greenboxhbar.html
== hScrollSimpleHeightQuirks-2D.html greenboxhbar.html
== hScrollSimpleHeightQuirks-3D.html greenboxhbar.html
== hScrollAbsHeightD.html greenboxhbar.html
== hScrollAbsHeightQuirksD.html greenboxhbar.html
fails-if(Android) == hScrollSimpleHeightD.html greenboxhbar.html # bug 650591
fails-if(Android) == hScrollSimpleHeightQuirks-1D.html greenboxhbar.html # bug 650591
fails-if(Android) == hScrollSimpleHeightQuirks-2D.html greenboxhbar.html # bug 650591
fails-if(Android) == hScrollSimpleHeightQuirks-3D.html greenboxhbar.html # bug 650591
fails-if(Android) == hScrollAbsHeightD.html greenboxhbar.html # bug 650591
fails-if(Android) == hScrollAbsHeightQuirksD.html greenboxhbar.html # bug 650591
== simpleMinHeight100D.html greenbox.html
== simpleAbsMinHeightD.html greenbox.html
== hScrollSimpleMinHeightD.html greenboxhbar.html
== hScrollSimpleMinHeightQuirks-1D.html greenboxhbar.html
== hScrollSimpleMinHeightQuirks-3D.html greenboxhbar.html
== hScrollAbsMinHeightD.html greenboxhbar.html
== hScrollAbsMinHeightQuirksD.html greenboxhbar.html
fails-if(Android) == hScrollSimpleMinHeightD.html greenboxhbar.html # bug 650591
fails-if(Android) == hScrollSimpleMinHeightQuirks-1D.html greenboxhbar.html # bug 650591
fails-if(Android) == hScrollSimpleMinHeightQuirks-3D.html greenboxhbar.html # bug 650591
fails-if(Android) == hScrollAbsMinHeightD.html greenboxhbar.html # bug 650591
fails-if(Android) == hScrollAbsMinHeightQuirksD.html greenboxhbar.html # bug 650591
== dynamicHeight100.html dynamicHeight100-ref.html

View File

@ -63,11 +63,7 @@ var CI = Components.interfaces;
var prefs =
CC["@mozilla.org/preferences-service;1"].getService(CI.nsIPrefBranch);
try {
prefs.clearUserPref('font.minimum-size.x-western');
} catch (ex) {
// throws if it wasn't already set
}
prefs.clearUserPref('font.minimum-size.x-western');
// preference change is async (although one setTimeout might be enough?)
setTimeout(setTimeout, 0, step1, 0);

View File

@ -5,14 +5,14 @@
== row-or-column-sizing-1.xul row-or-column-sizing-4.xul
== z-order-1.xul z-order-1-ref.xul
== z-order-2.xul z-order-2-ref.xul
== not-full-basic.xul not-full-basic-ref.xhtml
== not-full-grid-pack-align.xul not-full-basic-ref.xhtml
fails-if(Android) == not-full-basic.xul not-full-basic-ref.xhtml # bug 650597
fails-if(Android) == not-full-grid-pack-align.xul not-full-basic-ref.xhtml # bug 650597
== not-full-row-group-align.xul not-full-row-group-align-ref.xhtml # does anyone want/need this behavior?
== not-full-row-group-pack.xul not-full-row-group-pack-ref.xhtml
== not-full-row-group-direction.xul not-full-row-group-direction-ref.xhtml
== not-full-row-leaf-align.xul not-full-basic-ref.xhtml
== not-full-row-leaf-pack.xul not-full-row-leaf-pack-ref.xhtml
== not-full-row-leaf-direction.xul not-full-row-leaf-pack-ref.xhtml
== scrollable-columns.xul scrollable-columns-ref.xhtml
fails-if(Android) == not-full-row-group-direction.xul not-full-row-group-direction-ref.xhtml # bug 650597
fails-if(Android) == not-full-row-leaf-align.xul not-full-basic-ref.xhtml # bug 650597
fails-if(Android) == not-full-row-leaf-pack.xul not-full-row-leaf-pack-ref.xhtml # bug 650597
fails-if(Android) == not-full-row-leaf-direction.xul not-full-row-leaf-pack-ref.xhtml # bug 650597
fails-if(Android) == scrollable-columns.xul scrollable-columns-ref.xhtml # bug 650597
fails == scrollable-rows.xul scrollable-rows-ref.xhtml
== sizing-2d.xul sizing-2d-ref.xul

View File

@ -344,7 +344,7 @@ nsXULTooltipListener::AddTooltipSupport(nsIContent* aNode)
nsCOMPtr<nsIDOMEventTarget> evtTarget(do_QueryInterface(aNode));
evtTarget->AddEventListener(NS_LITERAL_STRING("mouseout"), static_cast<nsIDOMMouseListener*>(this), PR_FALSE);
evtTarget->AddEventListener(NS_LITERAL_STRING("mousemove"), static_cast<nsIDOMMouseListener*>(this), PR_FALSE);
evtTarget->AddEventListener(NS_LITERAL_STRING("dragstart"), static_cast<nsIDOMMouseListener*>(this), PR_FALSE);
evtTarget->AddEventListener(NS_LITERAL_STRING("dragstart"), static_cast<nsIDOMMouseListener*>(this), PR_TRUE);
return NS_OK;
}
@ -358,7 +358,7 @@ nsXULTooltipListener::RemoveTooltipSupport(nsIContent* aNode)
nsCOMPtr<nsIDOMEventTarget> evtTarget(do_QueryInterface(aNode));
evtTarget->RemoveEventListener(NS_LITERAL_STRING("mouseout"), static_cast<nsIDOMMouseListener*>(this), PR_FALSE);
evtTarget->RemoveEventListener(NS_LITERAL_STRING("mousemove"), static_cast<nsIDOMMouseListener*>(this), PR_FALSE);
evtTarget->RemoveEventListener(NS_LITERAL_STRING("dragstart"), static_cast<nsIDOMMouseListener*>(this), PR_FALSE);
evtTarget->RemoveEventListener(NS_LITERAL_STRING("dragstart"), static_cast<nsIDOMMouseListener*>(this), PR_TRUE);
return NS_OK;
}

View File

@ -874,7 +874,7 @@
<xul:vbox flex="1">
<xul:vbox flex="1">
<xul:textbox anonid="name" xbl:inherits="value=title" class="prompt-edit" flex="1"/>
<xul:textbox anonid="uri" xbl:inherits="value=uri" type="url" class="uri-element" class="prompt-edit" flex="1"/>
<xul:textbox anonid="uri" xbl:inherits="value=uri" type="url" class="uri-element prompt-edit" flex="1"/>
<xul:textbox anonid="tags" xbl:inherits="value=tags" emptytext="&editBookmarkTags.label;" class="prompt-edit" flex="1"/>
</xul:vbox>

View File

@ -104,7 +104,7 @@ UpdatePrompt.prototype = {
// Unconditionally use the "major" type here as for now it is always a new version
// without additional description required for a minor update message
let message = gUpdateBundle.formatStringFromName("intro_major", [brandName, aUpdate.displayVersion], 2);
let button0 = gUpdateBundle.GetStringFromName("updateButton_major");
let button0 = gUpdateBundle.GetStringFromName("okButton");
let button1 = gUpdateBundle.GetStringFromName("askLaterButton");
let prompt = Services.prompt;
let flags = prompt.BUTTON_POS_0 * prompt.BUTTON_TITLE_IS_STRING + prompt.BUTTON_POS_1 * prompt.BUTTON_TITLE_IS_STRING;

Some files were not shown because too many files have changed in this diff Show More