merge fx-team to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2014-07-10 14:54:35 +02:00
commit 61f33624c3
66 changed files with 703 additions and 98 deletions

View File

@ -41,6 +41,9 @@ function runTests() {
yield whenPagesUpdated(null, true);
yield addNewTabPageTab();
checkGrid("2,1,3,4,,,,,");
// Make sure these added links have the right type
is(getCell(1).site.link.type, "history", "added link is history");
}
function link(id) {

View File

@ -2,54 +2,54 @@
skip-if = e10s # Bug ?????? - devtools tests disabled with e10s
subsuite = devtools
support-files =
browser_inspector_breadcrumbs.html
browser_inspector_bug_650804_search.html
browser_inspector_bug_831693_search_suggestions.html
browser_inspector_cmd_inspect.html
browser_inspector_dead_node_exception.html
browser_inspector_destroyselection.html
browser_inspector_highlighter.html
browser_inspector_infobar.html
browser_inspector_menu.html
browser_inspector_select_last_selected.html
browser_inspector_select_last_selected2.html
browser_inspector_bug_848731_reset_selection_on_delete.html
browser_inspector_bug_958456_highlight_comments.html
doc_inspector_breadcrumbs.html
doc_inspector_delete-selected-node-01.html
doc_inspector_delete-selected-node-02.html
doc_inspector_gcli-inspect-command.html
doc_inspector_highlighter-comments.html
doc_inspector_highlighter.html
doc_inspector_infobar.html
doc_inspector_menu.html
doc_inspector_remove-iframe-during-load.html
doc_inspector_search.html
doc_inspector_search-suggestions.html
doc_inspector_select-last-selected-01.html
doc_inspector_select-last-selected-02.html
head.js
[browser_inspector_basic_highlighter.js]
[browser_inspector_breadcrumbs.js]
[browser_inspector_bug_650804_search.js]
[browser_inspector_bug_665880.js]
[browser_inspector_bug_672902_keyboard_shortcuts.js]
[browser_inspector_bug_674871.js]
[browser_inspector_bug_699308_iframe_navigation.js]
[browser_inspector_bug_817558_delete_node.js]
[browser_inspector_bug_831693_combinator_suggestions.js]
[browser_inspector_bug_831693_input_suggestion.js]
# [browser_inspector_bug_831693_searchbox_panel_navigation.js]
# Disabled for too many intermittent failures (bug 851349)
[browser_inspector_bug_840156_destroy_after_navigation.js]
[browser_inspector_cmd_inspect.js]
[browser_inspector_dead_node_exception.js]
[browser_inspector_destroyselection.js]
[browser_inspector_highlighter.js]
[browser_inspector_iframeTest.js]
[browser_inspector_delete-selected-node-01.js]
[browser_inspector_delete-selected-node-02.js]
[browser_inspector_delete-selected-node-03.js]
[browser_inspector_destroy-after-navigation.js]
[browser_inspector_gcli-inspect-command.js]
[browser_inspector_highlighter-01.js]
[browser_inspector_highlighter-02.js]
[browser_inspector_highlighter-03.js]
[browser_inspector_highlighter-comments.js]
[browser_inspector_highlighter-iframes.js]
[browser_inspector_iframe-navigation.js]
[browser_inspector_infobar.js]
skip-if = true # Bug 1028609
[browser_inspector_initialization.js]
[browser_inspector_inspect-object-element.js]
[browser_inspector_invalidate.js]
[browser_inspector_keyboard-shortcuts.js]
[browser_inspector_menu.js]
[browser_inspector_navigation.js]
[browser_inspector_pseudoClass_menu.js]
[browser_inspector_pseudoclass_lock.js]
[browser_inspector_picker-stop-on-destroy.js]
[browser_inspector_picker-stop-on-tool-change.js]
[browser_inspector_pseudoclass-lock.js]
[browser_inspector_pseudoclass-menu.js]
[browser_inspector_reload.js]
[browser_inspector_remove-iframe-during-load.js]
[browser_inspector_scrolling.js]
[browser_inspector_select_last_selected.js]
[browser_inspector_search-01.js]
[browser_inspector_search-02.js]
[browser_inspector_search-03.js]
[browser_inspector_select-last-selected.js]
# [browser_inspector_search-navigation.js]
# Disabled for too many intermittent failures (bug 851349)
[browser_inspector_sidebarstate.js]
[browser_inspector_bug_848731_reset_selection_on_delete.js]
[browser_inspector_bug_922125_destroy_on_navigate.js]
[browser_inspector_bug_958456_highlight_comments.js]
[browser_inspector_bug_958169_switch_to_inspector_on_pick.js]
[browser_inspector_bug_961771_picker_stops_on_tool_select.js]
[browser_inspector_bug_962478_picker_stops_on_destroy.js]
[browser_inspector_switch-to-inspector-on-pick.js]
[browser_inspector_update-on-navigation.js]

View File

@ -5,7 +5,7 @@
// Test that the breadcrumbs widget content is correct.
const TEST_URI = TEST_URL_ROOT + "browser_inspector_breadcrumbs.html";
const TEST_URI = TEST_URL_ROOT + "doc_inspector_breadcrumbs.html";
const NODES = [
{nodeId: "#i1111", result: "i1 i11 i111 i1111"},
{nodeId: "#i22", result: "i2 i22 i221"},

View File

@ -5,7 +5,7 @@
// Test to ensure inspector handles deletion of selected node correctly.
const TEST_URL = TEST_URL_ROOT + "browser_inspector_destroyselection.html";
const TEST_URL = TEST_URL_ROOT + "doc_inspector_delete-selected-node-01.html";
let test = asyncTest(function* () {
let { inspector } = yield openInspectorForURL(TEST_URL);

View File

@ -10,7 +10,7 @@
// box model view, and breadcrumbs, reset accordingly to show the right node
const TEST_PAGE = TEST_URL_ROOT +
"browser_inspector_bug_848731_reset_selection_on_delete.html";
"doc_inspector_delete-selected-node-02.html";
let test = asyncTest(function* () {
let { inspector } = yield openInspectorForURL(TEST_PAGE);

View File

@ -6,7 +6,7 @@
// Test to ensure inspector can handle destruction of selected node inside an
// iframe.
const TEST_URL = TEST_URL_ROOT + "browser_inspector_destroyselection.html";
const TEST_URL = TEST_URL_ROOT + "doc_inspector_delete-selected-node-01.html";
let test = asyncTest(function* () {
let { inspector } = yield openInspectorForURL(TEST_URL);

View File

@ -5,7 +5,7 @@
// Testing that the gcli 'inspect' command works as it should.
const TEST_URI = TEST_URL_ROOT + "browser_inspector_cmd_inspect.html";
const TEST_URI = TEST_URL_ROOT + "doc_inspector_gcli-inspect-command.html";
let test = asyncTest(function* () {
return helpers.addTabWithToolbar(TEST_URI, function(options) {

View File

@ -8,7 +8,7 @@
// Test that the highlighter is correctly displayed over a variety of elements
const TEST_URI = TEST_URL_ROOT + "browser_inspector_highlighter.html";
const TEST_URI = TEST_URL_ROOT + "doc_inspector_highlighter.html";
let test = asyncTest(function*() {
let { inspector } = yield openInspectorForURL(TEST_URI);

View File

@ -9,7 +9,7 @@
// highlighter, depending on the type of node hovered over.
const TEST_PAGE = TEST_URL_ROOT +
"browser_inspector_bug_958456_highlight_comments.html";
"doc_inspector_highlighter-comments.html";
let test = asyncTest(function* () {
let { inspector } = yield openInspectorForURL(TEST_PAGE);

View File

@ -5,7 +5,7 @@
"use strict";
const TEST_URI = "http://example.com/browser/browser/devtools/inspector/" +
"test/browser_inspector_infobar.html";
"test/doc_inspector_infobar.html";
const DOORHANGER_ARROW_HEIGHT = 5;
// Test that hovering over nodes in the markup-view shows the highlighter over

View File

@ -7,7 +7,7 @@ http://creativecommons.org/publicdomain/zero/1.0/ */
// 1) menu items are disabled/enabled depending on the clicked node
// 2) actions triggered by the items work correctly
const TEST_URL = TEST_URL_ROOT + "browser_inspector_menu.html";
const TEST_URL = TEST_URL_ROOT + "doc_inspector_menu.html";
const MENU_SENSITIVITY_TEST_DATA = [
{
desc: "doctype node",

View File

@ -8,7 +8,7 @@
// Test that inspector updates when page is navigated.
const TEST_URL_FILE = "browser/browser/devtools/inspector/test/" +
"browser_inspector_breadcrumbs.html";
"doc_inspector_breadcrumbs.html";
const TEST_URL_1 = "http://test1.example.org/" + TEST_URL_FILE;
const TEST_URL_2 = "http://test2.example.org/" + TEST_URL_FILE;

View File

@ -6,7 +6,7 @@
// Testing that the inspector doesn't go blank when navigating to a page that
// deletes an iframe while loading.
const TEST_URL = TEST_URL_ROOT + "browser_inspector_dead_node_exception.html";
const TEST_URL = TEST_URL_ROOT + "doc_inspector_remove-iframe-during-load.html";
let test = asyncTest(function* () {
let { inspector, toolbox } = yield openInspectorForURL("about:blank");

View File

@ -6,7 +6,7 @@
// Test that searching for nodes in the search field actually selects those
// nodes.
const TEST_URL = TEST_URL_ROOT + "browser_inspector_bug_650804_search.html";
const TEST_URL = TEST_URL_ROOT + "doc_inspector_search.html";
// Indexes of the keys in the KEY_STATES array that should listen to "keypress"
// event instead of "command". These are keys that don't change the content of

View File

@ -6,7 +6,7 @@
// Testing that searching for combining selectors using the inspector search
// field produces correct suggestions.
const TEST_URL = TEST_URL_ROOT + "browser_inspector_bug_831693_search_suggestions.html";
const TEST_URL = TEST_URL_ROOT + "doc_inspector_search-suggestions.html";
// An array of (key, suggestions) pairs where key is a key to press and
// suggestions is an array of suggestions that should be shown in the popup.

View File

@ -6,7 +6,7 @@
// Testing that searching for elements using the inspector search field
// produces correct suggestions.
const TEST_URL = TEST_URL_ROOT + "browser_inspector_bug_650804_search.html";
const TEST_URL = TEST_URL_ROOT + "doc_inspector_search.html";
// An array of (key, suggestions) pairs where key is a key to press and
// suggestions is an array of suggestions that should be shown in the popup.

View File

@ -67,7 +67,7 @@ function test()
waitForFocus(setupTest, content);
}, true);
content.location = "http://mochi.test:8888/browser/browser/devtools/inspector/test/browser_inspector_bug_831693_search_suggestions.html";
content.location = "http://mochi.test:8888/browser/browser/devtools/inspector/test/doc_inspector_search-suggestions.html";
function $(id) {
if (id == null) return null;

View File

@ -6,8 +6,8 @@
// Checks that the expected default node is selected after a page navigation or
// a reload.
let PAGE_1 = TEST_URL_ROOT + "browser_inspector_select_last_selected.html";
let PAGE_2 = TEST_URL_ROOT + "browser_inspector_select_last_selected2.html";
let PAGE_1 = TEST_URL_ROOT + "doc_inspector_select-last-selected-01.html";
let PAGE_2 = TEST_URL_ROOT + "doc_inspector_select-last-selected-02.html";
// An array of test cases with following properties:
// - url: URL to navigate to. If URL == content.location, reload instead.

View File

@ -14,6 +14,7 @@ let {OutputParser} = devtools.require("devtools/output-parser");
const COLOR_CLASS = "color-class";
const URL_CLASS = "url-class";
const CUBIC_BEZIER_CLASS = "bezier-class";
function test() {
function countAll(fragment) {
@ -25,12 +26,18 @@ function test() {
function countUrls(fragment) {
return fragment.querySelectorAll("." + URL_CLASS).length;
}
function countCubicBeziers(fragment) {
return fragment.querySelectorAll("." + CUBIC_BEZIER_CLASS).length;
}
function getColor(fragment, index) {
return fragment.querySelectorAll("." + COLOR_CLASS)[index||0].textContent;
}
function getUrl(fragment, index) {
return fragment.querySelectorAll("." + URL_CLASS)[index||0].textContent;
}
function getCubicBezier(fragment, index) {
return fragment.querySelectorAll("." + CUBIC_BEZIER_CLASS)[index||0].textContent;
}
let testData = [
{
@ -225,6 +232,67 @@ function test() {
is(countAll(fragment), 1);
is(getUrl(fragment), "../../../look/at/this/folder/structure/../../red.blue.green.svg");
}
},
{
name: "transition-timing-function",
value: "linear",
test: fragment => {
is(countCubicBeziers(fragment), 1);
is(getCubicBezier(fragment), "linear");
}
},
{
name: "animation-timing-function",
value: "ease-in-out",
test: fragment => {
is(countCubicBeziers(fragment), 1);
is(getCubicBezier(fragment), "ease-in-out");
}
},
{
name: "animation-timing-function",
value: "cubic-bezier(.1, 0.55, .9, -3.45)",
test: fragment => {
is(countCubicBeziers(fragment), 1);
is(getCubicBezier(fragment), "cubic-bezier(.1, 0.55, .9, -3.45)");
}
},
{
name: "animation",
value: "move 3s cubic-bezier(.1, 0.55, .9, -3.45)",
test: fragment => {
is(countCubicBeziers(fragment), 1);
is(getCubicBezier(fragment), "cubic-bezier(.1, 0.55, .9, -3.45)");
}
},
{
name: "transition",
value: "top 1s ease-in",
test: fragment => {
is(countCubicBeziers(fragment), 1);
is(getCubicBezier(fragment), "ease-in");
}
},
{
name: "transition",
value: "top 3s steps(4, end)",
test: fragment => {
is(countAll(fragment), 0);
}
},
{
name: "transition",
value: "top 3s step-start",
test: fragment => {
is(countAll(fragment), 0);
}
},
{
name: "transition",
value: "top 3s step-end",
test: fragment => {
is(countAll(fragment), 0);
}
}
];
@ -235,6 +303,7 @@ function test() {
data.test(parser.parseCssProperty(data.name, data.value, {
colorClass: COLOR_CLASS,
urlClass: URL_CLASS,
bezierClass: CUBIC_BEZIER_CLASS,
defaultColorType: false
}));
}

View File

@ -309,7 +309,6 @@ function CreateSocialMarkWidget(aId, aProvider) {
node.setAttribute('type', "socialmark");
node.style.listStyleImage = "url(" + (aProvider.unmarkedIcon || aProvider.icon32URL || aProvider.iconURL) + ")";
node.setAttribute("origin", aProvider.origin);
node.setAttribute("oncommand", "this.markCurrentPage();");
let window = aDocument.defaultView;
let menuLabel = window.gNavigatorBundle.getFormattedString("social.markpageMenu.label", [aProvider.name]);

View File

@ -199,6 +199,14 @@ a {
border-color: #777;
}
.theme-light .message:hover {
background-color: rgba(76, 158, 217, 0.23) !important;
}
.theme-dark .message:hover {
background-color: rgba(29, 79, 115, 0.5) !important;
}
.theme-light .message[severity=error] {
background-color: rgba(255, 150, 150, 0.3);
}

View File

@ -3903,7 +3903,6 @@ MOZ_SAFE_BROWSING=
MOZ_HELP_VIEWER=
MOZ_SPELLCHECK=1
MOZ_ANDROID_OMTC=
MOZ_NATIVE_CASTING=1
MOZ_TOOLKIT_SEARCH=1
MOZ_UI_LOCALE=en-US
MOZ_UNIVERSALCHARDET=1
@ -7682,19 +7681,6 @@ else
OMNIJAR_NAME=omni.ja
fi
dnl ========================================================
dnl = --disable-native-casting
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(native-casting,
[ --disable-native-casting Disable native casting devices],
MOZ_NATIVE_CASTING=,
MOZ_NATIVE_CASTING=1)
if test "$MOZ_NATIVE_CASTING"; then
AC_DEFINE(MOZ_NATIVE_CASTING)
fi
AC_SUBST(MOZ_NATIVE_CASTING)
AC_SUBST(OMNIJAR_NAME)
AC_SUBST(MOZ_OMNIJAR)
AC_SUBST(MOZ_PACKAGER_FORMAT)

View File

@ -92,7 +92,7 @@
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true"/>
#ifdef MOZ_NATIVE_CASTING
#ifdef MOZ_NATIVE_DEVICES
<!-- This resources comes from Google Play Services. Required for casting support. -->
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
#endif

View File

@ -164,7 +164,7 @@ public class AppConstants {
#endif
public static final boolean MOZ_MEDIA_PLAYER =
#ifdef MOZ_NATIVE_CASTING
#ifdef MOZ_NATIVE_DEVICES
true;
#else
false;

View File

@ -550,6 +550,19 @@ public class BrowserApp extends GeckoApp
Distribution.init(this);
// Shipping Native casting is optional and dependent on whether you've downloaded the support
// and google play libraries
if (AppConstants.MOZ_MEDIA_PLAYER) {
try {
Class<?> mediaManagerClass = Class.forName("org.mozilla.gecko.MediaPlayerManager");
Method init = mediaManagerClass.getMethod("init", Context.class);
init.invoke(null, this);
} catch(Exception ex) {
// Ignore failures
Log.i(LOGTAG, "No native casting support", ex);
}
}
JavaAddonManager.getInstance().init(getApplicationContext());
mSharedPreferencesHelper = new SharedPreferencesHelper(getApplicationContext());
mOrderedBroadcastHelper = new OrderedBroadcastHelper(getApplicationContext());

View File

@ -19,12 +19,10 @@ import com.google.android.gms.cast.MediaMetadata;
import com.google.android.gms.cast.MediaStatus;
import com.google.android.gms.cast.RemoteMediaPlayer;
import com.google.android.gms.cast.RemoteMediaPlayer.MediaChannelResult;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.common.GooglePlayServicesUtil;
import android.content.Context;
import android.os.Bundle;
@ -133,11 +131,6 @@ class ChromeCast implements GeckoMediaPlayer {
}
public ChromeCast(Context context, RouteInfo route) {
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(context);
if (status != ConnectionResult.SUCCESS) {
throw new IllegalStateException("Play services are required for Chromecast support (go status code " + status + ")");
}
this.context = context;
this.route = route;
}

View File

@ -67,7 +67,7 @@ JAVA_BOOTCLASSPATH = \
JAVA_BOOTCLASSPATH := $(subst $(NULL) ,:,$(strip $(JAVA_BOOTCLASSPATH)))
# If native devices are enabled, add Google Play Services and some of the v7 compat libraries
ifdef MOZ_NATIVE_CASTING
ifdef MOZ_NATIVE_DEVICES
JAVA_CLASSPATH += \
$(GOOGLE_PLAY_SERVICES_LIB) \
$(ANDROID_MEDIAROUTER_LIB) \
@ -304,7 +304,7 @@ generated/android/support/v7/appcompat/R.java: .aapt.deps ;
generated/android/support/v7/mediarouter/R.java: .aapt.deps ;
generated/com/google/android/gms/R.java: .aapt.deps ;
ifdef MOZ_NATIVE_CASTING
ifdef MOZ_NATIVE_DEVICES
extra_packages += android.support.v7.appcompat
extra_res_dirs += $(ANDROID_APPCOMPAT_RES)

View File

@ -5,7 +5,6 @@
package org.mozilla.gecko;
import org.mozilla.gecko.util.EventCallback;
import org.mozilla.gecko.mozglue.JNITarget;
import org.mozilla.gecko.util.NativeEventListener;
import org.mozilla.gecko.util.NativeJSObject;
@ -37,7 +36,7 @@ interface GeckoMediaPlayer {
* from Gecko to the correct caster based on the id of the display
*/
class MediaPlayerManager implements NativeEventListener,
GeckoAppShell.AppStateListener {
GeckoAppShell.AppStateListener {
private static final String LOGTAG = "GeckoMediaPlayerManager";
private static final boolean SHOW_DEBUG = false;
@ -59,7 +58,6 @@ class MediaPlayerManager implements NativeEventListener,
private final HashMap<String, GeckoMediaPlayer> displays = new HashMap<String, GeckoMediaPlayer>();
private static MediaPlayerManager instance;
@JNITarget
public static void init(Context context) {
if (instance != null) {
debug("MediaPlayerManager initialized twice");
@ -86,7 +84,6 @@ class MediaPlayerManager implements NativeEventListener,
"MediaPlayer:End");
}
@JNITarget
public static void onDestroy() {
if (instance == null) {
return;

View File

@ -33,6 +33,9 @@ public class BrowserContract {
public static final String READING_LIST_AUTHORITY = AppConstants.ANDROID_PACKAGE_NAME + ".db.readinglist";
public static final Uri READING_LIST_AUTHORITY_URI = Uri.parse("content://" + READING_LIST_AUTHORITY);
public static final String SEARCH_HISTORY_AUTHORITY = AppConstants.ANDROID_PACKAGE_NAME + ".db.searchhistory";
public static final Uri SEARCH_HISTORY_AUTHORITY_URI = Uri.parse("content://" + SEARCH_HISTORY_AUTHORITY);
public static final String PARAM_PROFILE = "profile";
public static final String PARAM_PROFILE_PATH = "profilePath";
public static final String PARAM_LIMIT = "limit";
@ -433,6 +436,17 @@ public class BrowserContract {
public static final String TYPE = "type";
}
@RobocopTarget
public static final class SearchHistory implements CommonColumns, HistoryColumns {
private SearchHistory() {}
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/searchhistory";
public static final String QUERY = "query";
public static final String TABLE_NAME = "searchhistory";
public static final Uri CONTENT_URI = Uri.withAppendedPath(SEARCH_HISTORY_AUTHORITY_URI, "searchhistory");
}
@RobocopTarget
public static final class SuggestedSites implements CommonColumns, URLColumns {
private SuggestedSites() {}

View File

@ -16,6 +16,7 @@ import org.mozilla.gecko.db.BrowserContract.Favicons;
import org.mozilla.gecko.db.BrowserContract.History;
import org.mozilla.gecko.db.BrowserContract.Obsolete;
import org.mozilla.gecko.db.BrowserContract.ReadingListItems;
import org.mozilla.gecko.db.BrowserContract.SearchHistory;
import org.mozilla.gecko.db.BrowserContract.Thumbnails;
import org.mozilla.gecko.sync.Utils;
@ -34,7 +35,7 @@ import android.util.Log;
final class BrowserDatabaseHelper extends SQLiteOpenHelper {
private static final String LOGTAG = "GeckoBrowserDBHelper";
public static final int DATABASE_VERSION = 19;
public static final int DATABASE_VERSION = 20;
public static final String DATABASE_NAME = "browser.db";
final protected Context mContext;
@ -758,6 +759,20 @@ final class BrowserDatabaseHelper extends SQLiteOpenHelper {
createOrUpdateAllSpecialFolders(db);
createReadingListTable(db);
createSearchHistoryTable(db);
}
private void createSearchHistoryTable(SQLiteDatabase db) {
debug("Creating " + SearchHistory.TABLE_NAME + " table");
db.execSQL("CREATE TABLE " + SearchHistory.TABLE_NAME + "(" +
SearchHistory._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
SearchHistory.QUERY + " TEXT UNIQUE NOT NULL, " +
SearchHistory.DATE_LAST_VISITED + " INTEGER, " +
SearchHistory.VISITS + " INTEGER ) ");
db.execSQL("CREATE INDEX idx_search_history_last_visited ON " +
SearchHistory.TABLE_NAME + "(" + SearchHistory.DATE_LAST_VISITED + ")");
}
private void createReadingListTable(SQLiteDatabase db) {
@ -1400,6 +1415,10 @@ final class BrowserDatabaseHelper extends SQLiteOpenHelper {
" WHERE " + Bookmarks.TYPE + " IS NULL");
}
private void upgradeDatabaseFrom19to20(SQLiteDatabase db) {
createSearchHistoryTable(db);
}
private void createV19CombinedView(SQLiteDatabase db) {
db.execSQL("DROP VIEW IF EXISTS " + VIEW_COMBINED);
db.execSQL("DROP VIEW IF EXISTS " + VIEW_COMBINED_WITH_FAVICONS);
@ -1487,6 +1506,10 @@ final class BrowserDatabaseHelper extends SQLiteOpenHelper {
case 19:
upgradeDatabaseFrom18to19(db);
break;
case 20:
upgradeDatabaseFrom19to20(db);
break;
}
}
@ -1600,3 +1623,4 @@ final class BrowserDatabaseHelper extends SQLiteOpenHelper {
}
}
}

View File

@ -0,0 +1,124 @@
/* 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/. */
package org.mozilla.gecko.db;
import org.mozilla.gecko.db.BrowserContract.SearchHistory;
import android.content.ContentUris;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
public class SearchHistoryProvider extends SharedBrowserDatabaseProvider {
private static final String LOG_TAG = "GeckoSearchProvider";
private static final boolean DEBUG_ENABLED = false;
/**
* Collapse whitespace.
*/
private String stripWhitespace(String query) {
if (TextUtils.isEmpty(query)) {
return "";
}
// Collapse whitespace
return query.trim().replaceAll("\\s+", " ");
}
@Override
public Uri insertInTransaction(Uri uri, ContentValues cv) {
final String query = stripWhitespace(cv.getAsString(SearchHistory.QUERY));
// We don't support inserting empty search queries.
if (TextUtils.isEmpty(query)) {
return null;
}
final SQLiteDatabase db = getWritableDatabase(uri);
long id = -1;
/*
* Attempt to insert the query. The catch block handles the case when
* the query already exists in the DB.
*/
try {
cv.put(SearchHistory.QUERY, query);
cv.put(SearchHistory.VISITS, 1);
cv.put(SearchHistory.DATE_LAST_VISITED, System.currentTimeMillis());
id = db.insertOrThrow(SearchHistory.TABLE_NAME, null, cv);
if (id > 0) {
return ContentUris.withAppendedId(uri, id);
}
} catch (SQLException e) {
// This happens when the column already exists for this term.
if (DEBUG_ENABLED) {
Log.w(LOG_TAG, String.format("Query `%s` already in db", query));
}
}
/*
* Increment the VISITS counter and update the DATE_LAST_VISITED.
*/
final String sql = "UPDATE " + SearchHistory.TABLE_NAME + " SET " +
SearchHistory.VISITS + " = " + SearchHistory.VISITS + " + 1, " +
SearchHistory.DATE_LAST_VISITED + " = " + System.currentTimeMillis() +
" WHERE " + SearchHistory.QUERY + " = ?";
final Cursor c = db.rawQuery(sql, new String[] { query });
try {
if (c.getCount() > 1) {
// There is a UNIQUE constraint on the QUERY column,
// so there should only be one match.
return null;
}
if (c.moveToFirst()) {
return ContentUris.withAppendedId(uri, c.getInt(c.getColumnIndex(SearchHistory._ID)));
}
} finally {
c.close();
}
return null;
}
@Override
public int deleteInTransaction(Uri uri, String selection, String[] selectionArgs) {
return getWritableDatabase(uri).delete(SearchHistory.TABLE_NAME,
selection, selectionArgs);
}
/**
* Since we are managing counts and the full-text db, an update
* could mangle the internal state. So we disable it.
*/
@Override
public int updateInTransaction(Uri uri, ContentValues values, String selection,
String[] selectionArgs) {
throw new UnsupportedOperationException("This content provider does not support updating items");
}
@Override
public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
String groupBy = null;
String having = null;
return getReadableDatabase(uri).query(SearchHistory.TABLE_NAME, projection,
selection, selectionArgs,
groupBy, having, sortOrder);
}
@Override
public String getType(Uri uri) {
return SearchHistory.CONTENT_TYPE;
}
}

View File

@ -16,7 +16,7 @@ public class FxAccountAuthenticatorService extends Service {
// Lazily initialized by <code>getAuthenticator</code>.
protected FxAccountAuthenticator accountAuthenticator = null;
protected FxAccountAuthenticator getAuthenticator() {
protected synchronized FxAccountAuthenticator getAuthenticator() {
if (accountAuthenticator == null) {
accountAuthenticator = new FxAccountAuthenticator(this);
}
@ -35,10 +35,21 @@ public class FxAccountAuthenticatorService extends Service {
public IBinder onBind(Intent intent) {
Logger.debug(LOG_TAG, "onBind");
if (intent.getAction().equals(android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT)) {
return getAuthenticator().getIBinder();
if (intent == null) {
// Should never happen, but can -- Bug 1025937.
return null;
}
return null;
if (!android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT.equals(intent.getAction())) {
return null;
}
final FxAccountAuthenticator authenticator = getAuthenticator();
if (authenticator == null) {
// Should never happen.
return null;
}
return authenticator.getIBinder();
}
}

View File

@ -17,7 +17,7 @@ resjar.generated_sources += [
'org/mozilla/gecko/R.java',
]
if CONFIG['MOZ_NATIVE_CASTING']:
if CONFIG['MOZ_NATIVE_DEVICES']:
resjar.generated_sources += ['com/google/android/gms/R.java']
resjar.generated_sources += ['android/support/v7/appcompat/R.java']
resjar.generated_sources += ['android/support/v7/mediarouter/R.java']
@ -150,6 +150,7 @@ gbjar.sources += [
'db/PerProfileDatabaseProvider.java',
'db/PerProfileDatabases.java',
'db/ReadingListProvider.java',
'db/SearchHistoryProvider.java',
'db/SharedBrowserDatabaseProvider.java',
'db/SQLiteBridgeContentProvider.java',
'db/SuggestedSites.java',
@ -473,7 +474,7 @@ gbjar.extra_jars = [
'websockets.jar',
]
if CONFIG['MOZ_NATIVE_CASTING']:
if CONFIG['MOZ_NATIVE_DEVICES']:
gbjar.extra_jars += [CONFIG['ANDROID_APPCOMPAT_LIB']]
gbjar.extra_jars += [CONFIG['ANDROID_MEDIAROUTER_LIB']]
gbjar.extra_jars += [CONFIG['GOOGLE_PLAY_SERVICES_LIB']]
@ -530,7 +531,7 @@ ANDROID_GENERATED_RESFILES += [
]
for var in ('MOZ_ANDROID_ANR_REPORTER', 'MOZ_LINKER_EXTRACT', 'MOZILLA_OFFICIAL', 'MOZ_DEBUG',
'MOZ_ANDROID_SEARCH_ACTIVITY', 'MOZ_NATIVE_CASTING'):
'MOZ_ANDROID_SEARCH_ACTIVITY', 'MOZ_NATIVE_DEVICES'):
if CONFIG[var]:
DEFINES[var] = 1
@ -613,7 +614,7 @@ cpe = main.add_classpathentry('src', SRCDIR,
'org/mozilla/gecko/resources/**'])
if not CONFIG['MOZ_CRASHREPORTER']:
cpe.exclude_patterns += ['org/mozilla/gecko/CrashReporter.java']
if not CONFIG['MOZ_NATIVE_CASTING']:
if not CONFIG['MOZ_NATIVE_DEVICES']:
cpe.exclude_patterns += ['org/mozilla/gecko/ChromeCast.java']
cpe.exclude_patterns += ['org/mozilla/gecko/MediaPlayerManager.java']
main.add_classpathentry('generated', OBJDIR + '/generated',

View File

@ -73,6 +73,7 @@ skip-if = processor == "x86"
skip-if = processor == "x86"
# [testReaderMode] # see bug 913254, 936224
[testReadingListProvider]
[testSearchHistoryProvider]
[testSearchSuggestions]
# disabled on x86; bug 907768
skip-if = processor == "x86"

View File

@ -0,0 +1,302 @@
/* 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/. */
package org.mozilla.gecko.tests;
import java.util.concurrent.Callable;
import org.mozilla.gecko.db.BrowserContract;
import org.mozilla.gecko.db.BrowserContract.SearchHistory;
import org.mozilla.gecko.db.SearchHistoryProvider;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
public class testSearchHistoryProvider extends ContentProviderTest {
// Translations of "United Kingdom" in several different languages
private static final String[] testStrings = {"An Ríocht Aontaithe", // Irish
"Angli", // Albanian
"Britanniarum Regnum", // Latin
"Britio", // Esperanto
"Büyük Britanya", // Turkish
"Egyesült Királyság", // Hungarian
"Erresuma Batua", // Basque
"Inggris Raya", // Indonesian
"Ir-Renju Unit", // Maltese
"Iso-Britannia", // Finnish
"Jungtinė Karalystė", // Lithuanian
"Lielbritānija", // Latvian
"Regatul Unit", // Romanian
"Regne Unit", // Catalan, Valencian
"Regno Unito", // Italian
"Royaume-Uni", // French
"Spojené království", // Czech
"Spojené kráľovstvo", // Slovak
"Storbritannia", // Norwegian
"Storbritannien", // Danish
"Suurbritannia", // Estonian
"Ujedinjeno Kraljevstvo", // Bosnian
"United Alaeze", // Igbo
"United Kingdom", // English
"Vereinigtes Königreich", // German
"Verenigd Koninkrijk", // Dutch
"Verenigde Koninkryk", // Afrikaans
"Vương quốc Anh", // Vietnamese
"Wayòm Ini", // Haitian, Haitian Creole
"Y Deyrnas Unedig", // Welsh
"Združeno kraljestvo", // Slovene
"Zjednoczone Królestwo", // Polish
"Ηνωμένο Βασίλειο", // Greek (modern)
"Великобритания", // Russian
"Нэгдсэн Вант Улс", // Mongolian
"Обединетото Кралство", // Macedonian
"Уједињено Краљевство", // Serbian
"Միացյալ Թագավորություն", // Armenian
"בריטניה", // Hebrew (modern)
"פֿאַראייניקטע מלכות", // Yiddish
"المملكة المتحدة", // Arabic
"برطانیہ", // Urdu
"پادشاهی متحده", // Persian (Farsi)
"यूनाइटेड किंगडम", // Hindi
"संयुक्त राज्य", // Nepali
"যুক্তরাজ্য", // Bengali, Bangla
"યુનાઇટેડ કિંગડમ", // Gujarati
"ஐக்கிய ராஜ்யம்", // Tamil
"สหราชอาณาจักร", // Thai
"ສະ​ຫະ​ປະ​ຊາ​ຊະ​ອາ​ນາ​ຈັກ", // Lao
"გაერთიანებული სამეფო", // Georgian
"イギリス", // Japanese
"联合王国" // Chinese
};
private static final String DB_NAME = "searchhistory.db";
/**
* Boilerplate alert.
* <p/>
* Make sure this method is present and that it returns a new
* instance of your class.
*/
private static Callable<ContentProvider> sProviderFactory =
new Callable<ContentProvider>() {
@Override
public ContentProvider call() {
return new SearchHistoryProvider();
}
};
@Override
public void setUp() throws Exception {
super.setUp(sProviderFactory, BrowserContract.SEARCH_HISTORY_AUTHORITY, DB_NAME);
mTests.add(new TestInsert());
mTests.add(new TestUnicodeQuery());
mTests.add(new TestTimestamp());
mTests.add(new TestDelete());
mTests.add(new TestIncrement());
}
public void testSearchHistory() throws Exception {
for (Runnable test : mTests) {
String testName = test.getClass().getSimpleName();
setTestName(testName);
mAsserter.dumpLog(
"testBrowserProvider: Database empty - Starting " + testName + ".");
// Clear the db
mProvider.delete(SearchHistory.CONTENT_URI, null, null);
test.run();
}
}
/**
* Verify that we can insert values into the DB, including unicode.
*/
private class TestInsert extends TestCase {
@Override
public void test() throws Exception {
ContentValues cv;
for (int i = 0; i < testStrings.length; i++) {
cv = new ContentValues();
cv.put(SearchHistory.QUERY, testStrings[i]);
mProvider.insert(SearchHistory.CONTENT_URI, cv);
}
final Cursor c = mProvider.query(SearchHistory.CONTENT_URI, null, null, null, null);
try {
mAsserter.is(c.getCount(), testStrings.length,
"Should have one row for each insert");
} finally {
c.close();
}
}
}
/**
* Verify that we can insert values into the DB, including unicode.
*/
private class TestUnicodeQuery extends TestCase {
@Override
public void test() throws Exception {
final String selection = SearchHistory.QUERY + " = ?";
for (int i = 0; i < testStrings.length; i++) {
final ContentValues cv = new ContentValues();
cv.put(SearchHistory.QUERY, testStrings[i]);
mProvider.insert(SearchHistory.CONTENT_URI, cv);
final Cursor c = mProvider.query(SearchHistory.CONTENT_URI, null, selection,
new String[]{ testStrings[i] }, null);
try {
mAsserter.is(c.getCount(), 1,
"Should have one row for insert of " + testStrings[i]);
} finally {
c.close();
}
}
}
}
/**
* Verify that timestamps are updated on insert.
*/
private class TestTimestamp extends TestCase {
@Override
public void test() throws Exception {
String insertedTerm = "Courtside Seats";
long insertStart;
long insertFinish;
long t1Db;
long t2Db;
ContentValues cv = new ContentValues();
cv.put(SearchHistory.QUERY, insertedTerm);
// First check that the DB has a value that is close to the
// system time.
insertStart = System.currentTimeMillis();
mProvider.insert(SearchHistory.CONTENT_URI, cv);
insertFinish = System.currentTimeMillis();
final Cursor c1 = mProvider.query(SearchHistory.CONTENT_URI, null, null, null, null);
try {
c1.moveToFirst();
t1Db = c1.getLong(c1.getColumnIndex(SearchHistory.DATE_LAST_VISITED));
} finally {
c1.close();
}
mAsserter.dumpLog("First insert:");
mAsserter.dumpLog(" insertStart " + insertStart);
mAsserter.dumpLog(" insertFinish " + insertFinish);
mAsserter.dumpLog(" t1Db " + t1Db);
mAsserter.ok(t1Db >= insertStart, "DATE_LAST_VISITED",
"Date last visited should be set on insert.");
mAsserter.ok(t1Db <= insertFinish, "DATE_LAST_VISITED",
"Date last visited should be set on insert.");
cv = new ContentValues();
cv.put(SearchHistory.QUERY, insertedTerm);
insertStart = System.currentTimeMillis();
mProvider.insert(SearchHistory.CONTENT_URI, cv);
insertFinish = System.currentTimeMillis();
final Cursor c2 = mProvider.query(SearchHistory.CONTENT_URI, null, null, null, null);
try {
c2.moveToFirst();
t2Db = c2.getLong(c2.getColumnIndex(SearchHistory.DATE_LAST_VISITED));
} finally {
c2.close();
}
mAsserter.dumpLog("Second insert:");
mAsserter.dumpLog(" insertStart " + insertStart);
mAsserter.dumpLog(" insertFinish " + insertFinish);
mAsserter.dumpLog(" t2Db " + t2Db);
mAsserter.ok(t2Db >= insertStart, "DATE_LAST_VISITED",
"Date last visited should be set on insert.");
mAsserter.ok(t2Db <= insertFinish, "DATE_LAST_VISITED",
"Date last visited should be set on insert.");
mAsserter.ok(t2Db >= t1Db, "DATE_LAST_VISITED",
"Date last visited should be updated on key increment.");
}
}
/**
* Verify that sending a delete command empties the database.
*/
private class TestDelete extends TestCase {
@Override
public void test() throws Exception {
String insertedTerm = "Courtside Seats";
ContentValues cv = new ContentValues();
cv.put(SearchHistory.QUERY, insertedTerm);
mProvider.insert(SearchHistory.CONTENT_URI, cv);
final Cursor c1 = mProvider.query(SearchHistory.CONTENT_URI, null, null, null, null);
try {
mAsserter.is(c1.getCount(), 1, "Should have one value");
mProvider.delete(SearchHistory.CONTENT_URI, null, null);
} finally {
c1.close();
}
final Cursor c2 = mProvider.query(SearchHistory.CONTENT_URI, null, null, null, null);
try {
mAsserter.is(c2.getCount(), 0, "Should be empty");
mProvider.insert(SearchHistory.CONTENT_URI, cv);
} finally {
c2.close();
}
final Cursor c3 = mProvider.query(SearchHistory.CONTENT_URI, null, null, null, null);
try {
mAsserter.is(c3.getCount(), 1, "Should have one value");
} finally {
c3.close();
}
}
}
/**
* Ensure that we only increment when the case matches.
*/
private class TestIncrement extends TestCase {
@Override
public void test() throws Exception {
ContentValues cv = new ContentValues();
cv.put(SearchHistory.QUERY, "omaha");
mProvider.insert(SearchHistory.CONTENT_URI, cv);
cv = new ContentValues();
cv.put(SearchHistory.QUERY, "omaha");
mProvider.insert(SearchHistory.CONTENT_URI, cv);
Cursor c = mProvider.query(SearchHistory.CONTENT_URI, null, null, null, null);
try {
c.moveToFirst();
mAsserter.is(c.getCount(), 1, "Should have one result");
mAsserter.is(c.getInt(c.getColumnIndex(SearchHistory.VISITS)), 2,
"Counter should be 2");
} finally {
c.close();
}
cv = new ContentValues();
cv.put(SearchHistory.QUERY, "Omaha");
mProvider.insert(SearchHistory.CONTENT_URI, cv);
c = mProvider.query(SearchHistory.CONTENT_URI, null, null, null, null);
try {
mAsserter.is(c.getCount(), 2, "Should have two results");
} finally {
c.close();
}
}
}
}

View File

@ -32,7 +32,6 @@ ac_add_options --with-android-gnu-compiler-version=4.7
ac_add_options --with-android-version=9
ac_add_options --with-system-zlib
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --disable-native-casting # Disable native casting support until the builders are updated
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors

View File

@ -69,5 +69,8 @@ MOZ_LOCALE_SWITCHER=1
# Enable second screen and casting support for external devices.
MOZ_DEVICES=1
# Enable second screen using native Android libraries
MOZ_NATIVE_DEVICES=
# Don't enable the Search Activity.
# MOZ_ANDROID_SEARCH_ACTIVITY=1

View File

@ -15,6 +15,7 @@ const REGEX_QUOTES = /^".*?"|^".*|^'.*?'|^'.*/;
const REGEX_WHITESPACE = /^\s+/;
const REGEX_FIRST_WORD_OR_CHAR = /^\w+|^./;
const REGEX_CSS_PROPERTY_VALUE = /(^[^;]+)/;
const REGEX_CUBIC_BEZIER = /^linear|^ease-in-out|^ease-in|^ease-out|^ease|^cubic-bezier\(([0-9.\- ]+,){3}[0-9.\- ]+\)/;
/**
* This regex matches:
@ -92,6 +93,11 @@ OutputParser.prototype = {
parseCssProperty: function(name, value, options={}) {
options = this._mergeOptions(options);
// XXX: This is a quick fix that should stay until bug 977063 gets fixed.
// It avoids parsing "linear" as a timing-function in "linear-gradient(...)"
options.expectCubicBezier = ["transition", "transition-timing-function",
"animation", "animation-timing-function"].indexOf(name) !== -1;
if (this._cssPropertySupportsValue(name, value)) {
return this._parse(value, options);
}
@ -200,6 +206,17 @@ OutputParser.prototype = {
continue;
}
if (options.expectCubicBezier) {
matched = text.match(REGEX_CUBIC_BEZIER);
if (matched) {
let match = matched[0];
text = this._trimMatchFromStart(text, match);
this._appendCubicBezier(match, options);
continue;
}
}
matched = text.match(REGEX_ALL_CSS_PROPERTIES);
if (matched) {
let [match] = matched;
@ -282,6 +299,35 @@ OutputParser.prototype = {
return [text, dirty];
},
/**
* Append a cubic-bezier timing function value to the output
*
* @param {String} bezier
* The cubic-bezier timing function
* @param {Object} options
* Options object. For valid options and default values see
* _mergeOptions()
*/
_appendCubicBezier: function(bezier, options) {
let container = this._createNode("span", {
"data-bezier": bezier
});
if (options.bezierSwatchClass) {
let swatch = this._createNode("span", {
class: options.bezierSwatchClass
});
container.appendChild(swatch);
}
let value = this._createNode("span", {
class: options.bezierClass
}, bezier);
container.appendChild(value);
this.parsed.push(container);
},
/**
* Check if a CSS property supports a specific value.
*
@ -489,6 +535,9 @@ OutputParser.prototype = {
* - colorSwatchClass: "" // The class to use for color swatches.
* - colorClass: "" // The class to use for the color value
* // that follows the swatch.
* - bezierSwatchClass: "" // The class to use for bezier swatches.
* - bezierClass: "" // The class to use for the bezier value
* // that follows the swatch.
* - isHTMLAttribute: false // This property indicates whether we
* // are parsing an HTML attribute value.
* // When the value is passed in from an
@ -507,6 +556,8 @@ OutputParser.prototype = {
defaultColorType: true,
colorSwatchClass: "",
colorClass: "",
bezierSwatchClass: "",
bezierClass: "",
isHTMLAttribute: false,
urlClass: "",
baseURI: ""

View File

@ -573,9 +573,7 @@ let PlacesProvider = {
title: title,
frecency: frecency,
lastVisitDate: lastVisitDate,
bgColor: "transparent",
type: "history",
imageURI: null,
});
}
}
@ -650,6 +648,7 @@ let PlacesProvider = {
url: aURI.spec,
frecency: aNewFrecency,
lastVisitDate: aLastVisitDate,
type: "history",
});
}
},

View File

@ -408,6 +408,14 @@ BinaryPropertyListReader.prototype = {
else if (aIntSize == 2) {
uints.push(this._dataView.getUint16(offset));
}
else if (aIntSize == 3) {
let int24 = Uint8Array(4);
int24[3] = 0;
int24[2] = this._dataView.getUint8(offset);
int24[1] = this._dataView.getUint8(offset + 1);
int24[0] = this._dataView.getUint8(offset + 2);
uints.push(Uint32Array(int24.buffer)[0]);
}
else if (aIntSize == 4) {
uints.push(this._dataView.getUint32(offset));
}