Skip to content

Commit

Permalink
Merge m-c to inbound, a=merge
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: Ah48RzFU8Mt
  • Loading branch information
KWierso committed Jul 22, 2017
2 parents 241ed8f + 051dc17 commit d45eb77
Show file tree
Hide file tree
Showing 534 changed files with 41,734 additions and 35,955 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function simulateCommand(ele) {
let { document } = window;
var evt = document.createEvent('XULCommandEvent');
evt.initCommandEvent('command', true, true, window,
0, false, false, false, false, null);
0, false, false, false, false, null, 0);
ele.dispatchEvent(evt);
}
exports.simulateCommand = simulateCommand;
Expand Down
2 changes: 1 addition & 1 deletion addon-sdk/source/test/sidebar/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function simulateCommand(ele) {
let { document } = window;
var evt = document.createEvent('XULCommandEvent');
evt.initCommandEvent('command', true, true, window,
0, false, false, false, false, null);
0, false, false, false, false, null, 0);
ele.dispatchEvent(evt);
}
exports.simulateCommand = simulateCommand;
Expand Down
3 changes: 2 additions & 1 deletion browser/base/content/browser-gestureSupport.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ var gGestureSupport = {
let cmdEvent = document.createEvent("xulcommandevent");
cmdEvent.initCommandEvent("command", true, true, window, 0,
aEvent.ctrlKey, aEvent.altKey,
aEvent.shiftKey, aEvent.metaKey, aEvent);
aEvent.shiftKey, aEvent.metaKey,
aEvent, aEvent.mozInputSource);
node.dispatchEvent(cmdEvent);
}

Expand Down
8 changes: 4 additions & 4 deletions browser/base/content/browser-places.js
Original file line number Diff line number Diff line change
Expand Up @@ -1860,16 +1860,16 @@ var BookmarkingUI = {
},

showSubView(anchor) {
this._showSubView(anchor);
this._showSubView(null, anchor);
},

_showSubView(anchor = document.getElementById(this.BOOKMARK_BUTTON_ID)) {
_showSubView(event, anchor = document.getElementById(this.BOOKMARK_BUTTON_ID)) {
let view = document.getElementById("PanelUI-bookmarks");
view.addEventListener("ViewShowing", this);
view.addEventListener("ViewHiding", this);
anchor.setAttribute("closemenu", "none");
PanelUI.showSubView("PanelUI-bookmarks", anchor,
CustomizableUI.AREA_PANEL);
CustomizableUI.AREA_PANEL, event);
},

onCommand: function BUI_onCommand(aEvent) {
Expand All @@ -1879,7 +1879,7 @@ var BookmarkingUI = {

// Handle special case when the button is in the panel.
if (this.button.getAttribute("cui-areatype") == CustomizableUI.TYPE_MENU_PANEL) {
this._showSubView();
this._showSubView(aEvent);
return;
}
let widget = CustomizableUI.getWidget(this.BOOKMARK_BUTTON_ID)
Expand Down
18 changes: 11 additions & 7 deletions browser/base/content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ const gClickAndHoldListenersOnElement = {
let cmdEvent = document.createEvent("xulcommandevent");
cmdEvent.initCommandEvent("command", true, true, window, 0,
aEvent.ctrlKey, aEvent.altKey, aEvent.shiftKey,
aEvent.metaKey, null);
aEvent.metaKey, null, aEvent.mozInputSource);
aEvent.currentTarget.dispatchEvent(cmdEvent);

// This is here to cancel the XUL default event
Expand Down Expand Up @@ -1631,7 +1631,7 @@ var gBrowserInit = {
PointerLock.init();

if (AppConstants.isPlatformAndVersionAtLeast("win", "10")) {
ContextMenuTouchModeObserver.init();
MenuTouchModeObserver.init();
}

// initialize the sync UI
Expand Down Expand Up @@ -1846,7 +1846,7 @@ var gBrowserInit = {
}

if (AppConstants.isPlatformAndVersionAtLeast("win", "10")) {
ContextMenuTouchModeObserver.uninit();
MenuTouchModeObserver.uninit();
}
BrowserOffline.uninit();
IndexedDBPromptHelper.uninit();
Expand Down Expand Up @@ -7960,7 +7960,10 @@ var gPageActionButton = {

this._preparePanelToBeShown();
this.panel.hidden = false;
this.panel.openPopup(this.button, "bottomcenter topright");
this.panel.openPopup(this.button, {
position: "bottomcenter topright",
triggerEvent: event,
});
},

_preparePanelToBeShown() {
Expand Down Expand Up @@ -8328,16 +8331,17 @@ function restoreLastSession() {
SessionStore.restoreLastSession();
}

/* Observes context menus and adjusts their size for better
/* Observes menus and adjusts their size for better
* usability when opened via a touch screen. */
var ContextMenuTouchModeObserver = {
var MenuTouchModeObserver = {
init() {
window.addEventListener("popupshowing", this, true);
},

handleEvent(event) {
let target = event.originalTarget;
if (target.localName != "menupopup") {
// Only resize non-context menus in Photon.
if (target.localName != "menupopup" && !gPhotonStructure) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion browser/base/content/browser.xul
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@
tooltip="dynamic-shortcut-tooltip"/>
#ifdef MOZ_PHOTON_THEME
<toolbarbutton id="library-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
oncommand="PanelUI.showSubView('appMenu-libraryView', this, null, true);"
oncommand="PanelUI.showSubView('appMenu-libraryView', this, null, event);"
closemenu="none"
label="&places.library.title;"/>
#endif
Expand Down
79 changes: 76 additions & 3 deletions browser/base/content/tabbrowser.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1980,6 +1980,22 @@
</body>
</method>

<method name="removePreloadedBrowser">
<body>
<![CDATA[
if (!this._isPreloadingEnabled()) {
return;
}
let browser = this._getPreloadedBrowser();
if (browser) {
browser.remove();
}
]]>
</body>
</method>

<field name="_preloadedBrowser">null</field>
<method name="_getPreloadedBrowser">
<body>
Expand Down Expand Up @@ -5579,6 +5595,7 @@
</getter>
</property>
<field name="_soundPlayingAttrRemovalTimer">0</field>
<field name="_hoverTabTimer">null</field>
</implementation>

<handlers>
Expand Down Expand Up @@ -5694,9 +5711,7 @@
// Preloaded browsers do not actually have any tabs. If one crashes,
// it should be released and removed.
if (browser === this._preloadedBrowser) {
// Calling _getPreloadedBrowser is necessary to actually consume the preloaded browser
let preloaded = this._getPreloadedBrowser();
preloaded.remove();
this.removePreloadedBrowser();
return;
}
Expand Down Expand Up @@ -7427,6 +7442,11 @@
this._setPositionAttributes(val);
// Tab becomes visible, it's not unselected anymore.
if (val) {
this.finishUnselectedTabHoverTimer();
}
return val;
]]>
</setter>
Expand Down Expand Up @@ -7570,6 +7590,10 @@
}
tabContainer._hoveredTab = this;
if (this.linkedPanel && !this.selected) {
this.linkedBrowser.unselectedTabHover(true);
this.startUnselectedTabHoverTimer();
}
]]></body>
</method>

Expand All @@ -7586,6 +7610,55 @@
}
tabContainer._hoveredTab = null;
if (this.linkedPanel && !this.selected) {
this.linkedBrowser.unselectedTabHover(false);
this.cancelUnselectedTabHoverTimer();
}
]]></body>
</method>

<method name="startUnselectedTabHoverTimer">
<body><![CDATA[
// Only record data when we need to.
if (!this.linkedBrowser.shouldHandleUnselectedTabHover) {
return;
}
if (!TelemetryStopwatch.running("HOVER_UNTIL_UNSELECTED_TAB_OPENED", this)) {
TelemetryStopwatch.start("HOVER_UNTIL_UNSELECTED_TAB_OPENED", this);
}
if (this._hoverTabTimer) {
clearTimeout(this._hoverTabTimer);
this._hoverTabTimer = null;
}
]]></body>
</method>

<method name="cancelUnselectedTabHoverTimer">
<body><![CDATA[
// Since we're listening "mouseout" event, instead of "mouseleave".
// Every time the cursor is moving from the tab to its child node (icon),
// it would dispatch "mouseout"(for tab) first and then dispatch
// "mouseover" (for icon, eg: close button, speaker icon) soon.
// It causes we would cancel present TelemetryStopwatch immediately
// when cursor is moving on the icon, and then start a new one.
// In order to avoid this situation, we could delay cancellation and
// remove it if we get "mouseover" within very short period.
this._hoverTabTimer = setTimeout(() => {
if (TelemetryStopwatch.running("HOVER_UNTIL_UNSELECTED_TAB_OPENED", this)) {
TelemetryStopwatch.cancel("HOVER_UNTIL_UNSELECTED_TAB_OPENED", this);
}
}, 100);
]]></body>
</method>

<method name="finishUnselectedTabHoverTimer">
<body><![CDATA[
// Stop timer when the tab is opened.
if (TelemetryStopwatch.running("HOVER_UNTIL_UNSELECTED_TAB_OPENED", this)) {
TelemetryStopwatch.finish("HOVER_UNTIL_UNSELECTED_TAB_OPENED", this);
}
]]></body>
</method>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ var whitelist = [
{file: "resource://gre/modules/ClusterLib.js"},
{file: "resource://gre/modules/ColorConversion.js"},

// List of built-in locales. See bug 1362617 for details.
{file: "resource://gre/res/multilocale.json"},

// The l10n build system can't package string files only for some platforms.
{file: "resource://gre/chrome/en-US/locale/en-US/global-platform/mac/accessible.properties",
platforms: ["linux", "win"]},
Expand Down
7 changes: 7 additions & 0 deletions browser/base/content/test/touch/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"use strict";

module.exports = {
"extends": [
"plugin:mozilla/browser-test"
]
};
4 changes: 4 additions & 0 deletions browser/base/content/test/touch/browser.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[DEFAULT]

[browser_menu_touch.js]
skip-if = !(os == 'win' && os_version == '10.0')
109 changes: 109 additions & 0 deletions browser/base/content/test/touch/browser_menu_touch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/* 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/. */

/* This test checks that toolbar menus are in touchmode
* when opened through a touch event. */

async function openAndCheckMenu(menu, target) {
is(menu.state, "closed", "Menu panel is initally closed.");

let popupshown = BrowserTestUtils.waitForEvent(menu, "popupshown");
EventUtils.synthesizeNativeTapAtCenter(target);
await popupshown;

is(menu.state, "open", "Menu panel is open.");
is(menu.getAttribute("touchmode"), "true", "Menu panel is in touchmode.");

menu.hidePopup();

popupshown = BrowserTestUtils.waitForEvent(menu, "popupshown");
EventUtils.synthesizeMouseAtCenter(target, {});
await popupshown;

is(menu.state, "open", "Menu panel is open.");
ok(!menu.hasAttribute("touchmode"), "Menu panel is not in touchmode.");

menu.hidePopup();
}

// The customization UI menu is not attached to the document when it is
// closed and hence requires special attention.
async function openAndCheckCustomizationUIMenu(target) {
EventUtils.synthesizeNativeTapAtCenter(target);

await BrowserTestUtils.waitForCondition(() =>
document.getElementById("customizationui-widget-panel") != null);
let menu = document.getElementById("customizationui-widget-panel");

if (menu.state != "open") {
await BrowserTestUtils.waitForEvent(menu, "popupshown");
is(menu.state, "open", "Menu is open");
}

is(menu.getAttribute("touchmode"), "true", "Menu is in touchmode.");

menu.hidePopup();

EventUtils.synthesizeMouseAtCenter(target, {});

await BrowserTestUtils.waitForCondition(() =>
document.getElementById("customizationui-widget-panel") != null);
menu = document.getElementById("customizationui-widget-panel");

if (menu.state != "open") {
await BrowserTestUtils.waitForEvent(menu, "popupshown");
is(menu.state, "open", "Menu is open");
}

ok(!menu.hasAttribute("touchmode"), "Menu is not in touchmode.");

menu.hidePopup();
}

// Test main ("hamburger") menu.
add_task(async function test_main_menu_touch() {
if (!gPhotonStructure) {
ok(true, "Skipping test because we're not in Photon mode");
return;
}

let mainMenu = document.getElementById("appMenu-popup");
let target = document.getElementById("PanelUI-menu-button");
await openAndCheckMenu(mainMenu, target);
});

// Test the page action menu.
add_task(async function test_page_action_panel_touch() {
if (!gPhotonStructure) {
ok(true, "Skipping test because we're not in Photon mode");
return;
}

let pageActionPanel = document.getElementById("page-action-panel");
let target = document.getElementById("urlbar-page-action-button");
await openAndCheckMenu(pageActionPanel, target);
});

// Test the customizationUI panel, which is used for various menus
// such as library, history, sync, developer and encoding.
add_task(async function test_customizationui_panel_touch() {
if (!gPhotonStructure) {
ok(true, "Skipping test because we're not in Photon mode");
return;
}

CustomizableUI.addWidgetToArea("library-button", CustomizableUI.AREA_NAVBAR);
CustomizableUI.addWidgetToArea("history-panelmenu", CustomizableUI.AREA_NAVBAR);

await BrowserTestUtils.waitForCondition(() =>
CustomizableUI.getPlacementOfWidget("library-button").area == "nav-bar");

let target = document.getElementById("library-button");
await openAndCheckCustomizationUIMenu(target);

target = document.getElementById("history-panelmenu");
await openAndCheckCustomizationUIMenu(target);

CustomizableUI.reset();
});
1 change: 1 addition & 0 deletions browser/base/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ BROWSER_CHROME_MANIFESTS += [
'content/test/tabcrashed/browser.ini',
'content/test/tabPrompts/browser.ini',
'content/test/tabs/browser.ini',
'content/test/touch/browser.ini',
'content/test/urlbar/browser.ini',
'content/test/webextensions/browser.ini',
'content/test/webrtc/browser.ini',
Expand Down
2 changes: 1 addition & 1 deletion browser/components/contextualidentity/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ BROWSER_CHROME_MANIFESTS += [
JAR_MANIFESTS += ['jar.mn']

with Files('**'):
BUG_COMPONENT = ('DOM', 'Security')
BUG_COMPONENT = ('Core', 'DOM: Security')
Loading

0 comments on commit d45eb77

Please sign in to comment.