From ec27214302829cb33d303594e512f83795b9aeee Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Fri, 8 Aug 2014 13:32:53 -0700 Subject: [PATCH 1/8] Bug 1045916 - Part 1: clean up MatrixBlobCursor without addressing hypothetical concurrency issues. r=wesj --- .../android/base/sqlite/MatrixBlobCursor.java | 92 +++++++++++-------- 1 file changed, 52 insertions(+), 40 deletions(-) diff --git a/mobile/android/base/sqlite/MatrixBlobCursor.java b/mobile/android/base/sqlite/MatrixBlobCursor.java index b66a675bef92..80b7b261786a 100644 --- a/mobile/android/base/sqlite/MatrixBlobCursor.java +++ b/mobile/android/base/sqlite/MatrixBlobCursor.java @@ -17,6 +17,9 @@ package org.mozilla.gecko.sqlite; +import java.nio.ByteBuffer; +import java.util.ArrayList; + import org.mozilla.gecko.AppConstants; import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI; @@ -24,29 +27,26 @@ import android.database.AbstractCursor; import android.database.CursorIndexOutOfBoundsException; import android.util.Log; -import java.nio.ByteBuffer; -import java.util.ArrayList; - -/* - * Android's AbstractCursor throws on getBlob() - * and MatrixCursor forgot to override it. This was fixed - * at some point but old devices are still SOL. - * Oh, and everything in MatrixCursor is private instead of - * protected, so we need to entirely duplicate it here, - * instad of just being able to add the missing method. - */ /** * A mutable cursor implementation backed by an array of {@code Object}s. Use * {@link #newRow()} to add rows. Automatically expands internal capacity * as needed. + * + * This class provides one missing feature from Android's MatrixCursor: + * the implementation of getBlob that was inadvertently omitted from API 9 (and + * perhaps later; it's present in 14). + * + * MatrixCursor is all private, so we entirely duplicate it here. */ public class MatrixBlobCursor extends AbstractCursor { + private static final String LOGTAG = "GeckoMatrixCursor"; private final String[] columnNames; - private Object[] data; - private int rowCount; private final int columnCount; - private static final String LOGTAG = "MatrixBlobCursor"; + + private int rowCount; + + /* inner-access */ Object[] data; /** * Constructs a new cursor with the given initial capacity. @@ -143,17 +143,18 @@ public class MatrixBlobCursor extends AbstractCursor { */ @WrapElementForJNI public void addRow(Iterable columnValues) { - int start = rowCount * columnCount; - int end = start + columnCount; - ensureCapacity(end); + final int start = rowCount * columnCount; if (columnValues instanceof ArrayList) { addRow((ArrayList) columnValues, start); return; } + final int end = start + columnCount; int current = start; - Object[] localData = data; + + ensureCapacity(end); + final Object[] localData = data; for (Object columnValue : columnValues) { if (current == end) { // TODO: null out row? @@ -176,39 +177,47 @@ public class MatrixBlobCursor extends AbstractCursor { /** Optimization for {@link ArrayList}. */ @WrapElementForJNI private void addRow(ArrayList columnValues, int start) { - int size = columnValues.size(); + final int size = columnValues.size(); if (size != columnCount) { throw new IllegalArgumentException("columnNames.length = " + columnCount + ", columnValues.size() = " + size); } - rowCount++; - Object[] localData = data; + final int end = start + columnCount; + ensureCapacity(end); + + // Take a reference just in case someone calls ensureCapacity + // and `data` gets replaced by a new array! + final Object[] localData = data; for (int i = 0; i < size; i++) { localData[start + i] = columnValues.get(i); } + + rowCount++; } - /** Ensures that this cursor has enough capacity. */ - private void ensureCapacity(int size) { - if (size > data.length) { - Object[] oldData = this.data; - int newSize = data.length * 2; - if (newSize < size) { - newSize = size; - } - this.data = new Object[newSize]; - System.arraycopy(oldData, 0, this.data, 0, oldData.length); + /** + * Ensures that this cursor has enough capacity. If it needs to allocate + * a new array, the existing capacity will be at least doubled. + */ + private void ensureCapacity(final int size) { + if (size <= data.length) { + return; } + + final Object[] oldData = this.data; + this.data = new Object[Math.max(size, data.length * 2)]; + System.arraycopy(oldData, 0, this.data, 0, oldData.length); } /** * Builds a row, starting from the left-most column and adding one column * value at a time. Follows the same ordering as the column names specified * at cursor construction time. + * + * Not thread-safe. */ public class RowBuilder { - private int index; private final int endIndex; @@ -224,10 +233,9 @@ public class MatrixBlobCursor extends AbstractCursor { * values * @return this builder to support chaining */ - public RowBuilder add(Object columnValue) { + public RowBuilder add(final Object columnValue) { if (index == endIndex) { - throw new CursorIndexOutOfBoundsException( - "No more columns left."); + throw new CursorIndexOutOfBoundsException("No more columns left."); } data[index++] = columnValue; @@ -235,6 +243,9 @@ public class MatrixBlobCursor extends AbstractCursor { } } + /** + * Not thread safe. + */ public void set(int column, Object value) { if (column < 0 || column >= columnCount) { throw new CursorIndexOutOfBoundsException("Requested column: " @@ -269,7 +280,7 @@ public class MatrixBlobCursor extends AbstractCursor { @Override public short getShort(int column) { - Object value = get(column); + final Object value = get(column); if (value == null) return 0; if (value instanceof Number) return ((Number) value).shortValue(); return Short.parseShort(value.toString()); @@ -314,10 +325,11 @@ public class MatrixBlobCursor extends AbstractCursor { if (value instanceof byte[]) { return (byte[]) value; } + if (value instanceof ByteBuffer) { - ByteBuffer data = (ByteBuffer)value; - byte[] byteArray = new byte[data.remaining()]; - data.get(byteArray); + final ByteBuffer bytes = (ByteBuffer) value; + byte[] byteArray = new byte[bytes.remaining()]; + bytes.get(byteArray); return byteArray; } throw new UnsupportedOperationException("BLOB Object not of known type"); @@ -332,7 +344,7 @@ public class MatrixBlobCursor extends AbstractCursor { protected void finalize() { if (AppConstants.DEBUG_BUILD) { if (!isClosed()) { - Log.e(LOGTAG, "Cursor finalized without being closed"); + Log.e(LOGTAG, "Cursor finalized without being closed", new RuntimeException("stack")); } } From 6ecbecbf1d98568aa26e94aaf17b54e33d606964 Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Fri, 8 Aug 2014 13:33:02 -0700 Subject: [PATCH 2/8] Bug 1050690. r=wesj --- mobile/android/components/HelperAppDialog.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mobile/android/components/HelperAppDialog.js b/mobile/android/components/HelperAppDialog.js index 811dc2c1e4c4..0190b6ea6693 100644 --- a/mobile/android/components/HelperAppDialog.js +++ b/mobile/android/components/HelperAppDialog.js @@ -72,6 +72,10 @@ HelperAppLauncherDialog.prototype = { // file to another application. let file = url.QueryInterface(Ci.nsIFileURL).file; + // Normalize the nsILocalFile in-place. This will ensure that paths + // can be correctly compared via `contains`, below. + file.normalize(); + // TODO: pref blacklist? let appRoot = FileUtils.getFile("XREExeF", []); From a744a4ad64351dd906e3893f4a2761cf4dba82e7 Mon Sep 17 00:00:00 2001 From: Brian Nicholson Date: Fri, 8 Aug 2014 14:05:31 -0700 Subject: [PATCH 3/8] Bug 1048395 - Add FennecResourcesSearch dependency to Fennec project. r=rnewman --- mobile/android/base/moz.build | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mobile/android/base/moz.build b/mobile/android/base/moz.build index f996e65c4c4b..bf0eef09f735 100644 --- a/mobile/android/base/moz.build +++ b/mobile/android/base/moz.build @@ -701,3 +701,11 @@ if CONFIG['MOZ_CRASHREPORTER']: if CONFIG['MOZ_ANDROID_MLS_STUMBLER']: main.included_projects += ['../FennecStumbler'] main.referenced_projects += ['../FennecStumbler'] + +if CONFIG['MOZ_ANDROID_SEARCH_ACTIVITY']: + searchactivity = add_android_eclipse_library_project('FennecResourcesSearch') + searchactivity.package_name = 'org.mozilla.fennec.resources.search' + searchactivity.res = SRCDIR + '/../search/res' + searchactivity.included_projects += ['../' + resources.name] + + main.included_projects += ['../' + searchactivity.name] From 3ec776d6127352c711b832875bf0a31f9849f568 Mon Sep 17 00:00:00 2001 From: Dan Mosedale Date: Fri, 8 Aug 2014 15:43:54 -0700 Subject: [PATCH 4/8] Bug 1050932 - Fix UI showcase regression triggered by tokbox SDK upgrade, NPOTB, DONTBUILD, r=Standard8 --- browser/components/loop/ui/index.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/browser/components/loop/ui/index.html b/browser/components/loop/ui/index.html index 2647c31d57a5..834e193ee919 100644 --- a/browser/components/loop/ui/index.html +++ b/browser/components/loop/ui/index.html @@ -15,6 +15,14 @@
+ From ddc3cf6b24443011b5853f9b03009b5948ce9492 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Sat, 9 Aug 2014 00:57:46 +0200 Subject: [PATCH 5/8] Bug 990322 - Don't show multiple thumbnails from the same base domain. r=adw --- .../browser_newtab_background_captures.js | 5 ++-- .../test/newtab/browser_newtab_bug721442.js | 12 ++++---- .../test/newtab/browser_newtab_bug725996.js | 6 ++-- .../test/newtab/browser_newtab_bug765628.js | 2 +- .../test/newtab/browser_newtab_enhanced.js | 24 ++++++++++------ .../test/newtab/browser_newtab_update.js | 2 +- browser/base/content/test/newtab/head.js | 28 +++++++++++-------- toolkit/modules/NewTabUtils.jsm | 28 ++++++++++++++++++- .../tests/xpcshell/test_NewTabUtils.js | 2 +- 9 files changed, 73 insertions(+), 36 deletions(-) diff --git a/browser/base/content/test/newtab/browser_newtab_background_captures.js b/browser/base/content/test/newtab/browser_newtab_background_captures.js index 2cffa70a44c9..82ba365b7e22 100644 --- a/browser/base/content/test/newtab/browser_newtab_background_captures.js +++ b/browser/base/content/test/newtab/browser_newtab_background_captures.js @@ -18,8 +18,7 @@ function runTests() { Services.prefs.setBoolPref(CAPTURE_PREF, true); // Make sure the thumbnail doesn't exist yet. - let siteName = "newtab_background_captures"; - let url = "http://example.com/#" + siteName; + let url = "http://example.com/"; let path = imports.PageThumbsStorage.getFilePathForURL(url); let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile); file.initWithPath(path); @@ -29,7 +28,7 @@ function runTests() { catch (err) {} // Add a top site. - yield setLinks(siteName); + yield setLinks("-1"); // We need a handle to a hidden, pre-loaded newtab so we can verify that it // doesn't allow background captures. Add a newtab, which triggers creation diff --git a/browser/base/content/test/newtab/browser_newtab_bug721442.js b/browser/base/content/test/newtab/browser_newtab_bug721442.js index 597aed25137a..f5223f85d4ed 100644 --- a/browser/base/content/test/newtab/browser_newtab_bug721442.js +++ b/browser/base/content/test/newtab/browser_newtab_bug721442.js @@ -4,17 +4,17 @@ function runTests() { yield setLinks("0,1,2,3,4,5,6,7,8"); setPinnedLinks([ - {url: "http://example.com/#7", title: ""}, - {url: "http://example.com/#8", title: "title"}, - {url: "http://example.com/#9", title: "http://example.com/#9"} + {url: "http://example7.com/", title: ""}, + {url: "http://example8.com/", title: "title"}, + {url: "http://example9.com/", title: "http://example9.com/"} ]); yield addNewTabPageTab(); checkGrid("7p,8p,9p,0,1,2,3,4,5"); - checkTooltip(0, "http://example.com/#7", "1st tooltip is correct"); - checkTooltip(1, "title\nhttp://example.com/#8", "2nd tooltip is correct"); - checkTooltip(2, "http://example.com/#9", "3rd tooltip is correct"); + checkTooltip(0, "http://example7.com/", "1st tooltip is correct"); + checkTooltip(1, "title\nhttp://example8.com/", "2nd tooltip is correct"); + checkTooltip(2, "http://example9.com/", "3rd tooltip is correct"); } function checkTooltip(aIndex, aExpected, aMessage) { diff --git a/browser/base/content/test/newtab/browser_newtab_bug725996.js b/browser/base/content/test/newtab/browser_newtab_bug725996.js index 4d3ef7d5ed7b..fee792dc6551 100644 --- a/browser/base/content/test/newtab/browser_newtab_bug725996.js +++ b/browser/base/content/test/newtab/browser_newtab_bug725996.js @@ -10,14 +10,14 @@ function runTests() { let cell = getCell(0).node; - sendDragEvent("drop", cell, "http://example.com/#99\nblank"); - is(NewTabUtils.pinnedLinks.links[0].url, "http://example.com/#99", + sendDragEvent("drop", cell, "http://example99.com/\nblank"); + is(NewTabUtils.pinnedLinks.links[0].url, "http://example99.com/", "first cell is pinned and contains the dropped site"); yield whenPagesUpdated(); checkGrid("99p,0,1,2,3,4,5,6,7"); sendDragEvent("drop", cell, ""); - is(NewTabUtils.pinnedLinks.links[0].url, "http://example.com/#99", + is(NewTabUtils.pinnedLinks.links[0].url, "http://example99.com/", "first cell is still pinned with the site we dropped before"); } diff --git a/browser/base/content/test/newtab/browser_newtab_bug765628.js b/browser/base/content/test/newtab/browser_newtab_bug765628.js index 6b93c8e6de77..9fc80e3ccbb4 100644 --- a/browser/base/content/test/newtab/browser_newtab_bug765628.js +++ b/browser/base/content/test/newtab/browser_newtab_bug765628.js @@ -2,7 +2,7 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ const BAD_DRAG_DATA = "javascript:alert('h4ck0rz');\nbad stuff"; -const GOOD_DRAG_DATA = "http://example.com/#99\nsite 99"; +const GOOD_DRAG_DATA = "http://example99.com/\nsite 99"; function runTests() { yield setLinks("0,1,2,3,4,5,6,7,8"); diff --git a/browser/base/content/test/newtab/browser_newtab_enhanced.js b/browser/base/content/test/newtab/browser_newtab_enhanced.js index 5fdc6c1d142a..71b8b1f3c072 100644 --- a/browser/base/content/test/newtab/browser_newtab_enhanced.js +++ b/browser/base/content/test/newtab/browser_newtab_enhanced.js @@ -21,7 +21,10 @@ function runTests() { Services.prefs.setBoolPref(PRELOAD_PREF, false); function getData(cellNum) { - let siteNode = getCell(cellNum).site.node; + let cell = getCell(cellNum); + if (!cell.site) + return null; + let siteNode = cell.site.node; return { type: siteNode.getAttribute("type"), enhanced: siteNode.querySelector(".enhanced-content").style.backgroundImage, @@ -29,7 +32,7 @@ function runTests() { } // Make the page have a directory link followed by a history link - yield setLinks("1"); + yield setLinks("-1"); // Test with enhanced = false NewTabUtils.allPages.enhanced = false; @@ -38,9 +41,7 @@ function runTests() { is(type, "organic", "directory link is organic"); isnot(enhanced, "", "directory link has enhanced image"); - let {type, enhanced} = getData(1); - is(type, "history", "history link is history"); - is(enhanced, "", "history link has no enhanced image"); + is(getData(1), null, "history link pushed out by directory link"); // Test with enhanced = true NewTabUtils.allPages.enhanced = true; @@ -49,7 +50,14 @@ function runTests() { is(type, "organic", "directory link is still organic"); isnot(enhanced, "", "directory link still has enhanced image"); - let {type, enhanced} = getData(1); - is(type, "enhanced", "history link now is enhanced"); - isnot(enhanced, "", "history link now has enhanced image"); + is(getData(1), null, "history link still pushed out by directory link"); + + // Test with a pinned link + setPinnedLinks("-1"); + yield addNewTabPageTab(); + let {type, enhanced} = getData(0); + is(type, "enhanced", "pinned history link is enhanced"); + isnot(enhanced, "", "pinned history link has enhanced image"); + + is(getData(1), null, "directory link pushed out by pinned history link"); } diff --git a/browser/base/content/test/newtab/browser_newtab_update.js b/browser/base/content/test/newtab/browser_newtab_update.js index bf03a5a8c892..a0151e953326 100644 --- a/browser/base/content/test/newtab/browser_newtab_update.js +++ b/browser/base/content/test/newtab/browser_newtab_update.js @@ -47,5 +47,5 @@ function runTests() { } function link(id) { - return { url: "http://example.com/#" + id, title: "site#" + id }; + return { url: "http://example" + id + ".com/", title: "site#" + id }; } diff --git a/browser/base/content/test/newtab/head.js b/browser/base/content/test/newtab/head.js index a75a916e6f16..d8d6beff0d34 100644 --- a/browser/base/content/test/newtab/head.js +++ b/browser/base/content/test/newtab/head.js @@ -203,17 +203,20 @@ function getCell(aIndex) { * Allows to provide a list of links that is used to construct the grid. * @param aLinksPattern the pattern (see below) * - * Example: setLinks("1,2,3") - * Result: [{url: "http://example.com/#1", title: "site#1"}, - * {url: "http://example.com/#2", title: "site#2"} - * {url: "http://example.com/#3", title: "site#3"}] + * Example: setLinks("-1,0,1,2,3") + * Result: [{url: "http://example.com/", title: "site#-1"}, + * {url: "http://example0.com/", title: "site#0"}, + * {url: "http://example1.com/", title: "site#1"}, + * {url: "http://example2.com/", title: "site#2"}, + * {url: "http://example3.com/", title: "site#3"}] */ function setLinks(aLinks) { let links = aLinks; if (typeof links == "string") { links = aLinks.split(/\s*,\s*/).map(function (id) { - return {url: "http://example.com/#" + id, title: "site#" + id}; + return {url: "http://example" + (id != "-1" ? id : "") + ".com/", + title: "site#" + id}; }); } @@ -284,7 +287,7 @@ function fillHistory(aLinks, aCallback) { * @param aLinksPattern the pattern (see below) * * Example: setPinnedLinks("3,,1") - * Result: 'http://example.com/#3' is pinned in the first cell. 'http://example.com/#1' is + * Result: 'http://example3.com/' is pinned in the first cell. 'http://example1.com/' is * pinned in the third cell. */ function setPinnedLinks(aLinks) { @@ -293,7 +296,8 @@ function setPinnedLinks(aLinks) { if (typeof links == "string") { links = aLinks.split(/\s*,\s*/).map(function (id) { if (id) - return {url: "http://example.com/#" + id, title: "site#" + id}; + return {url: "http://example" + (id != "-1" ? id : "") + ".com/", + title: "site#" + id}; }); } @@ -355,9 +359,9 @@ function addNewTabPageTab() { * @param the array of sites to compare with (optional) * * Example: checkGrid("3p,2,,1p") - * Result: We expect the first cell to contain the pinned site 'http://example.com/#3'. - * The second cell contains 'http://example.com/#2'. The third cell is empty. - * The fourth cell contains the pinned site 'http://example.com/#4'. + * Result: We expect the first cell to contain the pinned site 'http://example3.com/'. + * The second cell contains 'http://example2.com/'. The third cell is empty. + * The fourth cell contains the pinned site 'http://example4.com/'. */ function checkGrid(aSitesPattern, aSites) { let length = aSitesPattern.split(",").length; @@ -372,7 +376,7 @@ function checkGrid(aSitesPattern, aSites) { if (pinned != hasPinnedAttr) ok(false, "invalid state (site.isPinned() != site[pinned])"); - return aSite.url.replace(/^http:\/\/example\.com\/#(\d+)$/, "$1") + (pinned ? "p" : ""); + return aSite.url.replace(/^http:\/\/example(\d+)\.com\/$/, "$1") + (pinned ? "p" : ""); }); is(current, aSitesPattern, "grid status = " + aSitesPattern); @@ -489,7 +493,7 @@ function startAndCompleteDragOperation(aSource, aDest, aCallback) { */ function createExternalDropIframe() { const url = "data:text/html;charset=utf-8," + - "link"; + "link"; let deferred = Promise.defer(); let doc = getContentDocument(); diff --git a/toolkit/modules/NewTabUtils.jsm b/toolkit/modules/NewTabUtils.jsm index c5bf020fbfb4..dff9d1eae996 100644 --- a/toolkit/modules/NewTabUtils.jsm +++ b/toolkit/modules/NewTabUtils.jsm @@ -829,8 +829,34 @@ let Links = { let pinnedLinks = Array.slice(PinnedLinks.links); let links = this._getMergedProviderLinks(); - // Filter blocked and pinned links. + function getBaseDomain(url) { + let uri; + try { + uri = Services.io.newURI(url, null, null); + } catch (e) { + return null; + } + + try { + return Services.eTLD.getBaseDomain(uri); + } catch (e) { + return uri.asciiHost; + } + } + + let baseDomains = new Set(); + for (let link of pinnedLinks) { + if (link) + baseDomains.add(getBaseDomain(link.url)); + } + + // Filter blocked and pinned links and duplicate base domains. links = links.filter(function (link) { + let baseDomain = getBaseDomain(link.url); + if (baseDomain == null || baseDomains.has(baseDomain)) + return false; + baseDomains.add(baseDomain); + return !BlockedLinks.isBlocked(link) && !PinnedLinks.isPinned(link); }); diff --git a/toolkit/modules/tests/xpcshell/test_NewTabUtils.js b/toolkit/modules/tests/xpcshell/test_NewTabUtils.js index 0b764570d4e8..b8ca35d91c56 100644 --- a/toolkit/modules/tests/xpcshell/test_NewTabUtils.js +++ b/toolkit/modules/tests/xpcshell/test_NewTabUtils.js @@ -191,7 +191,7 @@ function makeLinks(frecRangeStart, frecRangeEnd, step) { function makeLink(frecency) { return { - url: "http://example.com/" + frecency, + url: "http://example" + frecency + ".com/", title: "My frecency is " + frecency, frecency: frecency, lastVisitDate: 0, From 0abd48ab06f6b189b2a5e1397678114f1f0653d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Sat, 9 Aug 2014 01:38:28 +0200 Subject: [PATCH 6/8] Bug 990322 - Prevent browser_newtab_bug991111.js from accessing a remote domain --- browser/base/content/test/newtab/browser_newtab_bug991111.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/base/content/test/newtab/browser_newtab_bug991111.js b/browser/base/content/test/newtab/browser_newtab_bug991111.js index 6149bf51e7aa..e9932094ca88 100644 --- a/browser/base/content/test/newtab/browser_newtab_bug991111.js +++ b/browser/base/content/test/newtab/browser_newtab_bug991111.js @@ -2,7 +2,7 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ function runTests() { - yield setLinks("0"); + yield setLinks("-1"); yield addNewTabPageTab(); // Remember if the click handler was triggered From da38fa3a7c96ad4b1d8293916047ff3acdce3195 Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Fri, 8 Aug 2014 17:07:28 -0700 Subject: [PATCH 7/8] Backout changeset b07c3d5ec540 (bug 1045415) because it breaks local builds; a=backout --- browser/themes/linux/jar.mn | 2 +- browser/themes/osx/jar.mn | 2 +- browser/themes/windows/jar.mn | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/browser/themes/linux/jar.mn b/browser/themes/linux/jar.mn index 18a500b2d9e8..469e19bd8933 100644 --- a/browser/themes/linux/jar.mn +++ b/browser/themes/linux/jar.mn @@ -23,7 +23,7 @@ browser.jar: * skin/classic/browser/browser.css * skin/classic/browser/browser-lightweightTheme.css skin/classic/browser/click-to-play-warning-stripes.png - skin/classic/browser/content-contextmenu.svg +* skin/classic/browser/content-contextmenu.svg * skin/classic/browser/engineManager.css skin/classic/browser/fullscreen-darknoise.png skin/classic/browser/Geolocation-16.png diff --git a/browser/themes/osx/jar.mn b/browser/themes/osx/jar.mn index c6aa3e743472..0a8f02477620 100644 --- a/browser/themes/osx/jar.mn +++ b/browser/themes/osx/jar.mn @@ -23,7 +23,7 @@ browser.jar: * skin/classic/browser/browser.css (browser.css) * skin/classic/browser/browser-lightweightTheme.css skin/classic/browser/click-to-play-warning-stripes.png - skin/classic/browser/content-contextmenu.svg +* skin/classic/browser/content-contextmenu.svg * skin/classic/browser/engineManager.css (engineManager.css) skin/classic/browser/fullscreen-darknoise.png skin/classic/browser/Geolocation-16.png diff --git a/browser/themes/windows/jar.mn b/browser/themes/windows/jar.mn index 2bd70b5521f2..f2f1cca004de 100644 --- a/browser/themes/windows/jar.mn +++ b/browser/themes/windows/jar.mn @@ -25,7 +25,7 @@ browser.jar: * skin/classic/browser/browser.css * skin/classic/browser/browser-lightweightTheme.css skin/classic/browser/click-to-play-warning-stripes.png - skin/classic/browser/content-contextmenu.svg +* skin/classic/browser/content-contextmenu.svg * skin/classic/browser/engineManager.css skin/classic/browser/fullscreen-darknoise.png skin/classic/browser/Geolocation-16.png @@ -444,7 +444,7 @@ browser.jar: * skin/classic/aero/browser/browser.css (browser-aero.css) * skin/classic/aero/browser/browser-lightweightTheme.css skin/classic/aero/browser/click-to-play-warning-stripes.png - skin/classic/aero/browser/content-contextmenu.svg +* skin/classic/aero/browser/content-contextmenu.svg * skin/classic/aero/browser/engineManager.css skin/classic/aero/browser/fullscreen-darknoise.png skin/classic/aero/browser/Geolocation-16.png From efe66d7e7053e2b084955fd147e22e5bcfaa68ae Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Fri, 8 Aug 2014 21:42:44 -0400 Subject: [PATCH 8/8] Backed out changesets 333bca3fb89e and 3f3f9b729ee7 (bug 990322) for frequent OSX 10.8 browser_thumbnails_privacy.js failures. --- .../browser_newtab_background_captures.js | 5 ++-- .../test/newtab/browser_newtab_bug721442.js | 12 ++++---- .../test/newtab/browser_newtab_bug725996.js | 6 ++-- .../test/newtab/browser_newtab_bug765628.js | 2 +- .../test/newtab/browser_newtab_bug991111.js | 2 +- .../test/newtab/browser_newtab_enhanced.js | 24 ++++++---------- .../test/newtab/browser_newtab_update.js | 2 +- browser/base/content/test/newtab/head.js | 28 ++++++++----------- toolkit/modules/NewTabUtils.jsm | 28 +------------------ .../tests/xpcshell/test_NewTabUtils.js | 2 +- 10 files changed, 37 insertions(+), 74 deletions(-) diff --git a/browser/base/content/test/newtab/browser_newtab_background_captures.js b/browser/base/content/test/newtab/browser_newtab_background_captures.js index 82ba365b7e22..2cffa70a44c9 100644 --- a/browser/base/content/test/newtab/browser_newtab_background_captures.js +++ b/browser/base/content/test/newtab/browser_newtab_background_captures.js @@ -18,7 +18,8 @@ function runTests() { Services.prefs.setBoolPref(CAPTURE_PREF, true); // Make sure the thumbnail doesn't exist yet. - let url = "http://example.com/"; + let siteName = "newtab_background_captures"; + let url = "http://example.com/#" + siteName; let path = imports.PageThumbsStorage.getFilePathForURL(url); let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile); file.initWithPath(path); @@ -28,7 +29,7 @@ function runTests() { catch (err) {} // Add a top site. - yield setLinks("-1"); + yield setLinks(siteName); // We need a handle to a hidden, pre-loaded newtab so we can verify that it // doesn't allow background captures. Add a newtab, which triggers creation diff --git a/browser/base/content/test/newtab/browser_newtab_bug721442.js b/browser/base/content/test/newtab/browser_newtab_bug721442.js index f5223f85d4ed..597aed25137a 100644 --- a/browser/base/content/test/newtab/browser_newtab_bug721442.js +++ b/browser/base/content/test/newtab/browser_newtab_bug721442.js @@ -4,17 +4,17 @@ function runTests() { yield setLinks("0,1,2,3,4,5,6,7,8"); setPinnedLinks([ - {url: "http://example7.com/", title: ""}, - {url: "http://example8.com/", title: "title"}, - {url: "http://example9.com/", title: "http://example9.com/"} + {url: "http://example.com/#7", title: ""}, + {url: "http://example.com/#8", title: "title"}, + {url: "http://example.com/#9", title: "http://example.com/#9"} ]); yield addNewTabPageTab(); checkGrid("7p,8p,9p,0,1,2,3,4,5"); - checkTooltip(0, "http://example7.com/", "1st tooltip is correct"); - checkTooltip(1, "title\nhttp://example8.com/", "2nd tooltip is correct"); - checkTooltip(2, "http://example9.com/", "3rd tooltip is correct"); + checkTooltip(0, "http://example.com/#7", "1st tooltip is correct"); + checkTooltip(1, "title\nhttp://example.com/#8", "2nd tooltip is correct"); + checkTooltip(2, "http://example.com/#9", "3rd tooltip is correct"); } function checkTooltip(aIndex, aExpected, aMessage) { diff --git a/browser/base/content/test/newtab/browser_newtab_bug725996.js b/browser/base/content/test/newtab/browser_newtab_bug725996.js index fee792dc6551..4d3ef7d5ed7b 100644 --- a/browser/base/content/test/newtab/browser_newtab_bug725996.js +++ b/browser/base/content/test/newtab/browser_newtab_bug725996.js @@ -10,14 +10,14 @@ function runTests() { let cell = getCell(0).node; - sendDragEvent("drop", cell, "http://example99.com/\nblank"); - is(NewTabUtils.pinnedLinks.links[0].url, "http://example99.com/", + sendDragEvent("drop", cell, "http://example.com/#99\nblank"); + is(NewTabUtils.pinnedLinks.links[0].url, "http://example.com/#99", "first cell is pinned and contains the dropped site"); yield whenPagesUpdated(); checkGrid("99p,0,1,2,3,4,5,6,7"); sendDragEvent("drop", cell, ""); - is(NewTabUtils.pinnedLinks.links[0].url, "http://example99.com/", + is(NewTabUtils.pinnedLinks.links[0].url, "http://example.com/#99", "first cell is still pinned with the site we dropped before"); } diff --git a/browser/base/content/test/newtab/browser_newtab_bug765628.js b/browser/base/content/test/newtab/browser_newtab_bug765628.js index 9fc80e3ccbb4..6b93c8e6de77 100644 --- a/browser/base/content/test/newtab/browser_newtab_bug765628.js +++ b/browser/base/content/test/newtab/browser_newtab_bug765628.js @@ -2,7 +2,7 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ const BAD_DRAG_DATA = "javascript:alert('h4ck0rz');\nbad stuff"; -const GOOD_DRAG_DATA = "http://example99.com/\nsite 99"; +const GOOD_DRAG_DATA = "http://example.com/#99\nsite 99"; function runTests() { yield setLinks("0,1,2,3,4,5,6,7,8"); diff --git a/browser/base/content/test/newtab/browser_newtab_bug991111.js b/browser/base/content/test/newtab/browser_newtab_bug991111.js index e9932094ca88..6149bf51e7aa 100644 --- a/browser/base/content/test/newtab/browser_newtab_bug991111.js +++ b/browser/base/content/test/newtab/browser_newtab_bug991111.js @@ -2,7 +2,7 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ function runTests() { - yield setLinks("-1"); + yield setLinks("0"); yield addNewTabPageTab(); // Remember if the click handler was triggered diff --git a/browser/base/content/test/newtab/browser_newtab_enhanced.js b/browser/base/content/test/newtab/browser_newtab_enhanced.js index 71b8b1f3c072..5fdc6c1d142a 100644 --- a/browser/base/content/test/newtab/browser_newtab_enhanced.js +++ b/browser/base/content/test/newtab/browser_newtab_enhanced.js @@ -21,10 +21,7 @@ function runTests() { Services.prefs.setBoolPref(PRELOAD_PREF, false); function getData(cellNum) { - let cell = getCell(cellNum); - if (!cell.site) - return null; - let siteNode = cell.site.node; + let siteNode = getCell(cellNum).site.node; return { type: siteNode.getAttribute("type"), enhanced: siteNode.querySelector(".enhanced-content").style.backgroundImage, @@ -32,7 +29,7 @@ function runTests() { } // Make the page have a directory link followed by a history link - yield setLinks("-1"); + yield setLinks("1"); // Test with enhanced = false NewTabUtils.allPages.enhanced = false; @@ -41,7 +38,9 @@ function runTests() { is(type, "organic", "directory link is organic"); isnot(enhanced, "", "directory link has enhanced image"); - is(getData(1), null, "history link pushed out by directory link"); + let {type, enhanced} = getData(1); + is(type, "history", "history link is history"); + is(enhanced, "", "history link has no enhanced image"); // Test with enhanced = true NewTabUtils.allPages.enhanced = true; @@ -50,14 +49,7 @@ function runTests() { is(type, "organic", "directory link is still organic"); isnot(enhanced, "", "directory link still has enhanced image"); - is(getData(1), null, "history link still pushed out by directory link"); - - // Test with a pinned link - setPinnedLinks("-1"); - yield addNewTabPageTab(); - let {type, enhanced} = getData(0); - is(type, "enhanced", "pinned history link is enhanced"); - isnot(enhanced, "", "pinned history link has enhanced image"); - - is(getData(1), null, "directory link pushed out by pinned history link"); + let {type, enhanced} = getData(1); + is(type, "enhanced", "history link now is enhanced"); + isnot(enhanced, "", "history link now has enhanced image"); } diff --git a/browser/base/content/test/newtab/browser_newtab_update.js b/browser/base/content/test/newtab/browser_newtab_update.js index a0151e953326..bf03a5a8c892 100644 --- a/browser/base/content/test/newtab/browser_newtab_update.js +++ b/browser/base/content/test/newtab/browser_newtab_update.js @@ -47,5 +47,5 @@ function runTests() { } function link(id) { - return { url: "http://example" + id + ".com/", title: "site#" + id }; + return { url: "http://example.com/#" + id, title: "site#" + id }; } diff --git a/browser/base/content/test/newtab/head.js b/browser/base/content/test/newtab/head.js index d8d6beff0d34..a75a916e6f16 100644 --- a/browser/base/content/test/newtab/head.js +++ b/browser/base/content/test/newtab/head.js @@ -203,20 +203,17 @@ function getCell(aIndex) { * Allows to provide a list of links that is used to construct the grid. * @param aLinksPattern the pattern (see below) * - * Example: setLinks("-1,0,1,2,3") - * Result: [{url: "http://example.com/", title: "site#-1"}, - * {url: "http://example0.com/", title: "site#0"}, - * {url: "http://example1.com/", title: "site#1"}, - * {url: "http://example2.com/", title: "site#2"}, - * {url: "http://example3.com/", title: "site#3"}] + * Example: setLinks("1,2,3") + * Result: [{url: "http://example.com/#1", title: "site#1"}, + * {url: "http://example.com/#2", title: "site#2"} + * {url: "http://example.com/#3", title: "site#3"}] */ function setLinks(aLinks) { let links = aLinks; if (typeof links == "string") { links = aLinks.split(/\s*,\s*/).map(function (id) { - return {url: "http://example" + (id != "-1" ? id : "") + ".com/", - title: "site#" + id}; + return {url: "http://example.com/#" + id, title: "site#" + id}; }); } @@ -287,7 +284,7 @@ function fillHistory(aLinks, aCallback) { * @param aLinksPattern the pattern (see below) * * Example: setPinnedLinks("3,,1") - * Result: 'http://example3.com/' is pinned in the first cell. 'http://example1.com/' is + * Result: 'http://example.com/#3' is pinned in the first cell. 'http://example.com/#1' is * pinned in the third cell. */ function setPinnedLinks(aLinks) { @@ -296,8 +293,7 @@ function setPinnedLinks(aLinks) { if (typeof links == "string") { links = aLinks.split(/\s*,\s*/).map(function (id) { if (id) - return {url: "http://example" + (id != "-1" ? id : "") + ".com/", - title: "site#" + id}; + return {url: "http://example.com/#" + id, title: "site#" + id}; }); } @@ -359,9 +355,9 @@ function addNewTabPageTab() { * @param the array of sites to compare with (optional) * * Example: checkGrid("3p,2,,1p") - * Result: We expect the first cell to contain the pinned site 'http://example3.com/'. - * The second cell contains 'http://example2.com/'. The third cell is empty. - * The fourth cell contains the pinned site 'http://example4.com/'. + * Result: We expect the first cell to contain the pinned site 'http://example.com/#3'. + * The second cell contains 'http://example.com/#2'. The third cell is empty. + * The fourth cell contains the pinned site 'http://example.com/#4'. */ function checkGrid(aSitesPattern, aSites) { let length = aSitesPattern.split(",").length; @@ -376,7 +372,7 @@ function checkGrid(aSitesPattern, aSites) { if (pinned != hasPinnedAttr) ok(false, "invalid state (site.isPinned() != site[pinned])"); - return aSite.url.replace(/^http:\/\/example(\d+)\.com\/$/, "$1") + (pinned ? "p" : ""); + return aSite.url.replace(/^http:\/\/example\.com\/#(\d+)$/, "$1") + (pinned ? "p" : ""); }); is(current, aSitesPattern, "grid status = " + aSitesPattern); @@ -493,7 +489,7 @@ function startAndCompleteDragOperation(aSource, aDest, aCallback) { */ function createExternalDropIframe() { const url = "data:text/html;charset=utf-8," + - "link"; + "link"; let deferred = Promise.defer(); let doc = getContentDocument(); diff --git a/toolkit/modules/NewTabUtils.jsm b/toolkit/modules/NewTabUtils.jsm index dff9d1eae996..c5bf020fbfb4 100644 --- a/toolkit/modules/NewTabUtils.jsm +++ b/toolkit/modules/NewTabUtils.jsm @@ -829,34 +829,8 @@ let Links = { let pinnedLinks = Array.slice(PinnedLinks.links); let links = this._getMergedProviderLinks(); - function getBaseDomain(url) { - let uri; - try { - uri = Services.io.newURI(url, null, null); - } catch (e) { - return null; - } - - try { - return Services.eTLD.getBaseDomain(uri); - } catch (e) { - return uri.asciiHost; - } - } - - let baseDomains = new Set(); - for (let link of pinnedLinks) { - if (link) - baseDomains.add(getBaseDomain(link.url)); - } - - // Filter blocked and pinned links and duplicate base domains. + // Filter blocked and pinned links. links = links.filter(function (link) { - let baseDomain = getBaseDomain(link.url); - if (baseDomain == null || baseDomains.has(baseDomain)) - return false; - baseDomains.add(baseDomain); - return !BlockedLinks.isBlocked(link) && !PinnedLinks.isPinned(link); }); diff --git a/toolkit/modules/tests/xpcshell/test_NewTabUtils.js b/toolkit/modules/tests/xpcshell/test_NewTabUtils.js index b8ca35d91c56..0b764570d4e8 100644 --- a/toolkit/modules/tests/xpcshell/test_NewTabUtils.js +++ b/toolkit/modules/tests/xpcshell/test_NewTabUtils.js @@ -191,7 +191,7 @@ function makeLinks(frecRangeStart, frecRangeEnd, step) { function makeLink(frecency) { return { - url: "http://example" + frecency + ".com/", + url: "http://example.com/" + frecency, title: "My frecency is " + frecency, frecency: frecency, lastVisitDate: 0,