Skip to content

Commit

Permalink
Merge f-t to m-c, a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
philor committed Sep 19, 2015
2 parents 6d3847c + 1e54de9 commit 19a7611
Show file tree
Hide file tree
Showing 101 changed files with 2,345 additions and 857 deletions.
2 changes: 1 addition & 1 deletion browser/app/profile/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -1879,7 +1879,7 @@ pref("browser.polaris.enabled", false);
pref("privacy.trackingprotection.ui.enabled", false);
#endif
pref("privacy.trackingprotection.introCount", 0);
pref("privacy.trackingprotection.introURL", "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/tracking-protection-pbm");
pref("privacy.trackingprotection.introURL", "https://www.mozilla.org/%LOCALE%/firefox/%VERSION%/tracking-protection/start/");

#ifndef RELEASE_BUILD
// At the moment, autostart.2 is used, while autostart.1 is unused.
Expand Down
3 changes: 3 additions & 0 deletions browser/components/loop/content/js/conversation.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ loop.conversation = (function(mozL10n) {
mozLoop: navigator.mozLoop
});

// expose for functional tests
loop.conversation._sdkDriver = sdkDriver;

// Create the stores.
var conversationAppStore = new loop.store.ConversationAppStore({
dispatcher: dispatcher,
Expand Down
3 changes: 3 additions & 0 deletions browser/components/loop/content/js/conversation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ loop.conversation = (function(mozL10n) {
mozLoop: navigator.mozLoop
});

// expose for functional tests
loop.conversation._sdkDriver = sdkDriver;

// Create the stores.
var conversationAppStore = new loop.store.ConversationAppStore({
dispatcher: dispatcher,
Expand Down
22 changes: 21 additions & 1 deletion browser/components/loop/content/shared/css/conversation.css
Original file line number Diff line number Diff line change
Expand Up @@ -457,17 +457,37 @@ html[dir="rtl"] .room-failure > .settings-control {
white-space: nowrap;
}

.screen-share-menu.dropdown-menu,
.settings-menu.dropdown-menu {
left: auto;
bottom: 3.1rem;
}

.screen-share-menu.dropdown-menu {
/*offset dropdown menu to be above menu button*/
right: 40px;
}

.settings-menu.dropdown-menu {
/*offset dropdown menu to be above menu button*/
right: 14px;
}

html[dir="rtl"] .screen-share-menu.dropdown-menu,
html[dir="rtl"] .settings-menu.dropdown-menu {
left: 14px;
right: auto;
}

html[dir="rtl"] .screen-share-menu.dropdown-menu {
/*offset dropdown menu to be above menu button*/
left: 40px;
}

html[dir="rtl"] .settings-menu.dropdown-menu {
/*offset dropdown menu to be above menu button*/
left: 14px;
}

.settings-menu.dropdown-menu.menu-below {
top: 11.5rem;
bottom: auto;
Expand Down
10 changes: 5 additions & 5 deletions browser/components/loop/content/shared/js/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ loop.shared.views = (function(_, mozL10n) {
"disabled": this.props.state === SCREEN_SHARE_STATES.PENDING
});
var dropdownMenuClasses = cx({
"native-dropdown-menu": true,
"conversation-window-dropdown": true,
"hide": !this.state.showMenu,
"visually-hidden": true
"screen-share-menu": true,
"dropdown-menu": true,
"hide": !this.state.showMenu
});
var windowSharingClasses = cx({
"dropdown-menu-item": true,
"disabled": this.state.windowSharingDisabled
});

Expand All @@ -168,7 +168,7 @@ loop.shared.views = (function(_, mozL10n) {
isActive ? null : React.createElement("span", {className: "chevron"})
),
React.createElement("ul", {className: dropdownMenuClasses, ref: "menu"},
React.createElement("li", {onClick: this._handleShareTabs},
React.createElement("li", {className: "dropdown-menu-item", onClick: this._handleShareTabs},
mozL10n.get("share_tabs_button_title2")
),
React.createElement("li", {className: windowSharingClasses, onClick: this._handleShareWindows},
Expand Down
10 changes: 5 additions & 5 deletions browser/components/loop/content/shared/js/views.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ loop.shared.views = (function(_, mozL10n) {
"disabled": this.props.state === SCREEN_SHARE_STATES.PENDING
});
var dropdownMenuClasses = cx({
"native-dropdown-menu": true,
"conversation-window-dropdown": true,
"hide": !this.state.showMenu,
"visually-hidden": true
"screen-share-menu": true,
"dropdown-menu": true,
"hide": !this.state.showMenu
});
var windowSharingClasses = cx({
"dropdown-menu-item": true,
"disabled": this.state.windowSharingDisabled
});

Expand All @@ -168,7 +168,7 @@ loop.shared.views = (function(_, mozL10n) {
{isActive ? null : <span className="chevron"/>}
</button>
<ul className={dropdownMenuClasses} ref="menu">
<li onClick={this._handleShareTabs}>
<li className="dropdown-menu-item" onClick={this._handleShareTabs}>
{mozL10n.get("share_tabs_button_title2")}
</li>
<li className={windowSharingClasses} onClick={this._handleShareWindows}>
Expand Down
10 changes: 5 additions & 5 deletions browser/components/loop/test/shared/views_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ describe("loop.shared.views", function() {
}));

TestUtils.Simulate.click(comp.getDOMNode().querySelector(
".conversation-window-dropdown > li"));
".screen-share-menu > li"));

sinon.assert.calledOnce(dispatcher.dispatch);
sinon.assert.calledWithExactly(dispatcher.dispatch,
Expand All @@ -186,7 +186,7 @@ describe("loop.shared.views", function() {
}));

TestUtils.Simulate.click(comp.getDOMNode().querySelector(
".conversation-window-dropdown > li:last-child"));
".screen-share-menu > li:last-child"));

sinon.assert.calledOnce(dispatcher.dispatch);
sinon.assert.calledWithExactly(dispatcher.dispatch,
Expand All @@ -201,7 +201,7 @@ describe("loop.shared.views", function() {
state: SCREEN_SHARE_STATES.INACTIVE
}));

var node = comp.getDOMNode().querySelector(".conversation-window-dropdown > li:last-child");
var node = comp.getDOMNode().querySelector(".screen-share-menu > li:last-child");
expect(node.classList.contains("disabled")).eql(false);
});

Expand All @@ -216,7 +216,7 @@ describe("loop.shared.views", function() {
state: SCREEN_SHARE_STATES.INACTIVE
}));

var node = comp.getDOMNode().querySelector(".conversation-window-dropdown > li:last-child");
var node = comp.getDOMNode().querySelector(".screen-share-menu > li:last-child");
expect(node.classList.contains("disabled")).eql(true);
});

Expand All @@ -231,7 +231,7 @@ describe("loop.shared.views", function() {
state: SCREEN_SHARE_STATES.INACTIVE
}));

var node = comp.getDOMNode().querySelector(".conversation-window-dropdown > li:last-child");
var node = comp.getDOMNode().querySelector(".screen-share-menu > li:last-child");
expect(node.classList.contains("disabled")).eql(true);
});

Expand Down
89 changes: 88 additions & 1 deletion browser/components/search/content/search.xml
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@
<method name="handleSearchCommand">
<parameter name="aEvent"/>
<parameter name="aEngine"/>
<parameter name="aForceNewTab"/>
<body><![CDATA[
var textBox = this._textbox;
var textValue = textBox.value;
Expand All @@ -347,6 +348,11 @@
return;
where = whereToOpenLink(aEvent, false, true);
}
else if (aForceNewTab) {
where = "tab";
if (Services.prefs.getBoolPref("browser.tabs.loadInBackground"))
where += "-background";
}
else {
var newTabPref = Services.prefs.getBoolPref("browser.search.openintab");
if (((aEvent instanceof KeyboardEvent) && aEvent.altKey) ^ newTabPref)
Expand Down Expand Up @@ -380,6 +386,8 @@
} else if (aEvent instanceof XULCommandEvent) {
if (target.getAttribute("anonid") == "paste-and-search") {
source = "paste";
} else if (target.getAttribute("anonid") == "search-one-offs-context-open-in-new-tab") {
source = "oneoff-context";
}
}
Expand Down Expand Up @@ -1007,7 +1015,7 @@
<resources>
<stylesheet src="chrome://browser/skin/searchbar.css"/>
</resources>
<content ignorekeys="true" level="top" consumeoutsideclicks="never">
<content ignorekeys="true" level="top" consumeoutsideclicks="never" context="_child">
<xul:hbox anonid="searchbar-engine" xbl:inherits="showonlysettings"
class="search-panel-header search-panel-current-engine">
<xul:image class="searchbar-engine-image" xbl:inherits="src"/>
Expand Down Expand Up @@ -1049,13 +1057,24 @@
oncommand="showSettings();"
class="search-setting-button search-panel-header"
label="&changeSearchSettings.button;"/>
<xul:menupopup anonid="search-one-offs-context-menu">
<xul:menuitem anonid="search-one-offs-context-open-in-new-tab"
label="&searchInNewTab.label;"
accesskey="&searchInNewTab.accesskey;"/>
<xul:menuitem anonid="search-one-offs-context-set-default"
label="&searchSetAsDefault.label;"
accesskey="&searchSetAsDefault.accesskey;"/>
</xul:menupopup>
</content>
<implementation>
<!-- Popup rollup is triggered by native events before the mousedown event
reaches the DOM. The will be set to true by the popuphiding event and
false after the mousedown event has been triggered to detect what
caused rollup. -->
<field name="_isHiding">false</field>
<!-- When a context menu is opened on a one-off button, this is set to the
engine of that button for use with the context menu actions. -->
<field name="_contextEngine">null</field>
<field name="_bundle">null</field>
<property name="bundle" readonly="true">
<getter>
Expand Down Expand Up @@ -1101,12 +1120,41 @@
BrowserSearch.searchBar._textbox.closePopup();
]]></body>
</method>

<constructor><![CDATA[
// Prevent popup events from the context menu from reaching the autocomplete
// binding (or other listeners).
let menu = document.getAnonymousElementByAttribute(this, "anonid", "search-one-offs-context-menu");
let listener = aEvent => aEvent.stopPropagation();
menu.addEventListener("popupshowing", listener);
menu.addEventListener("popuphiding", listener);
menu.addEventListener("popupshown", aEvent => {
this._ignoreMouseEvents = true;
aEvent.stopPropagation();
});
menu.addEventListener("popuphidden", aEvent => {
this._ignoreMouseEvents = false;
aEvent.stopPropagation();
});
]]></constructor>
</implementation>
<handlers>
<handler event="popuphidden"><![CDATA[
Services.tm.mainThread.dispatch(function() {
document.getElementById("searchbar").textbox.selectedButton = null;
}, Ci.nsIThread.DISPATCH_NORMAL);
this._contextEngine = null;
]]></handler>

<handler event="contextmenu"><![CDATA[
let target = event.originalTarget;
// Prevent the context menu from appearing except on the one off buttons.
if (!target.classList.contains("searchbar-engine-one-off-item") ||
target.classList.contains("dummy")) {
event.preventDefault();
return;
}
this._contextEngine = target.engine;
]]></handler>

<handler event="popupshowing"><![CDATA[
Expand Down Expand Up @@ -1321,6 +1369,10 @@
if (target.localName != "button")
return;
// Ignore mouse events when the context menu is open.
if (this._ignoreMouseEvents)
return;
if ((target.classList.contains("searchbar-engine-one-off-item") &&
!target.classList.contains("dummy")) ||
target.classList.contains("addengine-item") ||
Expand All @@ -1336,6 +1388,10 @@
if (target.localName != "button")
return;
// Don't deselect the current button if the context menu is open.
if (this._ignoreMouseEvents)
return;
let textbox = document.getElementById("searchbar").textbox;
if (textbox.selectedButton == target)
textbox.selectedButton = null;
Expand All @@ -1351,6 +1407,14 @@
if (!engine)
return;
// For some reason, if the context menu had been opened prior to the
// click, the suggestions popup won't be closed after loading the search
// in the current tab - so we hide it manually. Some focusing magic
// that happens when a search is loaded ensures that the popup is opened
// again if it needs to be, so we don't need to worry about which cases
// require manual hiding.
this.hidePopup();
let searchbar = document.getElementById("searchbar");
searchbar.handleSearchCommand(event, engine);
]]></handler>
Expand All @@ -1373,6 +1437,29 @@
target.getAttribute("image"), false,
installCallback);
}
let anonid = target.getAttribute("anonid");
if (anonid == "search-one-offs-context-open-in-new-tab") {
let searchbar = document.getElementById("searchbar");
searchbar.handleSearchCommand(event, this._contextEngine, true);
}
if (anonid == "search-one-offs-context-set-default") {
let currentEngine = Services.search.currentEngine;
// Make the target button of the context menu reflect the current
// search engine first. Doing this as opposed to rebuilding all the
// one-off buttons avoids flicker.
let button = document.getElementById("searchbar-engine-one-off-item-" +
this._contextEngine.name.replace(/ /g, '-'));
button.id = "searchbar-engine-one-off-item-" + currentEngine.name.replace(/ /g, '-');
let uri = "chrome://browser/skin/search-engine-placeholder.png";
if (currentEngine.iconURI)
uri = PlacesUtils.getImageURLForResolution(window, currentEngine.iconURI.spec);
button.setAttribute("image", uri);
button.setAttribute("tooltiptext", currentEngine.name);
button.engine = currentEngine;
Services.search.currentEngine = this._contextEngine;
}
]]></handler>

<handler event="popuphiding"><![CDATA[
Expand Down
Loading

0 comments on commit 19a7611

Please sign in to comment.