merge fx-team to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2016-04-29 11:48:06 +02:00
Родитель 98c52dc9eb 0ebf94b516
Коммит d60d2af75a
30 изменённых файлов: 1086 добавлений и 746 удалений

Просмотреть файл

@ -108,6 +108,7 @@ devtools/client/webconsole/**
!devtools/client/webconsole/jsterm.js !devtools/client/webconsole/jsterm.js
devtools/client/webide/** devtools/client/webide/**
devtools/server/** devtools/server/**
!devtools/server/actors/webbrowser.js
devtools/shared/*.js devtools/shared/*.js
!devtools/shared/css-color.js !devtools/shared/css-color.js
devtools/shared/*.jsm devtools/shared/*.jsm

Просмотреть файл

@ -4,7 +4,7 @@
%filter substitution %filter substitution
%define toolbarHighlight hsla(0,0%,100%,.05) %define toolbarHighlight hsla(0,0%,100%,.15)
%define toolbarHighlightLWT rgba(255,255,255,.4) %define toolbarHighlightLWT rgba(255,255,255,.4)
/* navbarInsetHighlight is tightly coupled to the toolbarHighlight constant. */ /* navbarInsetHighlight is tightly coupled to the toolbarHighlight constant. */
%define navbarInsetHighlight hsla(0,0%,100%,.4) %define navbarInsetHighlight hsla(0,0%,100%,.4)

Просмотреть файл

@ -33,7 +33,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:1.5.0' classpath 'com.android.tools.build:gradle:2.0.0'
classpath('com.stanfy.spoon:spoon-gradle-plugin:1.0.4') { classpath('com.stanfy.spoon:spoon-gradle-plugin:1.0.4') {
// Without these, we get errors linting. // Without these, we get errors linting.
exclude module: 'guava' exclude module: 'guava'

Просмотреть файл

@ -461,6 +461,7 @@ skip-if = e10s && debug
[browser_dbg_sources-eval-01.js] [browser_dbg_sources-eval-01.js]
skip-if = true # non-named eval sources turned off for now, bug 1124106 skip-if = true # non-named eval sources turned off for now, bug 1124106
[browser_dbg_sources-eval-02.js] [browser_dbg_sources-eval-02.js]
[browser_dbg_sources-iframe-reload.js]
[browser_dbg_sources-keybindings.js] [browser_dbg_sources-keybindings.js]
skip-if = e10s && debug skip-if = e10s && debug
[browser_dbg_sources-labels.js] [browser_dbg_sources-labels.js]

Просмотреть файл

@ -0,0 +1,35 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Make sure iframe scripts don't disappear after few reloads (bug 1259743)
*/
"use strict";
const IFRAME_URL = "data:text/html;charset=utf-8," +
"<script>function fn() { console.log('hello'); }</script>" +
"<div onclick='fn()'>hello</div>";
const TAB_URL = `data:text/html;charset=utf-8,<iframe src="${IFRAME_URL}"/>`;
add_task(function* () {
let [,, panel] = yield initDebugger("about:blank");
let dbg = panel.panelWin;
let newSource;
newSource = waitForDebuggerEvents(panel, dbg.EVENTS.NEW_SOURCE);
reload(panel, TAB_URL);
yield newSource;
ok(true, "Source event fired on initial load");
for (let i = 0; i < 5; i++) {
newSource = waitForDebuggerEvents(panel, dbg.EVENTS.NEW_SOURCE);
reload(panel);
yield newSource;
ok(true, `Source event fired after ${i + 1} reloads`);
}
yield closeDebuggerAndFinish(panel);
});

Просмотреть файл

@ -12,7 +12,7 @@ const Services = require("Services");
const { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {}); const { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
XPCOMUtils.defineLazyGetter(this, "JsonViewService", function () { XPCOMUtils.defineLazyGetter(this, "JsonViewUtils", function () {
return require("devtools/client/jsonview/utils"); return require("devtools/client/jsonview/utils");
}); });

Просмотреть файл

@ -22,3 +22,4 @@ support-files =
[browser_jsonview_filter.js] [browser_jsonview_filter.js]
[browser_jsonview_invalid_json.js] [browser_jsonview_invalid_json.js]
[browser_jsonview_valid_json.js] [browser_jsonview_valid_json.js]
[browser_jsonview_save_json.js]

Просмотреть файл

@ -0,0 +1,38 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_JSON_URL = URL_ROOT + "valid_json.json";
let { MockFilePicker } = SpecialPowers;
MockFilePicker.init(window);
MockFilePicker.returnValue = MockFilePicker.returnCancel;
registerCleanupFunction(function () {
MockFilePicker.cleanup();
});
add_task(function* () {
info("Test save JSON started");
yield addJsonViewTab(TEST_JSON_URL);
let promise = new Promise((resolve) => {
MockFilePicker.showCallback = () => {
MockFilePicker.showCallback = null;
ok(true, "File picker was opened");
resolve();
};
});
let browser = gBrowser.selectedBrowser;
yield BrowserTestUtils.synthesizeMouseAtCenter(
".jsonPanelBox button.save",
{}, browser);
yield promise;
});

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -943,63 +943,96 @@ exports.method = function(fn, spec={}) {
} }
/** /**
* Process an actor definition from its prototype and generate * Generates an actor specification from an actor description.
* request handlers.
*/ */
var actorProto = function(actorProto) { var generateActorSpec = function(actorDesc) {
if (actorProto._actorSpec) { let actorSpec = {
throw new Error("actorProto called twice on the same actor prototype!"); typeName: actorDesc.typeName,
} methods: []
let protoSpec = {
methods: [],
}; };
// Find method and form specifications attached to prototype properties. // Find method and form specifications attached to properties.
for (let name of Object.getOwnPropertyNames(actorProto)) { for (let name of Object.getOwnPropertyNames(actorDesc)) {
let desc = Object.getOwnPropertyDescriptor(actorProto, name); let desc = Object.getOwnPropertyDescriptor(actorDesc, name);
if (!desc.value) { if (!desc.value) {
continue; continue;
} }
if (name.startsWith("formType")) { if (name.startsWith("formType")) {
if (typeof(desc.value) === "string") { if (typeof(desc.value) === "string") {
protoSpec[name] = types.getType(desc.value); actorSpec[name] = types.getType(desc.value);
} else if (desc.value.name && registeredTypes.has(desc.value.name)) { } else if (desc.value.name && registeredTypes.has(desc.value.name)) {
protoSpec[name] = desc.value; actorSpec[name] = desc.value;
} else { } else {
// Shorthand for a newly-registered DictType. // Shorthand for a newly-registered DictType.
protoSpec[name] = types.addDictType(actorProto.typeName + "__" + name, desc.value); actorSpec[name] = types.addDictType(actorDesc.typeName + "__" + name, desc.value);
} }
} }
if (desc.value._methodSpec) { if (desc.value._methodSpec) {
let frozenSpec = desc.value._methodSpec; let methodSpec = desc.value._methodSpec;
let spec = {}; let spec = {};
spec.name = frozenSpec.name || name; spec.name = methodSpec.name || name;
spec.request = Request(object.merge({type: spec.name}, frozenSpec.request || undefined)); spec.request = Request(object.merge({type: spec.name}, methodSpec.request || undefined));
spec.response = Response(frozenSpec.response || undefined); spec.response = Response(methodSpec.response || undefined);
spec.telemetry = frozenSpec.telemetry; spec.telemetry = methodSpec.telemetry;
spec.release = frozenSpec.release; spec.release = methodSpec.release;
spec.oneway = frozenSpec.oneway; spec.oneway = methodSpec.oneway;
protoSpec.methods.push(spec); actorSpec.methods.push(spec);
}
}
// Find additional method specifications
if (actorDesc.methods) {
for (let name in actorDesc.methods) {
let methodSpec = actorDesc.methods[name];
let spec = {};
spec.name = methodSpec.name || name;
spec.request = Request(object.merge({type: spec.name}, methodSpec.request || undefined));
spec.response = Response(methodSpec.response || undefined);
spec.telemetry = methodSpec.telemetry;
spec.release = methodSpec.release;
spec.oneway = methodSpec.oneway;
actorSpec.methods.push(spec);
} }
} }
// Find event specifications // Find event specifications
if (actorProto.events) { if (actorDesc.events) {
protoSpec.events = new Map(); actorSpec.events = new Map();
for (let name in actorProto.events) { for (let name in actorDesc.events) {
let eventRequest = actorProto.events[name]; let eventRequest = actorDesc.events[name];
Object.freeze(eventRequest); Object.freeze(eventRequest);
protoSpec.events.set(name, Request(object.merge({type: name}, eventRequest))); actorSpec.events.set(name, Request(object.merge({type: name}, eventRequest)));
} }
} }
if (!registeredTypes.has(actorSpec.typeName)) {
types.addActorType(actorSpec.typeName);
}
registeredTypes.get(actorSpec.typeName).actorSpec = actorSpec;
return actorSpec;
};
exports.generateActorSpec = generateActorSpec;
/**
* Generates request handlers as described by the given actor specification on
* the given actor prototype. Returns the actor prototype.
*/
var generateRequestHandlers = function(actorSpec, actorProto) {
if (actorProto._actorSpec) {
throw new Error("actorProto called twice on the same actor prototype!");
}
actorProto.typeName = actorSpec.typeName;
// Generate request handlers for each method definition // Generate request handlers for each method definition
actorProto.requestTypes = Object.create(null); actorProto.requestTypes = Object.create(null);
protoSpec.methods.forEach(spec => { actorSpec.methods.forEach(spec => {
let handler = function(packet, conn) { let handler = function(packet, conn) {
try { try {
let args; let args;
@ -1055,30 +1088,42 @@ var actorProto = function(actorProto) {
actorProto.requestTypes[spec.request.type] = handler; actorProto.requestTypes[spec.request.type] = handler;
}); });
actorProto._actorSpec = protoSpec; actorProto._actorSpec = actorSpec;
return actorProto; return actorProto;
} }
/** /**
* Create an actor class for the given actor prototype. * Create an actor class for the given actor prototype.
* *
* @param object proto * @param object actorProto
* The object prototype. Must have a 'typeName' property, * The actor prototype. Must have a 'typeName' property,
* should have method definitions, can have event definitions. * should have method definitions, can have event definitions.
*/ */
exports.ActorClass = function(proto) { exports.ActorClass = function (actorProto) {
if (!proto.typeName) { return ActorClassWithSpec(generateActorSpec(actorProto), actorProto);
throw Error("Actor prototype must have a typeName member."); };
}
proto.extends = Actor; /**
if (!registeredTypes.has(proto.typeName)) { * Create an actor class for the given actor specification and prototype.
types.addActorType(proto.typeName); *
} * @param object actorSpec
let cls = Class(actorProto(proto)); * The actor specification. Must have a 'typeName' property.
* @param object actorProto
* The actor prototype. Should have method definitions, can have event
* definitions.
*/
var ActorClassWithSpec = function(actorSpec, actorProto) {
if (!actorSpec.typeName) {
throw Error("Actor specification must have a typeName member.");
}
actorProto.extends = Actor;
let cls = Class(generateRequestHandlers(actorSpec, actorProto));
registeredTypes.get(proto.typeName).actorSpec = proto._actorSpec;
return cls; return cls;
}; };
exports.ActorClassWithSpec = ActorClassWithSpec;
/** /**
* Base class for client-side actor fronts. * Base class for client-side actor fronts.
@ -1270,26 +1315,25 @@ function prototypeOf(obj) {
} }
/** /**
* Process a front definition from its prototype and generate * Generates request methods as described by the given actor specification on
* request methods. * the given front prototype. Returns the front prototype.
*/ */
var frontProto = function(proto) { var generateRequestMethods = function(actorSpec, frontProto) {
let actorType = prototypeOf(proto.actorType); if (frontProto._actorSpec) {
if (proto._actorSpec) {
throw new Error("frontProto called twice on the same front prototype!"); throw new Error("frontProto called twice on the same front prototype!");
} }
proto._actorSpec = actorType._actorSpec;
proto.typeName = actorType.typeName; frontProto.typeName = actorSpec.typeName;
// Generate request methods. // Generate request methods.
let methods = proto._actorSpec.methods; let methods = actorSpec.methods;
methods.forEach(spec => { methods.forEach(spec => {
let name = spec.name; let name = spec.name;
// If there's already a property by this name in the front, it must // If there's already a property by this name in the front, it must
// be a custom front method. // be a custom front method.
if (name in proto) { if (name in frontProto) {
let custom = proto[spec.name]._customFront; let custom = frontProto[spec.name]._customFront;
if (custom === undefined) { if (custom === undefined) {
throw Error("Existing method for " + spec.name + " not marked customFront while processing " + actorType.typeName + "."); throw Error("Existing method for " + spec.name + " not marked customFront while processing " + actorType.typeName + ".");
} }
@ -1300,7 +1344,7 @@ var frontProto = function(proto) {
name = custom.impl; name = custom.impl;
} }
proto[name] = function(...args) { frontProto[name] = function(...args) {
let histogram, startTime; let histogram, startTime;
if (spec.telemetry) { if (spec.telemetry) {
if (spec.oneway) { if (spec.oneway) {
@ -1354,8 +1398,8 @@ var frontProto = function(proto) {
// Release methods should call the destroy function on return. // Release methods should call the destroy function on return.
if (spec.release) { if (spec.release) {
let fn = proto[name]; let fn = frontProto[name];
proto[name] = function(...args) { frontProto[name] = function(...args) {
return fn.apply(this, args).then(result => { return fn.apply(this, args).then(result => {
this.destroy(); this.destroy();
return result; return result;
@ -1366,14 +1410,14 @@ var frontProto = function(proto) {
// Process event specifications // Process event specifications
proto._clientSpec = {}; frontProto._clientSpec = {};
let events = proto._actorSpec.events; let events = actorSpec.events;
if (events) { if (events) {
// This actor has events, scan the prototype for preEvent handlers... // This actor has events, scan the prototype for preEvent handlers...
let preHandlers = new Map(); let preHandlers = new Map();
for (let name of Object.getOwnPropertyNames(proto)) { for (let name of Object.getOwnPropertyNames(frontProto)) {
let desc = Object.getOwnPropertyDescriptor(proto, name); let desc = Object.getOwnPropertyDescriptor(frontProto, name);
if (!desc.value) { if (!desc.value) {
continue; continue;
} }
@ -1391,36 +1435,56 @@ var frontProto = function(proto) {
} }
} }
proto._clientSpec.events = new Map(); frontProto._clientSpec.events = new Map();
for (let [name, request] of events) { for (let [name, request] of events) {
proto._clientSpec.events.set(request.type, { frontProto._clientSpec.events.set(request.type, {
name: name, name: name,
request: request, request: request,
pre: preHandlers.get(name) pre: preHandlers.get(name)
}); });
} }
} }
return proto;
frontProto._actorSpec = actorSpec;
return frontProto;
} }
/** /**
* Create a front class for the given actor class, with the given prototype. * Create a front class for the given actor class and front prototype.
* *
* @param ActorClass actorType * @param ActorClass actorType
* The actor class you're creating a front for. * The actor class you're creating a front for.
* @param object frontProto
* The front prototype. Must have a 'typeName' property,
* should have method definitions, can have event definitions.
*/
exports.FrontClass = function(actorType, frontProto) {
return FrontClassWithSpec(prototypeOf(actorType)._actorSpec, frontProto);
}
/**
* Create a front class for the given actor specification and front prototype.
*
* @param object actorSpec
* The actor specification you're creating a front for.
* @param object proto * @param object proto
* The object prototype. Must have a 'typeName' property, * The object prototype. Must have a 'typeName' property,
* should have method definitions, can have event definitions. * should have method definitions, can have event definitions.
*/ */
exports.FrontClass = function(actorType, proto) { var FrontClassWithSpec = function(actorSpec, frontProto) {
proto.actorType = actorType; frontProto.extends = Front;
proto.extends = Front; let cls = Class(generateRequestMethods(actorSpec, frontProto));
let cls = Class(frontProto(proto));
registeredTypes.get(cls.prototype.typeName).frontClass = cls; if (!registeredTypes.has(actorSpec.typeName)) {
types.addActorType(actorSpec.typeName);
}
registeredTypes.get(actorSpec.typeName).frontClass = cls;
return cls; return cls;
} }
exports.FrontClassWithSpec = FrontClassWithSpec;
exports.dumpActorSpec = function(type) { exports.dumpActorSpec = function(type) {
let actorSpec = type.actorSpec; let actorSpec = type.actorSpec;

Просмотреть файл

@ -7,6 +7,7 @@
const { Cc, Ci, Cr } = require("chrome"); const { Cc, Ci, Cr } = require("chrome");
const l10n = require("gcli/l10n"); const l10n = require("gcli/l10n");
const Services = require("Services"); const Services = require("Services");
const { NetUtil } = require("resource://gre/modules/NetUtil.jsm");
const { getRect } = require("devtools/shared/layout/utils"); const { getRect } = require("devtools/shared/layout/utils");
const promise = require("promise"); const promise = require("promise");
@ -357,19 +358,18 @@ function getFilename(defaultName) {
*/ */
function saveToClipboard(context, reply) { function saveToClipboard(context, reply) {
try { try {
const channel = NetUtil.newChannel({
uri: reply.data,
loadUsingSystemPrincipal: true,
contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE
});
const input = channel.open2();
const loadContext = context.environment.chromeWindow const loadContext = context.environment.chromeWindow
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation) .getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsILoadContext); .QueryInterface(Ci.nsILoadContext);
const io = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
const channel = io.newChannel2(reply.data, null, null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE);
const input = channel.open();
const imgTools = Cc["@mozilla.org/image/tools;1"] const imgTools = Cc["@mozilla.org/image/tools;1"]
.getService(Ci.imgITools); .getService(Ci.imgITools);

6
gradle/wrapper/gradle-wrapper.properties поставляемый
Просмотреть файл

@ -1,7 +1,7 @@
#Mon Nov 02 13:44:39 GMT 2015 #Tue Apr 12 09:52:06 CEST 2016
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
distributionSha256Sum=2ba0aaa11a3e96ec0af31d532d808e1f09cc6dcad0954e637902a1ab544b9e60 distributionSha256Sum=496d60c331f8666f99b66d08ff67a880697a7e85a9d9b76ff08814cf97f61a4c

Просмотреть файл

@ -24,6 +24,7 @@
and not fail everything. --> and not fail everything. -->
<issue id="AppCompatResource" severity="warning" /> <issue id="AppCompatResource" severity="warning" />
<issue id="GoogleAppIndexingDeepLinkError" severity="warning" /> <issue id="GoogleAppIndexingDeepLinkError" severity="warning" />
<issue id="GoogleAppIndexingUrlError" severity="warning" />
<issue id="Instantiatable" severity="warning" /> <issue id="Instantiatable" severity="warning" />
<issue id="LongLogTag" severity="warning" /> <issue id="LongLogTag" severity="warning" />
<issue id="MissingPermission" severity="warning" /> <issue id="MissingPermission" severity="warning" />
@ -35,6 +36,11 @@
<issue id="ValidFragment" severity="warning" /> <issue id="ValidFragment" severity="warning" />
<issue id="WrongConstant" severity="warning" /> <issue id="WrongConstant" severity="warning" />
<!-- We fixed all "Registered" lint errors. However the current gradle plugin has a bug where
it ignores @SuppressLint annotations for this check. See CrashReporter class and
https://code.google.com/p/android/issues/detail?id=204846 -->
<issue id="Registered" severity="warning" />
<!-- WHEN YOU FIX A LINT WARNING, ADD IT TO THIS LIST. <!-- WHEN YOU FIX A LINT WARNING, ADD IT TO THIS LIST.
We want all lint warnings to be fatal errors. We want all lint warnings to be fatal errors.
@ -144,7 +150,6 @@
<issue id="ProtectedPermissions" severity="error" /> <issue id="ProtectedPermissions" severity="error" />
<issue id="PxUsage" severity="error" /> <issue id="PxUsage" severity="error" />
<issue id="Range" severity="error" /> <issue id="Range" severity="error" />
<issue id="Registered" severity="error" />
<issue id="RelativeOverlap" severity="error" /> <issue id="RelativeOverlap" severity="error" />
<issue id="RequiredSize" severity="error" /> <issue id="RequiredSize" severity="error" />
<issue id="ResAuto" severity="error" /> <issue id="ResAuto" severity="error" />

Просмотреть файл

@ -23,6 +23,7 @@ import java.util.zip.GZIPOutputStream;
import org.mozilla.gecko.AppConstants.Versions; import org.mozilla.gecko.AppConstants.Versions;
import android.annotation.SuppressLint;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.DialogInterface; import android.content.DialogInterface;
@ -39,6 +40,7 @@ import android.widget.CheckBox;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.EditText; import android.widget.EditText;
@SuppressLint("Registered") // This activity is only registered in the manifest if MOZ_CRASHREPORTER is set
public class CrashReporter extends AppCompatActivity public class CrashReporter extends AppCompatActivity
{ {
private static final String LOGTAG = "GeckoCrashReporter"; private static final String LOGTAG = "GeckoCrashReporter";

Просмотреть файл

@ -8,7 +8,7 @@ import android.content.ComponentName;
import android.content.Intent; import android.content.Intent;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
public class GeckoActivity extends AppCompatActivity implements GeckoActivityStatus { public abstract class GeckoActivity extends AppCompatActivity implements GeckoActivityStatus {
// has this activity recently started another Gecko activity? // has this activity recently started another Gecko activity?
private boolean mGeckoActivityOpened; private boolean mGeckoActivityOpened;

Просмотреть файл

@ -48,7 +48,7 @@ public class Locales {
} }
} }
public static class LocaleAwareAppCompatActivity extends AppCompatActivity { public static abstract class LocaleAwareAppCompatActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
Locales.initializeLocale(getApplicationContext()); Locales.initializeLocale(getApplicationContext());
@ -56,7 +56,7 @@ public class Locales {
} }
} }
public static class LocaleAwareFragmentActivity extends FragmentActivity { public static abstract class LocaleAwareFragmentActivity extends FragmentActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
Locales.initializeLocale(getApplicationContext()); Locales.initializeLocale(getApplicationContext());
@ -64,7 +64,7 @@ public class Locales {
} }
} }
public static class LocaleAwareActivity extends Activity { public static abstract class LocaleAwareActivity extends Activity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
Locales.initializeLocale(getApplicationContext()); Locales.initializeLocale(getApplicationContext());

Просмотреть файл

@ -88,4 +88,31 @@ final class UnusedResourcesUtil {
R.xml.preferences_privacy, R.xml.preferences_privacy,
R.xml.preferences_privacy_clear_tablet, R.xml.preferences_privacy_clear_tablet,
}; };
// We are migrating to Gradle 2.10 and the Android Gradle plugin 2.0. The new plugin does find
// more unused resources but we are not ready to remove them yet. Some of the resources are going
// to be reused soon. This is a temporary solution so that the gradle migration is not blocked.
// See bug 1263390 / bug 1268414.
public static final int[] TEMPORARY_UNUSED_WHILE_MIGRATING_GRADLE = {
R.color.remote_tabs_setup_button_background_hit,
R.drawable.remote_tabs_setup_button_background,
R.style.ActionBarThemeGeckoPreferences,
R.style.TabsPanelSectionBase,
R.style.TabsPanelSection,
R.style.TabsPanelItemBase,
R.style.TabsPanelItem,
R.style.TabsPanelItem_TextAppearance,
R.style.TabsPanelItem_TextAppearance_Header,
R.style.TabsPanelItem_TextAppearance_Linkified,
R.style.TabWidget,
R.style.GeckoDialogTitle,
R.style.GeckoDialogTitle_SubTitle,
R.style.RemoteTabsPanelItem,
R.style.RemoteTabsPanelItem_TextAppearance,
R.style.RemoteTabsPanelItem_TextAppearance_Header,
R.style.RemoteTabsPanelItem_TextAppearance_Linkified,
R.style.RemoteTabsPanelItem_Button,
};
} }

Просмотреть файл

@ -7,9 +7,9 @@
"Android Support Repository (Support Library 23.0.1)", "Android Support Repository (Support Library 23.0.1)",
"Google Support Repository (Google Play Services 8.1.0)" "Google Support Repository (Google Play Services 8.1.0)"
], ],
"size": 535625068, "size": 510579808,
"visibility": "internal", "visibility": "internal",
"digest": "0627515046a23c1d109e2782865b1b3b546c1d552955e4156317f76cbb195eb630aa25feea3f4edd1c685f129da0c2a5169d4d6349c1c31d8a95158a4569a478", "digest": "a4ea080f1aa5cb1d05250d45a288446ae07a54362a166bc7faa67281b5d50ee55001c1770cf9a942535b583e2f4c99d420902f065b03842d94a7d9273dca756d",
"algorithm": "sha512", "algorithm": "sha512",
"filename": "android-sdk-linux.tar.xz", "filename": "android-sdk-linux.tar.xz",
"unpack": true "unpack": true
@ -35,16 +35,16 @@
"visibility": "public", "visibility": "public",
"filename": "jcentral.tar.xz", "filename": "jcentral.tar.xz",
"unpack": true, "unpack": true,
"digest": "3fd467642a9067a1adfde7e3461b1366912b306607677b213d9f19201c23aab5f7f6361ebea7652bed1565215ed4524b51f5ced83ea68bb51ba2abca09b66148", "digest": "0a970a85165bad0247c5a015cf6e0eb22bc497ec3ab3fed3948031b066041462599586f30f275738c123715e78ca65684701ab3dba99944f36f8a21c1364a857",
"size": 41591712 "size": 41914156
}, },
{ {
"algorithm": "sha512", "algorithm": "sha512",
"visibility": "public", "visibility": "public",
"filename": "gradle.tar.xz", "filename": "gradle.tar.xz",
"unpack": true, "unpack": true,
"digest": "9011a0a322b55c6f55ca7aa83298886f3f57e2a91a33a079fcdae5af746f9cf1528f36942138cff5a00154757d9acba2f1a4332d0f92da18e454b3c0c1788d20", "digest": "2dcedca230ac47157611991d29231ea997396a094e08eca7cff47509ea79046c3bcd33c01198f367c99e9ba78d77af41619c0d47e24956f4b403b368304f8099",
"size": 50805888 "size": 52223524
}, },
{ {
"algorithm": "sha512", "algorithm": "sha512",

Просмотреть файл

@ -7,9 +7,9 @@
"Android Support Repository (Support Library 23.0.1)", "Android Support Repository (Support Library 23.0.1)",
"Google Support Repository (Google Play Services 8.1.0)" "Google Support Repository (Google Play Services 8.1.0)"
], ],
"size": 535625068, "size": 510579808,
"visibility": "internal", "visibility": "internal",
"digest": "0627515046a23c1d109e2782865b1b3b546c1d552955e4156317f76cbb195eb630aa25feea3f4edd1c685f129da0c2a5169d4d6349c1c31d8a95158a4569a478", "digest": "a4ea080f1aa5cb1d05250d45a288446ae07a54362a166bc7faa67281b5d50ee55001c1770cf9a942535b583e2f4c99d420902f065b03842d94a7d9273dca756d",
"algorithm": "sha512", "algorithm": "sha512",
"filename": "android-sdk-linux.tar.xz", "filename": "android-sdk-linux.tar.xz",
"unpack": true "unpack": true

Просмотреть файл

@ -16,9 +16,9 @@
"Android Support Repository (Support Library 23.0.1)", "Android Support Repository (Support Library 23.0.1)",
"Google Support Repository (Google Play Services 8.1.0)" "Google Support Repository (Google Play Services 8.1.0)"
], ],
"size": 535625068, "size": 510579808,
"visibility": "internal", "visibility": "internal",
"digest": "0627515046a23c1d109e2782865b1b3b546c1d552955e4156317f76cbb195eb630aa25feea3f4edd1c685f129da0c2a5169d4d6349c1c31d8a95158a4569a478", "digest": "a4ea080f1aa5cb1d05250d45a288446ae07a54362a166bc7faa67281b5d50ee55001c1770cf9a942535b583e2f4c99d420902f065b03842d94a7d9273dca756d",
"algorithm": "sha512", "algorithm": "sha512",
"filename": "android-sdk-linux.tar.xz", "filename": "android-sdk-linux.tar.xz",
"unpack": true "unpack": true
@ -50,15 +50,15 @@
"visibility": "public", "visibility": "public",
"filename": "jcentral.tar.xz", "filename": "jcentral.tar.xz",
"unpack": true, "unpack": true,
"digest": "3fd467642a9067a1adfde7e3461b1366912b306607677b213d9f19201c23aab5f7f6361ebea7652bed1565215ed4524b51f5ced83ea68bb51ba2abca09b66148", "digest": "0a970a85165bad0247c5a015cf6e0eb22bc497ec3ab3fed3948031b066041462599586f30f275738c123715e78ca65684701ab3dba99944f36f8a21c1364a857",
"size": 41591712 "size": 41914156
}, },
{ {
"algorithm": "sha512", "algorithm": "sha512",
"visibility": "public", "visibility": "public",
"filename": "gradle.tar.xz", "filename": "gradle.tar.xz",
"unpack": true, "unpack": true,
"digest": "9011a0a322b55c6f55ca7aa83298886f3f57e2a91a33a079fcdae5af746f9cf1528f36942138cff5a00154757d9acba2f1a4332d0f92da18e454b3c0c1788d20", "digest": "2dcedca230ac47157611991d29231ea997396a094e08eca7cff47509ea79046c3bcd33c01198f367c99e9ba78d77af41619c0d47e24956f4b403b368304f8099",
"size": 50805888 "size": 52223524
} }
] ]

Просмотреть файл

@ -14,7 +14,7 @@ import org.mozilla.gecko.sync.setup.activities.ActivityUtils;
/** /**
* Activity which shows the status activity or passes through to web flow. * Activity which shows the status activity or passes through to web flow.
*/ */
public class FxAccountWebFlowActivity extends FxAccountAbstractActivity { public abstract class FxAccountWebFlowActivity extends FxAccountAbstractActivity {
protected static final String LOG_TAG = FxAccountWebFlowActivity.class.getSimpleName(); protected static final String LOG_TAG = FxAccountWebFlowActivity.class.getSimpleName();
protected static final String ABOUT_ACCOUNTS = "about:accounts"; protected static final String ABOUT_ACCOUNTS = "about:accounts";

Просмотреть файл

@ -67,25 +67,16 @@ public class TestRunner extends RobolectricGradleTestRunner {
final String flavor = getFlavor(config); final String flavor = getFlavor(config);
final String packageName = getPackageName(config); final String packageName = getPackageName(config);
final FsFile res; final FsFile assets = buildFolder.join("assets", flavor, type);;
final FsFile assets; final FsFile manifest = buildFolder.join("manifests", "full", flavor, type, "AndroidManifest.xml");
final FsFile manifest;
if (areResourcesFromLibrary()) { final FsFile res;
FsFile bundlesFolder = buildFolder.join("bundles", flavor, type); if (buildFolder.join("res", "merged").exists()) {
res = bundlesFolder.join("res"); res = buildFolder.join("res", "merged", flavor, type);
assets = bundlesFolder.join("assets"); } else if(buildFolder.join("res").exists()) {
manifest = bundlesFolder.join("AndroidManifest.xml"); res = buildFolder.join("res", flavor, type);
} else { } else {
if (buildFolder.join("res", "merged").exists()) { throw new IllegalStateException("No resource folder found");
res = buildFolder.join("res", "merged", flavor, type);
} else if(buildFolder.join("res").exists()) {
res = buildFolder.join("res", flavor, type);
} else {
throw new IllegalStateException("No resource folder found");
}
assets = buildFolder.join("assets", flavor, type);
manifest = buildFolder.join("manifests", "full", flavor, type, "AndroidManifest.xml");
} }
Logger.debug("Robolectric assets directory: " + assets.getPath()); Logger.debug("Robolectric assets directory: " + assets.getPath());
@ -95,10 +86,6 @@ public class TestRunner extends RobolectricGradleTestRunner {
return new AndroidManifest(manifest, res, assets, packageName); return new AndroidManifest(manifest, res, assets, packageName);
} }
private boolean areResourcesFromLibrary() {
return buildFolder.join("bundles").exists();
}
private static String getType(Config config) { private static String getType(Config config) {
try { try {
return ReflectionHelpers.getStaticField(config.constants(), "BUILD_TYPE"); return ReflectionHelpers.getStaticField(config.constants(), "BUILD_TYPE");

Просмотреть файл

@ -3,7 +3,7 @@
set -x -e set -x -e
: WORKSPACE ${WORKSPACE:=/workspace} : WORKSPACE ${WORKSPACE:=/workspace}
: GRADLE_VERSION ${GRADLE_VERSION:=2.7} : GRADLE_VERSION ${GRADLE_VERSION:=2.10}
set -v set -v

Просмотреть файл

@ -137,6 +137,43 @@ this.PlacesTestUtils = Object.freeze({
}); });
commit.finalize(); commit.finalize();
}); });
} },
/**
* Asynchronously checks if an address is found in the database.
* @param aURI
* nsIURI or address to look for.
*
* @return {Promise}
* @resolves Returns true if the page is found.
* @rejects JavaScript exception.
*/
isPageInDB: Task.async(function* (aURI) {
let url = aURI instanceof Ci.nsIURI ? aURI.spec : aURI;
let db = yield PlacesUtils.promiseDBConnection();
let rows = yield db.executeCached(
"SELECT id FROM moz_places WHERE url = :url",
{ url });
return rows.length > 0;
}),
/**
* Asynchronously checks how many visits exist for a specified page.
* @param aURI
* nsIURI or address to look for.
*
* @return {Promise}
* @resolves Returns the number of visits found.
* @rejects JavaScript exception.
*/
visitsInDB: Task.async(function* (aURI) {
let url = aURI instanceof Ci.nsIURI ? aURI.spec : aURI;
let db = yield PlacesUtils.promiseDBConnection();
let rows = yield db.executeCached(
`SELECT count(*) FROM moz_historyvisits v
JOIN moz_places h ON h.id = v.place_id
WHERE url = :url`,
{ url });
return rows[0].getResultByIndex(0);
})
}); });

Просмотреть файл

@ -0,0 +1,10 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et: */
add_task(function* test_execute() {
var good_uri = uri("http://mozilla.com");
var bad_uri = uri("http://google.com");
yield PlacesTestUtils.addVisits({uri: good_uri});
do_check_true(yield PlacesTestUtils.isPageInDB(good_uri));
do_check_false(yield PlacesTestUtils.isPageInDB(bad_uri));
});

Просмотреть файл

@ -0,0 +1,12 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et: */
add_task(function* test_execute() {
const TEST_URI = uri("http://mozilla.com");
do_check_eq(0, yield PlacesTestUtils.visitsInDB(TEST_URI));
yield PlacesTestUtils.addVisits({uri: TEST_URI});
do_check_eq(1, yield PlacesTestUtils.visitsInDB(TEST_URI));
yield PlacesTestUtils.addVisits({uri: TEST_URI});
do_check_eq(2, yield PlacesTestUtils.visitsInDB(TEST_URI));
});

Просмотреть файл

@ -103,6 +103,7 @@ skip-if = os == "android"
skip-if = os == "android" skip-if = os == "android"
[test_history_sidebar.js] [test_history_sidebar.js]
[test_hosts_triggers.js] [test_hosts_triggers.js]
[test_isPageInDB.js]
[test_isURIVisited.js] [test_isURIVisited.js]
[test_isvisited.js] [test_isvisited.js]
[test_keywords.js] [test_keywords.js]
@ -149,3 +150,4 @@ skip-if = os == "android"
[test_utils_backups_create.js] [test_utils_backups_create.js]
[test_utils_getURLsForContainerNode.js] [test_utils_getURLsForContainerNode.js]
[test_utils_setAnnotationsFor.js] [test_utils_setAnnotationsFor.js]
[test_visitsInDB.js]

Просмотреть файл

@ -4,6 +4,7 @@
<!ENTITY window.emWidth "26em"> <!ENTITY window.emWidth "26em">
<!ENTITY window.emHeight "26em"> <!ENTITY window.emHeight "26em">
<!ENTITY ChooseApp.description "Choose an Application"> <!ENTITY ChooseOtherApp.description "Choose other Application">
<!ENTITY ChooseApp.label "Choose…"> <!ENTITY ChooseApp.label "Choose…">
<!ENTITY ChooseApp.accessKey "C"> <!ENTITY ChooseApp.accessKey "C">
<!ENTITY accept "Open link">

Просмотреть файл

@ -34,7 +34,7 @@
ondblclick="dialog.onDblClick();" ondblclick="dialog.onDblClick();"
onselect="dialog.updateOKButton();"> onselect="dialog.updateOKButton();">
<richlistitem id="item-choose" orient="horizontal" selected="true"> <richlistitem id="item-choose" orient="horizontal" selected="true">
<label value="&ChooseApp.description;" flex="1"/> <label value="&ChooseOtherApp.description;" flex="1"/>
<button oncommand="dialog.chooseApplication();" <button oncommand="dialog.chooseApplication();"
label="&ChooseApp.label;" accesskey="&ChooseApp.accessKey;"/> label="&ChooseApp.label;" accesskey="&ChooseApp.accessKey;"/>
</richlistitem> </richlistitem>
@ -44,4 +44,9 @@
<checkbox id="remember" aria-describedby="remember-text" oncommand="dialog.onCheck();"/> <checkbox id="remember" aria-describedby="remember-text" oncommand="dialog.onCheck();"/>
<description id="remember-text"/> <description id="remember-text"/>
<hbox class="dialog-button-box" pack="end">
<button dlgtype="cancel" icon="cancel" class="dialog-button"/>
<button dlgtype="accept" label="&accept;" icon="open" class="dialog-button"/>
</hbox>
</dialog> </dialog>