Merge m-c to inbound. a=merge
CLOSED TREE
@ -360,10 +360,10 @@ pref("layout.css.touch_action.enabled", false);
|
||||
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
// Safe browsing does nothing unless this pref is set
|
||||
pref("browser.safebrowsing.enabled", true);
|
||||
pref("browser.safebrowsing.enabled", false);
|
||||
|
||||
// Prevent loading of pages identified as malware
|
||||
pref("browser.safebrowsing.malware.enabled", true);
|
||||
pref("browser.safebrowsing.malware.enabled", false);
|
||||
|
||||
pref("browser.safebrowsing.debug", false);
|
||||
pref("browser.safebrowsing.updateURL", "https://safebrowsing.google.com/safebrowsing/downloads?client=SAFEBROWSING_ID&appver=%VERSION%&pver=2.2&key=%GOOGLE_API_KEY%");
|
||||
|
@ -61,11 +61,11 @@ let developerHUD = {
|
||||
* observed metrics with `target.register(metric)`, and keep them up-to-date
|
||||
* with `target.update(metric, message)` when necessary.
|
||||
*/
|
||||
registerWatcher: function dwp_registerWatcher(watcher) {
|
||||
registerWatcher(watcher) {
|
||||
this._watchers.unshift(watcher);
|
||||
},
|
||||
|
||||
init: function dwp_init() {
|
||||
init() {
|
||||
if (this._client) {
|
||||
return;
|
||||
}
|
||||
@ -106,7 +106,7 @@ let developerHUD = {
|
||||
});
|
||||
},
|
||||
|
||||
uninit: function dwp_uninit() {
|
||||
uninit() {
|
||||
if (!this._client) {
|
||||
return;
|
||||
}
|
||||
@ -125,7 +125,7 @@ let developerHUD = {
|
||||
* This method will ask all registered watchers to track and update metrics
|
||||
* on an app frame.
|
||||
*/
|
||||
trackFrame: function dwp_trackFrame(frame) {
|
||||
trackFrame(frame) {
|
||||
if (this._targets.has(frame)) {
|
||||
return;
|
||||
}
|
||||
@ -140,7 +140,7 @@ let developerHUD = {
|
||||
});
|
||||
},
|
||||
|
||||
untrackFrame: function dwp_untrackFrame(frame) {
|
||||
untrackFrame(frame) {
|
||||
let target = this._targets.get(frame);
|
||||
if (target) {
|
||||
for (let w of this._watchers) {
|
||||
@ -152,7 +152,7 @@ let developerHUD = {
|
||||
}
|
||||
},
|
||||
|
||||
onFrameCreated: function (frame, isFirstAppFrame) {
|
||||
onFrameCreated(frame, isFirstAppFrame) {
|
||||
let mozapp = frame.getAttribute('mozapp');
|
||||
if (!mozapp) {
|
||||
return;
|
||||
@ -160,7 +160,7 @@ let developerHUD = {
|
||||
this.trackFrame(frame);
|
||||
},
|
||||
|
||||
onFrameDestroyed: function (frame, isLastAppFrame) {
|
||||
onFrameDestroyed(frame, isLastAppFrame) {
|
||||
let mozapp = frame.getAttribute('mozapp');
|
||||
if (!mozapp) {
|
||||
return;
|
||||
@ -168,7 +168,7 @@ let developerHUD = {
|
||||
this.untrackFrame(frame);
|
||||
},
|
||||
|
||||
log: function dwp_log(message) {
|
||||
log(message) {
|
||||
if (this._logging) {
|
||||
dump(DEVELOPER_HUD_LOG_PREFIX + ': ' + message + '\n');
|
||||
}
|
||||
@ -204,7 +204,7 @@ Target.prototype = {
|
||||
/**
|
||||
* Register a metric that can later be updated. Does not update the front-end.
|
||||
*/
|
||||
register: function target_register(metric) {
|
||||
register(metric) {
|
||||
this.metrics.set(metric, 0);
|
||||
},
|
||||
|
||||
@ -212,7 +212,7 @@ Target.prototype = {
|
||||
* Modify one of a target's metrics, and send out an event to notify relevant
|
||||
* parties (e.g. the developer HUD, automated tests, etc).
|
||||
*/
|
||||
update: function target_update(metric, message) {
|
||||
update(metric, message) {
|
||||
if (!metric.name) {
|
||||
throw new Error('Missing metric.name');
|
||||
}
|
||||
@ -251,7 +251,7 @@ Target.prototype = {
|
||||
* Nicer way to call update() when the metric value is a number that needs
|
||||
* to be incremented.
|
||||
*/
|
||||
bump: function target_bump(metric, message) {
|
||||
bump(metric, message) {
|
||||
metric.value = (this.metrics.get(metric.name) || 0) + 1;
|
||||
this.update(metric, message);
|
||||
},
|
||||
@ -260,7 +260,7 @@ Target.prototype = {
|
||||
* Void a metric value and make sure it isn't displayed on the front-end
|
||||
* anymore.
|
||||
*/
|
||||
clear: function target_clear(metric) {
|
||||
clear(metric) {
|
||||
metric.value = 0;
|
||||
this.update(metric);
|
||||
},
|
||||
@ -269,19 +269,19 @@ Target.prototype = {
|
||||
* Tear everything down, including the front-end by sending a message without
|
||||
* widgets.
|
||||
*/
|
||||
destroy: function target_destroy() {
|
||||
destroy() {
|
||||
delete this.metrics;
|
||||
this._send({});
|
||||
},
|
||||
|
||||
_send: function target_send(data) {
|
||||
_send(data) {
|
||||
let frame = this.frame;
|
||||
|
||||
shell.sendEvent(frame, 'developer-hud-update', Cu.cloneInto(data, frame));
|
||||
this._sendTelemetryEvent(data.metric);
|
||||
},
|
||||
|
||||
_sendTelemetryEvent: function target_sendTelemetryEvent(metric) {
|
||||
_sendTelemetryEvent(metric) {
|
||||
if (!developerHUD._telemetry || !metric || metric.skipTelemetry) {
|
||||
return;
|
||||
}
|
||||
@ -332,7 +332,7 @@ let consoleWatcher = {
|
||||
'CORS'
|
||||
],
|
||||
|
||||
init: function cw_init(client) {
|
||||
init(client) {
|
||||
this._client = client;
|
||||
this.consoleListener = this.consoleListener.bind(this);
|
||||
|
||||
@ -359,7 +359,7 @@ let consoleWatcher = {
|
||||
client.addListener('reflowActivity', this.consoleListener);
|
||||
},
|
||||
|
||||
trackTarget: function cw_trackTarget(target) {
|
||||
trackTarget(target) {
|
||||
target.register('reflows');
|
||||
target.register('warnings');
|
||||
target.register('errors');
|
||||
@ -374,7 +374,7 @@ let consoleWatcher = {
|
||||
});
|
||||
},
|
||||
|
||||
untrackTarget: function cw_untrackTarget(target) {
|
||||
untrackTarget(target) {
|
||||
this._client.request({
|
||||
to: target.actor.consoleActor,
|
||||
type: 'stopListeners',
|
||||
@ -384,7 +384,7 @@ let consoleWatcher = {
|
||||
this._targets.delete(target.actor.consoleActor);
|
||||
},
|
||||
|
||||
consoleListener: function cw_consoleListener(type, packet) {
|
||||
consoleListener(type, packet) {
|
||||
let target = this._targets.get(packet.from);
|
||||
let metric = {};
|
||||
let output = '';
|
||||
@ -477,7 +477,7 @@ let consoleWatcher = {
|
||||
target.bump(metric, output);
|
||||
},
|
||||
|
||||
formatSourceURL: function cw_formatSourceURL(packet) {
|
||||
formatSourceURL(packet) {
|
||||
// Abbreviate source URL
|
||||
let source = WebConsoleUtils.abbreviateSourceURL(packet.sourceURL);
|
||||
|
||||
@ -489,9 +489,7 @@ let consoleWatcher = {
|
||||
return source;
|
||||
},
|
||||
|
||||
handleTelemetryMessage:
|
||||
function cw_handleTelemetryMessage(target, packet) {
|
||||
|
||||
handleTelemetryMessage(target, packet) {
|
||||
if (!developerHUD._telemetry) {
|
||||
return;
|
||||
}
|
||||
@ -540,13 +538,13 @@ let eventLoopLagWatcher = {
|
||||
_fronts: new Map(),
|
||||
_active: false,
|
||||
|
||||
init: function(client) {
|
||||
init(client) {
|
||||
this._client = client;
|
||||
|
||||
SettingsListener.observe('hud.jank', false, this.settingsListener.bind(this));
|
||||
},
|
||||
|
||||
settingsListener: function(value) {
|
||||
settingsListener(value) {
|
||||
if (this._active == value) {
|
||||
return;
|
||||
}
|
||||
@ -565,7 +563,7 @@ let eventLoopLagWatcher = {
|
||||
}
|
||||
},
|
||||
|
||||
trackTarget: function(target) {
|
||||
trackTarget(target) {
|
||||
target.register('jank');
|
||||
|
||||
let front = new EventLoopLagFront(this._client, target.actor);
|
||||
@ -580,7 +578,7 @@ let eventLoopLagWatcher = {
|
||||
}
|
||||
},
|
||||
|
||||
untrackTarget: function(target) {
|
||||
untrackTarget(target) {
|
||||
let fronts = this._fronts;
|
||||
if (fronts.has(target)) {
|
||||
fronts.get(target).destroy();
|
||||
@ -611,7 +609,7 @@ let memoryWatcher = {
|
||||
},
|
||||
_active: false,
|
||||
|
||||
init: function mw_init(client) {
|
||||
init(client) {
|
||||
this._client = client;
|
||||
let watching = this._watching;
|
||||
|
||||
@ -624,7 +622,7 @@ let memoryWatcher = {
|
||||
}
|
||||
},
|
||||
|
||||
update: function mw_update() {
|
||||
update() {
|
||||
let watching = this._watching;
|
||||
let active = watching.appmemory || watching.uss;
|
||||
|
||||
@ -642,7 +640,7 @@ let memoryWatcher = {
|
||||
this._active = active;
|
||||
},
|
||||
|
||||
measure: function mw_measure(target) {
|
||||
measure(target) {
|
||||
let watch = this._watching;
|
||||
let front = this._fronts.get(target);
|
||||
let format = this.formatMemory;
|
||||
@ -685,11 +683,11 @@ let memoryWatcher = {
|
||||
});
|
||||
}
|
||||
|
||||
let timer = setTimeout(() => this.measure(target), 800);
|
||||
let timer = setTimeout(() => this.measure(target), 2000);
|
||||
this._timers.set(target, timer);
|
||||
},
|
||||
|
||||
formatMemory: function mw_formatMemory(bytes) {
|
||||
formatMemory(bytes) {
|
||||
var prefix = ['','K','M','G','T','P','E','Z','Y'];
|
||||
var i = 0;
|
||||
for (; bytes > 1024 && i < prefix.length; ++i) {
|
||||
@ -698,7 +696,7 @@ let memoryWatcher = {
|
||||
return (Math.round(bytes * 100) / 100) + ' ' + prefix[i] + 'B';
|
||||
},
|
||||
|
||||
trackTarget: function mw_trackTarget(target) {
|
||||
trackTarget(target) {
|
||||
target.register('uss');
|
||||
target.register('memory');
|
||||
this._fronts.set(target, MemoryFront(this._client, target.actor));
|
||||
@ -707,7 +705,7 @@ let memoryWatcher = {
|
||||
}
|
||||
},
|
||||
|
||||
untrackTarget: function mw_untrackTarget(target) {
|
||||
untrackTarget(target) {
|
||||
let front = this._fronts.get(target);
|
||||
if (front) {
|
||||
front.destroy();
|
||||
|
@ -148,12 +148,16 @@ Components.utils.import('resource://gre/modules/ctypes.jsm');
|
||||
// Get the hardware info and firmware revision from device properties.
|
||||
let hardware_info = null;
|
||||
let firmware_revision = null;
|
||||
let product_manufacturer = null;
|
||||
let product_model = null;
|
||||
let product_device = null;
|
||||
let build_number = null;
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
hardware_info = libcutils.property_get('ro.hardware');
|
||||
firmware_revision = libcutils.property_get('ro.firmware_revision');
|
||||
product_manufacturer = libcutils.property_get('ro.product.manufacturer');
|
||||
product_model = libcutils.property_get('ro.product.model');
|
||||
product_device = libcutils.property_get('ro.product.device');
|
||||
build_number = libcutils.property_get('ro.build.version.incremental');
|
||||
#endif
|
||||
|
||||
@ -173,7 +177,9 @@ Components.utils.import('resource://gre/modules/ctypes.jsm');
|
||||
'deviceinfo.platform_build_id': appInfo.platformBuildID,
|
||||
'deviceinfo.hardware': hardware_info,
|
||||
'deviceinfo.firmware_revision': firmware_revision,
|
||||
'deviceinfo.product_model': product_model
|
||||
'deviceinfo.product_manufacturer': product_manufacturer,
|
||||
'deviceinfo.product_model': product_model,
|
||||
'deviceinfo.product_device': product_device
|
||||
}
|
||||
lock.set(setting);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49192a4e48d080e44a0d66f059e6897f07cf67f8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="47f48a42502b1c694db2b162011a67a2ff888c5d"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49192a4e48d080e44a0d66f059e6897f07cf67f8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="47f48a42502b1c694db2b162011a67a2ff888c5d"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
@ -101,7 +101,7 @@
|
||||
<project name="platform/external/webrtc" path="external/webrtc" revision="446452f84e9cc4c75d8e80f6f05e24793397a19d"/>
|
||||
<project name="platform/external/yaffs2" path="external/yaffs2" revision="a2cff2275e1b501ff478b03757d6e4f05fddc2db"/>
|
||||
<project name="platform/external/zlib" path="external/zlib" revision="a5c7131da47c991585a6c6ac0c063b6d7d56e3fc"/>
|
||||
<project name="platform/frameworks/base" path="frameworks/base" revision="2d12cb68a6c680e1ef50c6fbd19f782f67aec9de"/>
|
||||
<project name="platform/frameworks/base" path="frameworks/base" revision="d9d67d72dab332472d19aff19985d41d1c883763"/>
|
||||
<project name="platform/frameworks/native" path="frameworks/native" revision="8d54940d9bdad8fec3208ff58ddab590be9fe0d4"/>
|
||||
<project name="platform/frameworks/opt/emoji" path="frameworks/opt/emoji" revision="dbbe673145107e99883f62bafd70c5f43f11065c"/>
|
||||
<project name="platform/frameworks/wilhelm" path="frameworks/wilhelm" revision="aac6c4bb59a6577c97cbda68699829b507b7490d"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="87a2d8ab9248540910e56921654367b78a587095"/>
|
||||
|
@ -17,10 +17,10 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49192a4e48d080e44a0d66f059e6897f07cf67f8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="47f48a42502b1c694db2b162011a67a2ff888c5d"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49192a4e48d080e44a0d66f059e6897f07cf67f8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="47f48a42502b1c694db2b162011a67a2ff888c5d"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49192a4e48d080e44a0d66f059e6897f07cf67f8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="47f48a42502b1c694db2b162011a67a2ff888c5d"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
|
||||
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="87a2d8ab9248540910e56921654367b78a587095"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49192a4e48d080e44a0d66f059e6897f07cf67f8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="47f48a42502b1c694db2b162011a67a2ff888c5d"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"git": {
|
||||
"git_revision": "e6506d68e01489b57616f8b74e8773f938ce62b3",
|
||||
"git_revision": "86af137c7f4c41c1185e609339002ab47fd6c640",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "b126eb6c8cb42a881f56ed9ed9c81306858a388b",
|
||||
"revision": "e700d1e96a1185d51c9f5782e442dc0610a10d95",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
@ -17,10 +17,10 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49192a4e48d080e44a0d66f059e6897f07cf67f8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="47f48a42502b1c694db2b162011a67a2ff888c5d"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49192a4e48d080e44a0d66f059e6897f07cf67f8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="47f48a42502b1c694db2b162011a67a2ff888c5d"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
|
||||
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>
|
||||
|
@ -422,6 +422,12 @@ pref("browser.search.showOneOffButtons", true);
|
||||
// comma seperated list of of engines to hide in the search panel.
|
||||
pref("browser.search.hiddenOneOffs", "");
|
||||
|
||||
#ifdef XP_WIN
|
||||
pref("browser.search.redirectWindowsSearch", true);
|
||||
#else
|
||||
pref("browser.search.redirectWindowsSearch", false);
|
||||
#endif
|
||||
|
||||
pref("browser.sessionhistory.max_entries", 50);
|
||||
|
||||
// Built-in default permissions.
|
||||
|
@ -500,6 +500,13 @@ loop.shared.actions = (function() {
|
||||
JoinRoom: Action.define("joinRoom", {
|
||||
}),
|
||||
|
||||
/**
|
||||
* Starts the process for the user to join the room.
|
||||
* XXX: should move to some roomActions module - refs bug 1079284
|
||||
*/
|
||||
RetryAfterRoomFailure: Action.define("retryAfterRoomFailure", {
|
||||
}),
|
||||
|
||||
/**
|
||||
* Signals the user has successfully joined the room on the loop-server.
|
||||
* XXX: should move to some roomActions module - refs bug 1079284
|
||||
|
@ -25,7 +25,8 @@ loop.store.ActiveRoomStore = (function() {
|
||||
urls: "roomContextUrls",
|
||||
description: "roomDescription",
|
||||
roomInfoFailure: "roomInfoFailure",
|
||||
roomName: "roomName"
|
||||
roomName: "roomName",
|
||||
roomState: "roomState"
|
||||
};
|
||||
|
||||
/**
|
||||
@ -147,22 +148,67 @@ loop.store.ActiveRoomStore = (function() {
|
||||
console.error("Error in state `" + this._storeState.roomState + "`:",
|
||||
actionData.error);
|
||||
|
||||
var exitState = this._storeState.roomState !== ROOM_STATES.FAILED ?
|
||||
this._storeState.roomState : this._storeState.failureExitState;
|
||||
|
||||
this.setStoreState({
|
||||
error: actionData.error,
|
||||
failureReason: getReason(actionData.error.errno)
|
||||
failureReason: getReason(actionData.error.errno),
|
||||
failureExitState: exitState
|
||||
});
|
||||
|
||||
this._leaveRoom(actionData.error.errno === REST_ERRNOS.ROOM_FULL ?
|
||||
ROOM_STATES.FULL : ROOM_STATES.FAILED, actionData.failedJoinRequest);
|
||||
},
|
||||
|
||||
/**
|
||||
* Attempts to retry getting the room data if there has been a room failure.
|
||||
*/
|
||||
retryAfterRoomFailure: function() {
|
||||
if (this._storeState.failureReason === FAILURE_DETAILS.EXPIRED_OR_INVALID) {
|
||||
console.error("Invalid retry attempt for expired or invalid url");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (this._storeState.failureExitState) {
|
||||
case ROOM_STATES.GATHER:
|
||||
this.dispatchAction(new sharedActions.FetchServerData({
|
||||
cryptoKey: this._storeState.roomCryptoKey,
|
||||
token: this._storeState.roomToken,
|
||||
windowType: "room"
|
||||
}));
|
||||
return;
|
||||
case ROOM_STATES.INIT:
|
||||
case ROOM_STATES.ENDED:
|
||||
case ROOM_STATES.CLOSING:
|
||||
console.error("Unexpected retry for exit state", this._storeState.failureExitState);
|
||||
return;
|
||||
default:
|
||||
// For all other states, we simply join the room. We avoid dispatching
|
||||
// another action here so that metrics doesn't get two notifications
|
||||
// in a row (one for retry, one for the join).
|
||||
this.joinRoom();
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Registers the actions with the dispatcher that this store is interested
|
||||
* in after the initial setup has been performed.
|
||||
*/
|
||||
_registerPostSetupActions: function() {
|
||||
// Protect against calling this twice, as we don't want to register
|
||||
// before we know what type we are, but in some cases we need to re-do
|
||||
// an action (e.g. FetchServerData).
|
||||
if (this._registeredActions) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._registeredActions = true;
|
||||
|
||||
this.dispatcher.register(this, [
|
||||
"roomFailure",
|
||||
"retryAfterRoomFailure",
|
||||
"setupRoomInfo",
|
||||
"updateRoomInfo",
|
||||
"gotMediaPermission",
|
||||
@ -256,8 +302,8 @@ loop.store.ActiveRoomStore = (function() {
|
||||
|
||||
this.setStoreState({
|
||||
roomToken: actionData.token,
|
||||
roomCryptoKey: actionData.cryptoKey,
|
||||
roomState: ROOM_STATES.READY
|
||||
roomState: ROOM_STATES.GATHER,
|
||||
roomCryptoKey: actionData.cryptoKey
|
||||
});
|
||||
|
||||
this._mozLoop.rooms.on("update:" + actionData.roomToken,
|
||||
@ -271,9 +317,10 @@ loop.store.ActiveRoomStore = (function() {
|
||||
_getRoomDataForStandalone: function() {
|
||||
this._mozLoop.rooms.get(this._storeState.roomToken, function(err, result) {
|
||||
if (err) {
|
||||
// XXX Bug 1110937 will want to handle the error results here
|
||||
// e.g. room expired/invalid.
|
||||
console.error("Failed to get room data:", err);
|
||||
this.dispatchAction(new sharedActions.RoomFailure({
|
||||
error: err,
|
||||
failedJoinRequest: false
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -282,6 +329,12 @@ loop.store.ActiveRoomStore = (function() {
|
||||
roomUrl: result.roomUrl
|
||||
});
|
||||
|
||||
// If we've got this far, then we want to go to the ready state
|
||||
// regardless of success of failure. This is because failures of
|
||||
// crypto don't stop the user using the room, they just stop
|
||||
// us putting up the information.
|
||||
roomInfoData.roomState = ROOM_STATES.READY;
|
||||
|
||||
if (!result.context && !result.roomName) {
|
||||
roomInfoData.roomInfoFailure = ROOM_INFO_FAILURES.NO_DATA;
|
||||
this.dispatcher.dispatch(roomInfoData);
|
||||
@ -542,11 +595,15 @@ loop.store.ActiveRoomStore = (function() {
|
||||
return;
|
||||
}
|
||||
|
||||
var exitState = this._storeState.roomState === ROOM_STATES.FAILED ?
|
||||
this._storeState.failureExitState : this._storeState.roomState;
|
||||
|
||||
// Treat all reasons as something failed. In theory, clientDisconnected
|
||||
// could be a success case, but there's no way we should be intentionally
|
||||
// sending that and still have the window open.
|
||||
this.setStoreState({
|
||||
failureReason: actionData.reason
|
||||
failureReason: actionData.reason,
|
||||
failureExitState: exitState
|
||||
});
|
||||
|
||||
this._leaveRoom(ROOM_STATES.FAILED);
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
var loop = loop || {};
|
||||
loop.shared = loop.shared || {};
|
||||
loop.shared.views = (function(_, l10n) {
|
||||
loop.shared.views = (function(_, mozL10n) {
|
||||
"use strict";
|
||||
|
||||
var sharedActions = loop.shared.actions;
|
||||
@ -62,7 +62,7 @@ loop.shared.views = (function(_, l10n) {
|
||||
var prefix = this.props.enabled ? "mute" : "unmute";
|
||||
var suffix = "button_title";
|
||||
var msgId = [prefix, this.props.scope, this.props.type, suffix].join("_");
|
||||
return l10n.get(msgId);
|
||||
return mozL10n.get(msgId);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
@ -130,7 +130,7 @@ loop.shared.views = (function(_, l10n) {
|
||||
var prefix = this.props.state === SCREEN_SHARE_STATES.ACTIVE ?
|
||||
"active" : "inactive";
|
||||
|
||||
return l10n.get(prefix + "_screenshare_button_title");
|
||||
return mozL10n.get(prefix + "_screenshare_button_title");
|
||||
},
|
||||
|
||||
render: function() {
|
||||
@ -169,10 +169,10 @@ loop.shared.views = (function(_, l10n) {
|
||||
),
|
||||
React.createElement("ul", {className: dropdownMenuClasses, ref: "menu"},
|
||||
React.createElement("li", {onClick: this._handleShareTabs},
|
||||
l10n.get("share_tabs_button_title2")
|
||||
mozL10n.get("share_tabs_button_title2")
|
||||
),
|
||||
React.createElement("li", {className: windowSharingClasses, onClick: this._handleShareWindows},
|
||||
l10n.get("share_windows_button_title")
|
||||
mozL10n.get("share_windows_button_title")
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -226,7 +226,7 @@ loop.shared.views = (function(_, l10n) {
|
||||
},
|
||||
|
||||
_getHangupButtonLabel: function() {
|
||||
return this.props.hangupButtonLabel || l10n.get("hangup_button_caption2");
|
||||
return this.props.hangupButtonLabel || mozL10n.get("hangup_button_caption2");
|
||||
},
|
||||
|
||||
render: function() {
|
||||
@ -236,7 +236,7 @@ loop.shared.views = (function(_, l10n) {
|
||||
React.createElement("button", {className: "btn btn-hangup",
|
||||
disabled: !this.props.enableHangup,
|
||||
onClick: this.handleClickHangup,
|
||||
title: l10n.get("hangup_button_title")},
|
||||
title: mozL10n.get("hangup_button_title")},
|
||||
this._getHangupButtonLabel()
|
||||
)
|
||||
),
|
||||
@ -261,7 +261,7 @@ loop.shared.views = (function(_, l10n) {
|
||||
React.createElement(MediaControlButton, {action: this.handleToggleEdit,
|
||||
enabled: this.props.edit.enabled,
|
||||
scope: "local",
|
||||
title: l10n.get(this.props.edit.enabled ?
|
||||
title: mozL10n.get(this.props.edit.enabled ?
|
||||
"context_edit_tooltip" : "context_hide_tooltip"),
|
||||
type: "edit",
|
||||
visible: this.props.edit.visible})
|
||||
@ -794,7 +794,7 @@ loop.shared.views = (function(_, l10n) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return React.createElement("p", null, l10n.get("context_inroom_label"));
|
||||
return React.createElement("p", null, mozL10n.get("context_inroom_label"));
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
var loop = loop || {};
|
||||
loop.shared = loop.shared || {};
|
||||
loop.shared.views = (function(_, l10n) {
|
||||
loop.shared.views = (function(_, mozL10n) {
|
||||
"use strict";
|
||||
|
||||
var sharedActions = loop.shared.actions;
|
||||
@ -62,7 +62,7 @@ loop.shared.views = (function(_, l10n) {
|
||||
var prefix = this.props.enabled ? "mute" : "unmute";
|
||||
var suffix = "button_title";
|
||||
var msgId = [prefix, this.props.scope, this.props.type, suffix].join("_");
|
||||
return l10n.get(msgId);
|
||||
return mozL10n.get(msgId);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
@ -130,7 +130,7 @@ loop.shared.views = (function(_, l10n) {
|
||||
var prefix = this.props.state === SCREEN_SHARE_STATES.ACTIVE ?
|
||||
"active" : "inactive";
|
||||
|
||||
return l10n.get(prefix + "_screenshare_button_title");
|
||||
return mozL10n.get(prefix + "_screenshare_button_title");
|
||||
},
|
||||
|
||||
render: function() {
|
||||
@ -169,10 +169,10 @@ loop.shared.views = (function(_, l10n) {
|
||||
</button>
|
||||
<ul className={dropdownMenuClasses} ref="menu">
|
||||
<li onClick={this._handleShareTabs}>
|
||||
{l10n.get("share_tabs_button_title2")}
|
||||
{mozL10n.get("share_tabs_button_title2")}
|
||||
</li>
|
||||
<li className={windowSharingClasses} onClick={this._handleShareWindows}>
|
||||
{l10n.get("share_windows_button_title")}
|
||||
{mozL10n.get("share_windows_button_title")}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -226,7 +226,7 @@ loop.shared.views = (function(_, l10n) {
|
||||
},
|
||||
|
||||
_getHangupButtonLabel: function() {
|
||||
return this.props.hangupButtonLabel || l10n.get("hangup_button_caption2");
|
||||
return this.props.hangupButtonLabel || mozL10n.get("hangup_button_caption2");
|
||||
},
|
||||
|
||||
render: function() {
|
||||
@ -236,7 +236,7 @@ loop.shared.views = (function(_, l10n) {
|
||||
<button className="btn btn-hangup"
|
||||
disabled={!this.props.enableHangup}
|
||||
onClick={this.handleClickHangup}
|
||||
title={l10n.get("hangup_button_title")}>
|
||||
title={mozL10n.get("hangup_button_title")}>
|
||||
{this._getHangupButtonLabel()}
|
||||
</button>
|
||||
</li>
|
||||
@ -261,7 +261,7 @@ loop.shared.views = (function(_, l10n) {
|
||||
<MediaControlButton action={this.handleToggleEdit}
|
||||
enabled={this.props.edit.enabled}
|
||||
scope="local"
|
||||
title={l10n.get(this.props.edit.enabled ?
|
||||
title={mozL10n.get(this.props.edit.enabled ?
|
||||
"context_edit_tooltip" : "context_hide_tooltip")}
|
||||
type="edit"
|
||||
visible={this.props.edit.visible} />
|
||||
@ -794,7 +794,7 @@ loop.shared.views = (function(_, l10n) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <p>{l10n.get("context_inroom_label")}</p>;
|
||||
return <p>{mozL10n.get("context_inroom_label")}</p>;
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
@ -49,7 +49,8 @@ loop.store.StandaloneMetricsStore = (function() {
|
||||
"leaveRoom",
|
||||
"mediaConnected",
|
||||
"recordClick",
|
||||
"remotePeerConnected"
|
||||
"remotePeerConnected",
|
||||
"retryAfterRoomFailure"
|
||||
],
|
||||
|
||||
/**
|
||||
@ -190,6 +191,15 @@ loop.store.StandaloneMetricsStore = (function() {
|
||||
"Remote peer connected");
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles when the user retrys room activity after its failed initially
|
||||
* (e.g. on first load).
|
||||
*/
|
||||
retryAfterRoomFailure: function() {
|
||||
this._storeEvent(METRICS_GA_CATEGORY.general, METRICS_GA_ACTIONS.button,
|
||||
"Retry failed room");
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles notifications that the activeRoomStore has changed, updating
|
||||
* the metrics for room state and mute state as necessary.
|
||||
|
@ -14,12 +14,75 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
var sharedUtils = loop.shared.utils;
|
||||
var sharedViews = loop.shared.views;
|
||||
|
||||
/**
|
||||
* Handles display of failures, determining the correct messages and
|
||||
* displaying the retry button at appropriate times.
|
||||
*/
|
||||
var StandaloneRoomFailureView = React.createClass({displayName: "StandaloneRoomFailureView",
|
||||
propTypes: {
|
||||
dispatcher: React.PropTypes.instanceOf(loop.Dispatcher).isRequired,
|
||||
// One of FAILURE_DETAILS.
|
||||
failureReason: React.PropTypes.string
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles when the retry button is pressed.
|
||||
*/
|
||||
handleRetryButton: function() {
|
||||
this.props.dispatcher.dispatch(new sharedActions.RetryAfterRoomFailure());
|
||||
},
|
||||
|
||||
/**
|
||||
* @return String An appropriate string according to the failureReason.
|
||||
*/
|
||||
getFailureString: function() {
|
||||
switch(this.props.failureReason) {
|
||||
case FAILURE_DETAILS.MEDIA_DENIED:
|
||||
// XXX Bug 1166824 should provide a better string for this.
|
||||
case FAILURE_DETAILS.NO_MEDIA:
|
||||
return mozL10n.get("rooms_media_denied_message");
|
||||
case FAILURE_DETAILS.EXPIRED_OR_INVALID:
|
||||
return mozL10n.get("rooms_unavailable_notification_message");
|
||||
default:
|
||||
return mozL10n.get("status_error");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* This renders a retry button if one is necessary.
|
||||
*/
|
||||
renderRetryButton: function() {
|
||||
if (this.props.failureReason === FAILURE_DETAILS.EXPIRED_OR_INVALID) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
React.createElement("button", {className: "btn btn-join btn-info",
|
||||
onClick: this.handleRetryButton},
|
||||
mozL10n.get("retry_call_button")
|
||||
)
|
||||
);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
React.createElement("div", {className: "room-inner-info-area"},
|
||||
React.createElement("p", {className: "failed-room-message"},
|
||||
this.getFailureString()
|
||||
),
|
||||
this.renderRetryButton()
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
var StandaloneRoomInfoArea = React.createClass({displayName: "StandaloneRoomInfoArea",
|
||||
propTypes: {
|
||||
activeRoomStore: React.PropTypes.oneOfType([
|
||||
React.PropTypes.instanceOf(loop.store.ActiveRoomStore),
|
||||
React.PropTypes.instanceOf(loop.store.FxOSActiveRoomStore)
|
||||
]).isRequired,
|
||||
dispatcher: React.PropTypes.instanceOf(loop.Dispatcher).isRequired,
|
||||
failureReason: React.PropTypes.string,
|
||||
isFirefox: React.PropTypes.bool.isRequired,
|
||||
joinRoom: React.PropTypes.func.isRequired,
|
||||
@ -53,25 +116,8 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* @return String An appropriate string according to the failureReason.
|
||||
*/
|
||||
_getFailureString: function() {
|
||||
switch(this.props.failureReason) {
|
||||
case FAILURE_DETAILS.MEDIA_DENIED:
|
||||
// XXX Bug 1166824 should provide a better string for this.
|
||||
case FAILURE_DETAILS.NO_MEDIA:
|
||||
return mozL10n.get("rooms_media_denied_message");
|
||||
case FAILURE_DETAILS.EXPIRED_OR_INVALID:
|
||||
return mozL10n.get("rooms_unavailable_notification_message");
|
||||
default:
|
||||
return mozL10n.get("status_error");
|
||||
}
|
||||
},
|
||||
|
||||
render: function() {
|
||||
switch(this.props.roomState) {
|
||||
case ROOM_STATES.INIT:
|
||||
case ROOM_STATES.READY: {
|
||||
// XXX: In ENDED state, we should rather display the feedback form.
|
||||
return (
|
||||
@ -144,17 +190,13 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
}
|
||||
case ROOM_STATES.FAILED: {
|
||||
return (
|
||||
React.createElement("div", {className: "room-inner-info-area"},
|
||||
React.createElement("p", {className: "failed-room-message"},
|
||||
this._getFailureString()
|
||||
),
|
||||
React.createElement("button", {className: "btn btn-join btn-info",
|
||||
onClick: this.props.joinRoom},
|
||||
mozL10n.get("retry_call_button")
|
||||
)
|
||||
)
|
||||
React.createElement(StandaloneRoomFailureView, {
|
||||
dispatcher: this.props.dispatcher,
|
||||
failureReason: this.props.failureReason})
|
||||
);
|
||||
}
|
||||
case ROOM_STATES.INIT:
|
||||
case ROOM_STATES.GATHER:
|
||||
default: {
|
||||
return null;
|
||||
}
|
||||
@ -362,6 +404,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
// the other party to connect
|
||||
return true;
|
||||
|
||||
case ROOM_STATES.FAILED:
|
||||
case ROOM_STATES.CLOSING:
|
||||
// the other person has shown up, so we don't want to show an avatar
|
||||
return true;
|
||||
@ -437,6 +480,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
React.createElement("div", {className: "beta-logo"}),
|
||||
React.createElement(StandaloneRoomHeader, {dispatcher: this.props.dispatcher}),
|
||||
React.createElement(StandaloneRoomInfoArea, {activeRoomStore: this.props.activeRoomStore,
|
||||
dispatcher: this.props.dispatcher,
|
||||
failureReason: this.state.failureReason,
|
||||
isFirefox: this.props.isFirefox,
|
||||
joinRoom: this.joinRoom,
|
||||
|
@ -14,12 +14,75 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
var sharedUtils = loop.shared.utils;
|
||||
var sharedViews = loop.shared.views;
|
||||
|
||||
/**
|
||||
* Handles display of failures, determining the correct messages and
|
||||
* displaying the retry button at appropriate times.
|
||||
*/
|
||||
var StandaloneRoomFailureView = React.createClass({
|
||||
propTypes: {
|
||||
dispatcher: React.PropTypes.instanceOf(loop.Dispatcher).isRequired,
|
||||
// One of FAILURE_DETAILS.
|
||||
failureReason: React.PropTypes.string
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles when the retry button is pressed.
|
||||
*/
|
||||
handleRetryButton: function() {
|
||||
this.props.dispatcher.dispatch(new sharedActions.RetryAfterRoomFailure());
|
||||
},
|
||||
|
||||
/**
|
||||
* @return String An appropriate string according to the failureReason.
|
||||
*/
|
||||
getFailureString: function() {
|
||||
switch(this.props.failureReason) {
|
||||
case FAILURE_DETAILS.MEDIA_DENIED:
|
||||
// XXX Bug 1166824 should provide a better string for this.
|
||||
case FAILURE_DETAILS.NO_MEDIA:
|
||||
return mozL10n.get("rooms_media_denied_message");
|
||||
case FAILURE_DETAILS.EXPIRED_OR_INVALID:
|
||||
return mozL10n.get("rooms_unavailable_notification_message");
|
||||
default:
|
||||
return mozL10n.get("status_error");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* This renders a retry button if one is necessary.
|
||||
*/
|
||||
renderRetryButton: function() {
|
||||
if (this.props.failureReason === FAILURE_DETAILS.EXPIRED_OR_INVALID) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<button className="btn btn-join btn-info"
|
||||
onClick={this.handleRetryButton}>
|
||||
{mozL10n.get("retry_call_button")}
|
||||
</button>
|
||||
);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<div className="room-inner-info-area">
|
||||
<p className="failed-room-message">
|
||||
{this.getFailureString()}
|
||||
</p>
|
||||
{this.renderRetryButton()}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
var StandaloneRoomInfoArea = React.createClass({
|
||||
propTypes: {
|
||||
activeRoomStore: React.PropTypes.oneOfType([
|
||||
React.PropTypes.instanceOf(loop.store.ActiveRoomStore),
|
||||
React.PropTypes.instanceOf(loop.store.FxOSActiveRoomStore)
|
||||
]).isRequired,
|
||||
dispatcher: React.PropTypes.instanceOf(loop.Dispatcher).isRequired,
|
||||
failureReason: React.PropTypes.string,
|
||||
isFirefox: React.PropTypes.bool.isRequired,
|
||||
joinRoom: React.PropTypes.func.isRequired,
|
||||
@ -53,25 +116,8 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* @return String An appropriate string according to the failureReason.
|
||||
*/
|
||||
_getFailureString: function() {
|
||||
switch(this.props.failureReason) {
|
||||
case FAILURE_DETAILS.MEDIA_DENIED:
|
||||
// XXX Bug 1166824 should provide a better string for this.
|
||||
case FAILURE_DETAILS.NO_MEDIA:
|
||||
return mozL10n.get("rooms_media_denied_message");
|
||||
case FAILURE_DETAILS.EXPIRED_OR_INVALID:
|
||||
return mozL10n.get("rooms_unavailable_notification_message");
|
||||
default:
|
||||
return mozL10n.get("status_error");
|
||||
}
|
||||
},
|
||||
|
||||
render: function() {
|
||||
switch(this.props.roomState) {
|
||||
case ROOM_STATES.INIT:
|
||||
case ROOM_STATES.READY: {
|
||||
// XXX: In ENDED state, we should rather display the feedback form.
|
||||
return (
|
||||
@ -144,17 +190,13 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
}
|
||||
case ROOM_STATES.FAILED: {
|
||||
return (
|
||||
<div className="room-inner-info-area">
|
||||
<p className="failed-room-message">
|
||||
{this._getFailureString()}
|
||||
</p>
|
||||
<button className="btn btn-join btn-info"
|
||||
onClick={this.props.joinRoom}>
|
||||
{mozL10n.get("retry_call_button")}
|
||||
</button>
|
||||
</div>
|
||||
<StandaloneRoomFailureView
|
||||
dispatcher={this.props.dispatcher}
|
||||
failureReason={this.props.failureReason} />
|
||||
);
|
||||
}
|
||||
case ROOM_STATES.INIT:
|
||||
case ROOM_STATES.GATHER:
|
||||
default: {
|
||||
return null;
|
||||
}
|
||||
@ -362,6 +404,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
// the other party to connect
|
||||
return true;
|
||||
|
||||
case ROOM_STATES.FAILED:
|
||||
case ROOM_STATES.CLOSING:
|
||||
// the other person has shown up, so we don't want to show an avatar
|
||||
return true;
|
||||
@ -437,6 +480,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
|
||||
<div className="beta-logo" />
|
||||
<StandaloneRoomHeader dispatcher={this.props.dispatcher} />
|
||||
<StandaloneRoomInfoArea activeRoomStore={this.props.activeRoomStore}
|
||||
dispatcher={this.props.dispatcher}
|
||||
failureReason={this.state.failureReason}
|
||||
isFirefox={this.props.isFirefox}
|
||||
joinRoom={this.joinRoom}
|
||||
|
@ -233,6 +233,71 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe("#retryAfterRoomFailure", function() {
|
||||
beforeEach(function() {
|
||||
sandbox.stub(console, "error");
|
||||
});
|
||||
|
||||
it("should reject attempts to retry for invalid/expired urls", function() {
|
||||
store.setStoreState({
|
||||
failureReason: FAILURE_DETAILS.EXPIRED_OR_INVALID
|
||||
});
|
||||
|
||||
store.retryAfterRoomFailure();
|
||||
|
||||
sinon.assert.calledOnce(console.error);
|
||||
sinon.assert.calledWithMatch(console.error, "Invalid");
|
||||
sinon.assert.notCalled(dispatcher.dispatch);
|
||||
});
|
||||
|
||||
it("should reject attempts if the failure exit state is not expected", function() {
|
||||
store.setStoreState({
|
||||
failureReason: FAILURE_DETAILS.UNKNOWN,
|
||||
failureExitState: ROOM_STATES.INIT
|
||||
});
|
||||
|
||||
store.retryAfterRoomFailure();
|
||||
|
||||
sinon.assert.calledOnce(console.error);
|
||||
sinon.assert.calledWithMatch(console.error, "Unexpected");
|
||||
sinon.assert.notCalled(dispatcher.dispatch);
|
||||
});
|
||||
|
||||
it("should dispatch a FetchServerData action when the exit state is GATHER", function() {
|
||||
store.setStoreState({
|
||||
failureReason: FAILURE_DETAILS.UNKNOWN,
|
||||
failureExitState: ROOM_STATES.GATHER,
|
||||
roomCryptoKey: "fakeKey",
|
||||
roomToken: "fakeToken"
|
||||
});
|
||||
|
||||
store.retryAfterRoomFailure();
|
||||
|
||||
sinon.assert.calledOnce(dispatcher.dispatch);
|
||||
sinon.assert.calledWithExactly(dispatcher.dispatch,
|
||||
new sharedActions.FetchServerData({
|
||||
cryptoKey: "fakeKey",
|
||||
token: "fakeToken",
|
||||
windowType: "room"
|
||||
}));
|
||||
});
|
||||
|
||||
it("should join the room for other states", function() {
|
||||
sandbox.stub(store, "joinRoom");
|
||||
|
||||
store.setStoreState({
|
||||
failureReason: FAILURE_DETAILS.UNKNOWN,
|
||||
failureExitState: ROOM_STATES.MEDIA_WAIT,
|
||||
roomCryptoKey: "fakeKey",
|
||||
roomToken: "fakeToken"
|
||||
});
|
||||
|
||||
store.retryAfterRoomFailure();
|
||||
|
||||
sinon.assert.calledOnce(store.joinRoom);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#setupWindowData", function() {
|
||||
var fakeToken, fakeRoomData;
|
||||
|
||||
@ -346,10 +411,10 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
expect(store.getStoreState().roomToken).eql("fakeToken");
|
||||
});
|
||||
|
||||
it("should set the state to `READY`", function() {
|
||||
it("should set the state to `GATHER`", function() {
|
||||
store.fetchServerData(fetchServerAction);
|
||||
|
||||
expect(store.getStoreState().roomState).eql(ROOM_STATES.READY);
|
||||
expect(store.getStoreState().roomState).eql(ROOM_STATES.GATHER);
|
||||
});
|
||||
|
||||
it("should call mozLoop.rooms.get to get the room data", function() {
|
||||
@ -371,6 +436,7 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
new sharedActions.UpdateRoomInfo({
|
||||
roomInfoFailure: ROOM_INFO_FAILURES.NO_DATA,
|
||||
roomOwner: "Dan",
|
||||
roomState: ROOM_STATES.READY,
|
||||
roomUrl: "http://invalid"
|
||||
}));
|
||||
});
|
||||
@ -389,7 +455,9 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
|
||||
sinon.assert.calledOnce(dispatcher.dispatch);
|
||||
sinon.assert.calledWithExactly(dispatcher.dispatch,
|
||||
new sharedActions.UpdateRoomInfo(roomDetails));
|
||||
new sharedActions.UpdateRoomInfo(_.extend({
|
||||
roomState: ROOM_STATES.READY
|
||||
}, roomDetails)));
|
||||
});
|
||||
});
|
||||
|
||||
@ -422,7 +490,8 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
sinon.assert.calledOnce(dispatcher.dispatch);
|
||||
sinon.assert.calledWithExactly(dispatcher.dispatch,
|
||||
new sharedActions.UpdateRoomInfo(_.extend({
|
||||
roomInfoFailure: ROOM_INFO_FAILURES.WEB_CRYPTO_UNSUPPORTED
|
||||
roomInfoFailure: ROOM_INFO_FAILURES.WEB_CRYPTO_UNSUPPORTED,
|
||||
roomState: ROOM_STATES.READY
|
||||
}, expectedDetails)));
|
||||
});
|
||||
|
||||
@ -432,7 +501,8 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
sinon.assert.calledOnce(dispatcher.dispatch);
|
||||
sinon.assert.calledWithExactly(dispatcher.dispatch,
|
||||
new sharedActions.UpdateRoomInfo(_.extend({
|
||||
roomInfoFailure: ROOM_INFO_FAILURES.NO_CRYPTO_KEY
|
||||
roomInfoFailure: ROOM_INFO_FAILURES.NO_CRYPTO_KEY,
|
||||
roomState: ROOM_STATES.READY
|
||||
}, expectedDetails)));
|
||||
});
|
||||
|
||||
@ -454,7 +524,8 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
sinon.assert.calledOnce(dispatcher.dispatch);
|
||||
sinon.assert.calledWithExactly(dispatcher.dispatch,
|
||||
new sharedActions.UpdateRoomInfo(_.extend({
|
||||
roomInfoFailure: ROOM_INFO_FAILURES.DECRYPT_FAILED
|
||||
roomInfoFailure: ROOM_INFO_FAILURES.DECRYPT_FAILED,
|
||||
roomState: ROOM_STATES.READY
|
||||
}, expectedDetails)));
|
||||
});
|
||||
|
||||
@ -483,9 +554,13 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
|
||||
store.fetchServerData(fetchServerAction);
|
||||
|
||||
var expectedData = _.extend({
|
||||
roomState: ROOM_STATES.READY
|
||||
}, roomContext, expectedDetails);
|
||||
|
||||
sinon.assert.calledOnce(dispatcher.dispatch);
|
||||
sinon.assert.calledWithExactly(dispatcher.dispatch,
|
||||
new sharedActions.UpdateRoomInfo(_.extend(roomContext, expectedDetails)));
|
||||
new sharedActions.UpdateRoomInfo(expectedData));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -88,7 +88,7 @@
|
||||
|
||||
describe("Unexpected Warnings Check", function() {
|
||||
it("should long only the warnings we expect", function() {
|
||||
chai.expect(caughtWarnings.length).to.eql(36);
|
||||
chai.expect(caughtWarnings.length).to.eql(33);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -141,6 +141,15 @@ describe("loop.store.StandaloneMetricsStore", function() {
|
||||
"send", "event", METRICS_GA_CATEGORY.general, METRICS_GA_ACTIONS.success,
|
||||
"Remote peer connected");
|
||||
});
|
||||
|
||||
it("should log an event on RetryAfterRoomFailure", function() {
|
||||
store.retryAfterRoomFailure();
|
||||
|
||||
sinon.assert.calledOnce(window.ga);
|
||||
sinon.assert.calledWithExactly(window.ga,
|
||||
"send", "event", METRICS_GA_CATEGORY.general, METRICS_GA_ACTIONS.button,
|
||||
"Retry failed room");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Store Change Handlers", function() {
|
||||
|
@ -10,6 +10,7 @@ describe("loop.standaloneRoomViews", function() {
|
||||
|
||||
var ROOM_STATES = loop.store.ROOM_STATES;
|
||||
var FEEDBACK_STATES = loop.store.FEEDBACK_STATES;
|
||||
var FAILURE_DETAILS = loop.shared.utils.FAILURE_DETAILS;
|
||||
var ROOM_INFO_FAILURES = loop.shared.utils.ROOM_INFO_FAILURES;
|
||||
var sharedActions = loop.shared.actions;
|
||||
var sharedUtils = loop.shared.utils;
|
||||
@ -195,21 +196,36 @@ describe("loop.standaloneRoomViews", function() {
|
||||
});
|
||||
|
||||
describe("Failed room message", function() {
|
||||
it("should display a failed room message on FAILED",
|
||||
function() {
|
||||
activeRoomStore.setStoreState({roomState: ROOM_STATES.FAILED});
|
||||
beforeEach(function() {
|
||||
activeRoomStore.setStoreState({ roomState: ROOM_STATES.FAILED });
|
||||
});
|
||||
|
||||
expect(view.getDOMNode().querySelector(".failed-room-message"))
|
||||
.not.eql(null);
|
||||
it("should display a failed room message on FAILED", function() {
|
||||
expect(view.getDOMNode().querySelector(".failed-room-message"))
|
||||
.not.eql(null);
|
||||
});
|
||||
|
||||
it("should display a retry button", function() {
|
||||
expect(view.getDOMNode().querySelector(".btn-info")).not.eql(null);
|
||||
});
|
||||
|
||||
it("should not display a retry button when the failure reason is expired or invalid", function() {
|
||||
activeRoomStore.setStoreState({
|
||||
failureReason: FAILURE_DETAILS.EXPIRED_OR_INVALID
|
||||
});
|
||||
|
||||
it("should display a retry button",
|
||||
function() {
|
||||
activeRoomStore.setStoreState({roomState: ROOM_STATES.FAILED});
|
||||
expect(view.getDOMNode().querySelector(".btn-info")).eql(null);
|
||||
});
|
||||
|
||||
expect(view.getDOMNode().querySelector(".btn-info"))
|
||||
.not.eql(null);
|
||||
});
|
||||
it("should dispatch a RetryAfterRoomFailure action when the retry button is pressed", function() {
|
||||
var button = view.getDOMNode().querySelector(".btn-info");
|
||||
|
||||
TestUtils.Simulate.click(button);
|
||||
|
||||
sinon.assert.calledOnce(dispatcher.dispatch);
|
||||
sinon.assert.calledWithExactly(dispatcher.dispatch,
|
||||
new sharedActions.RetryAfterRoomFailure());
|
||||
});
|
||||
});
|
||||
|
||||
describe("Join button", function() {
|
||||
|
@ -1313,7 +1313,7 @@
|
||||
|
||||
// This simulates the mocha layout for errors which means we can run
|
||||
// this alongside our other unit tests but use the same harness.
|
||||
var expectedWarningsCount = 29;
|
||||
var expectedWarningsCount = 28;
|
||||
var warningsMismatch = caughtWarnings.length !== expectedWarningsCount;
|
||||
if (uncaughtError || warningsMismatch) {
|
||||
$("#results").append("<div class='failures'><em>" +
|
||||
|
@ -1313,7 +1313,7 @@
|
||||
|
||||
// This simulates the mocha layout for errors which means we can run
|
||||
// this alongside our other unit tests but use the same harness.
|
||||
var expectedWarningsCount = 29;
|
||||
var expectedWarningsCount = 28;
|
||||
var warningsMismatch = caughtWarnings.length !== expectedWarningsCount;
|
||||
if (uncaughtError || warningsMismatch) {
|
||||
$("#results").append("<div class='failures'><em>" +
|
||||
|
@ -2,6 +2,8 @@
|
||||
* 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/. */
|
||||
|
||||
Components.utils.importGlobalProperties(["URLSearchParams"]);
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
||||
@ -727,10 +729,42 @@ nsDefaultCommandLineHandler.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
let redirectWinSearch = false;
|
||||
if (AppConstants.isPlatformAndVersionAtLeast("win", "10")) {
|
||||
redirectWinSearch = Services.prefs.getBoolPref("browser.search.redirectWindowsSearch");
|
||||
}
|
||||
|
||||
try {
|
||||
var ar;
|
||||
while ((ar = cmdLine.handleFlagWithParam("url", false))) {
|
||||
var uri = resolveURIInternal(cmdLine, ar);
|
||||
|
||||
// Searches in the Windows 10 task bar searchbox simply open the default browser
|
||||
// with a URL for a search on Bing. Here we extract the search term and use the
|
||||
// user's default search engine instead.
|
||||
if (redirectWinSearch && uri.spec.startsWith("https://www.bing.com/search")) {
|
||||
try {
|
||||
var url = uri.QueryInterface(Components.interfaces.nsIURL);
|
||||
var params = new URLSearchParams(url.query);
|
||||
// We don't want to rewrite all Bing URLs coming from external apps. Look
|
||||
// for the magic URL parm that's present in searches from the task bar.
|
||||
// (Typed searches use "form=WNSGPH", Cortana voice searches use "FORM=WNSBOX")
|
||||
var formParam = params.get("form");
|
||||
if (!formParam) {
|
||||
formParam = params.get("FORM");
|
||||
}
|
||||
if (formParam == "WNSGPH" || formParam == "WNSBOX") {
|
||||
var term = params.get("q");
|
||||
var ss = Components.classes["@mozilla.org/browser/search-service;1"]
|
||||
.getService(nsIBrowserSearchService);
|
||||
var submission = ss.defaultEngine.getSubmission(term, null, "searchbar");
|
||||
uri = submission.uri;
|
||||
}
|
||||
} catch (e) {
|
||||
Components.utils.reportError("Couldn't redirect Windows search: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
urilist.push(uri);
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,16 @@ var gPrivacyPane = {
|
||||
},
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Linkify the Learn More link of the Private Browsing Mode Tracking
|
||||
* Protection UI.
|
||||
*/
|
||||
_initTrackingProtectionPBM: function () {
|
||||
let link = document.getElementById("trackingProtectionPBMLearnMore");
|
||||
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "tracking-protection-pbm";
|
||||
link.setAttribute("href", url);
|
||||
},
|
||||
|
||||
/**
|
||||
* Initialize autocomplete to ensure prefs are in sync.
|
||||
*/
|
||||
@ -73,6 +83,7 @@ var gPrivacyPane = {
|
||||
#ifdef NIGHTLY_BUILD
|
||||
this._initTrackingProtection();
|
||||
#endif
|
||||
this._initTrackingProtectionPBM();
|
||||
this._initAutocomplete();
|
||||
|
||||
setEventListener("privacy.sanitize.sanitizeOnShutdown", "change",
|
||||
|
@ -16,6 +16,9 @@
|
||||
<preference id="privacy.trackingprotection.enabled"
|
||||
name="privacy.trackingprotection.enabled"
|
||||
type="bool"/>
|
||||
<preference id="privacy.trackingprotection.pbmode.enabled"
|
||||
name="privacy.trackingprotection.pbmode.enabled"
|
||||
type="bool"/>
|
||||
|
||||
<!-- XXX button prefs -->
|
||||
<preference id="pref.privacy.disable_button.cookie_exceptions"
|
||||
@ -83,30 +86,12 @@
|
||||
<!-- Tracking -->
|
||||
<groupbox id="trackingGroup" data-category="panePrivacy" hidden="true" align="start">
|
||||
<caption><label>&tracking.label;</label></caption>
|
||||
<vbox id="trackingprotectionbox" hidden="true">
|
||||
<hbox align="center">
|
||||
<checkbox id="trackingProtection"
|
||||
preference="privacy.trackingprotection.enabled"
|
||||
accesskey="&trackingProtection.accesskey;"
|
||||
label="&trackingProtection.label;" />
|
||||
<image id="trackingProtectionImage"/>
|
||||
</hbox>
|
||||
<hbox align="center"
|
||||
class="indent">
|
||||
<label id="trackingProtectionLearnMore"
|
||||
class="text-link"
|
||||
value="&trackingProtectionLearnMore.label;"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<vbox>
|
||||
<hbox align="center">
|
||||
<checkbox id="privacyDoNotTrackCheckbox"
|
||||
label="&dntTrackingNotOkay.label2;"
|
||||
accesskey="&dntTrackingNotOkay.accesskey;"
|
||||
preference="privacy.donottrackheader.enabled"/>
|
||||
</hbox>
|
||||
<hbox align="center"
|
||||
class="indent">
|
||||
<label id="doNotTrackInfo"
|
||||
class="text-link"
|
||||
href="https://www.mozilla.org/dnt">
|
||||
@ -114,6 +99,28 @@
|
||||
</label>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<vbox id="trackingprotectionbox" hidden="true">
|
||||
<hbox align="center">
|
||||
<checkbox id="trackingProtection"
|
||||
preference="privacy.trackingprotection.enabled"
|
||||
accesskey="&trackingProtection.accesskey;"
|
||||
label="&trackingProtection.label;" />
|
||||
<label id="trackingProtectionLearnMore"
|
||||
class="text-link"
|
||||
value="&trackingProtectionLearnMore.label;"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<vbox id="trackingprotectionpbmbox">
|
||||
<hbox align="center">
|
||||
<checkbox id="trackingProtectionPBM"
|
||||
preference="privacy.trackingprotection.pbmode.enabled"
|
||||
accesskey="&trackingProtectionPBM.accesskey;"
|
||||
label="&trackingProtectionPBM.label;" />
|
||||
<label id="trackingProtectionPBMLearnMore"
|
||||
class="text-link"
|
||||
value="&trackingProtectionPBMLearnMore.label;"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</groupbox>
|
||||
|
||||
<!-- History -->
|
||||
|
@ -3,6 +3,8 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
|
||||
"resource://gre/modules/AppConstants.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
||||
"resource://gre/modules/PlacesUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
||||
@ -11,6 +13,10 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
||||
const ENGINE_FLAVOR = "text/x-moz-search-engine";
|
||||
|
||||
document.addEventListener("Initialized", () => {
|
||||
if (!AppConstants.isPlatformAndVersionAtLeast("win", "10")) {
|
||||
document.getElementById("redirectSearchCheckbox").hidden = true;
|
||||
}
|
||||
|
||||
if (Services.prefs.getBoolPref("browser.search.showOneOffButtons"))
|
||||
return;
|
||||
|
||||
|
@ -1,15 +1,17 @@
|
||||
<preferences id="searchPreferences" hidden="true" data-category="paneSearch">
|
||||
|
||||
<!-- Suggest -->
|
||||
<preference id="browser.search.suggest.enabled"
|
||||
name="browser.search.suggest.enabled"
|
||||
type="bool"/>
|
||||
|
||||
<!-- One off providers -->
|
||||
<preference id="browser.search.hiddenOneOffs"
|
||||
name="browser.search.hiddenOneOffs"
|
||||
type="unichar"/>
|
||||
|
||||
<preference id="browser.search.redirectWindowsSearch"
|
||||
name="browser.search.redirectWindowsSearch"
|
||||
type="bool"/>
|
||||
|
||||
</preferences>
|
||||
|
||||
<script type="application/javascript"
|
||||
@ -35,6 +37,10 @@
|
||||
label="&provideSearchSuggestions.label;"
|
||||
accesskey="&provideSearchSuggestions.accesskey;"
|
||||
preference="browser.search.suggest.enabled"/>
|
||||
<checkbox id="redirectSearchCheckbox"
|
||||
label="&redirectWindowsSearch.label;"
|
||||
accesskey="&redirectWindowsSearch.accesskey;"
|
||||
preference="browser.search.redirectWindowsSearch"/>
|
||||
</groupbox>
|
||||
|
||||
<groupbox id="oneClickSearchProvidersGroup" data-category="paneSearch">
|
||||
|
@ -235,7 +235,8 @@
|
||||
align="center">
|
||||
<hbox align="center">
|
||||
<image id="fxaProfileImage"
|
||||
onclick="gSyncPane.openChangeProfileImage();" hidden="true"/>
|
||||
onclick="gSyncPane.openChangeProfileImage();" hidden="true"
|
||||
tooltiptext="&profilePicture.tooltip;"/>
|
||||
<label id="fxaEmailAddress1"/>
|
||||
</hbox>
|
||||
<spacer flex="1"/>
|
||||
|
@ -144,4 +144,4 @@ skip-if = os == 'linux' # Bug 1172120
|
||||
[browser_timeline-waterfall-generic.js]
|
||||
[browser_timeline-waterfall-rerender.js]
|
||||
[browser_timeline-waterfall-sidebar.js]
|
||||
skip-if = os == 'linux' # Bug 1161817
|
||||
skip-if = true # Bug 1161817
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
<!ENTITY importFromIE.label "Microsoft Internet Explorer">
|
||||
<!ENTITY importFromIE.accesskey "M">
|
||||
<!ENTITY importFromEdge.label "Microsoft Edge">
|
||||
<!ENTITY importFromEdge.accesskey "E">
|
||||
<!ENTITY importFromNothing.label "Don't import anything">
|
||||
<!ENTITY importFromNothing.accesskey "D">
|
||||
<!ENTITY importFromSafari.label "Safari">
|
||||
|
@ -9,6 +9,9 @@
|
||||
<!ENTITY trackingProtection.label "Prevent sites from tracking me">
|
||||
<!ENTITY trackingProtection.accesskey "m">
|
||||
<!ENTITY trackingProtectionLearnMore.label "Learn more">
|
||||
<!ENTITY trackingProtectionPBM.label "Prevent sites from tracking my online activity in Private Windows">
|
||||
<!ENTITY trackingProtectionPBM.accesskey "m">
|
||||
<!ENTITY trackingProtectionPBMLearnMore.label "Learn more">
|
||||
<!ENTITY doNotTrackInfo.label "Learn More">
|
||||
|
||||
<!ENTITY history.label "History">
|
||||
|
@ -9,6 +9,8 @@
|
||||
<!ENTITY provideSearchSuggestions.label "Provide search suggestions">
|
||||
<!ENTITY provideSearchSuggestions.accesskey "s">
|
||||
|
||||
<!ENTITY redirectWindowsSearch.label "Use this search engine for searches from Windows">
|
||||
<!ENTITY redirectWindowsSearch.accesskey "W">
|
||||
|
||||
<!ENTITY oneClickSearchEngines.label "One-click search engines">
|
||||
|
||||
|
@ -74,6 +74,7 @@ both, to better adapt this sentence to their language.
|
||||
|
||||
<!ENTITY notSignedIn.label "You are not signed in.">
|
||||
<!ENTITY signIn.label "Sign in">
|
||||
<!ENTITY profilePicture.tooltip "Change profile picture">
|
||||
<!ENTITY manage.label "Manage">
|
||||
<!ENTITY disconnect.label "Disconnect…">
|
||||
<!ENTITY verify.label "Verify Email">
|
||||
|
@ -1333,7 +1333,7 @@ toolbarbutton[constrain-size="true"][cui-areatype="toolbar"] > .toolbarbutton-ba
|
||||
|
||||
/* Active styling: transparent white over toolbar colors */
|
||||
#forward-button:hover:active:not(:-moz-lwtheme),
|
||||
#back-button:hover:active:not(:-moz-lwtheme) {
|
||||
#back-button:not([disabled="true"]):hover:active:not(:-moz-lwtheme) {
|
||||
background-image: linear-gradient(to bottom, rgba(255,255,255, 0.3), rgba(255,255,255, 0.4));
|
||||
background-color: transparent;
|
||||
box-shadow: none;
|
||||
|
@ -228,7 +228,7 @@ description > html|a {
|
||||
}
|
||||
|
||||
#fxaProfileImage:hover {
|
||||
border-color: blue;
|
||||
box-shadow: 0px 0px 0px 1px #0095DD;
|
||||
}
|
||||
|
||||
#noFxaAccount {
|
||||
@ -267,16 +267,8 @@ description > html|a {
|
||||
-moz-margin-start: 33px;
|
||||
}
|
||||
|
||||
#trackingProtectionImage {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
list-style-image: url(chrome://browser/skin/bad-content-blocked-16.png);
|
||||
}
|
||||
|
||||
@media (min-resolution: 2dppx) {
|
||||
#trackingProtectionImage {
|
||||
list-style-image: url(chrome://browser/skin/bad-content-blocked-16@2x.png);
|
||||
}
|
||||
.text-link {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
#showUpdateHistory {
|
||||
|
@ -694,6 +694,27 @@ enum BluetoothGattCharPropBit {
|
||||
typedef uint8_t BluetoothGattCharProp;
|
||||
#define BLUETOOTH_EMPTY_GATT_CHAR_PROP static_cast<BluetoothGattCharProp>(0x00)
|
||||
|
||||
/*
|
||||
* Bluetooth GATT Attribute Permissions bit field
|
||||
*/
|
||||
enum BluetoothGattAttrPermBit {
|
||||
GATT_ATTR_PERM_BIT_READ = (1 << 0),
|
||||
GATT_ATTR_PERM_BIT_READ_ENCRYPTED = (1 << 1),
|
||||
GATT_ATTR_PERM_BIT_READ_ENCRYPTED_MITM = (1 << 2),
|
||||
GATT_ATTR_PERM_BIT_WRITE = (1 << 4),
|
||||
GATT_ATTR_PERM_BIT_WRITE_ENCRYPTED = (1 << 5),
|
||||
GATT_ATTR_PERM_BIT_WRITE_ENCRYPTED_MITM = (1 << 6),
|
||||
GATT_ATTR_PERM_BIT_WRITE_SIGNED = (1 << 7),
|
||||
GATT_ATTR_PERM_BIT_WRITE_SIGNED_MITM = (1 << 8)
|
||||
};
|
||||
|
||||
/*
|
||||
* BluetoothGattAttrPerm is used to store a bit mask value which contains
|
||||
* each corresponding bit value of each BluetoothGattAttrPermBit.
|
||||
*/
|
||||
typedef int32_t BluetoothGattAttrPerm;
|
||||
#define BLUETOOTH_EMPTY_GATT_ATTR_PERM static_cast<BluetoothGattAttrPerm>(0x00)
|
||||
|
||||
struct BluetoothGattAdvData {
|
||||
uint8_t mAdvData[62];
|
||||
};
|
||||
@ -767,6 +788,14 @@ struct BluetoothGattTestParam {
|
||||
uint16_t mU5;
|
||||
};
|
||||
|
||||
struct BluetoothGattResponse {
|
||||
uint16_t mHandle;
|
||||
uint16_t mOffset;
|
||||
uint16_t mLength;
|
||||
BluetoothGattAuthReq mAuthReq;
|
||||
uint8_t mValue[BLUETOOTH_GATT_MAX_ATTR_LEN];
|
||||
};
|
||||
|
||||
/**
|
||||
* EIR Data Type, Advertising Data Type (AD Type) and OOB Data Type Definitions
|
||||
* Please refer to https://www.bluetooth.org/en-us/specification/\
|
||||
|
@ -611,12 +611,120 @@ protected:
|
||||
class BluetoothGattServerNotificationHandler
|
||||
{
|
||||
public:
|
||||
virtual ~BluetoothGattServerNotificationHandler();
|
||||
// TODO: Add server notifications
|
||||
virtual void
|
||||
RegisterServerNotification(BluetoothGattStatus aStatus,
|
||||
int aServerIf,
|
||||
const BluetoothUuid& aAppUuid)
|
||||
{ }
|
||||
|
||||
virtual void
|
||||
ConnectionNotification(int aConnId,
|
||||
int aServerIf,
|
||||
bool aConnected,
|
||||
const nsAString& aBdAddr)
|
||||
{ }
|
||||
|
||||
virtual void
|
||||
ServiceAddedNotification(BluetoothGattStatus aStatus,
|
||||
int aServerIf,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
int aServiceHandle)
|
||||
{ }
|
||||
|
||||
virtual void
|
||||
IncludedServiceAddedNotification(BluetoothGattStatus aStatus,
|
||||
int aServerIf,
|
||||
int aServiceHandle,
|
||||
int aIncludedServiceHandle)
|
||||
{ }
|
||||
|
||||
virtual void
|
||||
CharacteristicAddedNotification(BluetoothGattStatus aStatus,
|
||||
int aServerIf,
|
||||
const BluetoothUuid& aCharId,
|
||||
int aServiceHandle,
|
||||
int aCharacteristicHandle)
|
||||
{ }
|
||||
|
||||
virtual void
|
||||
DescriptorAddedNotification(BluetoothGattStatus aStatus,
|
||||
int aServerIf,
|
||||
const BluetoothUuid& aCharId,
|
||||
int aServiceHandle,
|
||||
int aDescriptorHandle)
|
||||
{ }
|
||||
|
||||
virtual void
|
||||
ServiceStartedNotification(BluetoothGattStatus aStatus,
|
||||
int aServerIf,
|
||||
int aServiceHandle)
|
||||
{ }
|
||||
|
||||
virtual void
|
||||
ServiceStoppedNotification(BluetoothGattStatus aStatus,
|
||||
int aServerIf,
|
||||
int aServiceHandle)
|
||||
{ }
|
||||
|
||||
virtual void
|
||||
ServiceDeletedNotification(BluetoothGattStatus aStatus,
|
||||
int aServerIf,
|
||||
int aServiceHandle)
|
||||
{ }
|
||||
|
||||
virtual void
|
||||
RequestReadNotification(int aConnId,
|
||||
int aTransId,
|
||||
const nsAString& aBdAddr,
|
||||
int aAttributeHandle,
|
||||
int aOffset,
|
||||
bool aIsLong)
|
||||
{ }
|
||||
|
||||
virtual void
|
||||
RequestWriteNotification(int aConnId,
|
||||
int aTransId,
|
||||
const nsAString& aBdAddr,
|
||||
int aAttributeHandle,
|
||||
int aOffset,
|
||||
const nsTArray<uint8_t>& aValue,
|
||||
bool aNeedResponse,
|
||||
bool aIsPrepareWrite)
|
||||
{ }
|
||||
|
||||
virtual void
|
||||
RequestExecuteWriteNotification(int aConnId,
|
||||
int aTransId,
|
||||
const nsAString& aBdAddr,
|
||||
bool aExecute) /* true: execute */
|
||||
/* false: cancel */
|
||||
{ }
|
||||
|
||||
virtual void
|
||||
ResponseConfirmationNotification(BluetoothGattStatus aStatus,
|
||||
int aHandle)
|
||||
{ }
|
||||
|
||||
virtual void
|
||||
IndicationSentNotification(int aConnId,
|
||||
BluetoothGattStatus aStatus)
|
||||
{ }
|
||||
|
||||
virtual void
|
||||
CongestionNotification(int aConnId,
|
||||
bool aCongested)
|
||||
{ }
|
||||
|
||||
virtual void
|
||||
MtuChangedNotification(int aConnId,
|
||||
int aMtu)
|
||||
{ }
|
||||
|
||||
protected:
|
||||
BluetoothGattServerNotificationHandler()
|
||||
{ }
|
||||
|
||||
virtual ~BluetoothGattServerNotificationHandler();
|
||||
};
|
||||
|
||||
class BluetoothGattNotificationHandler
|
||||
@ -688,7 +796,38 @@ protected:
|
||||
virtual ~BluetoothGattClientResultHandler() { }
|
||||
};
|
||||
|
||||
// TODO: Add GattServerResultHandler
|
||||
class BluetoothGattServerResultHandler
|
||||
{
|
||||
public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothGattServerResultHandler)
|
||||
|
||||
virtual void OnError(BluetoothStatus aStatus)
|
||||
{
|
||||
BT_WARNING("Received error code %d", (int)aStatus);
|
||||
}
|
||||
|
||||
virtual void RegisterServer() { }
|
||||
virtual void UnregisterServer() { }
|
||||
|
||||
virtual void ConnectPeripheral() { }
|
||||
virtual void DisconnectPeripheral() { }
|
||||
|
||||
virtual void AddService() { }
|
||||
virtual void AddIncludedService() { }
|
||||
virtual void AddCharacteristic() { }
|
||||
virtual void AddDescriptor() { }
|
||||
|
||||
virtual void StartService() { }
|
||||
virtual void StopService() { }
|
||||
virtual void DeleteService() { }
|
||||
|
||||
virtual void SendIndication() { }
|
||||
|
||||
virtual void SendResponse() { }
|
||||
|
||||
protected:
|
||||
virtual ~BluetoothGattServerResultHandler() { }
|
||||
};
|
||||
|
||||
class BluetoothGattClientInterface
|
||||
{
|
||||
@ -827,7 +966,79 @@ protected:
|
||||
virtual ~BluetoothGattClientInterface();
|
||||
};
|
||||
|
||||
// TODO: Add GattServerInterface
|
||||
class BluetoothGattServerInterface
|
||||
{
|
||||
public:
|
||||
/* Register / Unregister */
|
||||
virtual void RegisterServer(const BluetoothUuid& aUuid,
|
||||
BluetoothGattServerResultHandler* aRes) = 0;
|
||||
virtual void UnregisterServer(int aServerIf,
|
||||
BluetoothGattServerResultHandler* aRes) = 0;
|
||||
|
||||
/* Connect / Disconnect */
|
||||
virtual void ConnectPeripheral(int aServerIf,
|
||||
const nsAString& aBdAddr,
|
||||
bool aIsDirect, /* auto connect */
|
||||
BluetoothTransport aTransport,
|
||||
BluetoothGattServerResultHandler* aRes) = 0;
|
||||
virtual void DisconnectPeripheral(int aServerIf,
|
||||
const nsAString& aBdAddr,
|
||||
int aConnId,
|
||||
BluetoothGattServerResultHandler* aRes) = 0;
|
||||
|
||||
/* Add a services / a characteristic / a descriptor */
|
||||
virtual void AddService(int aServerIf,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
int aNumHandles,
|
||||
BluetoothGattServerResultHandler* aRes) = 0;
|
||||
virtual void AddIncludedService(int aServerIf,
|
||||
int aServiceHandle,
|
||||
int aIncludedServiceHandle,
|
||||
BluetoothGattServerResultHandler* aRes) = 0;
|
||||
virtual void AddCharacteristic(int aServerIf,
|
||||
int aServiceHandle,
|
||||
const BluetoothUuid& aUuid,
|
||||
BluetoothGattCharProp aProperties,
|
||||
BluetoothGattAttrPerm aPermissions,
|
||||
BluetoothGattServerResultHandler* aRes) = 0;
|
||||
virtual void AddDescriptor(int aServerIf,
|
||||
int aServiceHandle,
|
||||
const BluetoothUuid& aUuid,
|
||||
BluetoothGattAttrPerm aPermissions,
|
||||
BluetoothGattServerResultHandler* aRes) = 0;
|
||||
|
||||
/* Start / Stop / Delete a service */
|
||||
virtual void StartService(int aServerIf,
|
||||
int aServiceHandle,
|
||||
BluetoothTransport aTransport,
|
||||
BluetoothGattServerResultHandler* aRes) = 0;
|
||||
virtual void StopService(int aServerIf,
|
||||
int aServiceHandle,
|
||||
BluetoothGattServerResultHandler* aRes) = 0;
|
||||
virtual void DeleteService(int aServerIf,
|
||||
int aServiceHandle,
|
||||
BluetoothGattServerResultHandler* aRes) = 0;
|
||||
|
||||
/* Send an indication or a notification */
|
||||
virtual void SendIndication(int aServerIf,
|
||||
int aAttributeHandle,
|
||||
int aConnId,
|
||||
const nsTArray<uint8_t>& aValue,
|
||||
bool aConfirm, /* true: indication */
|
||||
/* false: notification */
|
||||
BluetoothGattServerResultHandler* aRes) = 0;
|
||||
|
||||
/* Send a response for an incoming indication */
|
||||
virtual void SendResponse(int aConnId,
|
||||
int aTransId,
|
||||
BluetoothGattStatus aStatus,
|
||||
const BluetoothGattResponse& aResponse,
|
||||
BluetoothGattServerResultHandler* aRes) = 0;
|
||||
|
||||
protected:
|
||||
BluetoothGattServerInterface();
|
||||
virtual ~BluetoothGattServerInterface();
|
||||
};
|
||||
|
||||
class BluetoothGattInterface
|
||||
{
|
||||
|
@ -23,6 +23,15 @@ typedef
|
||||
BluetoothStatus, BluetoothStatus>
|
||||
BluetoothGattClientHALErrorRunnable;
|
||||
|
||||
typedef
|
||||
BluetoothHALInterfaceRunnable0<BluetoothGattServerResultHandler, void>
|
||||
BluetoothGattServerHALResultRunnable;
|
||||
|
||||
typedef
|
||||
BluetoothHALInterfaceRunnable1<BluetoothGattServerResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>
|
||||
BluetoothGattServerHALErrorRunnable;
|
||||
|
||||
typedef
|
||||
BluetoothHALInterfaceRunnable0<BluetoothGattResultHandler, void>
|
||||
BluetoothGattHALResultRunnable;
|
||||
@ -84,6 +93,29 @@ DispatchBluetoothGattClientHALResult(
|
||||
return rv;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
DispatchBluetoothGattServerHALResult(
|
||||
BluetoothGattServerResultHandler* aRes,
|
||||
void (BluetoothGattServerResultHandler::*aMethod)(),
|
||||
BluetoothStatus aStatus)
|
||||
{
|
||||
MOZ_ASSERT(aRes);
|
||||
|
||||
nsRunnable* runnable;
|
||||
|
||||
if (aStatus == STATUS_SUCCESS) {
|
||||
runnable = new BluetoothGattServerHALResultRunnable(aRes, aMethod);
|
||||
} else {
|
||||
runnable = new BluetoothGattServerHALErrorRunnable(aRes,
|
||||
&BluetoothGattServerResultHandler::OnError, aStatus);
|
||||
}
|
||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_WARNING("NS_DispatchToMainThread failed: %X", rv);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
DispatchBluetoothGattHALResult(
|
||||
BluetoothGattResultHandler* aRes,
|
||||
@ -416,73 +448,244 @@ struct BluetoothGattServerCallback
|
||||
};
|
||||
|
||||
// Notifications
|
||||
// TODO: Add Server Notifications
|
||||
typedef BluetoothNotificationHALRunnable3<
|
||||
GattServerNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int, BluetoothUuid,
|
||||
BluetoothGattStatus, int, const BluetoothUuid&>
|
||||
RegisterServerNotification;
|
||||
|
||||
typedef BluetoothNotificationHALRunnable4<
|
||||
GattServerNotificationHandlerWrapper, void,
|
||||
int, int, bool, nsString,
|
||||
int, int, bool, const nsAString&>
|
||||
ConnectionNotification;
|
||||
|
||||
typedef BluetoothNotificationHALRunnable4<
|
||||
GattServerNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int, BluetoothGattServiceId, int,
|
||||
BluetoothGattStatus, int, const BluetoothGattServiceId&, int>
|
||||
ServiceAddedNotification;
|
||||
|
||||
typedef BluetoothNotificationHALRunnable4<
|
||||
GattServerNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int, int, int>
|
||||
IncludedServiceAddedNotification;
|
||||
|
||||
typedef BluetoothNotificationHALRunnable5<
|
||||
GattServerNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int, BluetoothUuid, int, int,
|
||||
BluetoothGattStatus, int, const BluetoothUuid&, int, int>
|
||||
CharacteristicAddedNotification;
|
||||
|
||||
typedef BluetoothNotificationHALRunnable5<
|
||||
GattServerNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int, BluetoothUuid, int, int,
|
||||
BluetoothGattStatus, int, const BluetoothUuid&, int, int>
|
||||
DescriptorAddedNotification;
|
||||
|
||||
typedef BluetoothNotificationHALRunnable3<
|
||||
GattServerNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int, int>
|
||||
ServiceStartedNotification;
|
||||
|
||||
typedef BluetoothNotificationHALRunnable3<
|
||||
GattServerNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int, int>
|
||||
ServiceStoppedNotification;
|
||||
|
||||
typedef BluetoothNotificationHALRunnable3<
|
||||
GattServerNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int, int>
|
||||
ServiceDeletedNotification;
|
||||
|
||||
typedef BluetoothNotificationHALRunnable6<
|
||||
GattServerNotificationHandlerWrapper, void,
|
||||
int, int, nsString, int, int, bool,
|
||||
int, int, const nsAString&, int, int, bool>
|
||||
RequestReadNotification;
|
||||
|
||||
typedef BluetoothNotificationHALRunnable8<
|
||||
GattServerNotificationHandlerWrapper, void,
|
||||
int, int, nsString, int, int, nsTArray<uint8_t>, bool, bool,
|
||||
int, int, const nsAString&, int, int, const nsTArray<uint8_t>&, bool, bool>
|
||||
RequestWriteNotification;
|
||||
|
||||
typedef BluetoothNotificationHALRunnable4<
|
||||
GattServerNotificationHandlerWrapper, void,
|
||||
int, int, nsString, bool,
|
||||
int, int, const nsAString&, bool>
|
||||
RequestExecuteWriteNotification;
|
||||
|
||||
typedef BluetoothNotificationHALRunnable2<
|
||||
GattServerNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int>
|
||||
ResponseConfirmationNotification;
|
||||
|
||||
#if ANDROID_VERSION >= 21
|
||||
typedef BluetoothNotificationHALRunnable2<
|
||||
GattServerNotificationHandlerWrapper, void,
|
||||
int, BluetoothGattStatus>
|
||||
IndicationSentNotification;
|
||||
|
||||
typedef BluetoothNotificationHALRunnable2<
|
||||
GattServerNotificationHandlerWrapper, void,
|
||||
int, bool>
|
||||
CongestionNotification;
|
||||
#endif // ANDROID_VERSION >= 21
|
||||
|
||||
#if ANDROID_VERSION >=22
|
||||
typedef BluetoothNotificationHALRunnable2<
|
||||
GattServerNotificationHandlerWrapper, void,
|
||||
int, int>
|
||||
MtuChangedNotification;
|
||||
#endif // ANDROID_VERSION >=22
|
||||
|
||||
// GATT Server callbacks
|
||||
// TODO: Implement server callbacks
|
||||
|
||||
#if ANDROID_VERSION >= 19
|
||||
static void
|
||||
RegisterServer(int aStatus, int aServerIf, bt_uuid_t* aAppUuid)
|
||||
{ }
|
||||
{
|
||||
RegisterServerNotification::Dispatch(
|
||||
&BluetoothGattServerNotificationHandler::RegisterServerNotification,
|
||||
aStatus, aServerIf, *aAppUuid);
|
||||
}
|
||||
|
||||
static void
|
||||
Connection(int aConnId, int aServerIf, int aIsConnected,
|
||||
bt_bdaddr_t* aBdAddr)
|
||||
{ }
|
||||
{
|
||||
ConnectionNotification::Dispatch(
|
||||
&BluetoothGattServerNotificationHandler::ConnectionNotification,
|
||||
aConnId, aServerIf, aIsConnected != 0, aBdAddr);
|
||||
}
|
||||
|
||||
static void
|
||||
ServiceAdded(int aStatus, int aServerIf, btgatt_srvc_id_t* aServiceId,
|
||||
int aServiceHandle)
|
||||
{ }
|
||||
{
|
||||
ServiceAddedNotification::Dispatch(
|
||||
&BluetoothGattServerNotificationHandler::ServiceAddedNotification,
|
||||
aStatus, aServerIf, *aServiceId, aServiceHandle);
|
||||
}
|
||||
|
||||
static void
|
||||
IncludedServiceAdded(int aStatus, int aServerIf, int aServiceHandle,
|
||||
int aIncludedServiceHandle)
|
||||
{ }
|
||||
{
|
||||
IncludedServiceAddedNotification::Dispatch(
|
||||
&BluetoothGattServerNotificationHandler::IncludedServiceAddedNotification,
|
||||
aStatus, aServerIf, aServiceHandle, aIncludedServiceHandle);
|
||||
}
|
||||
|
||||
static void
|
||||
CharacteristicAdded(int aStatus, int aServerIf, bt_uuid_t* aUuid,
|
||||
int aServiceHandle, int aCharHandle)
|
||||
{ }
|
||||
{
|
||||
CharacteristicAddedNotification::Dispatch(
|
||||
&BluetoothGattServerNotificationHandler::CharacteristicAddedNotification,
|
||||
aStatus, aServerIf, *aUuid, aServiceHandle, aCharHandle);
|
||||
}
|
||||
|
||||
static void
|
||||
DescriptorAdded(int aStatus, int aServerIf, bt_uuid_t* aUuid,
|
||||
int aServiceHandle, int aDescriptorHandle)
|
||||
{ }
|
||||
{
|
||||
DescriptorAddedNotification::Dispatch(
|
||||
&BluetoothGattServerNotificationHandler::DescriptorAddedNotification,
|
||||
aStatus, aServerIf, *aUuid, aServiceHandle, aDescriptorHandle);
|
||||
}
|
||||
|
||||
static void
|
||||
ServiceStarted(int aStatus, int aServerIf, int aServiceHandle)
|
||||
{ }
|
||||
{
|
||||
ServiceStartedNotification::Dispatch(
|
||||
&BluetoothGattServerNotificationHandler::ServiceStartedNotification,
|
||||
aStatus, aServerIf, aServiceHandle);
|
||||
}
|
||||
|
||||
static void
|
||||
ServiceStopped(int aStatus, int aServerIf, int aServiceHandle)
|
||||
{ }
|
||||
{
|
||||
ServiceStoppedNotification::Dispatch(
|
||||
&BluetoothGattServerNotificationHandler::ServiceStoppedNotification,
|
||||
aStatus, aServerIf, aServiceHandle);
|
||||
}
|
||||
|
||||
static void
|
||||
ServiceDeleted(int aStatus, int aServerIf, int aServiceHandle)
|
||||
{ }
|
||||
{
|
||||
ServiceDeletedNotification::Dispatch(
|
||||
&BluetoothGattServerNotificationHandler::ServiceDeletedNotification,
|
||||
aStatus, aServerIf, aServiceHandle);
|
||||
}
|
||||
|
||||
static void
|
||||
RequestRead(int aConnId, int aTransId, bt_bdaddr_t* aBdAddr,
|
||||
int aAttrHandle, int aOffset, bool aIsLong)
|
||||
{ }
|
||||
{
|
||||
RequestReadNotification::Dispatch(
|
||||
&BluetoothGattServerNotificationHandler::RequestReadNotification,
|
||||
aConnId, aTransId, *aBdAddr, aAttrHandle, aOffset, aIsLong);
|
||||
}
|
||||
|
||||
static void
|
||||
RequestWrite(int aConnId, int aTransId, bt_bdaddr_t* aBdAddr,
|
||||
int aAttrHandle, int aOffset, int aLength,
|
||||
bool aNeedRsp, bool aIsPrep, uint8_t* aValue)
|
||||
{ }
|
||||
{
|
||||
nsTArray<uint8_t> value;
|
||||
value.AppendElements(aValue, aLength);
|
||||
RequestWriteNotification::Dispatch(
|
||||
&BluetoothGattServerNotificationHandler::RequestWriteNotification,
|
||||
aConnId, aTransId, *aBdAddr, aAttrHandle, aOffset, value, aNeedRsp,
|
||||
aIsPrep);
|
||||
}
|
||||
|
||||
static void
|
||||
RequestExecWrite(int aConnId, int aTransId, bt_bdaddr_t* aBdAddr,
|
||||
int aExecWrite)
|
||||
{ }
|
||||
RequestExecuteWrite(int aConnId, int aTransId, bt_bdaddr_t* aBdAddr,
|
||||
int aExecWrite)
|
||||
{
|
||||
RequestExecuteWriteNotification::Dispatch(
|
||||
&BluetoothGattServerNotificationHandler::RequestExecuteWriteNotification,
|
||||
aConnId, aTransId, *aBdAddr, aExecWrite != 0);
|
||||
}
|
||||
|
||||
static void
|
||||
ResponseConfirmation(int aStatus, int aHandle)
|
||||
{ }
|
||||
{
|
||||
ResponseConfirmationNotification::Dispatch(
|
||||
&BluetoothGattServerNotificationHandler::ResponseConfirmationNotification,
|
||||
aStatus, aHandle);
|
||||
}
|
||||
#endif // ANDROID_VERSION >= 19
|
||||
|
||||
#if ANDROID_VERSION >= 21
|
||||
static void
|
||||
IndicationSent(int aConnId, int aStatus)
|
||||
{
|
||||
IndicationSentNotification::Dispatch(
|
||||
&BluetoothGattServerNotificationHandler::IndicationSentNotification,
|
||||
aConnId, aStatus);
|
||||
}
|
||||
|
||||
static void
|
||||
Congestion(int aConnId, bool aCongested)
|
||||
{
|
||||
CongestionNotification::Dispatch(
|
||||
&BluetoothGattServerNotificationHandler::CongestionNotification,
|
||||
aConnId, aCongested);
|
||||
}
|
||||
#endif // ANDROID_VERSION >= 21
|
||||
|
||||
#if ANDROID_VERSION >= 22
|
||||
static void
|
||||
MtuChanged(int aConnId, int aMtu)
|
||||
{
|
||||
MtuChangedNotification::Dispatch(
|
||||
&BluetoothGattServerNotificationHandler::MtuChangedNotification,
|
||||
aConnId, aMtu);
|
||||
}
|
||||
#endif // ANDROID_VERSION >= 22
|
||||
};
|
||||
|
||||
// GATT Client Interface
|
||||
@ -1119,7 +1322,341 @@ BluetoothGattClientHALInterface::TestCommand(
|
||||
|
||||
}
|
||||
|
||||
// TODO: Add GATT Server Interface
|
||||
// GATT Server Interface
|
||||
|
||||
BluetoothGattServerHALInterface::BluetoothGattServerHALInterface(
|
||||
#if ANDROID_VERSION >= 19
|
||||
const btgatt_server_interface_t* aInterface
|
||||
#endif
|
||||
)
|
||||
#if ANDROID_VERSION >= 19
|
||||
:mInterface(aInterface)
|
||||
#endif
|
||||
{
|
||||
#if ANDROID_VERSION >= 19
|
||||
MOZ_ASSERT(mInterface);
|
||||
#endif
|
||||
}
|
||||
|
||||
BluetoothGattServerHALInterface::~BluetoothGattServerHALInterface()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothGattServerHALInterface::RegisterServer(
|
||||
const BluetoothUuid& aUuid, BluetoothGattServerResultHandler* aRes)
|
||||
{
|
||||
int status;
|
||||
#if ANDROID_VERSION >= 19
|
||||
bt_uuid_t uuid;
|
||||
if (NS_SUCCEEDED(Convert(aUuid, uuid))) {
|
||||
status = mInterface->register_server(&uuid);
|
||||
} else {
|
||||
status = BT_STATUS_PARM_INVALID;
|
||||
}
|
||||
#else
|
||||
status = BT_STATUS_UNSUPPORTED;
|
||||
#endif
|
||||
|
||||
if (aRes) {
|
||||
DispatchBluetoothGattServerHALResult(
|
||||
aRes, &BluetoothGattServerResultHandler::RegisterServer,
|
||||
ConvertDefault(status, STATUS_FAIL));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothGattServerHALInterface::UnregisterServer(
|
||||
int aServerIf, BluetoothGattServerResultHandler* aRes)
|
||||
{
|
||||
#if ANDROID_VERSION >= 19
|
||||
int status = mInterface->unregister_server(aServerIf);
|
||||
#else
|
||||
int status = BT_STATUS_UNSUPPORTED;
|
||||
#endif
|
||||
|
||||
if (aRes) {
|
||||
DispatchBluetoothGattServerHALResult(
|
||||
aRes, &BluetoothGattServerResultHandler::UnregisterServer,
|
||||
ConvertDefault(status, STATUS_FAIL));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothGattServerHALInterface::ConnectPeripheral(
|
||||
int aServerIf, const nsAString& aBdAddr, bool aIsDirect, /* auto connect */
|
||||
BluetoothTransport aTransport, BluetoothGattServerResultHandler* aRes)
|
||||
{
|
||||
bt_status_t status;
|
||||
#if ANDROID_VERSION >= 21
|
||||
bt_bdaddr_t bdAddr;
|
||||
btgatt_transport_t transport;
|
||||
|
||||
if (NS_SUCCEEDED(Convert(aBdAddr, bdAddr)) &&
|
||||
NS_SUCCEEDED(Convert(aTransport, transport))) {
|
||||
status = mInterface->connect(aServerIf, &bdAddr, aIsDirect, transport);
|
||||
} else {
|
||||
status = BT_STATUS_PARM_INVALID;
|
||||
}
|
||||
#elif ANDROID_VERSION >= 19
|
||||
bt_bdaddr_t bdAddr;
|
||||
|
||||
if (NS_SUCCEEDED(Convert(aBdAddr, bdAddr))) {
|
||||
status = mInterface->connect(aServerIf, &bdAddr, aIsDirect);
|
||||
} else {
|
||||
status = BT_STATUS_PARM_INVALID;
|
||||
}
|
||||
#else
|
||||
status = BT_STATUS_UNSUPPORTED;
|
||||
#endif
|
||||
|
||||
if (aRes) {
|
||||
DispatchBluetoothGattServerHALResult(
|
||||
aRes, &BluetoothGattServerResultHandler::ConnectPeripheral,
|
||||
ConvertDefault(status, STATUS_FAIL));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothGattServerHALInterface::DisconnectPeripheral(
|
||||
int aServerIf, const nsAString& aBdAddr, int aConnId,
|
||||
BluetoothGattServerResultHandler* aRes)
|
||||
{
|
||||
bt_status_t status;
|
||||
#if ANDROID_VERSION >= 19
|
||||
bt_bdaddr_t bdAddr;
|
||||
|
||||
if (NS_SUCCEEDED(Convert(aBdAddr, bdAddr))) {
|
||||
status = mInterface->disconnect(aServerIf, &bdAddr, aConnId);
|
||||
} else {
|
||||
status = BT_STATUS_PARM_INVALID;
|
||||
}
|
||||
#else
|
||||
status = BT_STATUS_UNSUPPORTED;
|
||||
#endif
|
||||
|
||||
if (aRes) {
|
||||
DispatchBluetoothGattServerHALResult(
|
||||
aRes, &BluetoothGattServerResultHandler::DisconnectPeripheral,
|
||||
ConvertDefault(status, STATUS_FAIL));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothGattServerHALInterface::AddService(
|
||||
int aServerIf, const BluetoothGattServiceId& aServiceId, int aNumHandles,
|
||||
BluetoothGattServerResultHandler* aRes)
|
||||
{
|
||||
bt_status_t status;
|
||||
#if ANDROID_VERSION >= 19
|
||||
btgatt_srvc_id_t serviceId;
|
||||
|
||||
if (NS_SUCCEEDED(Convert(aServiceId, serviceId))) {
|
||||
status = mInterface->add_service(aServerIf, &serviceId, aNumHandles);
|
||||
} else {
|
||||
status = BT_STATUS_PARM_INVALID;
|
||||
}
|
||||
#else
|
||||
status = BT_STATUS_UNSUPPORTED;
|
||||
#endif
|
||||
|
||||
if (aRes) {
|
||||
DispatchBluetoothGattServerHALResult(
|
||||
aRes, &BluetoothGattServerResultHandler::AddService,
|
||||
ConvertDefault(status, STATUS_FAIL));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothGattServerHALInterface::AddIncludedService(
|
||||
int aServerIf, int aServiceHandle, int aIncludedServiceHandle,
|
||||
BluetoothGattServerResultHandler* aRes)
|
||||
{
|
||||
bt_status_t status;
|
||||
#if ANDROID_VERSION >= 19
|
||||
status = mInterface->add_included_service(aServerIf, aServiceHandle,
|
||||
aIncludedServiceHandle);
|
||||
#else
|
||||
status = BT_STATUS_UNSUPPORTED;
|
||||
#endif
|
||||
|
||||
if (aRes) {
|
||||
DispatchBluetoothGattServerHALResult(
|
||||
aRes, &BluetoothGattServerResultHandler::AddIncludedService,
|
||||
ConvertDefault(status, STATUS_FAIL));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothGattServerHALInterface::AddCharacteristic(
|
||||
int aServerIf, int aServiceHandle, const BluetoothUuid& aUuid,
|
||||
BluetoothGattCharProp aProperties, BluetoothGattAttrPerm aPermissions,
|
||||
BluetoothGattServerResultHandler* aRes)
|
||||
{
|
||||
bt_status_t status;
|
||||
#if ANDROID_VERSION >= 19
|
||||
bt_uuid_t uuid;
|
||||
int properties;
|
||||
int permissions;
|
||||
|
||||
if (NS_SUCCEEDED(Convert(aUuid, uuid)) &&
|
||||
NS_SUCCEEDED(Convert(aProperties, properties)) &&
|
||||
NS_SUCCEEDED(Convert(aPermissions, permissions))) {
|
||||
status = mInterface->add_characteristic(aServerIf, aServiceHandle, &uuid,
|
||||
properties, permissions);
|
||||
} else {
|
||||
status = BT_STATUS_PARM_INVALID;
|
||||
}
|
||||
#else
|
||||
status = BT_STATUS_UNSUPPORTED;
|
||||
#endif
|
||||
|
||||
if (aRes) {
|
||||
DispatchBluetoothGattServerHALResult(
|
||||
aRes, &BluetoothGattServerResultHandler::AddCharacteristic,
|
||||
ConvertDefault(status, STATUS_FAIL));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothGattServerHALInterface::AddDescriptor(
|
||||
int aServerIf, int aServiceHandle, const BluetoothUuid& aUuid,
|
||||
BluetoothGattAttrPerm aPermissions, BluetoothGattServerResultHandler* aRes)
|
||||
{
|
||||
bt_status_t status;
|
||||
#if ANDROID_VERSION >= 19
|
||||
bt_uuid_t uuid;
|
||||
int permissions;
|
||||
|
||||
if (NS_SUCCEEDED(Convert(aUuid, uuid)) &&
|
||||
NS_SUCCEEDED(Convert(aPermissions, permissions))) {
|
||||
status = mInterface->add_descriptor(aServerIf, aServiceHandle, &uuid,
|
||||
permissions);
|
||||
} else {
|
||||
status = BT_STATUS_PARM_INVALID;
|
||||
}
|
||||
#else
|
||||
status = BT_STATUS_UNSUPPORTED;
|
||||
#endif
|
||||
|
||||
if (aRes) {
|
||||
DispatchBluetoothGattServerHALResult(
|
||||
aRes, &BluetoothGattServerResultHandler::AddDescriptor,
|
||||
ConvertDefault(status, STATUS_FAIL));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothGattServerHALInterface::StartService(
|
||||
int aServerIf, int aServiceHandle, BluetoothTransport aTransport,
|
||||
BluetoothGattServerResultHandler* aRes)
|
||||
{
|
||||
bt_status_t status;
|
||||
#if ANDROID_VERSION >= 19
|
||||
int transport;
|
||||
|
||||
if (NS_SUCCEEDED(Convert(aTransport, transport))) {
|
||||
status = mInterface->start_service(aServerIf, aServiceHandle, transport);
|
||||
} else {
|
||||
status = BT_STATUS_PARM_INVALID;
|
||||
}
|
||||
#else
|
||||
status = BT_STATUS_UNSUPPORTED;
|
||||
#endif
|
||||
|
||||
if (aRes) {
|
||||
DispatchBluetoothGattServerHALResult(
|
||||
aRes, &BluetoothGattServerResultHandler::StartService,
|
||||
ConvertDefault(status, STATUS_FAIL));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothGattServerHALInterface::StopService(
|
||||
int aServerIf, int aServiceHandle, BluetoothGattServerResultHandler* aRes)
|
||||
{
|
||||
bt_status_t status;
|
||||
#if ANDROID_VERSION >= 19
|
||||
status = mInterface->stop_service(aServerIf, aServiceHandle);
|
||||
#else
|
||||
status = BT_STATUS_UNSUPPORTED;
|
||||
#endif
|
||||
|
||||
if (aRes) {
|
||||
DispatchBluetoothGattServerHALResult(
|
||||
aRes, &BluetoothGattServerResultHandler::StopService,
|
||||
ConvertDefault(status, STATUS_FAIL));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothGattServerHALInterface::DeleteService(
|
||||
int aServerIf, int aServiceHandle, BluetoothGattServerResultHandler* aRes)
|
||||
{
|
||||
bt_status_t status;
|
||||
#if ANDROID_VERSION >= 19
|
||||
status = mInterface->delete_service(aServerIf, aServiceHandle);
|
||||
#else
|
||||
status = BT_STATUS_UNSUPPORTED;
|
||||
#endif
|
||||
|
||||
if (aRes) {
|
||||
DispatchBluetoothGattServerHALResult(
|
||||
aRes, &BluetoothGattServerResultHandler::DeleteService,
|
||||
ConvertDefault(status, STATUS_FAIL));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothGattServerHALInterface::SendIndication(
|
||||
int aServerIf, int aAttributeHandle, int aConnId,
|
||||
const nsTArray<uint8_t>& aValue,
|
||||
bool aConfirm, /* true: indication, false: notification */
|
||||
BluetoothGattServerResultHandler* aRes)
|
||||
{
|
||||
bt_status_t status;
|
||||
#if ANDROID_VERSION >= 19
|
||||
char* value =
|
||||
reinterpret_cast<char*>(const_cast<uint8_t*>(aValue.Elements()));
|
||||
status = mInterface->send_indication(aServerIf, aAttributeHandle, aConnId,
|
||||
aValue.Length(), aConfirm, value);
|
||||
#else
|
||||
status = BT_STATUS_UNSUPPORTED;
|
||||
#endif
|
||||
|
||||
if (aRes) {
|
||||
DispatchBluetoothGattServerHALResult(
|
||||
aRes, &BluetoothGattServerResultHandler::SendIndication,
|
||||
ConvertDefault(status, STATUS_FAIL));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothGattServerHALInterface::SendResponse(
|
||||
int aConnId, int aTransId, BluetoothGattStatus aStatus,
|
||||
const BluetoothGattResponse& aResponse,
|
||||
BluetoothGattServerResultHandler* aRes)
|
||||
{
|
||||
bt_status_t status;
|
||||
#if ANDROID_VERSION >= 19
|
||||
int response_status;
|
||||
btgatt_response_t response;
|
||||
if (NS_SUCCEEDED(Convert(aStatus, response_status)) &&
|
||||
NS_SUCCEEDED(Convert(aResponse, response))) {
|
||||
status = mInterface->send_response(aConnId, aTransId, response_status,
|
||||
&response);
|
||||
} else {
|
||||
status = BT_STATUS_PARM_INVALID;
|
||||
}
|
||||
#else
|
||||
status = BT_STATUS_UNSUPPORTED;
|
||||
#endif
|
||||
|
||||
if (aRes) {
|
||||
DispatchBluetoothGattServerHALResult(
|
||||
aRes, &BluetoothGattServerResultHandler::SendResponse,
|
||||
ConvertDefault(status, STATUS_FAIL));
|
||||
}
|
||||
}
|
||||
|
||||
// GATT Interface
|
||||
|
||||
@ -1179,8 +1716,15 @@ BluetoothGattHALInterface::Init(
|
||||
BluetoothGattServerCallback::ServiceDeleted,
|
||||
BluetoothGattServerCallback::RequestRead,
|
||||
BluetoothGattServerCallback::RequestWrite,
|
||||
BluetoothGattServerCallback::RequestExecWrite,
|
||||
BluetoothGattServerCallback::ResponseConfirmation
|
||||
BluetoothGattServerCallback::RequestExecuteWrite,
|
||||
BluetoothGattServerCallback::ResponseConfirmation,
|
||||
#if ANDROID_VERSION >= 21
|
||||
BluetoothGattServerCallback::IndicationSent,
|
||||
BluetoothGattServerCallback::Congestion,
|
||||
#endif // ANDROID_VERSION >= 21
|
||||
#if ANDROID_VERSION >= 22
|
||||
BluetoothGattServerCallback::MtuChanged
|
||||
#endif // ANDROID_VERSION >= 22
|
||||
};
|
||||
|
||||
static const btgatt_callbacks_t sCallbacks = {
|
||||
@ -1245,4 +1789,25 @@ BluetoothGattHALInterface::GetBluetoothGattClientInterface()
|
||||
return sBluetoothGattClientHALInterface;
|
||||
}
|
||||
|
||||
BluetoothGattServerInterface*
|
||||
BluetoothGattHALInterface::GetBluetoothGattServerInterface()
|
||||
{
|
||||
static BluetoothGattServerHALInterface* sBluetoothGattServerHALInterface;
|
||||
|
||||
if (sBluetoothGattServerHALInterface) {
|
||||
return sBluetoothGattServerHALInterface;
|
||||
}
|
||||
|
||||
#if ANDROID_VERSION >= 19
|
||||
MOZ_ASSERT(mInterface->server);
|
||||
sBluetoothGattServerHALInterface =
|
||||
new BluetoothGattServerHALInterface(mInterface->server);
|
||||
#else
|
||||
sBluetoothGattServerHALInterface =
|
||||
new BluetoothGattServerHALInterface();
|
||||
#endif
|
||||
|
||||
return sBluetoothGattServerHALInterface;
|
||||
}
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
||||
|
@ -160,7 +160,90 @@ private:
|
||||
#endif
|
||||
};
|
||||
|
||||
// TODO: Add server interface
|
||||
class BluetoothGattServerHALInterface final
|
||||
: public BluetoothGattServerInterface
|
||||
{
|
||||
public:
|
||||
friend class BluetoothGattHALInterface;
|
||||
|
||||
/* Register / Unregister */
|
||||
void RegisterServer(const BluetoothUuid& aUuid,
|
||||
BluetoothGattServerResultHandler* aRes);
|
||||
void UnregisterServer(int aServerIf,
|
||||
BluetoothGattServerResultHandler* aRes);
|
||||
|
||||
/* Connect / Disconnect */
|
||||
void ConnectPeripheral(int aServerIf,
|
||||
const nsAString& aBdAddr,
|
||||
bool aIsDirect, /* auto connect */
|
||||
BluetoothTransport aTransport,
|
||||
BluetoothGattServerResultHandler* aRes);
|
||||
void DisconnectPeripheral(int aServerIf,
|
||||
const nsAString& aBdAddr,
|
||||
int aConnId,
|
||||
BluetoothGattServerResultHandler* aRes);
|
||||
|
||||
/* Add a services / a characteristic / a descriptor */
|
||||
void AddService(int aServerIf,
|
||||
const BluetoothGattServiceId& aServiceId,
|
||||
int aNumHandles,
|
||||
BluetoothGattServerResultHandler* aRes);
|
||||
void AddIncludedService(int aServerIf,
|
||||
int aServiceHandle,
|
||||
int aIncludedServiceHandle,
|
||||
BluetoothGattServerResultHandler* aRes);
|
||||
void AddCharacteristic(int aServerIf,
|
||||
int aServiceHandle,
|
||||
const BluetoothUuid& aUuid,
|
||||
BluetoothGattCharProp aProperties,
|
||||
BluetoothGattAttrPerm aPermissions,
|
||||
BluetoothGattServerResultHandler* aRes);
|
||||
void AddDescriptor(int aServerIf,
|
||||
int aServiceHandle,
|
||||
const BluetoothUuid& aUuid,
|
||||
BluetoothGattAttrPerm aPermissions,
|
||||
BluetoothGattServerResultHandler* aRes);
|
||||
|
||||
/* Start / Stop / Delete a service */
|
||||
void StartService(int aServerIf,
|
||||
int aServiceHandle,
|
||||
BluetoothTransport aTransport,
|
||||
BluetoothGattServerResultHandler* aRes);
|
||||
void StopService(int aServerIf,
|
||||
int aServiceHandle,
|
||||
BluetoothGattServerResultHandler* aRes);
|
||||
void DeleteService(int aServerIf,
|
||||
int aServiceHandle,
|
||||
BluetoothGattServerResultHandler* aRes);
|
||||
|
||||
/* Send an indication or a notification */
|
||||
void SendIndication(int aServerIf,
|
||||
int aAttributeHandle,
|
||||
int aConnId,
|
||||
const nsTArray<uint8_t>& aValue,
|
||||
bool aConfirm, /* true: indication, false: notification */
|
||||
BluetoothGattServerResultHandler* aRes);
|
||||
|
||||
/* Send a response for an incoming indication */
|
||||
void SendResponse(int aConnId,
|
||||
int aTransId,
|
||||
BluetoothGattStatus aStatus,
|
||||
const BluetoothGattResponse& aResponse,
|
||||
BluetoothGattServerResultHandler* aRes);
|
||||
|
||||
protected:
|
||||
BluetoothGattServerHALInterface(
|
||||
#if ANDROID_VERSION >= 19
|
||||
const btgatt_server_interface_t* aInterface
|
||||
#endif
|
||||
);
|
||||
~BluetoothGattServerHALInterface();
|
||||
|
||||
private:
|
||||
#if ANDROID_VERSION >= 19
|
||||
const btgatt_server_interface_t* mInterface;
|
||||
#endif
|
||||
};
|
||||
|
||||
class BluetoothGattHALInterface final
|
||||
: public BluetoothGattInterface
|
||||
@ -173,6 +256,7 @@ public:
|
||||
void Cleanup(BluetoothGattResultHandler* aRes);
|
||||
|
||||
BluetoothGattClientInterface* GetBluetoothGattClientInterface();
|
||||
BluetoothGattServerInterface* GetBluetoothGattServerInterface();
|
||||
|
||||
protected:
|
||||
BluetoothGattHALInterface(
|
||||
|
@ -387,6 +387,36 @@ Convert(const BluetoothGattTestParam& aIn, btgatt_test_params_t& aOut)
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
Convert(const BluetoothGattResponse& aIn, btgatt_response_t& aOut)
|
||||
{
|
||||
// Only the read response format is used in bluedroid.
|
||||
nsresult rv = Convert(
|
||||
ConvertArray<uint8_t>(aIn.mValue, sizeof(aIn.mValue)),
|
||||
aOut.attr_value.value);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn.mHandle, aOut.attr_value.handle);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn.mOffset, aOut.attr_value.offset);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn.mLength, aOut.attr_value.len);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn.mAuthReq, aOut.attr_value.auth_req);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif // ANDROID_VERSION >= 19
|
||||
|
||||
#if ANDROID_VERSION >= 21
|
||||
|
@ -793,6 +793,40 @@ Convert(int aIn, BluetoothGattStatus& aOut)
|
||||
};
|
||||
if (static_cast<uint32_t>(aIn) >= MOZ_ARRAY_LENGTH(sGattStatus)) {
|
||||
aOut = GATT_STATUS_UNKNOWN_ERROR;
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
} else {
|
||||
aOut = sGattStatus[aIn];
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
Convert(BluetoothGattStatus aIn, int& aOut)
|
||||
{
|
||||
/* Reference: $B2G/external/bluetooth/bluedroid/stack/include/gatt_api.h */
|
||||
static const int sGattStatus[] = {
|
||||
CONVERT(GATT_STATUS_SUCCESS, 0x0000),
|
||||
CONVERT(GATT_STATUS_INVALID_HANDLE, 0x0001),
|
||||
CONVERT(GATT_STATUS_READ_NOT_PERMITTED, 0x0002),
|
||||
CONVERT(GATT_STATUS_WRITE_NOT_PERMITTED, 0x0003),
|
||||
CONVERT(GATT_STATUS_INVALID_PDU, 0x0004),
|
||||
CONVERT(GATT_STATUS_INSUFFICIENT_AUTHENTICATION, 0x0005),
|
||||
CONVERT(GATT_STATUS_REQUEST_NOT_SUPPORTED, 0x0006),
|
||||
CONVERT(GATT_STATUS_INVALID_OFFSET, 0x0007),
|
||||
CONVERT(GATT_STATUS_INSUFFICIENT_AUTHORIZATION, 0x0008),
|
||||
CONVERT(GATT_STATUS_PREPARE_QUEUE_FULL, 0x0009),
|
||||
CONVERT(GATT_STATUS_ATTRIBUTE_NOT_FOUND, 0x000a),
|
||||
CONVERT(GATT_STATUS_ATTRIBUTE_NOT_LONG, 0x000b),
|
||||
CONVERT(GATT_STATUS_INSUFFICIENT_ENCRYPTION_KEY_SIZE, 0x000c),
|
||||
CONVERT(GATT_STATUS_INVALID_ATTRIBUTE_LENGTH, 0x000d),
|
||||
CONVERT(GATT_STATUS_UNLIKELY_ERROR, 0x000e),
|
||||
CONVERT(GATT_STATUS_INSUFFICIENT_ENCRYPTION, 0x000f),
|
||||
CONVERT(GATT_STATUS_UNSUPPORTED_GROUP_TYPE, 0x0010),
|
||||
CONVERT(GATT_STATUS_INSUFFICIENT_RESOURCES, 0x0011)
|
||||
};
|
||||
if (static_cast<uint32_t>(aIn) >= MOZ_ARRAY_LENGTH(sGattStatus)) {
|
||||
aOut = -1;
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
} else {
|
||||
aOut = sGattStatus[aIn];
|
||||
}
|
||||
@ -802,6 +836,30 @@ Convert(int aIn, BluetoothGattStatus& aOut)
|
||||
nsresult
|
||||
Convert(const uint8_t* aIn, BluetoothGattAdvData& aOut);
|
||||
|
||||
inline nsresult
|
||||
Convert(BluetoothGattAttrPerm aIn, int& aOut)
|
||||
{
|
||||
/* Reference: $B2G/external/bluetooth/bluedroid/stack/include/gatt_api.h */
|
||||
static const uint16_t sGattAttrPermBit[] = {
|
||||
CONVERT(0, GATT_ATTR_PERM_BIT_READ),
|
||||
CONVERT(1, GATT_ATTR_PERM_BIT_READ_ENCRYPTED),
|
||||
CONVERT(2, GATT_ATTR_PERM_BIT_READ_ENCRYPTED_MITM),
|
||||
CONVERT(3, 0),
|
||||
CONVERT(4, GATT_ATTR_PERM_BIT_WRITE),
|
||||
CONVERT(5, GATT_ATTR_PERM_BIT_WRITE_ENCRYPTED),
|
||||
CONVERT(6, GATT_ATTR_PERM_BIT_WRITE_ENCRYPTED_MITM),
|
||||
CONVERT(7, GATT_ATTR_PERM_BIT_WRITE_SIGNED),
|
||||
CONVERT(8, GATT_ATTR_PERM_BIT_WRITE_SIGNED_MITM)
|
||||
};
|
||||
aOut = 0;
|
||||
for (uint8_t i = 0; i < MOZ_ARRAY_LENGTH(sGattAttrPermBit); i++) {
|
||||
if (aIn & sGattAttrPermBit[i]) {
|
||||
aOut |= (1 << i);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
Convert(int aIn, BluetoothGattCharProp& aOut)
|
||||
{
|
||||
@ -825,6 +883,29 @@ Convert(int aIn, BluetoothGattCharProp& aOut)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
Convert(BluetoothGattCharProp aIn, int& aOut)
|
||||
{
|
||||
/* Reference: $B2G/external/bluetooth/bluedroid/stack/include/gatt_api.h */
|
||||
static const uint8_t sGattCharPropBit[] = {
|
||||
CONVERT(0, GATT_CHAR_PROP_BIT_BROADCAST),
|
||||
CONVERT(1, GATT_CHAR_PROP_BIT_READ),
|
||||
CONVERT(2, GATT_CHAR_PROP_BIT_WRITE_NO_RESPONSE),
|
||||
CONVERT(3, GATT_CHAR_PROP_BIT_WRITE),
|
||||
CONVERT(4, GATT_CHAR_PROP_BIT_NOTIFY),
|
||||
CONVERT(5, GATT_CHAR_PROP_BIT_INDICATE),
|
||||
CONVERT(6, GATT_CHAR_PROP_BIT_SIGNED_WRITE),
|
||||
CONVERT(7, GATT_CHAR_PROP_BIT_EXTENDED_PROPERTIES)
|
||||
};
|
||||
aOut = 0;
|
||||
for (uint8_t i = 0; i < MOZ_ARRAY_LENGTH(sGattCharPropBit); i++) {
|
||||
if (aIn & sGattCharPropBit[i]) {
|
||||
aOut |= (1 << i);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
Convert(BluetoothGattAuthReq aIn, int& aOut)
|
||||
{
|
||||
@ -894,11 +975,6 @@ Convert(const btgatt_notify_params_t& aIn, BluetoothGattNotifyParam& aOut);
|
||||
|
||||
nsresult
|
||||
Convert(const BluetoothGattTestParam& aIn, btgatt_test_params_t& aOut);
|
||||
#endif // ANDROID_VERSION >= 19
|
||||
|
||||
#if ANDROID_VERSION >= 21
|
||||
nsresult
|
||||
Convert(const BluetoothTransport& aIn, btgatt_transport_t& aOut);
|
||||
|
||||
inline nsresult
|
||||
Convert(BluetoothTransport aIn, int& aOut)
|
||||
@ -909,12 +985,21 @@ Convert(BluetoothTransport aIn, int& aOut)
|
||||
CONVERT(TRANSPORT_LE, 2)
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sTransport))) {
|
||||
aOut = -1;
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
aOut = sTransport[aIn];
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
Convert(const BluetoothGattResponse& aIn, btgatt_response_t& aOut);
|
||||
#endif // ANDROID_VERSION >= 19
|
||||
|
||||
#if ANDROID_VERSION >= 21
|
||||
nsresult
|
||||
Convert(const BluetoothTransport& aIn, btgatt_transport_t& aOut);
|
||||
|
||||
nsresult
|
||||
Convert(const bt_activity_energy_info& aIn, BluetoothActivityEnergyInfo& aOut);
|
||||
|
||||
@ -1620,6 +1705,373 @@ private:
|
||||
Tin5 mArg5;
|
||||
};
|
||||
|
||||
template <typename ObjectWrapper, typename Res,
|
||||
typename Tin1, typename Tin2, typename Tin3,
|
||||
typename Tin4, typename Tin5, typename Tin6,
|
||||
typename Arg1=Tin1, typename Arg2=Tin2, typename Arg3=Tin3,
|
||||
typename Arg4=Tin4, typename Arg5=Tin5, typename Arg6=Tin6>
|
||||
class BluetoothNotificationHALRunnable6 : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef BluetoothNotificationHALRunnable6<ObjectWrapper, Res,
|
||||
Tin1, Tin2, Tin3, Tin4, Tin5, Tin6,
|
||||
Arg1, Arg2, Arg3, Arg4, Arg5, Arg6> SelfType;
|
||||
|
||||
template <typename T1, typename T2, typename T3, typename T4, typename T5,
|
||||
typename T6>
|
||||
static already_AddRefed<SelfType> Create(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6),
|
||||
const T1& aIn1, const T2& aIn2, const T3& aIn3,
|
||||
const T4& aIn4, const T5& aIn5, const T6& aIn6)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
|
||||
if (NS_FAILED(runnable->ConvertAndSet(aIn1, aIn2, aIn3, aIn4, aIn5,
|
||||
aIn6))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename T1, typename T2, typename T3, typename T4, typename T5,
|
||||
typename T6>
|
||||
static void
|
||||
Dispatch(Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6),
|
||||
const T1& aIn1, const T2& aIn2, const T3& aIn3,
|
||||
const T4& aIn4, const T5& aIn5, const T6& aIn6)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod,
|
||||
aIn1, aIn2, aIn3, aIn4, aIn5, aIn6);
|
||||
if (!runnable) {
|
||||
BT_WARNING("BluetoothNotificationHALRunnable6::Create failed");
|
||||
return;
|
||||
}
|
||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_WARNING("NS_DispatchToMainThread failed: %X", rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
|
||||
if (!obj) {
|
||||
BT_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)(mArg1, mArg2, mArg3, mArg4, mArg5, mArg6);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothNotificationHALRunnable6(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6))
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename T1, typename T2, typename T3, typename T4, typename T5,
|
||||
typename T6>
|
||||
nsresult
|
||||
ConvertAndSet(const T1& aIn1, const T2& aIn2, const T3& aIn3,
|
||||
const T4& aIn4, const T5& aIn5, const T6& aIn6)
|
||||
{
|
||||
nsresult rv = Convert(aIn1, mArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn2, mArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn3, mArg3);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn4, mArg4);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn5, mArg5);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn6, mArg6);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6);
|
||||
Tin1 mArg1;
|
||||
Tin2 mArg2;
|
||||
Tin3 mArg3;
|
||||
Tin4 mArg4;
|
||||
Tin5 mArg5;
|
||||
Tin6 mArg6;
|
||||
};
|
||||
|
||||
template <typename ObjectWrapper, typename Res,
|
||||
typename Tin1, typename Tin2, typename Tin3,
|
||||
typename Tin4, typename Tin5, typename Tin6,
|
||||
typename Tin7,
|
||||
typename Arg1=Tin1, typename Arg2=Tin2, typename Arg3=Tin3,
|
||||
typename Arg4=Tin4, typename Arg5=Tin5, typename Arg6=Tin6,
|
||||
typename Arg7=Tin7>
|
||||
class BluetoothNotificationHALRunnable7 : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef BluetoothNotificationHALRunnable7<ObjectWrapper, Res,
|
||||
Tin1, Tin2, Tin3, Tin4, Tin5, Tin6, Tin7,
|
||||
Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7> SelfType;
|
||||
|
||||
template <typename T1, typename T2, typename T3, typename T4, typename T5,
|
||||
typename T6, typename T7>
|
||||
static already_AddRefed<SelfType> Create(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7),
|
||||
const T1& aIn1, const T2& aIn2, const T3& aIn3,
|
||||
const T4& aIn4, const T5& aIn5, const T6& aIn6,
|
||||
const T7& aIn7)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
|
||||
if (NS_FAILED(runnable->ConvertAndSet(aIn1, aIn2, aIn3, aIn4, aIn5,
|
||||
aIn6, aIn7))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename T1, typename T2, typename T3, typename T4, typename T5,
|
||||
typename T6, typename T7>
|
||||
static void
|
||||
Dispatch(Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7),
|
||||
const T1& aIn1, const T2& aIn2, const T3& aIn3,
|
||||
const T4& aIn4, const T5& aIn5, const T6& aIn6,
|
||||
const T7& aIn7)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod,
|
||||
aIn1, aIn2, aIn3, aIn4, aIn5, aIn6,
|
||||
aIn7);
|
||||
if (!runnable) {
|
||||
BT_WARNING("BluetoothNotificationHALRunnable7::Create failed");
|
||||
return;
|
||||
}
|
||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_WARNING("NS_DispatchToMainThread failed: %X", rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
|
||||
if (!obj) {
|
||||
BT_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)(mArg1, mArg2, mArg3, mArg4, mArg5, mArg6, mArg7);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothNotificationHALRunnable7(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7))
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename T1, typename T2, typename T3, typename T4, typename T5,
|
||||
typename T6, typename T7>
|
||||
nsresult
|
||||
ConvertAndSet(const T1& aIn1, const T2& aIn2, const T3& aIn3,
|
||||
const T4& aIn4, const T5& aIn5, const T6& aIn6,
|
||||
const T7& aIn7)
|
||||
{
|
||||
nsresult rv = Convert(aIn1, mArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn2, mArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn3, mArg3);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn4, mArg4);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn5, mArg5);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn6, mArg6);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn7, mArg7);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7);
|
||||
Tin1 mArg1;
|
||||
Tin2 mArg2;
|
||||
Tin3 mArg3;
|
||||
Tin4 mArg4;
|
||||
Tin5 mArg5;
|
||||
Tin6 mArg6;
|
||||
Tin7 mArg7;
|
||||
};
|
||||
|
||||
template <typename ObjectWrapper, typename Res,
|
||||
typename Tin1, typename Tin2, typename Tin3,
|
||||
typename Tin4, typename Tin5, typename Tin6,
|
||||
typename Tin7, typename Tin8,
|
||||
typename Arg1=Tin1, typename Arg2=Tin2, typename Arg3=Tin3,
|
||||
typename Arg4=Tin4, typename Arg5=Tin5, typename Arg6=Tin6,
|
||||
typename Arg7=Tin7, typename Arg8=Tin8>
|
||||
class BluetoothNotificationHALRunnable8 : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef BluetoothNotificationHALRunnable8<ObjectWrapper, Res,
|
||||
Tin1, Tin2, Tin3, Tin4, Tin5, Tin6, Tin7, Tin8,
|
||||
Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8> SelfType;
|
||||
|
||||
template <typename T1, typename T2, typename T3, typename T4, typename T5,
|
||||
typename T6, typename T7, typename T8>
|
||||
static already_AddRefed<SelfType> Create(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8),
|
||||
const T1& aIn1, const T2& aIn2, const T3& aIn3,
|
||||
const T4& aIn4, const T5& aIn5, const T6& aIn6,
|
||||
const T7& aIn7, const T8& aIn8)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
|
||||
if (NS_FAILED(runnable->ConvertAndSet(aIn1, aIn2, aIn3, aIn4, aIn5,
|
||||
aIn6, aIn7, aIn8))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename T1, typename T2, typename T3, typename T4, typename T5,
|
||||
typename T6, typename T7, typename T8>
|
||||
static void
|
||||
Dispatch(Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7,
|
||||
Arg8),
|
||||
const T1& aIn1, const T2& aIn2, const T3& aIn3,
|
||||
const T4& aIn4, const T5& aIn5, const T6& aIn6,
|
||||
const T7& aIn7, const T8& aIn8)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod,
|
||||
aIn1, aIn2, aIn3, aIn4, aIn5, aIn6,
|
||||
aIn7, aIn8);
|
||||
if (!runnable) {
|
||||
BT_WARNING("BluetoothNotificationHALRunnable8::Create failed");
|
||||
return;
|
||||
}
|
||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_WARNING("NS_DispatchToMainThread failed: %X", rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
|
||||
if (!obj) {
|
||||
BT_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)(mArg1, mArg2, mArg3, mArg4, mArg5, mArg6, mArg7, mArg8);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothNotificationHALRunnable8(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8))
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename T1, typename T2, typename T3, typename T4, typename T5,
|
||||
typename T6, typename T7, typename T8>
|
||||
nsresult
|
||||
ConvertAndSet(const T1& aIn1, const T2& aIn2, const T3& aIn3,
|
||||
const T4& aIn4, const T5& aIn5, const T6& aIn6,
|
||||
const T7& aIn7, const T8& aIn8)
|
||||
{
|
||||
nsresult rv = Convert(aIn1, mArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn2, mArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn3, mArg3);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn4, mArg4);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn5, mArg5);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn6, mArg6);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn7, mArg7);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = Convert(aIn8, mArg8);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8);
|
||||
Tin1 mArg1;
|
||||
Tin2 mArg2;
|
||||
Tin3 mArg3;
|
||||
Tin4 mArg4;
|
||||
Tin5 mArg5;
|
||||
Tin6 mArg6;
|
||||
Tin7 mArg7;
|
||||
Tin8 mArg8;
|
||||
};
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
@ -407,12 +407,8 @@ public:
|
||||
|
||||
BT_LOGR("BluetoothInterface::Disable failed: %d", aStatus);
|
||||
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
BluetoothService::AcknowledgeToggleBt(true);
|
||||
#else
|
||||
// Always make progress; even on failures
|
||||
BluetoothService::AcknowledgeToggleBt(false);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
@ -1813,6 +1809,13 @@ BluetoothServiceBluedroid::AdapterStateChangedNotification(bool aState)
|
||||
|
||||
BT_LOGR("BT_STATE: %d", aState);
|
||||
|
||||
if (sIsRestart && aState) {
|
||||
// daemon restarted, reset flag
|
||||
BT_LOGR("daemon restarted, reset flag");
|
||||
sIsRestart = false;
|
||||
sIsFirstTimeToggleOffBt = false;
|
||||
}
|
||||
|
||||
sAdapterEnabled = aState;
|
||||
|
||||
if (!sAdapterEnabled) {
|
||||
@ -1892,6 +1895,13 @@ BluetoothServiceBluedroid::AdapterStateChangedNotification(bool aState)
|
||||
DispatchReplySuccess(sChangeAdapterStateRunnableArray[0]);
|
||||
sChangeAdapterStateRunnableArray.RemoveElementAt(0);
|
||||
}
|
||||
|
||||
// After ProfileManagers deinit and cleanup, now restarts bluetooth daemon
|
||||
if (sIsRestart && !aState) {
|
||||
BT_LOGR("sIsRestart and off, now restart");
|
||||
StartBluetooth(false, nullptr);
|
||||
}
|
||||
|
||||
#else
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
|
@ -204,7 +204,7 @@ IsAndroidAvailable()
|
||||
return false;
|
||||
#else
|
||||
// We need android.media.MediaCodec which exists in API level 16 and higher.
|
||||
return AndroidBridge::Bridge()->GetAPIVersion() >= 16;
|
||||
return AndroidBridge::Bridge() && (AndroidBridge::Bridge()->GetAPIVersion() >= 16);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -819,7 +819,9 @@ void NetworkUtils::postTetherInterfaceList(CommandChain* aChain,
|
||||
|
||||
char buf[BUF_SIZE];
|
||||
NS_ConvertUTF16toUTF8 reason(aResult.mResultReason);
|
||||
memcpy(buf, reason.get(), reason.Length() + 1);
|
||||
|
||||
size_t length = reason.Length() + 1 < BUF_SIZE ? reason.Length() + 1 : BUF_SIZE;
|
||||
memcpy(buf, reason.get(), length);
|
||||
split(buf, INTERFACE_DELIMIT, GET_FIELD(mInterfaceList));
|
||||
|
||||
doCommand(command, aChain, aCallback);
|
||||
|
@ -441,7 +441,8 @@ SampleAnimations(Layer* aLayer, TimeStamp aPoint)
|
||||
|
||||
MOZ_ASSERT(!animation.startTime().IsNull(),
|
||||
"Failed to resolve start time of pending animations");
|
||||
TimeDuration elapsedDuration = aPoint - animation.startTime();
|
||||
TimeDuration elapsedDuration =
|
||||
(aPoint - animation.startTime()).MultDouble(animation.playbackRate());
|
||||
// Skip animations that are yet to start.
|
||||
//
|
||||
// Currently, this should only happen when the refresh driver is under test
|
||||
|
@ -199,6 +199,7 @@ struct Animation {
|
||||
int32_t direction;
|
||||
nsCSSProperty property;
|
||||
AnimationData data;
|
||||
float playbackRate;
|
||||
};
|
||||
|
||||
// Change a layer's attributes
|
||||
|
@ -415,7 +415,7 @@ gfxAndroidPlatform::UseAcceleratedSkiaCanvas()
|
||||
bool gfxAndroidPlatform::HaveChoiceOfHWAndSWCanvas()
|
||||
{
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
if (AndroidBridge::Bridge()->GetAPIVersion() < 11) {
|
||||
if (!AndroidBridge::Bridge() || AndroidBridge::Bridge()->GetAPIVersion() < 11) {
|
||||
// It's slower than software due to not having a compositing fast path
|
||||
return false;
|
||||
}
|
||||
|
@ -375,17 +375,16 @@ ProcLoaderLoadRunner::ShuffleFds()
|
||||
|
||||
MOZ_ASSERT(mFdsRemap.Length() <= kReservedFileDescriptors);
|
||||
|
||||
InjectiveMultimap fd_shuffle1, fd_shuffle2;
|
||||
fd_shuffle1.reserve(mFdsRemap.Length());
|
||||
fd_shuffle2.reserve(mFdsRemap.Length());
|
||||
InjectiveMultimap fd_shuffle;
|
||||
fd_shuffle.reserve(mFdsRemap.Length());
|
||||
|
||||
for (i = 0; i < mFdsRemap.Length(); i++) {
|
||||
const FDRemap *map = &mFdsRemap[i];
|
||||
int fd = map->fd().PlatformHandle();
|
||||
int tofd = map->mapto();
|
||||
|
||||
fd_shuffle1.push_back(InjectionArc(fd, tofd, false));
|
||||
fd_shuffle2.push_back(InjectionArc(fd, tofd, false));
|
||||
// The FD that is dup2()'d from needs to be closed after shuffling.
|
||||
fd_shuffle.push_back(InjectionArc(fd, tofd, /*in_close=*/true));
|
||||
|
||||
// Erase from sReservedFds we will use.
|
||||
for (int* toErase = sReservedFds->begin();
|
||||
@ -398,7 +397,7 @@ ProcLoaderLoadRunner::ShuffleFds()
|
||||
}
|
||||
}
|
||||
|
||||
DebugOnly<bool> ok = ShuffleFileDescriptors(&fd_shuffle1);
|
||||
DebugOnly<bool> ok = ShuffleFileDescriptors(&fd_shuffle);
|
||||
|
||||
// Close the FDs that are reserved but not used after
|
||||
// ShuffleFileDescriptors().
|
||||
|
@ -385,6 +385,7 @@ AddAnimationForProperty(nsIFrame* aFrame, const AnimationProperty& aProperty,
|
||||
animation->iterationCount() = timing.mIterationCount;
|
||||
animation->direction() = timing.mDirection;
|
||||
animation->property() = aProperty.mProperty;
|
||||
animation->playbackRate() = aAnimation->PlaybackRate();
|
||||
animation->data() = aData;
|
||||
|
||||
for (uint32_t segIdx = 0; segIdx < aProperty.mSegments.Length(); segIdx++) {
|
||||
|
@ -218,7 +218,8 @@ public:
|
||||
|
||||
virtual void PostDelayedTask(Task* aTask, int aDelayMs) override
|
||||
{
|
||||
MessageLoop::current()->PostDelayedTask(FROM_HERE, aTask, aDelayMs);
|
||||
(MessageLoop::current() ? MessageLoop::current() : mUILoop)->
|
||||
PostDelayedTask(FROM_HERE, aTask, aDelayMs);
|
||||
}
|
||||
|
||||
virtual bool GetTouchSensitiveRegion(CSSRect* aOutRegion) override
|
||||
|
55
layout/style/test/file_animations_playbackrate.html
Normal file
@ -0,0 +1,55 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script type="application/javascript"
|
||||
src="/tests/SimpleTest/paint_listener.js"></script>
|
||||
<script type="application/javascript" src="animation_utils.js"></script>
|
||||
<style type="text/css">
|
||||
@keyframes anim {
|
||||
0% { transform: translate(0px) }
|
||||
100% { transform: translate(100px) }
|
||||
}
|
||||
.target {
|
||||
/* The animation target needs geometry in order to qualify for OMTA */
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: white;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var ok = opener.ok.bind(opener);
|
||||
var is = opener.is.bind(opener);
|
||||
var todo = opener.todo.bind(opener);
|
||||
function finish() {
|
||||
var o = opener;
|
||||
self.close();
|
||||
o.SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="display"></div>
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
runOMTATest(function() {
|
||||
runAllAsyncAnimTests().then(function() {
|
||||
finish();
|
||||
});
|
||||
}, finish, opener.SpecialPowers);
|
||||
|
||||
addAsyncAnimTest(function *() {
|
||||
var [ div, cs ] = new_div("animation: anim 10s 1 linear forwards");
|
||||
var animation = div.getAnimations()[0];
|
||||
animation.playbackRate = 10;
|
||||
|
||||
advance_clock(300);
|
||||
|
||||
yield waitForPaints();
|
||||
omta_is(div, "transform", { tx: 30 }, RunningOn.Compositor,
|
||||
"at 300ms");
|
||||
done_div();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -42,6 +42,8 @@ skip-if = toolkit == 'android'
|
||||
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # bug 1041017
|
||||
[test_animations_pausing.html]
|
||||
support-files = file_animations_pausing.html
|
||||
[test_animations_playbackrate.html]
|
||||
support-files = file_animations_playbackrate.html
|
||||
[test_any_dynamic.html]
|
||||
[test_at_rule_parse_serialize.html]
|
||||
[test_bug73586.html]
|
||||
|
28
layout/style/test/test_animations_playbackrate.html
Normal file
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1175751
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Animation.playbackRate on compositor animations (Bug 1175751)</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1175751">Mozilla Bug 1175751</a>
|
||||
<div id="display"></div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{ "set": [[ "dom.animations-api.core.enabled", true]] },
|
||||
function() {
|
||||
window.open("file_animations_playbackrate.html");
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 456 B |
Before Width: | Height: | Size: 299 B |
Before Width: | Height: | Size: 551 B |
Before Width: | Height: | Size: 132 B |
Before Width: | Height: | Size: 463 B |
Before Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 109 B |
Before Width: | Height: | Size: 147 B |
Before Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 217 B |
Before Width: | Height: | Size: 217 B |
Before Width: | Height: | Size: 217 B |
Before Width: | Height: | Size: 217 B |
Before Width: | Height: | Size: 146 B |
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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/. -->
|
||||
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="@android:color/white"/>
|
||||
|
||||
<stroke android:width="1dp"
|
||||
android:color="@color/placeholder_grey" />
|
||||
|
||||
</shape>
|
@ -32,6 +32,15 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView android:id="@+id/doorhanger_link"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.DoorHanger.Medium"
|
||||
android:textColor="@color/link_blue"
|
||||
android:layout_marginTop="@dimen/doorhanger_section_padding_large"
|
||||
android:layout_marginBottom="@dimen/doorhanger_section_padding_small"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -12,15 +12,6 @@
|
||||
android:focusable="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/doorhanger_section_padding_large"
|
||||
android:textAppearance="@style/TextAppearance.DoorHanger.Medium"/>
|
||||
|
||||
<TextView android:id="@+id/doorhanger_link"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.DoorHanger.Medium"
|
||||
android:textColor="@color/link_blue"
|
||||
android:layout_marginBottom="@dimen/doorhanger_section_padding_small"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -24,6 +24,12 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1.0">
|
||||
|
||||
<TextView android:id="@+id/site_identity_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/doorhanger_subsection_padding"
|
||||
android:textAppearance="@style/TextAppearance.DoorHanger.Medium.Light"/>
|
||||
|
||||
<include layout="@layout/site_identity_unknown" />
|
||||
|
||||
<LinearLayout android:id="@+id/site_identity_known_container"
|
||||
@ -32,12 +38,6 @@
|
||||
android:visibility="gone"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView android:id="@+id/site_identity_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/doorhanger_subsection_padding"
|
||||
android:textAppearance="@style/TextAppearance.DoorHanger.Medium.Light"/>
|
||||
|
||||
<TextView android:id="@+id/site_identity_encrypted"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -110,7 +110,7 @@ public class SiteIdentityPopup extends AnchoredPopup implements GeckoEventListen
|
||||
(LinearLayout) mIdentity.findViewById(R.id.site_identity_unknown_container);
|
||||
|
||||
|
||||
mTitle = (TextView) mIdentityKnownContainer.findViewById(R.id.site_identity_title);
|
||||
mTitle = (TextView) mIdentity.findViewById(R.id.site_identity_title);
|
||||
mEncrypted = (TextView) mIdentityKnownContainer.findViewById(R.id.site_identity_encrypted);
|
||||
mHost = (TextView) mIdentityKnownContainer.findViewById(R.id.host);
|
||||
mOwnerLabel = (TextView) mIdentityKnownContainer.findViewById(R.id.owner_label);
|
||||
@ -329,7 +329,7 @@ public class SiteIdentityPopup extends AnchoredPopup implements GeckoEventListen
|
||||
config.setMessage(mContext.getString(R.string.loaded_mixed_content_message));
|
||||
}
|
||||
|
||||
config.setLink(mContext.getString(R.string.learn_more), MIXED_CONTENT_SUPPORT_URL, "\n\n");
|
||||
config.setLink(mContext.getString(R.string.learn_more), MIXED_CONTENT_SUPPORT_URL);
|
||||
addNotificationButtons(config, blocked);
|
||||
|
||||
mMixedContentNotification = DoorHanger.Get(mContext, config);
|
||||
@ -363,7 +363,7 @@ public class SiteIdentityPopup extends AnchoredPopup implements GeckoEventListen
|
||||
mContext.getString(R.string.loaded_tracking_content_message_bottom));
|
||||
}
|
||||
|
||||
config.setLink(mContext.getString(R.string.learn_more), TRACKING_CONTENT_SUPPORT_URL, "\n\n");
|
||||
config.setLink(mContext.getString(R.string.learn_more), TRACKING_CONTENT_SUPPORT_URL);
|
||||
addNotificationButtons(config, blocked);
|
||||
|
||||
mTrackingContentNotification = DoorHanger.Get(mContext, config);
|
||||
|
@ -6,11 +6,7 @@
|
||||
package org.mozilla.gecko.widget;
|
||||
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.util.Log;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
@ -66,7 +62,7 @@ public class DefaultDoorHanger extends DoorHanger {
|
||||
|
||||
final DoorhangerConfig.Link link = config.getLink();
|
||||
if (link != null) {
|
||||
addLink(link.label, link.url, link.delimiter);
|
||||
addLink(link.label, link.url);
|
||||
}
|
||||
|
||||
addButtonsToLayout(config);
|
||||
@ -93,7 +89,7 @@ public class DefaultDoorHanger extends DoorHanger {
|
||||
try {
|
||||
final String linkLabel = link.getString("label");
|
||||
final String linkUrl = link.getString("url");
|
||||
addLink(linkLabel, linkUrl, " ");
|
||||
addLink(linkLabel, linkUrl);
|
||||
} catch (JSONException e) { }
|
||||
}
|
||||
|
||||
@ -175,23 +171,15 @@ public class DefaultDoorHanger extends DoorHanger {
|
||||
mMessage.setText(markupMessage);
|
||||
}
|
||||
|
||||
private void addLink(String label, String url, String delimiter) {
|
||||
String title = mMessage.getText().toString();
|
||||
SpannableString titleWithLink = new SpannableString(title + delimiter + label);
|
||||
URLSpan linkSpan = new URLSpan(url) {
|
||||
private void addLink(String label, final String url) {
|
||||
mLink.setText(label);
|
||||
mLink.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Tabs.getInstance().loadUrlInTab(getURL());
|
||||
Tabs.getInstance().loadUrlInTab(url);
|
||||
}
|
||||
};
|
||||
|
||||
// Prevent text outside the link from flashing when clicked.
|
||||
ForegroundColorSpan colorSpan = new ForegroundColorSpan(mMessage.getCurrentTextColor());
|
||||
titleWithLink.setSpan(colorSpan, 0, title.length(), 0);
|
||||
|
||||
titleWithLink.setSpan(linkSpan, title.length() + 1, titleWithLink.length(), 0);
|
||||
mMessage.setText(titleWithLink);
|
||||
mMessage.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
});
|
||||
mLink.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
private void styleInput(PromptInput input, View view) {
|
||||
|
@ -59,6 +59,7 @@ public abstract class DoorHanger extends LinearLayout {
|
||||
protected final Type mType;
|
||||
|
||||
protected final ImageView mIcon;
|
||||
protected final TextView mLink;
|
||||
protected final TextView mDoorhangerTitle;
|
||||
|
||||
protected final Context mContext;
|
||||
@ -84,6 +85,7 @@ public abstract class DoorHanger extends LinearLayout {
|
||||
|
||||
mDivider = findViewById(R.id.divider_doorhanger);
|
||||
mIcon = (ImageView) findViewById(R.id.doorhanger_icon);
|
||||
mLink = (TextView) findViewById(R.id.doorhanger_link);
|
||||
mDoorhangerTitle = (TextView) findViewById(R.id.doorhanger_title);
|
||||
|
||||
mNegativeButton = (Button) findViewById(R.id.doorhanger_button_negative);
|
||||
|
@ -14,12 +14,10 @@ public class DoorhangerConfig {
|
||||
public static class Link {
|
||||
public final String label;
|
||||
public final String url;
|
||||
public final String delimiter;
|
||||
|
||||
private Link(String label, String url, String delimiter) {
|
||||
private Link(String label, String url) {
|
||||
this.label = label;
|
||||
this.url = url;
|
||||
this.delimiter = delimiter;
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,8 +105,8 @@ public class DoorhangerConfig {
|
||||
return this.buttonClickListener;
|
||||
}
|
||||
|
||||
public void setLink(String label, String url, String delimiter) {
|
||||
this.link = new Link(label, url, delimiter);
|
||||
public void setLink(String label, String url) {
|
||||
this.link = new Link(label, url);
|
||||
}
|
||||
|
||||
public Link getLink() {
|
||||
|
@ -36,14 +36,12 @@ public class LoginDoorHanger extends DoorHanger {
|
||||
private enum ActionType { EDIT, SELECT }
|
||||
|
||||
private final TextView mMessage;
|
||||
private final TextView mLink;
|
||||
private final DoorhangerConfig.ButtonConfig mButtonConfig;
|
||||
|
||||
public LoginDoorHanger(Context context, DoorhangerConfig config) {
|
||||
super(context, config, Type.LOGIN);
|
||||
|
||||
mMessage = (TextView) findViewById(R.id.doorhanger_message);
|
||||
mLink = (TextView) findViewById(R.id.doorhanger_link);
|
||||
mIcon.setImageResource(R.drawable.icon_key);
|
||||
mIcon.setVisibility(View.VISIBLE);
|
||||
|
||||
|
@ -24,12 +24,12 @@ profileDir.append("extensions");
|
||||
// Don't need the full interface, attempts to call other methods will just
|
||||
// throw which is just fine
|
||||
var WindowWatcher = {
|
||||
openWindow: function(parent, url, name, features, arguments) {
|
||||
openWindow: function(parent, url, name, features, args) {
|
||||
// Should be called to list the newly blocklisted items
|
||||
do_check_eq(url, URI_EXTENSION_BLOCKLIST_DIALOG);
|
||||
|
||||
// Simulate auto-disabling any softblocks
|
||||
var list = arguments.wrappedJSObject.list;
|
||||
var list = args.wrappedJSObject.list;
|
||||
list.forEach(function(aItem) {
|
||||
if (!aItem.blocked)
|
||||
aItem.disable = true;
|
||||
|
@ -30,12 +30,12 @@ profileDir.append("extensions");
|
||||
// Don't need the full interface, attempts to call other methods will just
|
||||
// throw which is just fine
|
||||
var WindowWatcher = {
|
||||
openWindow: function(parent, url, name, features, arguments) {
|
||||
openWindow: function(parent, url, name, features, args) {
|
||||
// Should be called to list the newly blocklisted items
|
||||
do_check_eq(url, URI_EXTENSION_BLOCKLIST_DIALOG);
|
||||
|
||||
// Simulate auto-disabling any softblocks
|
||||
var list = arguments.wrappedJSObject.list;
|
||||
var list = args.wrappedJSObject.list;
|
||||
list.forEach(function(aItem) {
|
||||
if (!aItem.blocked)
|
||||
aItem.disable = true;
|
||||
|
@ -25,12 +25,12 @@ profileDir.append("extensions");
|
||||
// Don't need the full interface, attempts to call other methods will just
|
||||
// throw which is just fine
|
||||
var WindowWatcher = {
|
||||
openWindow: function(parent, url, name, features, arguments) {
|
||||
openWindow: function(parent, url, name, features, args) {
|
||||
// Should be called to list the newly blocklisted items
|
||||
do_check_eq(url, URI_EXTENSION_BLOCKLIST_DIALOG);
|
||||
|
||||
// Simulate auto-disabling any softblocks
|
||||
var list = arguments.wrappedJSObject.list;
|
||||
var list = args.wrappedJSObject.list;
|
||||
list.forEach(function(aItem) {
|
||||
if (!aItem.blocked)
|
||||
aItem.disable = true;
|
||||
|
@ -37,12 +37,12 @@ let addonIDs = ["test_bug393285_1@tests.mozilla.org",
|
||||
|
||||
// A window watcher to deal with the blocklist UI dialog.
|
||||
var WindowWatcher = {
|
||||
openWindow: function(parent, url, name, features, arguments) {
|
||||
openWindow: function(parent, url, name, features, args) {
|
||||
// Should be called to list the newly blocklisted items
|
||||
do_check_eq(url, URI_EXTENSION_BLOCKLIST_DIALOG);
|
||||
|
||||
// Simulate auto-disabling any softblocks
|
||||
var list = arguments.wrappedJSObject.list;
|
||||
var list = args.wrappedJSObject.list;
|
||||
list.forEach(function(aItem) {
|
||||
if (!aItem.blocked)
|
||||
aItem.disable = true;
|
||||
|
@ -26,12 +26,12 @@ profileDir.append("extensions");
|
||||
|
||||
// A window watcher to deal with the blocklist UI dialog.
|
||||
var WindowWatcher = {
|
||||
openWindow: function(parent, url, name, features, arguments) {
|
||||
openWindow: function(parent, url, name, features, args) {
|
||||
// Should be called to list the newly blocklisted items
|
||||
do_check_eq(url, URI_EXTENSION_BLOCKLIST_DIALOG);
|
||||
|
||||
// Simulate auto-disabling any softblocks
|
||||
var list = arguments.wrappedJSObject.list;
|
||||
var list = args.wrappedJSObject.list;
|
||||
list.forEach(function(aItem) {
|
||||
if (!aItem.blocked)
|
||||
aItem.disable = true;
|
||||
|
@ -253,12 +253,12 @@ var PluginHost = {
|
||||
// Don't need the full interface, attempts to call other methods will just
|
||||
// throw which is just fine
|
||||
var WindowWatcher = {
|
||||
openWindow: function(parent, url, name, features, arguments) {
|
||||
openWindow: function(parent, url, name, features, args) {
|
||||
// Should be called to list the newly blocklisted items
|
||||
do_check_eq(url, URI_EXTENSION_BLOCKLIST_DIALOG);
|
||||
do_check_neq(gCallback, null);
|
||||
|
||||
var args = arguments.wrappedJSObject;
|
||||
var args = args.wrappedJSObject;
|
||||
|
||||
gNewBlocks = [];
|
||||
var list = args.list;
|
||||
|
@ -60,13 +60,13 @@ var PluginHost = {
|
||||
// Don't need the full interface, attempts to call other methods will just
|
||||
// throw which is just fine
|
||||
var WindowWatcher = {
|
||||
openWindow: function(parent, url, name, features, arguments) {
|
||||
openWindow: function(parent, url, name, features, args) {
|
||||
// Should be called to list the newly blocklisted items
|
||||
do_check_eq(url, URI_EXTENSION_BLOCKLIST_DIALOG);
|
||||
// Should only include one item
|
||||
do_check_eq(arguments.wrappedJSObject.list.length, 1);
|
||||
do_check_eq(args.wrappedJSObject.list.length, 1);
|
||||
// And that item should be the blocked plugin, not the outdated one
|
||||
var item = arguments.wrappedJSObject.list[0];
|
||||
var item = args.wrappedJSObject.list[0];
|
||||
do_check_true(item.item instanceof Ci.nsIPluginTag);
|
||||
do_check_neq(item.name, "test_bug514327_outdated");
|
||||
|
||||
|
@ -27,14 +27,14 @@ var gCheckUpdates = false;
|
||||
// This will be called to show the compatibility update dialog.
|
||||
var WindowWatcher = {
|
||||
expected: false,
|
||||
arguments: null,
|
||||
args: null,
|
||||
|
||||
openWindow: function(parent, url, name, features, args) {
|
||||
do_check_true(Services.startup.interrupted);
|
||||
do_check_eq(url, URI_EXTENSION_UPDATE_DIALOG);
|
||||
do_check_true(this.expected);
|
||||
this.expected = false;
|
||||
this.arguments = args.QueryInterface(AM_Ci.nsIVariant);
|
||||
this.args = args.QueryInterface(AM_Ci.nsIVariant);
|
||||
|
||||
var updated = !gCheckUpdates;
|
||||
if (gCheckUpdates) {
|
||||
@ -387,9 +387,9 @@ add_task(function* run_test_1() {
|
||||
"override1x2-1x3@tests.mozilla.org"]);
|
||||
check_state_v3(addons);
|
||||
|
||||
do_check_eq(WindowWatcher.arguments.length, 2);
|
||||
do_check_true(WindowWatcher.arguments.indexOf("upgradeable1x2-3@tests.mozilla.org") >= 0);
|
||||
do_check_true(WindowWatcher.arguments.indexOf("override1x2-1x3@tests.mozilla.org") >= 0);
|
||||
do_check_eq(WindowWatcher.args.length, 2);
|
||||
do_check_true(WindowWatcher.args.indexOf("upgradeable1x2-3@tests.mozilla.org") >= 0);
|
||||
do_check_true(WindowWatcher.args.indexOf("override1x2-1x3@tests.mozilla.org") >= 0);
|
||||
});
|
||||
|
||||
// Downgrade to version 2 which will remove appDisable from two add-ons
|
||||
@ -440,8 +440,8 @@ add_task(function* run_test_5() {
|
||||
"override1x2-1x3@tests.mozilla.org"]);
|
||||
check_state_v3_2(addons);
|
||||
|
||||
do_check_eq(WindowWatcher.arguments.length, 1);
|
||||
do_check_true(WindowWatcher.arguments.indexOf("upgradeable1x2-3@tests.mozilla.org") >= 0);
|
||||
do_check_eq(WindowWatcher.args.length, 1);
|
||||
do_check_true(WindowWatcher.args.indexOf("upgradeable1x2-3@tests.mozilla.org") >= 0);
|
||||
});
|
||||
|
||||
// Downgrade to version 1 which will appEnable all the add-ons
|
||||
|
@ -20,7 +20,7 @@ var gCachePurged = false;
|
||||
|
||||
// Override the window watcher
|
||||
var WindowWatcher = {
|
||||
openWindow: function(parent, url, name, features, arguments) {
|
||||
openWindow: function(parent, url, name, features, args) {
|
||||
do_check_false(gCachePurged);
|
||||
},
|
||||
|
||||
|
@ -17,7 +17,7 @@ var gExpectedURL = null;
|
||||
|
||||
// This will be called to show the any update dialog.
|
||||
var WindowWatcher = {
|
||||
openWindow: function(parent, url, name, features, arguments) {
|
||||
openWindow: function(parent, url, name, features, args) {
|
||||
do_check_eq(url, gExpectedURL);
|
||||
gExpectedURL = null;
|
||||
},
|
||||
|
@ -38,7 +38,6 @@ profileDir.append("extensions");
|
||||
// This will be called to show the compatibility update dialog.
|
||||
var WindowWatcher = {
|
||||
expected: false,
|
||||
arguments: null,
|
||||
|
||||
openWindow: function(parent, url, name, features, args) {
|
||||
do_check_true(Services.startup.interrupted);
|
||||
|
@ -27,8 +27,8 @@ profileDir.append("extensions");
|
||||
var WindowWatcher = {
|
||||
sawAddon: false,
|
||||
|
||||
openWindow: function(parent, url, name, features, arguments) {
|
||||
let ids = arguments.QueryInterface(AM_Ci.nsIVariant);
|
||||
openWindow: function(parent, url, name, features, args) {
|
||||
let ids = args.QueryInterface(AM_Ci.nsIVariant);
|
||||
this.sawAddon = ids.indexOf(ID) >= 0;
|
||||
},
|
||||
|
||||
|