merge fx-team to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2015-04-15 12:36:46 +02:00
Родитель 3e1ee64dda 2773a89419
Коммит 07bcc385b7
79 изменённых файлов: 1022 добавлений и 223 удалений

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

@ -142,7 +142,7 @@ function create(options) {
node.setAttribute('label', label);
node.setAttribute('tooltiptext', label);
node.setAttribute('image', image);
node.setAttribute('sdk-button', 'true');
node.setAttribute('constrain-size', 'true');
views.set(id, {
area: this.currentArea,

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

@ -57,7 +57,7 @@ exports['test exceptions'] = function(assert) {
} + '();');
}
catch (error) {
assert.equal(error.fileName, '', 'no fileName reported');
assert.equal(error.fileName, '[System Principal]', 'No specific fileName reported');
assert.equal(error.lineNumber, 3, 'reports correct line number');
}

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

@ -252,7 +252,7 @@ let ReadingListUI = {
if (this.enabled && state == "valid") {
uri = gBrowser.currentURI;
if (uri.schemeIs("about"))
uri = ReaderParent.parseReaderUrl(uri.spec);
uri = ReaderMode.getOriginalUrl(uri.spec);
else if (!uri.schemeIs("http") && !uri.schemeIs("https"))
uri = null;
}
@ -309,7 +309,7 @@ let ReadingListUI = {
togglePageByBrowser: Task.async(function* (browser) {
let uri = browser.currentURI;
if (uri.spec.startsWith("about:reader?"))
uri = ReaderParent.parseReaderUrl(uri.spec);
uri = ReaderMode.getOriginalUrl(uri.spec);
if (!uri)
return;
@ -330,7 +330,7 @@ let ReadingListUI = {
isItemForCurrentBrowser(item) {
let currentURL = gBrowser.currentURI.spec;
if (currentURL.startsWith("about:reader?"))
currentURL = ReaderParent.parseReaderUrl(currentURL);
currentURL = ReaderMode.getOriginalUrl(currentURL);
if (item.url == currentURL || item.resolvedURL == currentURL) {
return true;

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

@ -213,6 +213,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "CastingApps",
XPCOMUtils.defineLazyModuleGetter(this, "SimpleServiceDiscovery",
"resource://gre/modules/SimpleServiceDiscovery.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode",
"resource://gre/modules/ReaderMode.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ReaderParent",
"resource:///modules/ReaderParent.jsm");

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

@ -578,6 +578,7 @@ nsContextMenu.prototype = {
this.linkURI = null;
this.linkText = "";
this.linkProtocol = "";
this.linkDownload = "";
this.linkHasNoReferrer = false;
this.onMathML = false;
this.inFrame = false;
@ -751,6 +752,14 @@ nsContextMenu.prototype = {
this.onMailtoLink = (this.linkProtocol == "mailto");
this.onSaveableLink = this.isLinkSaveable( this.link );
this.linkHasNoReferrer = BrowserUtils.linkHasNoReferrer(elem);
try {
if (elem.download) {
// Ignore download attribute on cross-origin links
this.principal.checkMayLoad(this.linkURI, false, true);
this.linkDownload = elem.download;
}
}
catch (ex) {}
}
// Background image? Don't bother if we've already found a
@ -1171,7 +1180,8 @@ nsContextMenu.prototype = {
// Helper function to wait for appropriate MIME-type headers and
// then prompt the user with a file picker
saveHelper: function(linkURL, linkText, dialogTitle, bypassCache, doc) {
saveHelper: function(linkURL, linkText, dialogTitle, bypassCache, doc,
linkDownload) {
// canonical def in nsURILoader.h
const NS_ERROR_SAVE_LINK_AS_TIMEOUT = 0x805d0020;
@ -1277,6 +1287,8 @@ nsContextMenu.prototype = {
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
if (linkDownload)
channel.contentDispositionFilename = linkDownload;
if (channel instanceof Ci.nsIPrivateBrowsingChannel) {
let docIsPrivate = PrivateBrowsingUtils.isBrowserPrivate(gBrowser.selectedBrowser);
channel.setPrivate(docIsPrivate);
@ -1313,7 +1325,8 @@ nsContextMenu.prototype = {
// Save URL of clicked-on link.
saveLink: function() {
urlSecurityCheck(this.linkURL, this.principal);
this.saveHelper(this.linkURL, this.linkText, null, true, this.ownerDoc);
this.saveHelper(this.linkURL, this.linkText, null, true, this.ownerDoc,
this.linkDownload);
},
// Backwards-compatibility wrapper
@ -1341,7 +1354,7 @@ nsContextMenu.prototype = {
else if (this.onVideo || this.onAudio) {
urlSecurityCheck(this.mediaURL, this.principal);
var dialogTitle = this.onVideo ? "SaveVideoTitle" : "SaveAudioTitle";
this.saveHelper(this.mediaURL, null, dialogTitle, false, doc);
this.saveHelper(this.mediaURL, null, dialogTitle, false, doc, "");
}
},

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

@ -17,7 +17,7 @@ const TEST_PATH = "http://example.com/browser/browser/base/content/test/general/
let readerButton = document.getElementById("reader-mode-button");
add_task(function* () {
add_task(function* test_reader_button() {
registerCleanupFunction(function() {
// Reset test prefs.
TEST_PREFS.forEach(([name, value]) => {
@ -90,3 +90,16 @@ add_task(function* () {
yield promiseWaitForCondition(() => !readerButton.hidden);
is_element_visible(readerButton, "Reader mode button is present on a reader-able page");
});
add_task(function* test_getOriginalUrl() {
let { ReaderMode } = Cu.import("resource://gre/modules/ReaderMode.jsm", {});
let url = "http://foo.com/article.html";
is(ReaderMode.getOriginalUrl("about:reader?url=" + encodeURIComponent(url)), url, "Found original URL from encoded URL");
is(ReaderMode.getOriginalUrl("about:reader?foobar"), null, "Did not find original URL from malformed reader URL");
is(ReaderMode.getOriginalUrl(url), null, "Did not find original URL from non-reader URL");
let badUrl = "http://foo.com/?;$%^^";
is(ReaderMode.getOriginalUrl("about:reader?url=" + encodeURIComponent(badUrl)), badUrl, "Found original URL from encoded malformed URL");
is(ReaderMode.getOriginalUrl("about:reader?url=" + badUrl), badUrl, "Found original URL from non-encoded malformed URL");
});

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

@ -6,7 +6,21 @@
* as expected. Pinned tabs should not be moved. Gaps will be re-filled
* if more sites are available.
*/
gDirectorySource = "data:application/json," + JSON.stringify({
"suggested": [{
url: "http://suggested.com/",
imageURI: "data:image/png;base64,helloWORLD3",
title: "title",
type: "affiliate",
frecent_sites: ["example0.com"]
}]
});
function runTests() {
let origIsTopPlacesSite = NewTabUtils.isTopPlacesSite;
NewTabUtils.isTopPlacesSite = (site) => false;
// we remove sites and expect the gaps to be filled as long as there still
// are some sites available
yield setLinks("0,1,2,3,4,5,6,7,8,9");
@ -58,4 +72,16 @@ function runTests() {
yield blockCell(0);
checkGrid("1,2,3,4,5,6,7,9,8p");
// Test that blocking the targeted site also removes its associated suggested tile
NewTabUtils.isTopPlacesSite = origIsTopPlacesSite;
yield restore();
yield setLinks("0,1,2,3,4,5,6,7,8,9");
yield addNewTabPageTab();
yield customizeNewTabPage("enhanced");
checkGrid("http://suggested.com/,0,1,2,3,4,5,6,7,8,9");
yield blockCell(1);
yield addNewTabPageTab();
checkGrid("1,2,3,4,5,6,7,8,9");
}

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

@ -109,7 +109,7 @@ function runTests() {
// Test that a suggested tile is not enhanced by a directory tile
let origIsTopPlacesSite = NewTabUtils.isTopPlacesSite;
NewTabUtils.isTopPlacesSite = () => true;
yield setLinks("-1");
yield setLinks("-1,2,3,4,5,6,7,8");
// Test with enhanced = false
yield addNewTabPageTab();
@ -119,7 +119,8 @@ function runTests() {
is(enhanced, "", "history link has no enhanced image");
is(title, "site#-1");
is(getData(1), null, "there is only one link and it's a history link");
isnot(getData(7), null, "there are 8 history links");
is(getData(8), null, "there are 8 history links");
// Test with enhanced = true
@ -138,5 +139,5 @@ function runTests() {
isnot(enhanced, "", "pinned history link has enhanced image");
is(title, "title");
is(getData(2), null, "there is only a suggested link followed by an enhanced history link");
is(getData(9), null, "there is a suggested link followed by an enhanced history link and the remaining history links");
}

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

@ -168,7 +168,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
}
}
} else {
let originalUrl = ReaderParent.parseReaderUrl(aValue);
let originalUrl = ReaderMode.getOriginalUrl(aValue);
if (originalUrl) {
returnValue = originalUrl;
}

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

@ -185,7 +185,7 @@ var gContentPane = {
*/
configureFonts: function ()
{
gSubDialog.open("chrome://browser/content/preferences/fonts.xul");
gSubDialog.open("chrome://browser/content/preferences/fonts.xul", "resizable=no");
},
/**
@ -194,7 +194,7 @@ var gContentPane = {
*/
configureColors: function ()
{
gSubDialog.open("chrome://browser/content/preferences/colors.xul");
gSubDialog.open("chrome://browser/content/preferences/colors.xul", "resizable=no");
},
// LANGUAGES

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

@ -511,7 +511,7 @@ var gPrivacyPane = {
*/
showClearPrivateDataSettings: function ()
{
gSubDialog.open("chrome://browser/content/preferences/sanitize.xul");
gSubDialog.open("chrome://browser/content/preferences/sanitize.xul", "resizable=no");
},

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

@ -217,7 +217,7 @@ var gSecurityPane = {
changeMasterPassword: function ()
{
gSubDialog.open("chrome://mozapps/content/preferences/changemp.xul",
null, null, this._initMasterPasswordUI.bind(this));
"resizable=no", null, this._initMasterPasswordUI.bind(this));
},
/**

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

@ -65,6 +65,9 @@ const SUGGESTED_FRECENCY = Infinity;
// Default number of times to show a link
const DEFAULT_FREQUENCY_CAP = 5;
// The min number of visible (not blocked) history tiles to have before showing suggested tiles
const MIN_VISIBLE_HISTORY_TILES = 8;
// Divide frecency by this amount for pings
const PING_SCORE_DIVISOR = 10000;
@ -509,6 +512,7 @@ let DirectoryLinksProvider = {
this._lastDownloadMS = 0;
NewTabUtils.placesProvider.addObserver(this);
NewTabUtils.links.addObserver(this);
return Task.spawn(function() {
// get the last modified time of the links file if it exists
@ -563,7 +567,7 @@ let DirectoryLinksProvider = {
onLinkChanged: function (aProvider, aLink) {
// Make sure NewTabUtils.links handles the notification first.
setTimeout(() => {
if (this._handleLinkChanged(aLink)) {
if (this._handleLinkChanged(aLink) || this._shouldUpdateSuggestedTile()) {
this._updateSuggestedTile();
}
}, 0);
@ -591,6 +595,38 @@ let DirectoryLinksProvider = {
}
},
_getCurrentTopSiteCount: function() {
let visibleTopSiteCount = 0;
for (let link of NewTabUtils.links.getLinks().slice(0, MIN_VISIBLE_HISTORY_TILES)) {
if (link && (link.type == "history" || link.type == "enhanced")) {
visibleTopSiteCount++;
}
}
return visibleTopSiteCount;
},
_shouldUpdateSuggestedTile: function() {
let sortedLinks = NewTabUtils.getProviderLinks(this);
let mostFrecentLink = {};
if (sortedLinks && sortedLinks.length) {
mostFrecentLink = sortedLinks[0]
}
let currTopSiteCount = this._getCurrentTopSiteCount();
if ((!mostFrecentLink.targetedSite && currTopSiteCount >= MIN_VISIBLE_HISTORY_TILES) ||
(mostFrecentLink.targetedSite && currTopSiteCount < MIN_VISIBLE_HISTORY_TILES)) {
// If mostFrecentLink has a targetedSite then mostFrecentLink is a suggested link.
// If we have enough history links (8+) to show a suggested tile and we are not
// already showing one, then we should update (to *attempt* to add a suggested tile).
// OR if we don't have enough history to show a suggested tile (<8) and we are
// currently showing one, we should update (to remove it).
return true;
}
return false;
},
/**
* Chooses and returns a suggested tile based on a user's top sites
* that we have an available suggested tile for.
@ -620,8 +656,9 @@ let DirectoryLinksProvider = {
}
}
if (this._topSitesWithSuggestedLinks.size == 0) {
// There are no potential suggested links we can show.
if (this._topSitesWithSuggestedLinks.size == 0 || !this._shouldUpdateSuggestedTile()) {
// There are no potential suggested links we can show or not
// enough history for a suggested tile.
return;
}

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

@ -172,7 +172,7 @@ let ReaderParent = {
let url = browser.currentURI.spec;
if (url.startsWith("about:reader")) {
let originalURL = this._getOriginalUrl(url);
let originalURL = ReaderMode.getOriginalUrl(url);
if (!originalURL) {
Cu.reportError("Error finding original URL for about:reader URL: " + url);
} else {
@ -183,28 +183,6 @@ let ReaderParent = {
}
},
parseReaderUrl: function(url) {
if (!url.startsWith("about:reader?")) {
return null;
}
return this._getOriginalUrl(url);
},
/**
* Returns original URL from an about:reader URL.
*
* @param url An about:reader URL.
* @return The original URL for the article, or null if we did not find
* a properly formatted about:reader URL.
*/
_getOriginalUrl: function(url) {
let searchParams = new URLSearchParams(url.substring("about:reader?".length));
if (!searchParams.has("url")) {
return null;
}
return decodeURIComponent(searchParams.get("url"));
},
/**
* Gets an article for a given URL. This method will download and parse a document.
*

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

@ -265,18 +265,19 @@ function CreateSocialStatusWidget(aId, aProvider) {
CustomizableUI.createWidget({
id: aId,
type: 'custom',
type: "custom",
removable: true,
defaultArea: CustomizableUI.AREA_NAVBAR,
onBuild: function(aDocument) {
let node = aDocument.createElement('toolbarbutton');
let node = aDocument.createElement("toolbarbutton");
node.id = this.id;
node.setAttribute('class', 'toolbarbutton-1 chromeclass-toolbar-additional social-status-button badged-button');
node.setAttribute("class", "toolbarbutton-1 chromeclass-toolbar-additional social-status-button badged-button");
node.style.listStyleImage = "url(" + (aProvider.icon32URL || aProvider.iconURL) + ")";
node.setAttribute("origin", aProvider.origin);
node.setAttribute("label", aProvider.name);
node.setAttribute("tooltiptext", aProvider.name);
node.setAttribute("oncommand", "SocialStatus.showPopup(this);");
node.setAttribute("constrain-size", "true");
if (PrivateBrowsingUtils.isWindowPrivate(aDocument.defaultView))
node.setAttribute("disabled", "true");
@ -298,14 +299,15 @@ function CreateSocialMarkWidget(aId, aProvider) {
CustomizableUI.createWidget({
id: aId,
type: 'custom',
type: "custom",
removable: true,
defaultArea: CustomizableUI.AREA_NAVBAR,
onBuild: function(aDocument) {
let node = aDocument.createElement('toolbarbutton');
let node = aDocument.createElement("toolbarbutton");
node.id = this.id;
node.setAttribute('class', 'toolbarbutton-1 chromeclass-toolbar-additional social-mark-button');
node.setAttribute('type', "socialmark");
node.setAttribute("class", "toolbarbutton-1 chromeclass-toolbar-additional social-mark-button");
node.setAttribute("type", "socialmark");
node.setAttribute("constrain-size", "true");
node.style.listStyleImage = "url(" + (aProvider.unmarkedIcon || aProvider.icon32URL || aProvider.iconURL) + ")";
node.setAttribute("origin", aProvider.origin);

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

@ -223,6 +223,42 @@ function run_test() {
});
}
add_task(function test_shouldUpdateSuggestedTile() {
let suggestedLink = {
targetedSite: "somesite.com"
};
// DirectoryLinksProvider has no suggested tile and no top sites => no need to update
do_check_eq(DirectoryLinksProvider._getCurrentTopSiteCount(), 0);
isIdentical(NewTabUtils.getProviderLinks(), []);
do_check_eq(DirectoryLinksProvider._shouldUpdateSuggestedTile(), false);
// DirectoryLinksProvider has a suggested tile and no top sites => need to update
let origGetProviderLinks = NewTabUtils.getProviderLinks;
NewTabUtils.getProviderLinks = (provider) => [suggestedLink];
do_check_eq(DirectoryLinksProvider._getCurrentTopSiteCount(), 0);
isIdentical(NewTabUtils.getProviderLinks(), [suggestedLink]);
do_check_eq(DirectoryLinksProvider._shouldUpdateSuggestedTile(), true);
// DirectoryLinksProvider has a suggested tile and 8 top sites => no need to update
let origCurrentTopSiteCount = DirectoryLinksProvider._getCurrentTopSiteCount;
DirectoryLinksProvider._getCurrentTopSiteCount = () => 8;
do_check_eq(DirectoryLinksProvider._getCurrentTopSiteCount(), 8);
isIdentical(NewTabUtils.getProviderLinks(), [suggestedLink]);
do_check_eq(DirectoryLinksProvider._shouldUpdateSuggestedTile(), false);
// DirectoryLinksProvider has no suggested tile and 8 top sites => need to update
NewTabUtils.getProviderLinks = origGetProviderLinks;
do_check_eq(DirectoryLinksProvider._getCurrentTopSiteCount(), 8);
isIdentical(NewTabUtils.getProviderLinks(), []);
do_check_eq(DirectoryLinksProvider._shouldUpdateSuggestedTile(), true);
// Cleanup
DirectoryLinksProvider._getCurrentTopSiteCount = origCurrentTopSiteCount;
});
add_task(function test_updateSuggestedTile() {
let topSites = ["site0.com", "1040.com", "site2.com", "hrblock.com", "site4.com", "freetaxusa.com", "site6.com"];
@ -246,6 +282,9 @@ add_task(function test_updateSuggestedTile() {
return links;
}
let origCurrentTopSiteCount = DirectoryLinksProvider._getCurrentTopSiteCount;
DirectoryLinksProvider._getCurrentTopSiteCount = () => 8;
do_check_eq(DirectoryLinksProvider._updateSuggestedTile(), undefined);
function TestFirstRun() {
@ -346,6 +385,7 @@ add_task(function test_updateSuggestedTile() {
yield promiseCleanDirectoryLinksProvider();
NewTabUtils.isTopPlacesSite = origIsTopPlacesSite;
NewTabUtils.getProviderLinks = origGetProviderLinks;
DirectoryLinksProvider._getCurrentTopSiteCount = origCurrentTopSiteCount;
});
add_task(function test_suggestedLinksMap() {
@ -436,6 +476,9 @@ add_task(function test_suggestedAttributes() {
let origIsTopPlacesSite = NewTabUtils.isTopPlacesSite;
NewTabUtils.isTopPlacesSite = () => true;
let origCurrentTopSiteCount = DirectoryLinksProvider._getCurrentTopSiteCount;
DirectoryLinksProvider._getCurrentTopSiteCount = () => 8;
let frecent_sites = ["top.site.com"];
let imageURI = "https://image/";
let title = "the title";
@ -478,6 +521,7 @@ add_task(function test_suggestedAttributes() {
// Cleanup.
NewTabUtils.isTopPlacesSite = origIsTopPlacesSite;
DirectoryLinksProvider._getCurrentTopSiteCount = origCurrentTopSiteCount;
gLinks.removeProvider(DirectoryLinksProvider);
DirectoryLinksProvider.removeObserver(gLinks);
});
@ -487,6 +531,9 @@ add_task(function test_frequencyCappedSites_views() {
let origIsTopPlacesSite = NewTabUtils.isTopPlacesSite;
NewTabUtils.isTopPlacesSite = () => true;
let origCurrentTopSiteCount = DirectoryLinksProvider._getCurrentTopSiteCount;
DirectoryLinksProvider._getCurrentTopSiteCount = () => 8;
let testUrl = "http://frequency.capped/link";
let targets = ["top.site.com"];
let data = {
@ -548,6 +595,7 @@ add_task(function test_frequencyCappedSites_views() {
// Cleanup.
NewTabUtils.isTopPlacesSite = origIsTopPlacesSite;
DirectoryLinksProvider._getCurrentTopSiteCount = origCurrentTopSiteCount;
gLinks.removeProvider(DirectoryLinksProvider);
DirectoryLinksProvider.removeObserver(gLinks);
Services.prefs.setCharPref(kPingUrlPref, kPingUrl);
@ -558,6 +606,9 @@ add_task(function test_frequencyCappedSites_click() {
let origIsTopPlacesSite = NewTabUtils.isTopPlacesSite;
NewTabUtils.isTopPlacesSite = () => true;
let origCurrentTopSiteCount = DirectoryLinksProvider._getCurrentTopSiteCount;
DirectoryLinksProvider._getCurrentTopSiteCount = () => 8;
let testUrl = "http://frequency.capped/link";
let targets = ["top.site.com"];
let data = {
@ -613,6 +664,7 @@ add_task(function test_frequencyCappedSites_click() {
// Cleanup.
NewTabUtils.isTopPlacesSite = origIsTopPlacesSite;
DirectoryLinksProvider._getCurrentTopSiteCount = origCurrentTopSiteCount;
gLinks.removeProvider(DirectoryLinksProvider);
DirectoryLinksProvider.removeObserver(gLinks);
Services.prefs.setCharPref(kPingUrlPref, kPingUrl);
@ -1089,6 +1141,8 @@ add_task(function test_DirectoryLinksProvider_getEnhancedLink() {
add_task(function test_DirectoryLinksProvider_enhancedURIs() {
let origIsTopPlacesSite = NewTabUtils.isTopPlacesSite;
NewTabUtils.isTopPlacesSite = () => true;
let origCurrentTopSiteCount = DirectoryLinksProvider._getCurrentTopSiteCount;
DirectoryLinksProvider._getCurrentTopSiteCount = () => 8;
let data = {
"suggested": [
@ -1129,6 +1183,7 @@ add_task(function test_DirectoryLinksProvider_enhancedURIs() {
// Cleanup.
NewTabUtils.isTopPlacesSite = origIsTopPlacesSite;
DirectoryLinksProvider._getCurrentTopSiteCount = origCurrentTopSiteCount;
gLinks.removeProvider(DirectoryLinksProvider);
});

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

@ -595,12 +595,12 @@ menuitem:not([type]):not(.menuitem-tooltip):not(.menuitem-iconic-tooltip) {
}
/* Help SDK icons fit: */
toolbarbutton[sdk-button="true"][cui-areatype="toolbar"] > .toolbarbutton-icon,
toolbarbutton[sdk-button="true"][cui-areatype="toolbar"] > .toolbarbutton-badge-container > .toolbarbutton-icon {
toolbarbutton[constrain-size="true"][cui-areatype="toolbar"] > .toolbarbutton-icon,
toolbarbutton[constrain-size="true"][cui-areatype="toolbar"] > .toolbarbutton-badge-container > .toolbarbutton-icon {
width: 16px;
}
:-moz-any(#TabsToolbar, #nav-bar) toolbarbutton[sdk-button="true"][cui-areatype="toolbar"] > .toolbarbutton-icon {
:-moz-any(#TabsToolbar, #nav-bar) toolbarbutton[constrain-size="true"][cui-areatype="toolbar"] > .toolbarbutton-icon {
/* XXXgijs box models strike again: this is 16px + 2 * 7px padding + 2 * 1px border (from the rules above) */
width: 32px;
}

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

@ -1353,8 +1353,8 @@ toolbar .toolbarbutton-1:not(:-moz-any(@primaryToolbarButtons@)) > .toolbarbutto
}
/* Help SDK icons fit: */
toolbarbutton[sdk-button="true"][cui-areatype="toolbar"] > .toolbarbutton-icon,
toolbarbutton[sdk-button="true"][cui-areatype="toolbar"] > .toolbarbutton-badge-container > .toolbarbutton-icon {
toolbarbutton[constrain-size="true"][cui-areatype="toolbar"] > .toolbarbutton-icon,
toolbarbutton[constrain-size="true"][cui-areatype="toolbar"] > .toolbarbutton-badge-container > .toolbarbutton-icon {
width: 16px;
}

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

@ -300,10 +300,10 @@ toolbarpaletteitem[place="panel"]:not([haswideitem=true]) > .toolbarbutton-1 {
}
/* Help SDK buttons fit in. */
toolbarpaletteitem[place="palette"] > toolbarbutton[sdk-button="true"] > .toolbarbutton-icon,
toolbarpaletteitem[place="palette"] > toolbarbutton[sdk-button="true"] > .toolbarbutton-badge-container > .toolbarbutton-icon,
toolbarbutton[sdk-button="true"][cui-areatype="menu-panel"] > .toolbarbutton-icon,
toolbarbutton[sdk-button="true"][cui-areatype="menu-panel"] > .toolbarbutton-badge-container > .toolbarbutton-icon {
toolbarpaletteitem[place="palette"] > toolbarbutton[constrain-size="true"] > .toolbarbutton-icon,
toolbarpaletteitem[place="palette"] > toolbarbutton[constrain-size="true"] > .toolbarbutton-badge-container > .toolbarbutton-icon,
toolbarbutton[constrain-size="true"][cui-areatype="menu-panel"] > .toolbarbutton-icon,
toolbarbutton[constrain-size="true"][cui-areatype="menu-panel"] > .toolbarbutton-badge-container > .toolbarbutton-icon {
height: 32px;
width: 32px;
}

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

@ -733,12 +733,12 @@ toolbarbutton[cui-areatype="toolbar"] > :-moz-any(@nestedButtons@) > .toolbarbut
}
/* Help SDK icons fit: */
toolbarbutton[sdk-button="true"][cui-areatype="toolbar"] > .toolbarbutton-icon,
toolbarbutton[sdk-button="true"][cui-areatype="toolbar"] > .toolbarbutton-badge-container > .toolbarbutton-icon {
toolbarbutton[constrain-size="true"][cui-areatype="toolbar"] > .toolbarbutton-icon,
toolbarbutton[constrain-size="true"][cui-areatype="toolbar"] > .toolbarbutton-badge-container > .toolbarbutton-icon {
width: 16px;
}
#nav-bar toolbarbutton[sdk-button="true"][cui-areatype="toolbar"] > .toolbarbutton-icon {
#nav-bar toolbarbutton[constrain-size="true"][cui-areatype="toolbar"] > .toolbarbutton-icon {
/* XXXgijs box models strike again: this is 16px + 2 * 7px padding + 2 * 1px border (from the rules above) */
width: 32px;
}
@ -1630,13 +1630,6 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
}
toolbarbutton[type="socialmark"] > .toolbarbutton-icon {
width: auto;
height: auto;
max-width: 32px;
max-height: 24px;
}
/* fixup corners for share panel */
.social-panel > .social-panel-frame {
border-radius: inherit;

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

@ -980,8 +980,21 @@ nsExpandedPrincipal::IsOnCSSUnprefixingWhitelist()
void
nsExpandedPrincipal::GetScriptLocation(nsACString& aStr)
{
// Is that a good idea to list it's principals?
aStr.Assign(EXPANDED_PRINCIPAL_SPEC);
aStr.AppendLiteral(" (");
for (size_t i = 0; i < mPrincipals.Length(); ++i) {
if (i != 0) {
aStr.AppendLiteral(", ");
}
nsAutoCString spec;
nsJSPrincipals::get(mPrincipals.ElementAt(i))->GetScriptLocation(spec);
aStr.Append(spec);
}
aStr.Append(")");
}
#ifdef DEBUG

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

@ -446,6 +446,9 @@ GLContextEGL::ReleaseSurface() {
if (mOwnsContext) {
mozilla::gl::DestroySurface(mSurface);
}
if (mSurface == mSurfaceOverride) {
mSurfaceOverride = EGL_NO_SURFACE;
}
mSurface = EGL_NO_SURFACE;
}
@ -813,6 +816,41 @@ GLContextProviderEGL::CreateForWindow(nsIWidget *aWidget)
return glContext.forget();
}
#if defined(ANDROID)
EGLSurface
GLContextProviderEGL::CreateEGLSurface(void* aWindow)
{
if (!sEGLLibrary.EnsureInitialized()) {
MOZ_CRASH("Failed to load EGL library!\n");
}
EGLConfig config;
if (!CreateConfig(&config)) {
MOZ_CRASH("Failed to create EGLConfig!\n");
}
MOZ_ASSERT(aWindow);
EGLSurface surface = sEGLLibrary.fCreateWindowSurface(EGL_DISPLAY(), config, aWindow, 0);
if (surface == EGL_NO_SURFACE) {
MOZ_CRASH("Failed to create EGLSurface!\n");
}
return surface;
}
void
GLContextProviderEGL::DestroyEGLSurface(EGLSurface surface)
{
if (!sEGLLibrary.EnsureInitialized()) {
MOZ_CRASH("Failed to load EGL library!\n");
}
sEGLLibrary.fDestroySurface(EGL_DISPLAY(), surface);
}
#endif // defined(ANDROID)
already_AddRefed<GLContextEGL>
GLContextEGL::CreateEGLPBufferOffscreenContext(const gfxIntSize& size)
{

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

@ -10,6 +10,9 @@
#ifndef GL_CONTEXT_PROVIDER_NAME
#error GL_CONTEXT_PROVIDER_NAME not defined
#endif
#if defined(ANDROID)
typedef void* EGLSurface;
#endif // defined(ANDROID)
class GL_CONTEXT_PROVIDER_NAME
{
@ -76,6 +79,11 @@ public:
static already_AddRefed<GLContext>
CreateWrappingExisting(void* aContext, void* aSurface);
#if defined(ANDROID)
static EGLSurface CreateEGLSurface(void* aWindow);
static void DestroyEGLSurface(EGLSurface surface);
#endif // defined(ANDROID)
/**
* Get a pointer to the global context, creating it if it doesn't exist.
*/

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

@ -55,6 +55,11 @@
#include "nsRegion.h" // for nsIntRegion, etc
#ifdef MOZ_WIDGET_ANDROID
#include <android/log.h>
#include "AndroidBridge.h"
#include "opengl/CompositorOGL.h"
#include "GLContextEGL.h"
#include "GLContextProvider.h"
#include "ScopedGLHelpers.h"
#endif
#include "GeckoProfiler.h"
#include "TextRenderer.h" // for TextRenderer
@ -307,6 +312,9 @@ LayerManagerComposite::EndTransaction(DrawPaintedLayerCallback aCallback,
ApplyOcclusionCulling(mRoot, opaque);
Render();
#ifdef MOZ_WIDGET_ANDROID
RenderToPresentationSurface();
#endif
mGeometryChanged = false;
} else {
// Modified layer tree
@ -769,6 +777,175 @@ LayerManagerComposite::Render()
RecordFrame();
}
#ifdef MOZ_WIDGET_ANDROID
class ScopedCompositorProjMatrix {
public:
ScopedCompositorProjMatrix(CompositorOGL* aCompositor, const Matrix4x4& aProjMatrix):
mCompositor(aCompositor),
mOriginalProjMatrix(mCompositor->GetProjMatrix())
{
mCompositor->SetProjMatrix(aProjMatrix);
}
~ScopedCompositorProjMatrix()
{
mCompositor->SetProjMatrix(mOriginalProjMatrix);
}
private:
CompositorOGL* const mCompositor;
const Matrix4x4 mOriginalProjMatrix;
};
class ScopedCompostitorSurfaceSize {
public:
ScopedCompostitorSurfaceSize(CompositorOGL* aCompositor, const gfx::IntSize& aSize) :
mCompositor(aCompositor),
mOriginalSize(mCompositor->GetDestinationSurfaceSize())
{
mCompositor->SetDestinationSurfaceSize(aSize);
}
~ScopedCompostitorSurfaceSize()
{
mCompositor->SetDestinationSurfaceSize(mOriginalSize);
}
private:
CompositorOGL* const mCompositor;
const gfx::IntSize mOriginalSize;
};
class ScopedCompositorRenderOffset {
public:
ScopedCompositorRenderOffset(CompositorOGL* aCompositor, const ScreenPoint& aOffset) :
mCompositor(aCompositor),
mOriginalOffset(mCompositor->GetScreenRenderOffset())
{
mCompositor->SetScreenRenderOffset(aOffset);
}
~ScopedCompositorRenderOffset()
{
mCompositor->SetScreenRenderOffset(mOriginalOffset);
}
private:
CompositorOGL* const mCompositor;
const ScreenPoint mOriginalOffset;
};
class ScopedContextSurfaceOverride {
public:
ScopedContextSurfaceOverride(GLContextEGL* aContext, void* aSurface) :
mContext(aContext)
{
MOZ_ASSERT(aSurface);
mContext->SetEGLSurfaceOverride(aSurface);
mContext->MakeCurrent(true);
}
~ScopedContextSurfaceOverride()
{
mContext->SetEGLSurfaceOverride(EGL_NO_SURFACE);
mContext->MakeCurrent(true);
}
private:
GLContextEGL* const mContext;
};
void
LayerManagerComposite::RenderToPresentationSurface()
{
if (!AndroidBridge::Bridge()) {
return;
}
void* window = AndroidBridge::Bridge()->GetPresentationWindow();
if (!window) {
return;
}
EGLSurface surface = AndroidBridge::Bridge()->GetPresentationSurface();
if (!surface) {
//create surface;
surface = GLContextProviderEGL::CreateEGLSurface(window);
if (!surface) {
return;
}
AndroidBridge::Bridge()->SetPresentationSurface(surface);
}
CompositorOGL* compositor = static_cast<CompositorOGL*>(mCompositor.get());
GLContext* gl = compositor->gl();
GLContextEGL* egl = GLContextEGL::Cast(gl);
if (!egl) {
return;
}
const IntSize windowSize = AndroidBridge::Bridge()->GetNativeWindowSize(window);
if ((windowSize.width <= 0) || (windowSize.height <= 0)) {
return;
}
const int actualWidth = windowSize.width;
const int actualHeight = windowSize.height;
const gfx::IntSize originalSize = compositor->GetDestinationSurfaceSize();
const int pageWidth = originalSize.width;
const int pageHeight = originalSize.height;
float scale = 1.0;
if ((pageWidth > actualWidth) || (pageHeight > actualHeight)) {
const float scaleWidth = (float)actualWidth / (float)pageWidth;
const float scaleHeight = (float)actualHeight / (float)pageHeight;
scale = scaleWidth <= scaleHeight ? scaleWidth : scaleHeight;
}
const gfx::IntSize actualSize(actualWidth, actualHeight);
ScopedCompostitorSurfaceSize overrideSurfaceSize(compositor, actualSize);
const ScreenPoint offset((actualWidth - (int)(scale * pageWidth)) / 2, 0);
ScopedCompositorRenderOffset overrideRenderOffset(compositor, offset);
ScopedContextSurfaceOverride overrideSurface(egl, surface);
nsIntRegion invalid;
Rect bounds(0.0f, 0.0f, scale * pageWidth, (float)actualHeight);
Rect rect, actualBounds;
mCompositor->BeginFrame(invalid, nullptr, bounds, &rect, &actualBounds);
// Override the projection matrix since the presentation frame buffer
// is probably not the same size as the device frame buffer. The override
// projection matrix also scales the content to fit into the presentation
// frame buffer.
Matrix viewMatrix;
viewMatrix.PreTranslate(-1.0, 1.0);
viewMatrix.PreScale((2.0f * scale) / (float)actualWidth, (2.0f * scale) / (float)actualHeight);
viewMatrix.PreScale(1.0f, -1.0f);
viewMatrix.PreTranslate((int)((float)offset.x / scale), offset.y);
Matrix4x4 projMatrix = Matrix4x4::From2D(viewMatrix);
ScopedCompositorProjMatrix overrideProjMatrix(compositor, projMatrix);
// The Java side of Fennec sets a scissor rect that accounts for
// chrome such as the URL bar. Override that so that the entire frame buffer
// is cleared.
ScopedScissorRect screen(egl, 0, 0, actualWidth, actualHeight);
egl->fClearColor(0.0, 0.0, 0.0, 0.0);
egl->fClear(LOCAL_GL_COLOR_BUFFER_BIT);
const nsIntRect clipRect = nsIntRect(0, 0, (int)(scale * pageWidth), actualHeight);
RootLayer()->Prepare(RenderTargetPixel::FromUntyped(clipRect));
RootLayer()->RenderLayer(clipRect);
mCompositor->EndFrame();
mCompositor->SetFBAcquireFence(mRoot);
}
#endif
static void
SubtractTransformedRegion(nsIntRegion& aRegion,
const nsIntRegion& aRegionToSubtract,

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

@ -278,6 +278,9 @@ private:
* Render the current layer tree to the active target.
*/
void Render();
#ifdef MOZ_WIDGET_ANDROID
void RenderToPresentationSurface();
#endif
/**
* Render debug overlays such as the FPS/FrameCounter above the frame.

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

@ -800,6 +800,22 @@ CompositorParent::SchedulePauseOnCompositorThread()
lock.Wait();
}
bool
CompositorParent::ScheduleResumeOnCompositorThread()
{
MonitorAutoLock lock(mResumeCompositionMonitor);
CancelableTask *resumeTask =
NewRunnableMethod(this, &CompositorParent::ResumeComposition);
MOZ_ASSERT(CompositorLoop());
CompositorLoop()->PostTask(FROM_HERE, resumeTask);
// Wait until the resume has actually been processed by the compositor thread
lock.Wait();
return !mPaused;
}
bool
CompositorParent::ScheduleResumeOnCompositorThread(int width, int height)
{

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

@ -226,6 +226,7 @@ public:
* Returns true if a surface was obtained and the resume succeeded; false
* otherwise.
*/
bool ScheduleResumeOnCompositorThread();
bool ScheduleResumeOnCompositorThread(int width, int height);
virtual void ScheduleComposition();

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

@ -304,6 +304,19 @@ public:
const gfx::Matrix4x4& GetProjMatrix() const {
return mProjMatrix;
}
void SetProjMatrix(const gfx::Matrix4x4& aProjMatrix) {
mProjMatrix = aProjMatrix;
}
const gfx::IntSize GetDestinationSurfaceSize() const {
return gfx::IntSize (mSurfaceSize.width, mSurfaceSize.height);
}
const ScreenPoint& GetScreenRenderOffset() const {
return mRenderOffset;
}
private:
virtual gfx::IntSize GetWidgetSize() const override
{

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

@ -1507,7 +1507,7 @@ xpc::EvalInSandbox(JSContext* cx, HandleObject sandboxArg, const nsAString& sour
NS_ENSURE_TRUE(prin, NS_ERROR_FAILURE);
nsAutoCString filenameBuf;
if (!filename.IsVoid()) {
if (!filename.IsVoid() && filename.Length() != 0) {
filenameBuf.Assign(filename);
} else {
// Default to the spec of the principal.

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

@ -0,0 +1,28 @@
"use strict";
const { utils: Cu, interfaces: Ci, classes: Cc } = Components;
/**
* Test that the name of a sandbox contains the name of all principals.
*/
function test_sandbox_name() {
let names = [
"http://example.com/?" + Math.random(),
"http://example.org/?" + Math.random()
];
let sandbox = Cu.Sandbox(names);
let fileName = Cu.evalInSandbox(
"(new Error()).fileName",
sandbox,
"latest" /*js version*/,
""/*file name*/
);
for (let name of names) {
Assert.ok(fileName.indexOf(name) != -1, `Name ${name} appears in ${fileName}`);
}
};
function run_test() {
test_sandbox_name();
}

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

@ -99,6 +99,7 @@ skip-if = os == "android" # native test components aren't available on Android
[test_sandbox_atob.js]
[test_isProxy.js]
[test_getObjectPrincipal.js]
[test_sandbox_name.js]
[test_watchdog_enable.js]
head = head_watchdog.js
[test_watchdog_disable.js]

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

@ -779,6 +779,7 @@ public class BrowserApp extends GeckoApp
"Menu:Add",
"Menu:Remove",
"Reader:Share",
"Sanitize:ClearHistory",
"Settings:Show",
"Telemetry:Gather",
"Updater:Launch");
@ -1324,6 +1325,7 @@ public class BrowserApp extends GeckoApp
"Menu:Add",
"Menu:Remove",
"Reader:Share",
"Sanitize:ClearHistory",
"Settings:Show",
"Telemetry:Gather",
"Updater:Launch");
@ -1360,6 +1362,16 @@ public class BrowserApp extends GeckoApp
}
}
private void handleClearHistory(final boolean clearSearchHistory) {
final BrowserDB db = getProfile().getDB();
ThreadUtils.postToBackgroundThread(new Runnable() {
@Override
public void run() {
db.clearHistory(getContentResolver(), clearSearchHistory);
}
});
}
private void shareCurrentUrl() {
Tab tab = Tabs.getInstance().getSelectedTab();
if (tab == null) {
@ -1636,7 +1648,9 @@ public class BrowserApp extends GeckoApp
final String title = message.getString("title");
final String url = message.getString("url");
GeckoAppShell.openUriExternal(url, "text/plain", "", "", Intent.ACTION_SEND, title);
} else if ("Sanitize:ClearHistory".equals(event)) {
handleClearHistory(message.optBoolean("clearSearchHistory", false));
callback.sendSuccess(true);
} else if ("Settings:Show".equals(event)) {
final String resource =
message.optString(GeckoPreferences.INTENT_EXTRA_RESOURCES, null);

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

@ -523,16 +523,6 @@ public abstract class GeckoApp
outState.putString(SAVED_STATE_PRIVATE_SESSION, mPrivateBrowsingSession);
}
void handleClearHistory(final boolean clearSearchHistory) {
final BrowserDB db = getProfile().getDB();
ThreadUtils.postToBackgroundThread(new Runnable() {
@Override
public void run() {
db.clearHistory(getContentResolver(), clearSearchHistory);
}
});
}
public void addTab() { }
public void addPrivateTab() { }
@ -625,10 +615,6 @@ public abstract class GeckoApp
} else if ("PrivateBrowsing:Data".equals(event)) {
mPrivateBrowsingSession = message.optString("session", null);
} else if ("Sanitize:ClearHistory".equals(event)) {
handleClearHistory(message.optBoolean("clearSearchHistory", false));
callback.sendSuccess(true);
} else if ("Session:StatePurged".equals(event)) {
onStatePurged();
@ -1547,7 +1533,6 @@ public abstract class GeckoApp
"Locale:Set",
"Permissions:Data",
"PrivateBrowsing:Data",
"Sanitize:ClearHistory",
"Session:StatePurged",
"Share:Text",
"SystemUI:Visibility",
@ -2039,7 +2024,6 @@ public abstract class GeckoApp
"Locale:Set",
"Permissions:Data",
"PrivateBrowsing:Data",
"Sanitize:ClearHistory",
"Session:StatePurged",
"Share:Text",
"SystemUI:Visibility",

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

@ -294,6 +294,9 @@ public class GeckoAppShell
public static native SurfaceBits getSurfaceBits(Surface surface);
public static native void addPresentationSurface(Surface surface);
public static native void removePresentationSurface(Surface surface);
public static native void onFullScreenPluginHidden(View view);
public static class CreateShortcutFaviconLoadedListener implements OnFaviconLoadedListener {

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

@ -5,6 +5,9 @@
package org.mozilla.gecko;
import android.app.Presentation;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.media.MediaControlIntent;
@ -12,6 +15,13 @@ import android.support.v7.media.MediaRouteSelector;
import android.support.v7.media.MediaRouter;
import android.support.v7.media.MediaRouter.RouteInfo;
import android.util.Log;
import android.view.Display;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import com.google.android.gms.cast.CastMediaControlIntent;
@ -61,6 +71,7 @@ public class MediaPlayerManager extends Fragment implements NativeEventListener
private MediaRouter mediaRouter = null;
private final Map<String, GeckoMediaPlayer> displays = new HashMap<String, GeckoMediaPlayer>();
private GeckoPresentation presentation = null;
@Override
public void onCreate(Bundle savedInstanceState) {
@ -135,19 +146,23 @@ public class MediaPlayerManager extends Fragment implements NativeEventListener
displays.remove(route.getId());
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent(
"MediaPlayer:Removed", route.getId()));
updatePresentation();
}
@SuppressWarnings("unused")
public void onRouteSelected(MediaRouter router, int type, MediaRouter.RouteInfo route) {
updatePresentation();
}
// These methods aren't used by the support version Media Router
@SuppressWarnings("unused")
public void onRouteUnselected(MediaRouter router, int type, RouteInfo route) {
updatePresentation();
}
@Override
public void onRoutePresentationDisplayChanged(MediaRouter router, RouteInfo route) {
updatePresentation();
}
@Override
@ -159,6 +174,7 @@ public class MediaPlayerManager extends Fragment implements NativeEventListener
debug("onRouteAdded: route=" + route);
final GeckoMediaPlayer display = getMediaPlayerForRoute(route);
saveAndNotifyOfDisplay("MediaPlayer:Added", route, display);
updatePresentation();
}
@Override
@ -166,6 +182,7 @@ public class MediaPlayerManager extends Fragment implements NativeEventListener
debug("onRouteChanged: route=" + route);
final GeckoMediaPlayer display = displays.get(route.getId());
saveAndNotifyOfDisplay("MediaPlayer:Changed", route, display);
updatePresentation();
}
private void saveAndNotifyOfDisplay(final String eventName,
@ -221,4 +238,86 @@ public class MediaPlayerManager extends Fragment implements NativeEventListener
.build();
mediaRouter.addCallback(selectorBuilder, callback, MediaRouter.CALLBACK_FLAG_REQUEST_DISCOVERY);
}
@Override
public void onStop() {
super.onStop();
if (presentation != null) {
presentation.dismiss();
presentation = null;
}
}
private void updatePresentation() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
return;
}
if (mediaRouter == null) {
return;
}
MediaRouter.RouteInfo route = mediaRouter.getSelectedRoute();
Display display = route != null ? route.getPresentationDisplay() : null;
if (display != null) {
if ((presentation != null) && (presentation.getDisplay() != display)) {
presentation.dismiss();
presentation = null;
}
if (presentation == null) {
presentation = new GeckoPresentation(getActivity(), display);
try {
presentation.show();
} catch (WindowManager.InvalidDisplayException ex) {
Log.w(LOGTAG, "Couldn't show presentation! Display was removed in "
+ "the meantime.", ex);
presentation = null;
}
}
} else if (presentation != null) {
presentation.dismiss();
presentation = null;
}
}
private static class SurfaceListener implements SurfaceHolder.Callback {
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
// Surface changed so force a composite
GeckoAppShell.scheduleComposite();
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
GeckoAppShell.addPresentationSurface(holder.getSurface());
GeckoAppShell.scheduleComposite();
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
GeckoAppShell.removePresentationSurface(holder.getSurface());
}
}
private final static class GeckoPresentation extends Presentation {
private SurfaceView mView;
public GeckoPresentation(Context context, Display display) {
super(context, display);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mView = new SurfaceView(getContext());
setContentView(mView, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mView.getHolder().addCallback(new SurfaceListener());
}
}
}

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

@ -4,6 +4,7 @@
package org.mozilla.gecko;
import android.content.res.Resources;
import org.mozilla.gecko.gfx.BitmapUtils;
import org.mozilla.gecko.gfx.BitmapUtils.BitmapLoader;
import org.mozilla.gecko.gfx.Layer;
@ -16,6 +17,7 @@ import org.mozilla.gecko.util.FloatUtils;
import org.mozilla.gecko.util.GeckoEventListener;
import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.gecko.ActionModeCompat.Callback;
import org.mozilla.gecko.AppConstants.Versions;
import android.content.Context;
import android.app.Activity;
@ -279,11 +281,23 @@ class TextSelection extends Layer implements GeckoEventListener {
final int actionEnum = obj.optBoolean("showAsAction") ? GeckoMenuItem.SHOW_AS_ACTION_ALWAYS : GeckoMenuItem.SHOW_AS_ACTION_NEVER;
menuitem.setShowAsAction(actionEnum, R.attr.menuItemActionModeStyle);
BitmapUtils.getDrawable(anchorHandle.getContext(), obj.optString("icon"), new BitmapLoader() {
final String iconString = obj.optString("icon");
BitmapUtils.getDrawable(anchorHandle.getContext(), iconString, new BitmapLoader() {
@Override
public void onBitmapFound(Drawable d) {
if (d != null) {
menuitem.setIcon(d);
// Dynamically add padding to align the share icon on GB devices.
// To be removed in bug 1122752.
if (Versions.preHC && "drawable://ic_menu_share".equals(iconString)) {
final View view = menuitem.getActionView();
final Resources res = view.getContext().getResources();
final int padding = res.getDimensionPixelSize(R.dimen.ab_share_padding);
view.setPadding(padding, padding, padding, padding);
}
}
}
});

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

@ -213,6 +213,10 @@
<dimen name="find_in_page_matchcase_padding">10dip</dimen>
<dimen name="find_in_page_control_margin_top">2dip</dimen>
<!-- The share icon asset has no padding while the other action bar items do
so we dynamically add padding to compensate. To be removed in bug 1122752. -->
<dimen name="ab_share_padding">12dp</dimen>
<!-- This is a 4:7 ratio (as per UX decision). -->
<item name="thumbnail_aspect_ratio" format="float" type="dimen">0.571</item>

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

@ -5,8 +5,6 @@
"use strict";
XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode", "resource://gre/modules/ReaderMode.jsm");
let Reader = {
// These values should match those defined in BrowserContract.java.
STATUS_UNFETCHED: 0,

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

@ -113,6 +113,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "Notifications",
XPCOMUtils.defineLazyModuleGetter(this, "GMPInstallManager",
"resource://gre/modules/GMPInstallManager.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode", "resource://gre/modules/ReaderMode.jsm");
let lazilyLoadedBrowserScripts = [
["SelectHelper", "chrome://browser/content/SelectHelper.js"],
["InputWidgetHelper", "chrome://browser/content/InputWidgetHelper.js"],
@ -4562,16 +4564,7 @@ Tab.prototype = {
},
_stripAboutReaderURL: function (url) {
if (!url.startsWith("about:reader")) {
return url;
}
// From ReaderParent._getOriginalUrl (browser/modules/ReaderParent.jsm).
let searchParams = new URLSearchParams(url.substring("about:reader?".length));
if (!searchParams.has("url")) {
return url;
}
return decodeURIComponent(searchParams.get("url"));
return ReaderMode.getOriginalUrl(url) || url;
},
// Properties used to cache security state used to update the UI

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

@ -305,6 +305,44 @@ Java_org_mozilla_gecko_GeckoAppShell_getSurfaceBits(JNIEnv * arg0, jclass arg1,
#ifdef JNI_STUBS
typedef void (*Java_org_mozilla_gecko_GeckoAppShell_addPresentationSurface_t)(JNIEnv *, jclass, jobject);
static Java_org_mozilla_gecko_GeckoAppShell_addPresentationSurface_t f_Java_org_mozilla_gecko_GeckoAppShell_addPresentationSurface;
extern "C" NS_EXPORT void JNICALL
Java_org_mozilla_gecko_GeckoAppShell_addPresentationSurface(JNIEnv * arg0, jclass arg1, jobject arg2) {
if (!f_Java_org_mozilla_gecko_GeckoAppShell_addPresentationSurface) {
arg0->ThrowNew(arg0->FindClass("java/lang/UnsupportedOperationException"),
"JNI Function called before it was loaded");
return ;
}
f_Java_org_mozilla_gecko_GeckoAppShell_addPresentationSurface(arg0, arg1, arg2);
}
#endif
#ifdef JNI_BINDINGS
xul_dlsym("Java_org_mozilla_gecko_GeckoAppShell_addPresentationSurface", &f_Java_org_mozilla_gecko_GeckoAppShell_addPresentationSurface);
#endif
#ifdef JNI_STUBS
typedef void (*Java_org_mozilla_gecko_GeckoAppShell_removePresentationSurface_t)(JNIEnv *, jclass, jobject);
static Java_org_mozilla_gecko_GeckoAppShell_removePresentationSurface_t f_Java_org_mozilla_gecko_GeckoAppShell_removePresentationSurface;
extern "C" NS_EXPORT void JNICALL
Java_org_mozilla_gecko_GeckoAppShell_removePresentationSurface(JNIEnv * arg0, jclass arg1, jobject arg2) {
if (!f_Java_org_mozilla_gecko_GeckoAppShell_removePresentationSurface) {
arg0->ThrowNew(arg0->FindClass("java/lang/UnsupportedOperationException"),
"JNI Function called before it was loaded");
return ;
}
f_Java_org_mozilla_gecko_GeckoAppShell_removePresentationSurface(arg0, arg1, arg2);
}
#endif
#ifdef JNI_BINDINGS
xul_dlsym("Java_org_mozilla_gecko_GeckoAppShell_removePresentationSurface", &f_Java_org_mozilla_gecko_GeckoAppShell_removePresentationSurface);
#endif
#ifdef JNI_STUBS
typedef void (*Java_org_mozilla_gecko_GeckoAppShell_onFullScreenPluginHidden_t)(JNIEnv *, jclass, jobject);
static Java_org_mozilla_gecko_GeckoAppShell_onFullScreenPluginHidden_t f_Java_org_mozilla_gecko_GeckoAppShell_onFullScreenPluginHidden;
extern "C" NS_EXPORT void JNICALL

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

@ -2,12 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#if defined(MOZ_UPDATER)
# if !defined(MOZ_WIDGET_ANDROID)
# define USE_MOZ_UPDATER
# endif
#endif
#define NS_ALERTSERVICE_CONTRACTID \
"@mozilla.org/alerts-service;1"
@ -90,7 +84,7 @@
#define NS_APPSTARTUP_CONTRACTID \
"@mozilla.org/toolkit/app-startup;1"
#if defined(USE_MOZ_UPDATER)
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
#define NS_UPDATEPROCESSOR_CONTRACTID \
"@mozilla.org/updates/update-processor;1"
#endif
@ -173,7 +167,7 @@
#define NS_FAVICONSERVICE_CID \
{ 0x984e3259, 0x9266, 0x49cf, { 0xb6, 0x05, 0x60, 0xb0, 0x22, 0xa0, 0x07, 0x56 } }
#if defined(USE_MOZ_UPDATER)
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
#define NS_UPDATEPROCESSOR_CID \
{ 0xf3dcf644, 0x79e8, 0x4f59, { 0xa1, 0xbb, 0x87, 0x84, 0x54, 0x48, 0x8e, 0xf9 } }
#endif

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

@ -7,7 +7,7 @@
#include "nsUserInfo.h"
#include "nsToolkitCompsCID.h"
#include "nsFindService.h"
#if defined(USE_MOZ_UPDATER)
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
#include "nsUpdateDriver.h"
#endif
@ -109,7 +109,7 @@ nsUrlClassifierDBServiceConstructor(nsISupports *aOuter, REFNSIID aIID,
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBrowserStatusFilter)
#if defined(USE_MOZ_UPDATER)
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUpdateProcessor)
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR(FinalizationWitnessService)
@ -141,7 +141,7 @@ NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERSTREAMUPDATER_CID);
NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERUTILS_CID);
#endif
NS_DEFINE_NAMED_CID(NS_BROWSERSTATUSFILTER_CID);
#if defined(USE_MOZ_UPDATER)
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
NS_DEFINE_NAMED_CID(NS_UPDATEPROCESSOR_CID);
#endif
NS_DEFINE_NAMED_CID(FINALIZATIONWITNESSSERVICE_CID);
@ -173,7 +173,7 @@ static const Module::CIDEntry kToolkitCIDs[] = {
{ &kNS_URLCLASSIFIERUTILS_CID, false, nullptr, nsUrlClassifierUtilsConstructor },
#endif
{ &kNS_BROWSERSTATUSFILTER_CID, false, nullptr, nsBrowserStatusFilterConstructor },
#if defined(USE_MOZ_UPDATER)
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
{ &kNS_UPDATEPROCESSOR_CID, false, nullptr, nsUpdateProcessorConstructor },
#endif
{ &kFINALIZATIONWITNESSSERVICE_CID, false, nullptr, FinalizationWitnessServiceConstructor },
@ -207,7 +207,7 @@ static const Module::ContractIDEntry kToolkitContracts[] = {
{ NS_URLCLASSIFIERUTILS_CONTRACTID, &kNS_URLCLASSIFIERUTILS_CID },
#endif
{ NS_BROWSERSTATUSFILTER_CONTRACTID, &kNS_BROWSERSTATUSFILTER_CID },
#if defined(USE_MOZ_UPDATER)
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
{ NS_UPDATEPROCESSOR_CONTRACTID, &kNS_UPDATEPROCESSOR_CID },
#endif
{ FINALIZATIONWITNESSSERVICE_CONTRACTID, &kFINALIZATIONWITNESSSERVICE_CID },

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

@ -48,6 +48,7 @@ DIRS += [
'statusfilter',
'telemetry',
'thumbnails',
'timermanager',
'typeaheadfind',
'urlformatter',
'viewconfig',

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

@ -8,6 +8,7 @@ let Ci = Components.interfaces, Cc = Components.classes, Cu = Components.utils;
this.EXPORTED_SYMBOLS = [ "AboutReader" ];
Cu.import("resource://gre/modules/ReaderMode.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
@ -734,9 +735,8 @@ AboutReader.prototype = {
this._domainElement.href = article.url;
let articleUri = Services.io.newURI(article.url, null, null);
this._domainElement.innerHTML = this._stripHost(articleUri.host);
this._creditsElement.innerHTML = article.byline;
this._domainElement.textContent = this._stripHost(articleUri.host);
this._creditsElement.textContent = article.byline;
this._titleElement.textContent = article.title;
this._doc.title = article.title;
@ -787,12 +787,7 @@ AboutReader.prototype = {
*/
_getOriginalUrl: function(win) {
let url = win ? win.location.href : this._win.location.href;
let searchParams = new URLSearchParams(url.split("?")[1]);
if (!searchParams.has("url")) {
Cu.reportError("Error finding original URL for about:reader URL: " + url);
return url;
}
return decodeURIComponent(searchParams.get("url"));
return ReaderMode.getOriginalUrl(url) || url;
},
_setupSegmentedButton: function Reader_setupSegmentedButton(id, options, initialValue, callback) {

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

@ -67,6 +67,31 @@ this.ReaderMode = {
}
},
/**
* Returns original URL from an about:reader URL.
*
* @param url An about:reader URL.
* @return The original URL for the article, or null if we did not find
* a properly formatted about:reader URL.
*/
getOriginalUrl: function(url) {
if (!url.startsWith("about:reader?")) {
return null;
}
let searchParams = new URLSearchParams(url.substring("about:reader?".length));
if (!searchParams.has("url")) {
return null;
}
let encodedURL = searchParams.get("url");
try {
return decodeURIComponent(encodedURL);
} catch (e) {
Cu.reportError("Error decoding original URL: " + e);
return encodedURL;
}
},
/**
* Decides whether or not a document is reader-able without parsing the whole thing.
*

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

@ -84,11 +84,12 @@ this.AutoCompleteE10S = {
messageManager.addMessageListener("FormAutoComplete:ClosePopup", this);
},
_initPopup: function(browserWindow, rect) {
_initPopup: function(browserWindow, rect, direction) {
this.browser = browserWindow.gBrowser.selectedBrowser;
this.popup = this.browser.autoCompletePopup;
this.popup.hidden = false;
this.popup.setAttribute("width", rect.width);
this.popup.style.direction = direction;
this.x = rect.left;
this.y = rect.top + rect.height;
@ -137,8 +138,9 @@ this.AutoCompleteE10S = {
search: function(message) {
let browserWindow = message.target.ownerDocument.defaultView;
let rect = message.data;
let direction = message.data.direction;
this._initPopup(browserWindow, rect);
this._initPopup(browserWindow, rect, direction);
let formAutoComplete = Cc["@mozilla.org/satchel/form-autocomplete;1"]
.getService(Ci.nsIFormAutoComplete);

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

@ -372,9 +372,10 @@ FormAutoCompleteChild.prototype = {
this.stopAutoCompleteSearch();
}
let rect = BrowserUtils.getElementBoundingScreenRect(aField);
let window = aField.ownerDocument.defaultView;
let rect = BrowserUtils.getElementBoundingScreenRect(aField);
let direction = window.getComputedStyle(aField).direction;
let topLevelDocshell = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDocShell)
.sameTypeRootTreeItem
@ -389,7 +390,8 @@ FormAutoCompleteChild.prototype = {
left: rect.left,
top: rect.top,
width: rect.width,
height: rect.height
height: rect.height,
direction: direction,
});
let search = this._pendingSearch = {};

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

@ -0,0 +1,21 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
XPIDL_MODULE = 'update'
XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
XPIDL_SOURCES += [
'nsIUpdateTimerManager.idl',
]
EXTRA_COMPONENTS += [
'nsUpdateTimerManager.js',
'nsUpdateTimerManager.manifest',
]
with Files('**'):
BUG_COMPONENT = ('Toolkit', 'Application Update')

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

@ -471,11 +471,23 @@ let PinnedLinks = {
* Singleton that keeps track of all blocked links in the grid.
*/
let BlockedLinks = {
/**
* A list of objects that are observing blocked link changes.
*/
_observers: [],
/**
* The cached list of blocked links.
*/
_links: null,
/**
* Registers an object that will be notified when the blocked links change.
*/
addObserver: function (aObserver) {
this._observers.push(aObserver);
},
/**
* The list of blocked links.
*/
@ -487,10 +499,11 @@ let BlockedLinks = {
},
/**
* Blocks a given link.
* Blocks a given link. Adjusts siteMap accordingly, and notifies listeners.
* @param aLink The link to block.
*/
block: function BlockedLinks_block(aLink) {
this._callObservers("onLinkBlocked", aLink);
this.links[toHash(aLink.url)] = 1;
this.save();
@ -499,13 +512,14 @@ let BlockedLinks = {
},
/**
* Unblocks a given link.
* Unblocks a given link. Adjusts siteMap accordingly, and notifies listeners.
* @param aLink The link to unblock.
*/
unblock: function BlockedLinks_unblock(aLink) {
if (this.isBlocked(aLink)) {
delete this.links[toHash(aLink.url)];
this.save();
this._callObservers("onLinkUnblocked", aLink);
}
},
@ -537,6 +551,18 @@ let BlockedLinks = {
*/
resetCache: function BlockedLinks_resetCache() {
this._links = null;
},
_callObservers(methodName, ...args) {
for (let obs of this._observers) {
if (typeof(obs[methodName]) == "function") {
try {
obs[methodName](...args);
} catch (err) {
Cu.reportError(err);
}
}
}
}
};
@ -719,6 +745,8 @@ let Links = {
* A mapping from each provider to an object { sortedLinks, siteMap, linkMap }.
* sortedLinks is the cached, sorted array of links for the provider.
* siteMap is a mapping from base domains to URL count associated with the domain.
* The count does not include blocked URLs. siteMap is used to look up a
* user's top sites that can be targeted with a suggested tile.
* linkMap is a Map from link URLs to link objects.
*/
_providers: new Map(),
@ -737,6 +765,18 @@ let Links = {
*/
_populateCallbacks: [],
/**
* A list of objects that are observing links updates.
*/
_observers: [],
/**
* Registers an object that will be notified when links updates.
*/
addObserver: function (aObserver) {
this._observers.push(aObserver);
},
/**
* Adds a link provider.
* @param aProvider The link provider.
@ -861,11 +901,19 @@ let Links = {
},
_incrementSiteMap: function(map, link) {
if (NewTabUtils.blockedLinks.isBlocked(link)) {
// Don't count blocked URLs.
return;
}
let site = NewTabUtils.extractSite(link.url);
map.set(site, (map.get(site) || 0) + 1);
},
_decrementSiteMap: function(map, link) {
if (NewTabUtils.blockedLinks.isBlocked(link)) {
// Blocked URLs are not included in map.
return;
}
let site = NewTabUtils.extractSite(link.url);
let previousURLCount = map.get(site);
if (previousURLCount === 1) {
@ -875,6 +923,37 @@ let Links = {
}
},
/**
* Update the siteMap cache based on the link given and whether we need
* to increment or decrement it. We do this by iterating over all stored providers
* to find which provider this link already exists in. For providers that
* have this link, we will adjust siteMap for them accordingly.
*
* @param aLink The link that will affect siteMap
* @param increment A boolean for whether to increment or decrement siteMap
*/
_adjustSiteMapAndNotify: function(aLink, increment=true) {
for (let [provider, cache] of this._providers) {
// We only update siteMap if aLink is already stored in linkMap.
if (cache.linkMap.get(aLink.url)) {
if (increment) {
this._incrementSiteMap(cache.siteMap, aLink);
continue;
}
this._decrementSiteMap(cache.siteMap, aLink);
}
}
this._callObservers("onLinkChanged", aLink);
},
onLinkBlocked: function(aLink) {
this._adjustSiteMapAndNotify(aLink, false);
},
onLinkUnblocked: function(aLink) {
this._adjustSiteMapAndNotify(aLink);
},
populateProviderCache: function(provider, callback) {
if (!this._providers.has(provider)) {
throw new Error("Can only populate provider cache for existing provider.");
@ -1095,6 +1174,18 @@ let Links = {
this.resetCache();
},
_callObservers(methodName, ...args) {
for (let obs of this._observers) {
if (typeof(obs[methodName]) == "function") {
try {
obs[methodName](this, ...args);
} catch (err) {
Cu.reportError(err);
}
}
}
},
/**
* Adds a sanitization observer and turns itself into a no-op after the first
* invokation.
@ -1235,6 +1326,7 @@ this.NewTabUtils = {
if (this.initWithoutProviders()) {
PlacesProvider.init();
Links.addProvider(PlacesProvider);
BlockedLinks.addObserver(Links);
}
},

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

@ -23,10 +23,17 @@ DIRS += [
'webapps',
]
DIRS += ['mozapps/update']
if CONFIG['MOZ_UPDATER'] and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
DIRS += ['mozapps/update']
if CONFIG['MOZ_MAINTENANCE_SERVICE']:
DIRS += ['components/maintenanceservice']
# Including mozapps/update/common-standalone allows the maintenance service
# to be built so the maintenance service can be used for things other than
# updating applications.
DIRS += [
'mozapps/update/common-standalone',
'components/maintenanceservice'
]
DIRS += ['xre']
@ -61,6 +68,3 @@ with Files('mozapps/plugins/*'):
with Files('mozapps/preferences/*'):
BUG_COMPONENT = ('Toolkit', 'Preferences')
with Files('mozapps/update/*'):
BUG_COMPONENT = ('Toolkit', 'Application Update')

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

@ -10,3 +10,5 @@ include('../common/sources.mozbuild')
if CONFIG['OS_ARCH'] == 'WINNT':
USE_STATIC_LIBS = True
FAIL_ON_WARNINGS = True

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

@ -25,3 +25,5 @@ srcdir = '.'
include('sources.mozbuild')
FINAL_LIBRARY = 'xul'
FAIL_ON_WARNINGS = True

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

@ -4,47 +4,32 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
if CONFIG['MOZ_UPDATER'] or CONFIG['MOZ_MAINTENANCE_SERVICE']:
# If only the maintenance service is installed and not
# the updater, then the maintenance service may still be
# used for other things. We need to build update/common
# which the maintenance service uses.
DIRS += ['common']
if CONFIG['OS_ARCH'] == 'WINNT':
DIRS += ['common-standalone']
if CONFIG['MOZ_UPDATER']:
DIRS += ['updater']
XPIDL_MODULE = 'update'
XPCSHELL_TESTS_MANIFESTS += ['tests/unit_timermanager/xpcshell.ini']
DIRS += [
'common',
'updater',
]
XPIDL_SOURCES += [
'nsIUpdateTimerManager.idl',
'nsIUpdateService.idl',
]
TEST_DIRS += ['tests']
EXTRA_COMPONENTS += [
'nsUpdateTimerManager.js',
'nsUpdateTimerManager.manifest',
'nsUpdateService.js',
'nsUpdateService.manifest',
'nsUpdateServiceStub.js',
]
if CONFIG['MOZ_UPDATER']:
TEST_DIRS += ['tests']
XPIDL_SOURCES += [
'nsIUpdateService.idl',
]
EXTRA_COMPONENTS += [
'nsUpdateService.js',
'nsUpdateService.manifest',
'nsUpdateServiceStub.js',
]
EXTRA_JS_MODULES += [
'UpdateTelemetry.jsm',
]
EXTRA_JS_MODULES += [
'UpdateTelemetry.jsm',
]
JAR_MANIFESTS += ['jar.mn']
FAIL_ON_WARNINGS = True
with Files('**'):
BUG_COMPONENT = ('Toolkit', 'Application Update')

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

@ -18,8 +18,6 @@ xpcshell-data_FILES := $(filter-out $(pp_const_file),$(wildcard $(srcdir)/data/
xpcshell-data_DEST := $(XPCSHELLTESTROOT)/data
xpcshell-data_TARGET := misc
# Android doesn't use the Mozilla updater or the toolkit update UI
ifneq (android,$(MOZ_WIDGET_TOOLKIT))
ifndef MOZ_PROFILE_GENERATE
ifdef COMPILE_ENVIRONMENT
INSTALL_TARGETS += xpcshell-helper
@ -47,11 +45,8 @@ INI_TEST_FILES = \
MOZ_WINCONSOLE = 1
endif # Not Android
include $(topsrcdir)/config/rules.mk
ifneq (android,$(MOZ_WIDGET_TOOLKIT))
# TestAUSReadStrings runs during check in the following directory with a Unicode
# char in order to test bug 473417 on Windows.
ifeq ($(OS_ARCH),WINNT)
@ -67,4 +62,3 @@ check::
done
$(INSTALL) $(FINAL_TARGET)/TestAUSReadStrings$(BIN_SUFFIX) $(DEPTH)/_tests/updater/$(bug473417dir)/
@$(RUN_TEST_PROGRAM) $(DEPTH)/_tests/updater/$(bug473417dir)/TestAUSReadStrings$(BIN_SUFFIX)
endif # Not Android

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

@ -8,37 +8,35 @@ HAS_MISC_RULE = True
XPCSHELL_TESTS_MANIFESTS += ['unit_aus_update/xpcshell.ini']
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
MOCHITEST_CHROME_MANIFESTS += ['chrome/chrome.ini']
XPCSHELL_TESTS_MANIFESTS += ['unit_base_updater/xpcshell.ini']
MOCHITEST_CHROME_MANIFESTS += ['chrome/chrome.ini']
XPCSHELL_TESTS_MANIFESTS += ['unit_base_updater/xpcshell.ini']
if CONFIG['MOZ_MAINTENANCE_SERVICE']:
XPCSHELL_TESTS_MANIFESTS += ['unit_service_updater/xpcshell.ini']
if CONFIG['MOZ_MAINTENANCE_SERVICE']:
XPCSHELL_TESTS_MANIFESTS += ['unit_service_updater/xpcshell.ini']
SimplePrograms([
'TestAUSHelper',
'TestAUSReadStrings',
])
SimplePrograms([
'TestAUSHelper',
'TestAUSReadStrings',
])
LOCAL_INCLUDES += [
'/toolkit/mozapps/update',
'/toolkit/mozapps/update/common',
LOCAL_INCLUDES += [
'/toolkit/mozapps/update',
'/toolkit/mozapps/update/common',
]
if CONFIG['OS_ARCH'] == 'WINNT':
USE_LIBS += [
'updatecommon-standalone',
]
if CONFIG['OS_ARCH'] == 'WINNT':
USE_LIBS += [
'updatecommon-standalone',
]
else:
USE_LIBS += [
'updatecommon',
]
if CONFIG['OS_ARCH'] == 'WINNT':
OS_LIBS += [
'wintrust',
'shlwapi',
]
OS_LIBS += [
'wintrust',
'shlwapi',
]
else:
USE_LIBS += [
'updatecommon',
]
for var in ('MOZ_APP_NAME', 'MOZ_APP_BASENAME', 'MOZ_APP_DISPLAYNAME',
'MOZ_APP_VENDOR', 'BIN_SUFFIX', 'MOZ_DEBUG'):

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

@ -5,7 +5,6 @@
[DEFAULT]
head = head_update.js
tail =
skip-if = toolkit == 'android'
[canCheckForAndCanApplyUpdates.js]
[urlConstruction.js]

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

@ -9,7 +9,6 @@
[DEFAULT]
head = head_update.js
tail =
skip-if = toolkit == 'android'
[marSuccessComplete.js]
[marSuccessPartial.js]

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

@ -10,3 +10,4 @@ updater_rel_path = '../'
NO_DIST_INSTALL = True
DEFINES['UPDATER_XPCSHELL_CERT'] = True
include('../updater-common.build')
FAIL_ON_WARNINGS = True

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

@ -6,13 +6,13 @@ toolkit.jar:
% skin global classic/1.0 %skin/classic/global/
skin/classic/global/10pct_transparent_grey.png
skin/classic/global/50pct_transparent_grey.png
skin/classic/global/about.css (../../windows/global/about.css)
skin/classic/global/aboutCache.css (../../windows/global/aboutCache.css)
skin/classic/global/aboutCacheEntry.css (../../windows/global/aboutCacheEntry.css)
skin/classic/global/aboutMemory.css (../../windows/global/aboutMemory.css)
skin/classic/global/aboutReader.css (../../windows/global/aboutReader.css)
skin/classic/global/aboutSupport.css (../../windows/global/aboutSupport.css)
skin/classic/global/appPicker.css (../../windows/global/appPicker.css)
skin/classic/global/about.css (../../shared/about.css)
skin/classic/global/aboutCache.css (../../shared/aboutCache.css)
skin/classic/global/aboutCacheEntry.css (../../shared/aboutCacheEntry.css)
skin/classic/global/aboutMemory.css (../../shared/aboutMemory.css)
skin/classic/global/aboutReader.css (../../shared/aboutReader.css)
skin/classic/global/aboutSupport.css (../../shared/aboutSupport.css)
skin/classic/global/appPicker.css (../../shared/appPicker.css)
skin/classic/global/arrow.css
skin/classic/global/autocomplete.css
skin/classic/global/button.css

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

@ -4,13 +4,13 @@
toolkit.jar:
% skin global classic/1.0 %skin/classic/global/
skin/classic/global/about.css
skin/classic/global/aboutCache.css
skin/classic/global/aboutCacheEntry.css
skin/classic/global/aboutMemory.css
skin/classic/global/aboutReader.css
skin/classic/global/aboutSupport.css
skin/classic/global/appPicker.css
skin/classic/global/about.css (../../shared/about.css)
skin/classic/global/aboutCache.css (../../shared/aboutCache.css)
skin/classic/global/aboutCacheEntry.css (../../shared/aboutCacheEntry.css)
skin/classic/global/aboutMemory.css (../../shared/aboutMemory.css)
skin/classic/global/aboutReader.css (../../shared/aboutReader.css)
skin/classic/global/aboutSupport.css (../../shared/aboutSupport.css)
skin/classic/global/appPicker.css (../../shared/appPicker.css)
skin/classic/global/arrow.css
* skin/classic/global/autocomplete.css
skin/classic/global/button.css

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

@ -23,7 +23,9 @@
#include "nsAppRunner.h"
#include "mozilla/AppData.h"
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
#include "nsUpdateDriver.h"
#endif
#include "ProfileReset.h"
#ifdef MOZ_INSTRUMENT_EVENT_LOOP
@ -3718,7 +3720,7 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
}
#endif
#if defined(USE_MOZ_UPDATER)
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
// Check for and process any available updates
nsCOMPtr<nsIFile> updRoot;
bool persistent;

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

@ -8,13 +8,11 @@
#define nsUpdateDriver_h__
#include "nscore.h"
#ifdef MOZ_UPDATER
#include "nsIUpdateService.h"
#include "nsIThread.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "mozilla/Attributes.h"
#endif
class nsIFile;
@ -57,7 +55,6 @@ nsresult ProcessUpdates(nsIFile *greDir, nsIFile *appDir,
nsIFile *osApplyToDir = nullptr,
ProcessType *pid = nullptr);
#ifdef MOZ_UPDATER
// The implementation of the update processor handles the task of loading the
// updater application for staging an update.
// XXX ehsan this is living in this file in order to make use of the existing
@ -107,6 +104,4 @@ private:
nsCOMPtr<nsIThread> mProcessWatcher;
StagedUpdateInfo mInfo;
};
#endif
#endif // nsUpdateDriver_h__

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

@ -44,6 +44,7 @@
#include "MediaCodec.h"
#include "SurfaceTexture.h"
#include "GLContextProvider.h"
using namespace mozilla;
using namespace mozilla::gfx;
@ -821,6 +822,8 @@ AndroidBridge::OpenGraphicsLibraries()
ANativeWindow_setBuffersGeometry = (int (*)(void*, int, int, int)) dlsym(handle, "ANativeWindow_setBuffersGeometry");
ANativeWindow_lock = (int (*)(void*, void*, void*)) dlsym(handle, "ANativeWindow_lock");
ANativeWindow_unlockAndPost = (int (*)(void*))dlsym(handle, "ANativeWindow_unlockAndPost");
ANativeWindow_getWidth = (int (*)(void*))dlsym(handle, "ANativeWindow_getWidth");
ANativeWindow_getHeight = (int (*)(void*))dlsym(handle, "ANativeWindow_getHeight");
// This is only available in Honeycomb and ICS. It was removed in Jelly Bean
ANativeWindow_fromSurfaceTexture = (void* (*)(JNIEnv*, jobject))dlsym(handle, "ANativeWindow_fromSurfaceTexture");
@ -1275,6 +1278,16 @@ AndroidBridge::ReleaseNativeWindow(void *window)
// have nothing to do here. We should probably ref it.
}
IntSize
AndroidBridge::GetNativeWindowSize(void* window)
{
if (!window || !ANativeWindow_getWidth || !ANativeWindow_getHeight) {
return IntSize(0, 0);
}
return IntSize(ANativeWindow_getWidth(window), ANativeWindow_getHeight(window));
}
void*
AndroidBridge::AcquireNativeWindowFromSurfaceTexture(JNIEnv* aEnv, jobject aSurfaceTexture)
{
@ -1508,7 +1521,9 @@ void AndroidBridge::SyncFrameMetrics(const ParentLayerPoint& aScrollOffset, floa
}
AndroidBridge::AndroidBridge()
: mLayerClient(nullptr)
: mLayerClient(nullptr),
mPresentationWindow(nullptr),
mPresentationSurface(nullptr)
{
}
@ -2036,6 +2051,51 @@ AndroidBridge::RunDelayedUiThreadTasks()
return -1;
}
void*
AndroidBridge::GetPresentationWindow()
{
return mPresentationWindow;
}
void
AndroidBridge::SetPresentationWindow(void* aPresentationWindow)
{
if (mPresentationWindow) {
const bool wasAlreadyPaused = nsWindow::IsCompositionPaused();
if (!wasAlreadyPaused) {
nsWindow::SchedulePauseComposition();
}
mPresentationWindow = aPresentationWindow;
if (mPresentationSurface) {
// destroy the egl surface!
// The compositor is paused so it should be okay to destroy
// the surface here.
mozilla::gl::GLContextProvider::DestroyEGLSurface(mPresentationSurface);
mPresentationSurface = nullptr;
}
if (!wasAlreadyPaused) {
nsWindow::ScheduleResumeComposition();
}
}
else {
mPresentationWindow = aPresentationWindow;
}
}
EGLSurface
AndroidBridge::GetPresentationSurface()
{
return mPresentationSurface;
}
void
AndroidBridge::SetPresentationSurface(EGLSurface aPresentationSurface)
{
mPresentationSurface = aPresentationSurface;
}
Object::LocalRef AndroidBridge::ChannelCreate(Object::Param stream) {
JNIEnv* const env = GetJNIForThread();
auto rv = Object::LocalRef::Adopt(env, env->CallStaticObjectMethod(

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

@ -21,6 +21,7 @@
#include "nsIMIMEInfo.h"
#include "nsColor.h"
#include "gfxRect.h"
#include "mozilla/gfx/Point.h"
#include "nsIAndroidBridge.h"
#include "nsIMobileMessageCallback.h"
@ -264,6 +265,7 @@ public:
void *AcquireNativeWindow(JNIEnv* aEnv, jobject aSurface);
void ReleaseNativeWindow(void *window);
mozilla::gfx::IntSize GetNativeWindowSize(void* window);
void *AcquireNativeWindowFromSurfaceTexture(JNIEnv* aEnv, jobject aSurface);
void ReleaseNativeWindowForSurfaceTexture(void *window);
@ -426,6 +428,8 @@ protected:
int (* ANativeWindow_lock)(void *window, void *outBuffer, void *inOutDirtyBounds);
int (* ANativeWindow_unlockAndPost)(void *window);
int (* ANativeWindow_getWidth)(void * window);
int (* ANativeWindow_getHeight)(void * window);
int (* Surface_lock)(void* surface, void* surfaceInfo, void* region, bool block);
int (* Surface_unlockAndPost)(void* surface);
@ -439,6 +443,15 @@ private:
public:
void PostTaskToUiThread(Task* aTask, int aDelayMs);
int64_t RunDelayedUiThreadTasks();
void* GetPresentationWindow();
void SetPresentationWindow(void* aPresentationWindow);
EGLSurface GetPresentationSurface();
void SetPresentationSurface(EGLSurface aPresentationSurface);
private:
void* mPresentationWindow;
EGLSurface mPresentationSurface;
};
class AutoJNIClass {

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

@ -811,6 +811,27 @@ cleanup:
return surfaceBits;
}
NS_EXPORT void JNICALL
Java_org_mozilla_gecko_GeckoAppShell_addPresentationSurface(JNIEnv* jenv, jclass, jobject surface)
{
if (surface != NULL) {
void* window = AndroidBridge::Bridge()->AcquireNativeWindow(jenv, surface);
if (window) {
AndroidBridge::Bridge()->SetPresentationWindow(window);
}
}
}
NS_EXPORT void JNICALL
Java_org_mozilla_gecko_GeckoAppShell_removePresentationSurface(JNIEnv* jenv, jclass, jobject surface)
{
void* window = AndroidBridge::Bridge()->GetPresentationWindow();
if (window) {
AndroidBridge::Bridge()->SetPresentationWindow(nullptr);
AndroidBridge::Bridge()->ReleaseNativeWindow(window);
}
}
NS_EXPORT void JNICALL
Java_org_mozilla_gecko_GeckoAppShell_onFullScreenPluginHidden(JNIEnv* jenv, jclass, jobject view)
{

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

@ -2454,6 +2454,29 @@ nsWindow::ScheduleComposite()
}
}
bool
nsWindow::IsCompositionPaused()
{
return sCompositorPaused;
}
void
nsWindow::SchedulePauseComposition()
{
if (sCompositorParent) {
sCompositorParent->SchedulePauseOnCompositorThread();
sCompositorPaused = true;
}
}
void
nsWindow::ScheduleResumeComposition()
{
if (sCompositorParent && sCompositorParent->ScheduleResumeOnCompositorThread()) {
sCompositorPaused = false;
}
}
void
nsWindow::ScheduleResumeComposition(int width, int height)
{

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

@ -156,7 +156,10 @@ public:
static void SetCompositor(mozilla::layers::LayerManager* aLayerManager,
mozilla::layers::CompositorParent* aCompositorParent,
mozilla::layers::CompositorChild* aCompositorChild);
static bool IsCompositionPaused();
static void ScheduleComposite();
static void SchedulePauseComposition();
static void ScheduleResumeComposition();
static void ScheduleResumeComposition(int width, int height);
static void ForceIsFirstPaint();
static float ComputeRenderIntegrity();