Skip to content

Commit

Permalink
merge mozilla-inbound to mozilla-central. r=merge a=merge
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: ES9rKhiQo10
  • Loading branch information
Archaeopteryx committed Sep 1, 2017
2 parents 476c801 + 71d6942 commit 43bc951
Show file tree
Hide file tree
Showing 276 changed files with 6,277 additions and 3,598 deletions.
6 changes: 4 additions & 2 deletions accessible/generic/Accessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -848,8 +848,10 @@ Accessible::HandleAccEvent(AccEvent* aEvent)
if (profiler_is_active()) {
nsAutoCString strEventType;
GetAccService()->GetStringEventType(aEvent->GetEventType(), strEventType);

profiler_tracing("A11y Event", strEventType.get());
nsAutoCString strMarker;
strMarker.AppendLiteral("A11y Event - ");
strMarker.Append(strEventType);
profiler_add_marker(strMarker.get());
}

if (IPCAccessibilityActive() && Document()) {
Expand Down
1 change: 1 addition & 0 deletions browser/base/content/browser.css
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ toolbarpaletteitem > toolbaritem[sdkstylewidget="true"][cui-areatype="toolbar"]
}

.webextension-browser-action > .toolbarbutton-badge-stack > .toolbarbutton-icon {
height: 16px;
width: 16px;
}

Expand Down
54 changes: 21 additions & 33 deletions browser/base/content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,25 @@ var gBrowserInit = {

gRemoteControl.updateVisualCue(Marionette.running);

// If we are given a tab to swap in, take care of it before first paint to
// avoid an about:blank flash.
let tabToOpen = window.arguments && window.arguments[0];
if (tabToOpen instanceof XULElement) {
// Clear the reference to the tab from the arguments array.
window.arguments[0] = null;

// Stop the about:blank load
gBrowser.stop();
// make sure it has a docshell
gBrowser.docShell;

try {
gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, tabToOpen);
} catch (e) {
Cu.reportError(e);
}
}

// Wait until chrome is painted before executing code not critical to making the window visible
this._boundDelayedStartup = this._delayedStartup.bind(this);
window.addEventListener("MozAfterPaint", this._boundDelayedStartup);
Expand Down Expand Up @@ -1601,6 +1620,8 @@ var gBrowserInit = {
return;
}

// We don't check if uriToLoad is a XULElement because this case has
// already been handled before first paint, and the argument cleared.
if (uriToLoad instanceof Ci.nsIArray) {
let count = uriToLoad.length;
let specs = [];
Expand All @@ -1618,39 +1639,6 @@ var gBrowserInit = {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
} catch (e) {}
} else if (uriToLoad instanceof XULElement) {
// swap the given tab with the default about:blank tab and then close
// the original tab in the other window.
let tabToOpen = uriToLoad;

// If this tab was passed as a window argument, clear the
// reference to it from the arguments array.
if (window.arguments[0] == tabToOpen) {
window.arguments[0] = null;
}

// Stop the about:blank load
gBrowser.stop();
// make sure it has a docshell
gBrowser.docShell;

// We must set usercontextid before updateBrowserRemoteness()
// so that the newly created remote tab child has correct usercontextid
if (tabToOpen.hasAttribute("usercontextid")) {
let usercontextid = tabToOpen.getAttribute("usercontextid");
gBrowser.selectedBrowser.setAttribute("usercontextid", usercontextid);
}

try {
// Make sure selectedBrowser has the same remote settings as the one
// we are swapping in.
gBrowser.updateBrowserRemoteness(gBrowser.selectedBrowser,
tabToOpen.linkedBrowser.isRemoteBrowser,
{ remoteType: tabToOpen.linkedBrowser.remoteType });
gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, tabToOpen);
} catch (e) {
Cu.reportError(e);
}
} else if (window.arguments.length >= 3) {
// window.arguments[2]: referrer (nsIURI | string)
// [3]: postData (nsIInputStream)
Expand Down
49 changes: 45 additions & 4 deletions browser/base/content/tabbrowser.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3009,6 +3009,16 @@
newTab = true;
}
aTab._endRemoveArgs = [closeWindow, newTab];
// swapBrowsersAndCloseOther will take care of closing the window without animation.
if (closeWindow && aAdoptedByTab) {
// Remove the tab's filter to avoid leaking.
if (aTab.linkedPanel) {
this._tabFilters.delete(aTab);
}
return true;
}
if (!aTab._fullyOpen) {
// If the opening tab animation hasn't finished before we start closing the
Expand Down Expand Up @@ -3079,7 +3089,6 @@
tab.owner = null;
}
aTab._endRemoveArgs = [closeWindow, newTab];
return true;
]]>
</body>
Expand Down Expand Up @@ -3297,6 +3306,25 @@
if (!remoteBrowser._beginRemoveTab(aOtherTab, aOurTab, true))
return;
// If this is the last tab of the window, hide the window
// immediately without animation before the docshell swap, to avoid
// about:blank being painted.
let [closeWindow] = aOtherTab._endRemoveArgs;
if (closeWindow) {
let win = aOtherTab.ownerGlobal;
let dwu = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
dwu.suppressAnimation(true);
// Only suppressing window animations isn't enough to avoid
// an empty content area being painted.
let baseWin = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDocShell)
.QueryInterface(Ci.nsIDocShellTreeItem)
.treeOwner
.QueryInterface(Ci.nsIBaseWindow);
baseWin.visibility = false;
}
let modifiedAttrs = [];
if (aOtherTab.hasAttribute("muted")) {
aOurTab.setAttribute("muted", "true");
Expand Down Expand Up @@ -3363,7 +3391,11 @@
}
// Finish tearing down the tab that's going away.
remoteBrowser._endRemoveTab(aOtherTab);
if (closeWindow) {
aOtherTab.ownerGlobal.close();
} else {
remoteBrowser._endRemoveTab(aOtherTab);
}
this.setTabTitle(aOurTab);
Expand Down Expand Up @@ -3729,6 +3761,14 @@
for (var name in aOptions)
options += "," + name + "=" + aOptions[name];
// Play the tab closing animation to give immediate feedback while
// waiting for the new window to appear.
// content area when the docshells are swapped.
if (this.animationsEnabled) {
aTab.style.maxWidth = ""; // ensure that fade-out transition happens
aTab.removeAttribute("fadein");
}
// tell a new window to take the "dropped" tab
return window.openDialog(getBrowserURL(), "_blank", options, aTab);
]]>
Expand Down Expand Up @@ -3851,7 +3891,8 @@
let linkedBrowser = aTab.linkedBrowser;
let params = { eventDetail: { adoptedTab: aTab },
preferredRemoteType: linkedBrowser.remoteType,
sameProcessAsFrameLoader: linkedBrowser.frameLoader };
sameProcessAsFrameLoader: linkedBrowser.frameLoader,
skipAnimation: true };
if (aTab.hasAttribute("usercontextid")) {
// new tab must have the same usercontextid as the old one
params.userContextId = aTab.getAttribute("usercontextid");
Expand Down Expand Up @@ -7399,7 +7440,7 @@
window.moveTo(left, top);
window.focus();
} else {
let props = { screenX: left, screenY: top };
let props = { screenX: left, screenY: top, suppressanimation: 1 };
if (AppConstants.platform != "win") {
props.outerWidth = winWidth;
props.outerHeight = winHeight;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const EXPECTED_REFLOWS_FIRST_OPEN = [
"_invalidate@chrome://global/content/bindings/autocomplete.xml",
"invalidate@chrome://global/content/bindings/autocomplete.xml"
],
times: 1584, // This number should only ever go down - never up.
times: 1344, // This number should only ever go down - never up.
},

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const EXPECTED_REFLOWS_FIRST_OPEN = [
"_invalidate@chrome://global/content/bindings/autocomplete.xml",
"invalidate@chrome://global/content/bindings/autocomplete.xml"
],
times: 390, // This number should only ever go down - never up.
times: 330, // This number should only ever go down - never up.
},

{
Expand Down Expand Up @@ -119,7 +119,7 @@ const EXPECTED_REFLOWS_SECOND_OPEN = [
"_invalidate@chrome://global/content/bindings/autocomplete.xml",
"invalidate@chrome://global/content/bindings/autocomplete.xml"
],
times: 444, // This number should only ever go down - never up.
times: 384, // This number should only ever go down - never up.
},

// Bug 1384256
Expand Down
10 changes: 5 additions & 5 deletions browser/components/customizableui/content/panelUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,15 +318,15 @@ const PanelUI = {
*
* @return a Promise that resolves once the panel is ready to roll.
*/
ensureReady() {
if (this._readyPromise) {
return this._readyPromise;
async ensureReady() {
if (this._isReady) {
return;
}

await window.delayedStartupPromise;
this._ensureEventListenersAdded();
this.panel.hidden = false;
this._readyPromise = Promise.resolve();
this._isReady = true;
return this._readyPromise;
},

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ skip-if = os == 'linux'
[browser_ext_browserAction_pageAction_icon.js]
[browser_ext_browserAction_pageAction_icon_permissions.js]
[browser_ext_browserAction_popup.js]
skip-if = debug && (os == 'linux' && bits == 32) # Bug 1313372
[browser_ext_browserAction_popup_preload.js]
skip-if = (os == 'win' && !debug) # bug 1352668
[browser_ext_browserAction_popup_resize.js]
Expand Down
8 changes: 3 additions & 5 deletions browser/extensions/formautofill/FormAutofillContent.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,10 @@ var FormAutofillContent = {
*
* @param {Object} profile Submitted form's address/creditcard guid and record.
* @param {Object} domWin Current content window.
* @param {int} timeStartedFillingMS Time of form filling started.
*/
_onFormSubmit(profile, domWin, timeStartedFillingMS) {
_onFormSubmit(profile, domWin) {
let mm = this._messageManagerFromWindow(domWin);
mm.sendAsyncMessage("FormAutofill:OnFormSubmit",
{profile, timeStartedFillingMS});
mm.sendAsyncMessage("FormAutofill:OnFormSubmit", profile);
},

/**
Expand Down Expand Up @@ -409,7 +407,7 @@ var FormAutofillContent = {
return true;
}

this._onFormSubmit(records, domWin, handler.timeStartedFillingMS);
this._onFormSubmit(records, domWin);
return true;
},

Expand Down
45 changes: 0 additions & 45 deletions browser/extensions/formautofill/FormAutofillHandler.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ FormAutofillHandler.prototype = {
return this._formFieldCount != this.form.elements.length;
},

/**
* Time in milliseconds since epoch when a user started filling in the form.
*/
timeStartedFillingMS: null,

/**
* Set fieldDetails from the form about fields that can be autofilled.
*
Expand All @@ -132,7 +127,6 @@ FormAutofillHandler.prototype = {
this._formFieldCount = this.form.elements.length;
let fieldDetails = FormAutofillHeuristics.getFormInfo(this.form, allowDuplicates);
this.fieldDetails = fieldDetails ? fieldDetails : [];
this.form.rootElement.addEventListener("input", this);
log.debug("Collected details on", this.fieldDetails.length, "fields");

this.address.fieldDetails = this.fieldDetails.filter(
Expand Down Expand Up @@ -588,43 +582,4 @@ FormAutofillHandler.prototype = {
Services.cpmm.sendAsyncMessage("FormAutofill:GetDecryptedString", {cipherText, reauth});
});
},

/**
* Find the fieldDetail by HTML element (assume all details were collected in collectFormFields).
*
* @param {HTMLElement} element
*
* @returns {Object|null}
* Return fieldDetail if fieldDetail's element ref could match the target.
* (or return null if the element could not match any fieldDetail).
*/
getFieldDetailsForElement(element) {
for (let detail of this.fieldDetails) {
if (detail.elementWeakRef.get() == element) {
return detail;
}
}
return null;
},

handleEvent(event) {
switch (event.type) {
case "input":
if (!event.isTrusted) {
return;
}

if (!FormAutofillUtils.isFieldEligibleForAutofill(event.target)) {
return;
}

if (!this.getFieldDetailsForElement(event.target)) {
return;
}

this.form.rootElement.removeEventListener("input", this);
this.timeStartedFillingMS = Date.now();
break;
}
},
};
Loading

0 comments on commit 43bc951

Please sign in to comment.