diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index c3508da9c8b0..8c1af1daba39 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -20,7 +20,7 @@ ad75e912fbc1d64ed63c1d0a51d7157566de1887 # gecko-dev # Bug 1513205 - Also update the tests to match the Google coding style # https://hg.mozilla.org/integration/autoland/rev/09c71a7cf75a -13452f36fb36ad09d81f6b53eaf7928ee63f05e3 # cinnabar +13452f36fb36ad09d81f6b53eaf7928ee63f05e3 # cinnabar 6f45c666bc7f98c3e3250a7c2cf8dc3fb95d12d7 # gecko-dev # Bug 1519636 - Reformat everything to the Google coding style @@ -39,5 +39,6 @@ d25e4032d4d15e732a78082505d62b6d6ffa1445 # cinnabar e5e885ae3128a6878d08df4ff6baaf3fc4a4b9e8 # gecko-dev # Bug 1513205 - Ride along, update some code to match the Google coding style # https://hg.mozilla.org/integration/autoland/rev/039a7c0c18fb -1ce955dcb2e09fd9ce19c1ec6c470f75db486bd2 # cinnabar +1ce955dcb2e09fd9ce19c1ec6c470f75db486bd2 # cinnabar 7cf43b9bc01d650f87deceb65f336cdac7c0e78f # gecko-dev + diff --git a/Cargo.lock b/Cargo.lock index ca5f179e8d7c..3bbc59a3a12d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2990,7 +2990,7 @@ dependencies = [ [[package]] name = "webrender" -version = "0.58.0" +version = "0.59.0" dependencies = [ "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3060,7 +3060,7 @@ dependencies = [ "rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "thread_profiler 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender 0.58.0", + "webrender 0.59.0", ] [[package]] diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 88c00361f160..0c6c0ae06d2b 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -973,6 +973,9 @@ pref("security.certerrors.recordEventTelemetry", true); // Whether to start the private browsing mode at application startup pref("browser.privatebrowsing.autostart", false); +// Whether to show the new private browsing UI with in-content search box. +pref("browser.privatebrowsing.searchUI", true); + // Whether the bookmark panel should be shown when bookmarking a page. pref("browser.bookmarks.editDialog.showForNewBookmarks", true); diff --git a/browser/base/content/moz.build b/browser/base/content/moz.build index fc2e3509bc05..89d1f50cb842 100644 --- a/browser/base/content/moz.build +++ b/browser/base/content/moz.build @@ -97,9 +97,6 @@ with Files("test/touch/**"): with Files("test/trackingUI/**"): BUG_COMPONENT = ("Firefox", "Tracking Protection") -with Files("test/urlbar/**"): - BUG_COMPONENT = ("Firefox", "Address Bar") - with Files("test/webextensions/**"): BUG_COMPONENT = ("WebExtensions", "Untriaged") diff --git a/browser/base/content/safeMode.js b/browser/base/content/safeMode.js index 46cf09e00f2f..ccf08e486d71 100644 --- a/browser/base/content/safeMode.js +++ b/browser/base/content/safeMode.js @@ -77,4 +77,6 @@ function onLoad() { document.documentElement.getButton("extra1").hidden = true; document.getElementById("resetProfileInstead").hidden = true; } + document.l10n.translateElements(document.querySelectorAll("label, description")).then( + () => window.sizeToContent()); } diff --git a/browser/base/content/safeMode.xul b/browser/base/content/safeMode.xul index b2400ababe09..0602f7742ca6 100644 --- a/browser/base/content/safeMode.xul +++ b/browser/base/content/safeMode.xul @@ -4,46 +4,43 @@ - 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/. --> - -%brandDTD; - -%safeModeDTD; - -%resetProfileDTD; -]> - + + + + + - - - Hello - - diff --git a/browser/base/moz.build b/browser/base/moz.build index ba8616818295..ae384cb3fb89 100644 --- a/browser/base/moz.build +++ b/browser/base/moz.build @@ -53,7 +53,6 @@ BROWSER_CHROME_MANIFESTS += [ 'content/test/tabs/browser.ini', 'content/test/touch/browser.ini', 'content/test/trackingUI/browser.ini', - 'content/test/urlbar/browser.ini', 'content/test/webextensions/browser.ini', 'content/test/webrtc/browser.ini', ] diff --git a/browser/components/about/AboutPrivateBrowsingHandler.jsm b/browser/components/about/AboutPrivateBrowsingHandler.jsm index fa62a90710c0..57d13aa62229 100644 --- a/browser/components/about/AboutPrivateBrowsingHandler.jsm +++ b/browser/components/about/AboutPrivateBrowsingHandler.jsm @@ -7,11 +7,13 @@ var EXPORTED_SYMBOLS = ["AboutPrivateBrowsingHandler"]; ChromeUtils.import("resource://gre/modules/remotepagemanager/RemotePageManagerParent.jsm"); +ChromeUtils.import("resource://gre/modules/Services.jsm"); var AboutPrivateBrowsingHandler = { _topics: [ "DontShowIntroPanelAgain", "OpenPrivateWindow", + "SearchHandoff", ], init() { @@ -40,6 +42,67 @@ var AboutPrivateBrowsingHandler = { win.ContentBlocking.dontShowIntroPanelAgain(); break; } + case "SearchHandoff": { + let searchAlias = ""; + let searchAliases = Services.search.defaultEngine.wrappedJSObject.__internalAliases; + if (searchAliases && searchAliases.length > 0) { + searchAlias = `${searchAliases[0]} `; + } + let urlBar = aMessage.target.browser.ownerGlobal.gURLBar; + let isFirstChange = true; + + if (!aMessage.data || !aMessage.data.text) { + urlBar.hiddenFocus(); + } else { + // Pass the provided text to the awesomebar. Prepend the @engine shortcut. + urlBar.search(`${searchAlias}${aMessage.data.text}`); + isFirstChange = false; + } + + let checkFirstChange = () => { + // Check if this is the first change since we hidden focused. If it is, + // remove hidden focus styles, prepend the search alias and hide the + // in-content search. + if (isFirstChange) { + isFirstChange = false; + urlBar.removeHiddenFocus(); + urlBar.search(searchAlias); + aMessage.target.sendAsyncMessage("HideSearch"); + urlBar.removeEventListener("compositionstart", checkFirstChange); + urlBar.removeEventListener("paste", checkFirstChange); + } + }; + + let onKeydown = ev => { + // Check if the keydown will cause a value change. + if (ev.key.length === 1 && !ev.altKey && !ev.ctrlKey && !ev.metaKey) { + checkFirstChange(); + } + // If the Esc button is pressed, we are done. Show in-content search and cleanup. + if (ev.key === "Escape") { + onDone(); + } + }; + + let onDone = () => { + // We are done. Show in-content search again and cleanup. + aMessage.target.sendAsyncMessage("ShowSearch"); + urlBar.removeHiddenFocus(); + + urlBar.removeEventListener("keydown", onKeydown); + urlBar.removeEventListener("mousedown", onDone); + urlBar.removeEventListener("blur", onDone); + urlBar.removeEventListener("compositionstart", checkFirstChange); + urlBar.removeEventListener("paste", checkFirstChange); + }; + + urlBar.addEventListener("keydown", onKeydown); + urlBar.addEventListener("mousedown", onDone); + urlBar.addEventListener("blur", onDone); + urlBar.addEventListener("compositionstart", checkFirstChange); + urlBar.addEventListener("paste", checkFirstChange); + break; + } } }, }; diff --git a/browser/components/newtab/bin/render-activity-stream-html.js b/browser/components/newtab/bin/render-activity-stream-html.js index 23a7c136f7f8..59443df5f435 100644 --- a/browser/components/newtab/bin/render-activity-stream-html.js +++ b/browser/components/newtab/bin/render-activity-stream-html.js @@ -93,6 +93,8 @@ for (const src of ${JSON.stringify(scripts, null, 2)}) { script.src = src; } `; + // Comment to indicate if prerendered version of html is used. See Bug 1516034 + const isPrerenderedStatus = ""; return ` @@ -108,6 +110,7 @@ for (const src of ${JSON.stringify(scripts, null, 2)}) {
${options.noscripts ? "" : scriptTag} + ${isPrerendered ? "" : isPrerenderedStatus} `; diff --git a/browser/components/newtab/common/PrerenderData.jsm b/browser/components/newtab/common/PrerenderData.jsm index bc32db06a035..711bc6f34679 100644 --- a/browser/components/newtab/common/PrerenderData.jsm +++ b/browser/components/newtab/common/PrerenderData.jsm @@ -28,11 +28,22 @@ class _PrerenderData { return result.concat(next.oneOf); } else if (next && next.indexedDB) { return result.concat(next.indexedDB); + } else if (next && next.jsonPrefs) { + return result.concat(next.jsonPrefs); } throw new Error("Your validation configuration is not properly configured"); }, []); } + _isPrefEnabled(prefObj) { + try { + let data = JSON.parse(prefObj); + return data && data.enabled; + } catch (e) { + return null; + } + } + arePrefsValid(getPref, indexedDBPrefs) { for (const prefs of this.validation) { // {oneOf: ["foo", "bar"]} @@ -45,6 +56,13 @@ class _PrerenderData { if (anyModifiedPrefs) { return false; } + // {jsonPrefs: ["foo", "bar"]} + } else if (prefs && prefs.jsonPrefs) { + const isPrefModified = + prefs.jsonPrefs.some(name => this._isPrefEnabled(getPref(name)) !== this.initialPrefs[name].enabled); + if (isPrefModified) { + return false; + } // "foo" } else if (getPref(prefs) !== this.initialPrefs[prefs]) { return false; @@ -64,6 +82,7 @@ this.PrerenderData = new _PrerenderData({ "feeds.section.highlights": true, "sectionOrder": "topsites,topstories,highlights", "collapsed": false, + "discoverystream.config": {"enabled": false}, }, // Prefs listed as invalidating will prevent the prerendered version // of AS from being used if their value is something other than what is listed @@ -82,6 +101,9 @@ this.PrerenderData = new _PrerenderData({ // If any component has the following preference set to `true` it will // invalidate the prerendered version. {indexedDB: ["collapsed"]}, + // For below prefs, parse value to check enabled property. If enabled property + // differs from initial prefs enabled value, prerendering cannot be used + {jsonPrefs: ["discoverystream.config"]}, ], initialSections: [ { diff --git a/browser/components/newtab/content-src/components/DiscoveryStreamBase/DiscoveryStreamBase.jsx b/browser/components/newtab/content-src/components/DiscoveryStreamBase/DiscoveryStreamBase.jsx index b70cf00a2699..139a25315d2b 100644 --- a/browser/components/newtab/content-src/components/DiscoveryStreamBase/DiscoveryStreamBase.jsx +++ b/browser/components/newtab/content-src/components/DiscoveryStreamBase/DiscoveryStreamBase.jsx @@ -161,11 +161,13 @@ export class _DiscoveryStreamBase extends React.PureComponent { case "HorizontalRule": return (); case "List": - rows = this.extractRows(component, MAX_ROWS_LIST); + rows = this.extractRows(component, + Math.min(component.properties.items, MAX_ROWS_LIST)); return ( diff --git a/browser/components/newtab/content-src/components/DiscoveryStreamComponents/CardGrid/_CardGrid.scss b/browser/components/newtab/content-src/components/DiscoveryStreamComponents/CardGrid/_CardGrid.scss index 409b9b5635cd..c9603e436686 100644 --- a/browser/components/newtab/content-src/components/DiscoveryStreamComponents/CardGrid/_CardGrid.scss +++ b/browser/components/newtab/content-src/components/DiscoveryStreamComponents/CardGrid/_CardGrid.scss @@ -19,7 +19,7 @@ // "Full width layout" .ds-column-9 &, - .dscolumn-10 &, + .ds-column-10 &, .ds-column-11 &, .ds-column-12 & { grid-template-columns: repeat(4, 1fr); diff --git a/browser/components/newtab/content-src/components/DiscoveryStreamComponents/List/_List.scss b/browser/components/newtab/content-src/components/DiscoveryStreamComponents/List/_List.scss index 81bec60d1bed..bd0f003913c4 100644 --- a/browser/components/newtab/content-src/components/DiscoveryStreamComponents/List/_List.scss +++ b/browser/components/newtab/content-src/components/DiscoveryStreamComponents/List/_List.scss @@ -28,13 +28,31 @@ $item-line-height: 20; .ds-list { display: grid; - grid-template-columns: repeat(3, 1fr); - grid-row-gap: 18px; + grid-row-gap: 24px; grid-column-gap: 24px; // reset some stuff from