Skip to content

Commit

Permalink
Merge mozilla-central to mozilla-inbound
Browse files Browse the repository at this point in the history
  • Loading branch information
BavarianTomcat committed Nov 22, 2016
2 parents fea9033 + 8b27dda commit e0f4651
Show file tree
Hide file tree
Showing 284 changed files with 17,284 additions and 19,444 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ module.exports = {
"env": {
"es6": true
},
"parserOptions": {
"ecmaVersion": 8,
},
};
11 changes: 6 additions & 5 deletions addon-sdk/source/lib/sdk/content/page-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ const { Rules } = require('../util/rules');
const { uuid } = require('../util/uuid');
const { WorkerChild } = require("./worker-child");
const { Cc, Ci, Cu } = require("chrome");
const { observe } = require("../event/chrome");
const { on } = require("../event/core");
const { on: onSystemEvent } = require("../system/events");

const appShell = Cc["@mozilla.org/appshell/appShellService;1"].getService(Ci.nsIAppShellService);

Expand Down Expand Up @@ -96,6 +95,7 @@ const ChildPage = Class({
this.options.contentURL = url;

url = this.options.contentURL ? data.url(this.options.contentURL) : "about:blank";

this.webNav.loadURI(url, Ci.nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
},

Expand All @@ -121,14 +121,15 @@ const ChildPage = Class({
QueryInterface: XPCOMUtils.generateQI(["nsIWebProgressListener", "nsISupportsWeakReference"])
});

on(observe(DOC_INSERTED), "data", ({ target }) => {
let page = Array.from(pages.values()).find(p => p.contentWindow.document === target);
onSystemEvent(DOC_INSERTED, ({type, subject, data}) => {
let page = Array.from(pages.values()).find(p => p.contentWindow.document === subject);

if (!page)
return;

if (getAttachEventType(page.options) == DOC_INSERTED)
page.attachWorker();
});
}, true);

frames.port.on("sdk/frame/create", (frame, id, options) => {
new ChildPage(frame, id, options);
Expand Down
1 change: 0 additions & 1 deletion addon-sdk/source/test/addons/jetpack-addon.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ skip-if = true
[page-mod-debugger-post.xpi]
[page-mod-debugger-pre.xpi]
[page-worker.xpi]
skip-if = true # Bug 1288619 and Bug 1288708
[places.xpi]
[predefined-id-with-at.xpi]
[preferences-branch.xpi]
Expand Down
1,846 changes: 923 additions & 923 deletions browser/app/blocklist.xml

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions browser/base/content/browser.css
Original file line number Diff line number Diff line change
Expand Up @@ -502,12 +502,10 @@ toolbar:not(#TabsToolbar) > #personal-bookmarks {
#PopupAutoComplete > richlistbox > richlistitem[originaltype="insecureWarning"] {
-moz-binding: url("chrome://global/content/bindings/autocomplete.xml#autocomplete-richlistitem-insecure-field");
height: auto;
background-color: #F6F6F6;
}

#PopupAutoComplete > richlistbox > richlistitem[originaltype="insecureWarning"] > .ac-site-icon {
display: initial;
list-style-image: url(chrome://browser/skin/connection-mixed-active-loaded.svg#icon);
}

#PopupAutoComplete > richlistbox > richlistitem[originaltype="insecureWarning"] > .ac-title > .ac-text-overflow-container > .ac-title-text {
Expand Down
2 changes: 2 additions & 0 deletions browser/base/content/tabbrowser.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5405,6 +5405,8 @@
continue;
gClickAndHoldListenersOnElement.remove(parent);
parent.removeAttribute("type");
if (!parent.firstChild)
continue;
parent.firstChild.remove();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ add_task(function* test() {
let newTabButton = document.getAnonymousElementByAttribute(newTab, "anonid", "tabs-newtab-button");
ok(newTabButton, "New tab button exists");
ok(!newTabButton.hidden, "New tab button is visible");
yield BrowserTestUtils.waitForCondition(() => !!document.getAnonymousElementByAttribute(newTab, "anonid", "newtab-popup"), "Wait for popup to exist");
let popup = document.getAnonymousElementByAttribute(newTab, "anonid", "newtab-popup");

for (let i = 1; i <= 4; i++) {
Expand Down
154 changes: 154 additions & 0 deletions browser/components/preferences/SiteDataManager.jsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
"use strict";

const { classes: Cc, interfaces: Ci, utils: Cu } = Components;

Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");

this.EXPORTED_SYMBOLS = [
"SiteDataManager"
];

this.SiteDataManager = {

_qms: Services.qms,

_diskCache: Services.cache2.diskCacheStorage(Services.loadContextInfo.default, false),

_appCache: Cc["@mozilla.org/network/application-cache-service;1"].getService(Ci.nsIApplicationCacheService),

// A Map of sites using the persistent-storage API (have requested persistent-storage permission)
// Key is site's origin.
// Value is one object holding:
// - perm: persistent-storage permision; instance of nsIPermission
// - status: the permission granted/rejected status
// - quotaUsage: the usage of indexedDB and localStorage.
// - appCacheList: an array of app cache; instances of nsIApplicationCache
// - diskCacheList: an array. Each element is object holding metadata of http cache:
// - dataSize: that http cache size
// - idEnhance: the id extension of that http cache
_sites: new Map(),

_updateQuotaPromise: null,

_updateDiskCachePromise: null,

_quotaUsageRequests: null,

updateSites() {
// Clear old data and requests first
this._sites.clear();
this._cancelQuotaUpdate();

// Collect sites granted/rejected with the persistent-storage permission
let perm = null;
let status = null;
let e = Services.perms.enumerator;
while (e.hasMoreElements()) {
perm = e.getNext();
status = Services.perms.testExactPermissionFromPrincipal(perm.principal, "persistent-storage");
if (status === Ci.nsIPermissionManager.ALLOW_ACTION ||
status === Ci.nsIPermissionManager.DENY_ACTION) {
this._sites.set(perm.principal.origin, {
perm: perm,
status: status,
quotaUsage: 0,
appCacheList: [],
diskCacheList: []
});
}
}

this._updateQuota();
this._updateAppCache();
this._updateDiskCache();
},

_updateQuota() {
this._quotaUsageRequests = [];
let promises = [];
for (let [key, site] of this._sites) { // eslint-disable-line no-unused-vars
promises.push(new Promise(resolve => {
let callback = {
onUsageResult: function(request) {
site.quotaUsage = request.usage;
resolve();
}
};
// XXX: The work of integrating localStorage into Quota Manager is in progress.
// After the bug 742822 and 1286798 landed, localStorage usage will be included.
// So currently only get indexedDB usage.
this._quotaUsageRequests.push(
this._qms.getUsageForPrincipal(site.perm.principal, callback));
}));
}
this._updateQuotaPromise = Promise.all(promises);
},

_cancelQuotaUpdate() {
if (this._quotaUsageRequests) {
for (let request of this._quotaUsageRequests) {
request.cancel();
}
this._quotaUsageRequests = null;
}
},

_updateAppCache() {
let groups = this._appCache.getGroups();
for (let [key, site] of this._sites) { // eslint-disable-line no-unused-vars
for (let group of groups) {
let uri = Services.io.newURI(group, null, null);
if (site.perm.matchesURI(uri, true)) {
let cache = this._appCache.getActiveCache(group);
site.appCacheList.push(cache);
}
}
}
},

_updateDiskCache() {
this._updateDiskCachePromise = new Promise(resolve => {
if (this._sites.size) {
let sites = this._sites;
let visitor = {
onCacheEntryInfo: function(uri, idEnhance, dataSize) {
for (let [key, site] of sites) { // eslint-disable-line no-unused-vars
if (site.perm.matchesURI(uri, true)) {
site.diskCacheList.push({
dataSize,
idEnhance
});
break;
}
}
},
onCacheEntryVisitCompleted: function() {
resolve();
}
};
this._diskCache.asyncVisitStorage(visitor, true);
} else {
resolve();
}
});
},

getTotalUsage() {
return Promise.all([this._updateQuotaPromise, this._updateDiskCachePromise])
.then(() => {
let usage = 0;
for (let [key, site] of this._sites) { // eslint-disable-line no-unused-vars
let cache = null;
for (cache of site.appCacheList) {
usage += cache.usage;
}
for (cache of site.diskCacheList) {
usage += cache.dataSize;
}
usage += site.quotaUsage;
}
return usage;
});
},
};
20 changes: 20 additions & 0 deletions browser/components/preferences/in-content/advanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
Components.utils.import("resource://gre/modules/LoadContextInfo.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");

XPCOMUtils.defineLazyModuleGetter(this, "SiteDataManager",
"resource:///modules/SiteDataManager.jsm");

const PREF_UPLOAD_ENABLED = "datareporting.healthreport.uploadEnabled";

var gAdvancedPane = {
Expand Down Expand Up @@ -52,6 +55,11 @@ var gAdvancedPane = {
this.updateActualCacheSize();
this.updateActualAppCacheSize();

if (Services.prefs.getBoolPref("browser.storageManager.enabled")) {
SiteDataManager.updateSites();
this.updateTotalSiteDataSize();
}

setEventListener("layers.acceleration.disabled", "change",
gAdvancedPane.updateHardwareAcceleration);
setEventListener("advancedPrefs", "select",
Expand Down Expand Up @@ -329,6 +337,18 @@ var gAdvancedPane = {
gSubDialog.open("chrome://browser/content/preferences/connection.xul");
},

updateTotalSiteDataSize: function() {
SiteDataManager.getTotalUsage()
.then(usage => {
let size = DownloadUtils.convertByteUnits(usage);
let prefStrBundle = document.getElementById("bundlePreferences");
let totalSiteDataSizeLabel = document.getElementById("totalSiteDataSize");
totalSiteDataSizeLabel.textContent = prefStrBundle.getFormattedString("totalSiteDataSize", size);
let siteDataGroup = document.getElementById("siteDataGroup");
siteDataGroup.hidden = false;
});
},

// Retrieves the amount of space currently used by disk cache
updateActualCacheSize: function()
{
Expand Down
9 changes: 9 additions & 0 deletions browser/components/preferences/in-content/advanced.xul
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,15 @@
</vbox>
</hbox>
</groupbox>

<!-- Site Data -->
<groupbox id="siteDataGroup" hidden="true">
<caption><label>&siteData.label;</label></caption>

<hbox align="center">
<label id="totalSiteDataSize" flex="1"></label>
</hbox>
</groupbox>
</tabpanel>

<!-- Update -->
Expand Down
4 changes: 4 additions & 0 deletions browser/components/preferences/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3', 'cocoa'):

JAR_MANIFESTS += ['jar.mn']

EXTRA_JS_MODULES += [
'SiteDataManager.jsm',
]

with Files('**'):
BUG_COMPONENT = ('Firefox', 'Preferences')
40 changes: 27 additions & 13 deletions browser/components/search/content/search.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2075,6 +2075,24 @@

<handler event="mousemove"><![CDATA[
let target = event.originalTarget;
// Handle mouseover on the add-engine menu button and its popup items.
if (target.getAttribute("anonid") == "addengine-menu-button" ||
(target.localName == "menuitem" &&
target.classList.contains("addengine-item"))) {
// Make the menu button visually selected. It's highlighted in the
// CSS when the popup is open, but the popup doesn't open until a
// short timeout has elapsed. Making the button visually selected now
// provides better feedback to the user.
let menuButton = document.getAnonymousElementByAttribute(
this, "anonid", "addengine-menu-button"
);
this._changeVisuallySelectedButton(menuButton);
this._addEngineMenuShouldBeOpen = true;
this._resetAddEngineMenuTimeout();
return;
}
if (target.localName != "button")
return;
Expand All @@ -2092,26 +2110,22 @@
}
]]></handler>

<handler event="mouseenter"><![CDATA[
let target = event.originalTarget;
if (target.getAttribute("anonid") == "addengine-menu-button") {
this._addEngineMenuShouldBeOpen = true;
this._resetAddEngineMenuTimeout();
return;
}
]]></handler>
<handler event="mouseout"><![CDATA[
<handler event="mouseleave"><![CDATA[
let target = event.originalTarget;
if (target.getAttribute("anonid") == "addengine-menu-button") {
// Handle mouseout on the add-engine menu button and its popup items.
if (target.getAttribute("anonid") == "addengine-menu-button" ||
(target.localName == "menuitem" &&
target.classList.contains("addengine-item"))) {
// The menu button will appear selected since the mouse is either over
// it or over one of the menu items in the popup. Make it unselected.
this._changeVisuallySelectedButton(null);
this._addEngineMenuShouldBeOpen = false;
this._resetAddEngineMenuTimeout();
return;
}
]]></handler>
<handler event="mouseout"><![CDATA[
let target = event.originalTarget;
if (target.localName != "button") {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ add_task(function* test() {
// Mouse over the menu button to open it.
let buttonPopup = menuButton.firstChild;
promise = promiseEvent(buttonPopup, "popupshown");
EventUtils.synthesizeMouse(menuButton, 5, 5, { type: "mouseover" });
EventUtils.synthesizeMouse(menuButton, 5, 5, { type: "mousemove" });
yield promise;

Assert.ok(menuButton.open, "Submenu should be open");
Expand Down
3 changes: 1 addition & 2 deletions browser/confvars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ if test "$OS_ARCH" = "WINNT"; then
fi
fi

if test "$MOZ_UPDATE_CHANNEL" = "default" -o \
"$MOZ_UPDATE_CHANNEL" = "nightly"; then
if test "$NIGHTLY_BUILD"; then
MOZ_RUST_URLPARSE=1
fi

Expand Down
1 change: 1 addition & 0 deletions browser/locales/en-US/chrome/browser/browser.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ These should match what Safari and other Apple applications use on OS X Lion. --
<!ENTITY openCmd.commandkey "l">
<!ENTITY urlbar.placeholder2 "Search or enter address">
<!ENTITY urlbar.accesskey "d">
<!-- LOCALIZATION NOTE (urlbar.extension.label): Used to indicate that a selected autocomplete entry is provided by an extension. -->
<!ENTITY urlbar.extension.label "Extension:">
<!ENTITY urlbar.switchToTab.label "Switch to tab:">

Expand Down
Loading

0 comments on commit e0f4651

Please sign in to comment.