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
CosminSabou committed Nov 10, 2018
2 parents a9100d7 + ed785ea commit 2279674
Show file tree
Hide file tree
Showing 163 changed files with 2,540 additions and 1,592 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions browser/app/profile/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -1035,9 +1035,9 @@ pref("security.sandbox.gmp.win32k-disable", false);
#endif

#if defined(NIGHTLY_BUILD) && defined(XP_MACOSX) && defined(MOZ_SANDBOX)
// Start the Mac sandbox immediately during child process startup instead
// Start the Mac sandbox early during child process startup instead
// of when messaged by the parent after the message loop is running.
pref("security.sandbox.content.mac.earlyinit", false);
pref("security.sandbox.content.mac.earlyinit", true);
#endif

#if defined(XP_MACOSX) && defined(MOZ_SANDBOX) && defined(MOZ_CONTENT_SANDBOX)
Expand Down
8 changes: 2 additions & 6 deletions browser/base/content/browser-places.js
Original file line number Diff line number Diff line change
Expand Up @@ -1102,13 +1102,9 @@ var LibraryUI = {
let animatableBox = document.getElementById("library-animatable-box");
let navBar = document.getElementById("nav-bar");
let libraryIcon = document.getAnonymousElementByAttribute(libraryButton, "class", "toolbarbutton-icon");
let dwu = window.windowUtils;
let iconBounds = dwu.getBoundsWithoutFlushing(libraryIcon);
let libraryBounds = dwu.getBoundsWithoutFlushing(libraryButton);
let toolboxBounds = dwu.getBoundsWithoutFlushing(gNavToolbox);
let iconBounds = window.windowUtils.getBoundsWithoutFlushing(libraryIcon);
let libraryBounds = window.windowUtils.getBoundsWithoutFlushing(libraryButton);

animatableBox.style.setProperty("--toolbox-y", toolboxBounds.y + "px");
animatableBox.style.setProperty("--library-button-y", libraryBounds.y + "px");
animatableBox.style.setProperty("--library-button-height", libraryBounds.height + "px");
animatableBox.style.setProperty("--library-icon-x", iconBounds.x + "px");
if (navBar.hasAttribute("brighttext")) {
Expand Down
16 changes: 7 additions & 9 deletions browser/base/content/browser.xul
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ xmlns="http://www.w3.org/1999/xhtml"
<menuitem id="context_duplicateTab" label="&duplicateTab.label;"
accesskey="&duplicateTab.accesskey;"
oncommand="duplicateTabIn(TabContextMenu.contextTab, 'tab');"/>
<menuitem id="context_duplicateTabs" label="&duplicateTabs.label;"
accesskey="&duplicateTabs.accesskey;"
oncommand="TabContextMenu.duplicateSelectedTabs();"/>
<menuseparator/>
<menuitem id="context_selectAllTabs" label="&selectAllTabs.label;" accesskey="&selectAllTabs.accesskey;"
oncommand="gBrowser.selectAllTabs();"/>
Expand Down Expand Up @@ -444,37 +447,31 @@ xmlns="http://www.w3.org/1999/xhtml"
contexttype="toolbaritem"
class="customize-context-removeFromToolbar"/>
<menuitem id="toolbar-context-reloadSelectedTab"
class="toolbaritem-tabsmenu"
contexttype="tabbar"
oncommand="gBrowser.reloadMultiSelectedTabs();"
label="&toolbarContextMenu.reloadSelectedTab.label;"
accesskey="&toolbarContextMenu.reloadSelectedTab.accesskey;"/>
<menuitem id="toolbar-context-reloadSelectedTabs"
class="toolbaritem-tabsmenu"
contexttype="tabbar"
oncommand="gBrowser.reloadMultiSelectedTabs();"
label="&toolbarContextMenu.reloadSelectedTabs.label;"
accesskey="&toolbarContextMenu.reloadSelectedTabs.accesskey;"/>
<menuitem id="toolbar-context-bookmarkSelectedTab"
class="toolbaritem-tabsmenu"
contexttype="tabbar"
oncommand="PlacesCommandHook.bookmarkPages(PlacesCommandHook.uniqueSelectedPages);"
label="&toolbarContextMenu.bookmarkSelectedTab.label;"
accesskey="&toolbarContextMenu.bookmarkSelectedTab.accesskey;"/>
<menuitem id="toolbar-context-bookmarkSelectedTabs"
class="toolbaritem-tabsmenu"
contexttype="tabbar"
oncommand="PlacesCommandHook.bookmarkPages(PlacesCommandHook.uniqueSelectedPages);"
label="&toolbarContextMenu.bookmarkSelectedTabs.label;"
accesskey="&toolbarContextMenu.bookmarkSelectedTabs.accesskey;"/>
<menuitem id="toolbar-context-selectAllTabs"
class="toolbaritem-tabsmenu"
contexttype="tabbar"
oncommand="gBrowser.selectAllTabs();"
label="&toolbarContextMenu.selectAllTabs.label;"
accesskey="&toolbarContextMenu.selectAllTabs.accesskey;"/>
<menuitem id="toolbar-context-undoCloseTab"
class="toolbaritem-tabsmenu"
contexttype="tabbar"
label="&toolbarContextMenu.undoCloseTab.label;"
accesskey="&toolbarContextMenu.undoCloseTab.accesskey;"
Expand Down Expand Up @@ -1115,6 +1112,10 @@ xmlns="http://www.w3.org/1999/xhtml"
tooltiptext="&fullScreenClose.tooltip;"
oncommand="BrowserTryToCloseWindow();"/>
</hbox>

<box id="library-animatable-box" class="toolbarbutton-animatable-box">
<image class="toolbarbutton-animatable-image"/>
</box>
</toolbar>

<toolbar id="PersonalToolbar"
Expand Down Expand Up @@ -1296,9 +1297,6 @@ xmlns="http://www.w3.org/1999/xhtml"
<searchbar id="searchbar" flex="1"/>
</toolbaritem>
</toolbarpalette>
<box id="library-animatable-box" class="toolbarbutton-animatable-box">
<image class="toolbarbutton-animatable-image"/>
</box>
</toolbox>

<hbox id="fullscr-toggler" hidden="true"/>
Expand Down
14 changes: 11 additions & 3 deletions browser/base/content/tabbrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -5443,9 +5443,9 @@ var TabContextMenu = {
let contextMoveTabToStart = document.getElementById("context_moveToStart");
contextMoveTabToStart.disabled = selectedTabs[0]._tPos == 0 && allSelectedTabsAdjacent;

// Hide the "Duplicate Tab" if there is a selection present
let contextDuplicateTab = document.getElementById("context_duplicateTab");
contextDuplicateTab.hidden = multiselectionContext;
// Only one of "Duplicate Tab"/"Duplicate Tabs" should be visible.
document.getElementById("context_duplicateTab").hidden = multiselectionContext;
document.getElementById("context_duplicateTabs").hidden = !multiselectionContext;

// Disable "Close Tabs to the Right" if there are no tabs
// following it.
Expand Down Expand Up @@ -5537,6 +5537,14 @@ var TabContextMenu = {
excludeUserContextId: this.contextTab.getAttribute("usercontextid"),
});
},
duplicateSelectedTabs() {
let tabsToDuplicate = gBrowser.selectedTabs;
let newIndex = tabsToDuplicate[tabsToDuplicate.length - 1]._tPos + 1;
for (let tab of tabsToDuplicate) {
let newTab = SessionStore.duplicateTab(window, tab);
gBrowser.moveTabTo(newTab, newIndex++);
}
},
reopenInContainer(event) {
let userContextId = parseInt(event.target.getAttribute("data-usercontextid"));
/* Create a triggering principal that is able to load the new tab
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ add_task(async function setPref() {
});

add_task(async function test() {
let tab1 = await addTab();
let tab2 = await addTab();
let tab3 = await addTab();
let originalTab = gBrowser.selectedTab;
let tab1 = await addTab("http://example.com/1");
let tab2 = await addTab("http://example.com/2");
let tab3 = await addTab("http://example.com/3");

let menuItemDuplicateTab = document.getElementById("context_duplicateTab");
let menuItemDuplicateTabs = document.getElementById("context_duplicateTabs");

is(gBrowser.multiSelectedTabsCount, 0, "Zero multiselected tabs");

Expand All @@ -25,24 +27,68 @@ add_task(async function test() {
// Check the context menu with a multiselected tabs
updateTabContextMenu(tab2);
is(menuItemDuplicateTab.hidden, true, "Duplicate Tab is hidden");
is(menuItemDuplicateTabs.hidden, false, "Duplicate Tabs is visible");

// Check the context menu with a non-multiselected tab
updateTabContextMenu(tab3);
is(menuItemDuplicateTab.hidden, false, "Duplicate Tab is visible");
is(menuItemDuplicateTabs.hidden, true, "Duplicate Tabs is hidden");

let newTabOpened = BrowserTestUtils.waitForNewTab(gBrowser, "http://mochi.test:8888/");
let newTabOpened = BrowserTestUtils.waitForNewTab(gBrowser, "http://example.com/3", true);
window.TabContextMenu.contextTab = tab3; // Set proper context for command handler
menuItemDuplicateTab.click();
let tab4 = await newTabOpened;

is(getUrl(tab4), getUrl(tab3), "tab4 should have same URL as tab3, where it was duplicated from");

// Selection should be cleared after duplication
ok(!tab1.multiselected, "Tab1 is not multiselected");
ok(!tab2.multiselected, "Tab2 is not multiselected");
ok(!tab4.multiselected, "Tab3 is not multiselected");
ok(!tab3.multiselected, "Tab4 is not multiselected");
ok(!tab3.multiselected, "Tab3 is not multiselected");
ok(!tab4.multiselected, "Tab4 is not multiselected");

is(gBrowser.selectedTab._tPos, tab4._tPos, "Tab4 should be selected");

await BrowserTestUtils.switchTab(gBrowser, tab1);
await triggerClickOn(tab3, { ctrlKey: true });

ok(tab1.multiselected, "Tab1 is multiselected");
ok(!tab2.multiselected, "Tab2 is not multiselected");
ok(tab3.multiselected, "Tab3 is multiselected");
ok(!tab4.multiselected, "Tab4 is not multiselected");

// Check the context menu with a non-multiselected tab
updateTabContextMenu(tab3);
is(menuItemDuplicateTab.hidden, true, "Duplicate Tab is hidden");
is(menuItemDuplicateTabs.hidden, false, "Duplicate Tabs is visible");

// 7 tabs because there was already one open when the test starts.
// Can't use BrowserTestUtils.waitForNewTab because waitForNewTab only works
// with one tab at a time.
let newTabsOpened = TestUtils.waitForCondition(() => gBrowser.visibleTabs.length == 7,
"Wait for two tabs to get created");
window.TabContextMenu.contextTab = tab3; // Set proper context for command handler
menuItemDuplicateTabs.click();
await newTabsOpened;
info("Two tabs opened");

await TestUtils.waitForCondition(() => {
return getUrl(gBrowser.visibleTabs[4]) == "http://example.com/1" &&
getUrl(gBrowser.visibleTabs[5]) == "http://example.com/3";
});

is(originalTab, gBrowser.visibleTabs[0], "Original tab should still be first");
is(tab1, gBrowser.visibleTabs[1], "tab1 should still be second");
is(tab2, gBrowser.visibleTabs[2], "tab2 should still be third");
is(tab3, gBrowser.visibleTabs[3], "tab3 should still be fourth");
is(getUrl(gBrowser.visibleTabs[4]), getUrl(tab1),
"the first duplicated tab should be placed next to tab3 and have URL of tab1");
is(getUrl(gBrowser.visibleTabs[5]), getUrl(tab3),
"the second duplicated tab should have URL of tab3 and maintain same order");
is(tab4, gBrowser.visibleTabs[6], "tab4 should now be the still be the seventh tab");

BrowserTestUtils.removeTab(tab1);
BrowserTestUtils.removeTab(tab2);
BrowserTestUtils.removeTab(tab3);
BrowserTestUtils.removeTab(tab4);
let tabsToClose = gBrowser.visibleTabs.filter(t => t != originalTab);
for (let tab of tabsToClose) {
BrowserTestUtils.removeTab(tab);
}
});
35 changes: 20 additions & 15 deletions browser/components/newtab/content-src/asrouter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,29 @@
Name | Used for | Type | Example value
--- | --- | --- | ---
`whitelistHosts` | Whitelist a host in order to fetch messages from its endpoint | `[String]` | `["gist.github.com", "gist.githubusercontent.com", "localhost:8000"]`
`messageProviders` | Message provider options | `Object` | [see below](#message-providers)
`providers.snippets` | Message provider options for snippets | `Object` | [see below](#message-providers)
`providers.cfr` | Message provider options for cfr | `Object` | [see below](#message-providers)
`providers.onboarding` | Message provider options for onboarding | `Object` | [see below](#message-providers)

### Message providers
### Message providers examples

```json
[
{
"id" : "onboarding",
"type" : "local",
"localProvider" : "OnboardingMessageProvider"
},
{
"type" : "remote",
"url" : "https://snippets.cdn.mozilla.net/us-west/bundles/bundle_d6d90fb9098ce8b45e60acf601bcb91b68322309.json",
"updateCycleInMs" : 14400000,
"id" : "snippets"
}
]
{
"id" : "snippets",
"type" : "remote",
"enabled": true,
"url" : "https://snippets.cdn.mozilla.net/us-west/bundles/bundle_d6d90fb9098ce8b45e60acf601bcb91b68322309.json",
"updateCycleInMs" : 14400000
}
```

```json
{
"id" : "onboarding",
"enabled": true,
"type" : "local",
"localProvider" : "OnboardingMessageProvider"
}
```

## Admin Interface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Please note that some targeting attributes require stricter controls on the tele
## Available attributes

* [addonsInfo](#addonsinfo)
* [attributionData](#attributiondata)
* [browserSettings](#browsersettings)
* [currentDate](#currentdate)
* [devToolsOpenedCount](#devtoolsopenedcount)
Expand Down Expand Up @@ -76,20 +77,40 @@ interface AddonsInfoResponse {
};
}
```
### `attributionData`

An object containing information on exactly how Firefox was downloaded

#### Examples
* Was the browser installed via the `"back_to_school"` campaign?
```java
attributionData && attributionData.campaign == "back_to_school"
```

#### Definition
```ts
declare const attributionData: AttributionCode;
interface AttributionCode {
// Descriptor for where the download started from
campaign: string,
// A source, like addons.mozilla.org, or google.com
source: string,
// The medium for the download, like if this was referral
medium: string,
// Additional content, like an addonID for instance
content: string
}
```

### `browserSettings`

Includes two properties:
* `attribution`, which indicates how Firefox was downloaded,
* `attribution`, which indicates how Firefox was downloaded - DEPRECATED - please use [attributionData](#attributiondata)
* `update`, which has information about how Firefox updates

Note that attribution can be `undefined`, so you should check that it exists first.

#### Examples
* Was the browser installed via the `"back_to_school"` campaign?
```java
browserSettings.attribution && browserSettings.attribution.campaign == "back_to_school"
```
* Is updating enabled?
```java
browserSettings.update.enabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import {SubmitFormSnippet} from "../SubmitFormSnippet/SubmitFormSnippet.jsx";
export const NewsletterSnippet = props => {
const extendedContent = {
form_action: "https://basket.mozilla.org/subscribe.json",
scene2_email_placeholder_text: "Your Email Here",
scene2_button_label: "Sign Me Up",
...props.content,
hidden_inputs: {
newsletters: props.content.scene2_newsletter || "mozilla-foundation",
fmt: "H",
lang: "en-US",
lang: props.content.locale || "en-US",
source_url: `https://snippets.mozilla.com/show/${props.id}`,
...props.content.hidden_inputs,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@
&.gift {
background-image: url('resource://activity-stream/data/content/assets/illustration-gift@2x.png');
}

&.sync {
background-image: url('resource://activity-stream/data/content/assets/illustration-sync@2x.png');
}
}

.onboardingContent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class SubmitFormSnippet extends React.PureComponent {
return (<SnippetBase {...this.props} className={containerClass} footerDismiss={true}>
{content.scene2_icon ? <div className="scene2Icon"><img src={content.scene2_icon} /></div> : null}
<div className="message">
<p>{content.scene2_text}</p>
<p>{content.scene2_title ? <h3 className="scene2Title">{content.scene2_title}</h3> : null} {content.scene2_text}</p>
</div>
<form action={content.form_action} method={this.props.form_method} onSubmit={this.handleSubmit} ref="form">
{this.renderHiddenFormInputs()}
Expand Down
Loading

0 comments on commit 2279674

Please sign in to comment.