Merge m-c to inbound, a=merge

This commit is contained in:
Wes Kocher committed 2015-07-24 13:47:28 -07:00
commit 1400655fd5
85 files changed
+1431 -366

No files matched your search

+1 -1
View File
@@ -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="db299103dd17a873cba4ff88e62ec173bf80fe62"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ade1ef5249cfab921e00ed67b30f3d03c2e24b5e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
+1 -1
View File
@@ -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="db299103dd17a873cba4ff88e62ec173bf80fe62"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ade1ef5249cfab921e00ed67b30f3d03c2e24b5e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
+1 -1
View File
@@ -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="db299103dd17a873cba4ff88e62ec173bf80fe62"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ade1ef5249cfab921e00ed67b30f3d03c2e24b5e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="8bc59310552179f9a8bc6cdd0188e2475df52fb7"/>
+1 -1
View File
@@ -17,7 +17,7 @@
</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="db299103dd17a873cba4ff88e62ec173bf80fe62"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ade1ef5249cfab921e00ed67b30f3d03c2e24b5e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="657894b4a1dc0a926117f4812e0940229f9f676f"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1b587ca868ee75758959c2470a9c35a21299377f"/>
+2 -2
View File
@@ -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="db299103dd17a873cba4ff88e62ec173bf80fe62"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ade1ef5249cfab921e00ed67b30f3d03c2e24b5e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@@ -123,7 +123,7 @@
<project name="platform/system/security" path="system/security" revision="583374f69f531ba68fc3dcbff1f74893d2a96406"/>
<project name="platform/system/vold" path="system/vold" revision="d4455b8cf361f8353e8aebac15ffd64b4aedd2b9"/>
<project name="platform/external/icu4c" path="external/icu4c" remote="aosp" revision="b4c6379528887dc25ca9991a535a8d92a61ad6b6"/>
<project name="platform_frameworks_av" path="frameworks/av" remote="b2g" revision="f3cedd7fd9b1649aa5107d466be9078bb7602af6"/>
<project name="platform_frameworks_av" path="frameworks/av" remote="b2g" revision="f313503b5c91aaa6fcf962d4ec9bf260e0c00bf1"/>
<project name="platform_system_core" path="system/core" remote="b2g" revision="9395eb5aa885cf6d305a202de6e9694a58a89717"/>
<default remote="caf" revision="refs/tags/android-4.4.2_r1" sync-j="4"/>
<!-- Emulator specific things -->
+3 -3
View File
@@ -12,10 +12,10 @@
<!--original fetch url was https://git.mozilla.org/releases-->
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
<!-- B2G specific things. -->
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
<project name="platform_build" path="build" remote="b2g" revision="07c383a786f188904311a37f6062c2cb84c9b61d">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="db299103dd17a873cba4ff88e62ec173bf80fe62"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ade1ef5249cfab921e00ed67b30f3d03c2e24b5e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@@ -143,7 +143,7 @@
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="fe7df1bc8dd0fd71571505d7be1c31a4ad1e40fb"/>
<project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="48132ec0b0dfe9fc29c7c3f0e799066be8999198"/>
<!-- external/qemu for emulator-l need to be updated in bug-1121378 -->
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="7639c5c496ffd207bb627f2a59b2c5203ae6fefc"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="85f91439c854061bda3c6228d98381ea8867170c"/>
<project name="platform_external_wpa_supplicant_8" path="external/wpa_supplicant_8" remote="b2g" revision="cbda29a58abc4ea1f7f4611fe354ab67b606219d"/>
<project name="platform/development" path="development" revision="0c51f6e0aa2ee57fcb75ec3b2ff6bf754cece63e"/>
<project name="android-sdk" path="sdk" remote="b2g" revision="ff4190dc603f62a7caa48342aa268acf99863c5c"/>
+1 -1
View File
@@ -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="db299103dd17a873cba4ff88e62ec173bf80fe62"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ade1ef5249cfab921e00ed67b30f3d03c2e24b5e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="8bc59310552179f9a8bc6cdd0188e2475df52fb7"/>
+1 -1
View File
@@ -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="db299103dd17a873cba4ff88e62ec173bf80fe62"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ade1ef5249cfab921e00ed67b30f3d03c2e24b5e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
+2 -2
View File
@@ -1,9 +1,9 @@
{
"git": {
"git_revision": "db299103dd17a873cba4ff88e62ec173bf80fe62",
"git_revision": "ade1ef5249cfab921e00ed67b30f3d03c2e24b5e",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "16f2c422168acd350ff048a22d39297e60508059",
"revision": "e09bb83fd01a4f6ab6d569c3cf2d8b099f30df55",
"repo_path": "integration/gaia-central"
}
+1 -1
View File
@@ -17,7 +17,7 @@
</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="db299103dd17a873cba4ff88e62ec173bf80fe62"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ade1ef5249cfab921e00ed67b30f3d03c2e24b5e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="657894b4a1dc0a926117f4812e0940229f9f676f"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1b587ca868ee75758959c2470a9c35a21299377f"/>
+2 -2
View File
@@ -12,10 +12,10 @@
<!--original fetch url was https://git.mozilla.org/releases-->
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
<!-- B2G specific things. -->
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
<project name="platform_build" path="build" remote="b2g" revision="07c383a786f188904311a37f6062c2cb84c9b61d">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="db299103dd17a873cba4ff88e62ec173bf80fe62"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ade1ef5249cfab921e00ed67b30f3d03c2e24b5e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@@ -8,6 +8,11 @@ let TrackingProtection = {
PREF_ENABLED_IN_PRIVATE_WINDOWS: "privacy.trackingprotection.pbmode.enabled",
enabledGlobally: false,
enabledInPrivateWindows: false,
container: null,
content: null,
icon: null,
activeTooltipText: null,
disabledTooltipText: null,
init() {
let $ = selector => document.querySelector(selector);
@@ -19,6 +24,11 @@ let TrackingProtection = {
Services.prefs.addObserver(this.PREF_ENABLED_GLOBALLY, this, false);
Services.prefs.addObserver(this.PREF_ENABLED_IN_PRIVATE_WINDOWS, this, false);
this.activeTooltipText =
gNavigatorBundle.getString("trackingProtection.icon.activeTooltip");
this.disabledTooltipText =
gNavigatorBundle.getString("trackingProtection.icon.disabledTooltip");
this.enabledHistogram.add(this.enabledGlobally);
},
@@ -66,21 +76,14 @@ let TrackingProtection = {
this.icon.setAttribute("animate", "true");
}
let {
STATE_BLOCKED_TRACKING_CONTENT, STATE_LOADED_TRACKING_CONTENT
} = Ci.nsIWebProgressListener;
let isBlocking = state & Ci.nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT;
let isAllowing = state & Ci.nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT;
for (let element of [this.icon, this.content]) {
if (state & STATE_BLOCKED_TRACKING_CONTENT) {
element.setAttribute("state", "blocked-tracking-content");
} else if (state & STATE_LOADED_TRACKING_CONTENT) {
element.setAttribute("state", "loaded-tracking-content");
} else {
element.removeAttribute("state");
}
}
if (isBlocking) {
this.icon.setAttribute("tooltiptext", this.activeTooltipText);
this.icon.setAttribute("state", "blocked-tracking-content");
this.content.setAttribute("state", "blocked-tracking-content");
if (state & STATE_BLOCKED_TRACKING_CONTENT) {
// Open the tracking protection introduction panel, if applicable.
let introCount = gPrefService.getIntPref("privacy.trackingprotection.introCount");
if (introCount < TrackingProtection.MAX_INTROS) {
@@ -88,6 +91,14 @@ let TrackingProtection = {
gPrefService.savePrefFile(null);
this.showIntroPanel();
}
} else if (isAllowing) {
this.icon.setAttribute("tooltiptext", this.disabledTooltipText);
this.icon.setAttribute("state", "loaded-tracking-content");
this.content.setAttribute("state", "loaded-tracking-content");
} else {
this.icon.removeAttribute("tooltiptext");
this.icon.removeAttribute("state");
this.content.removeAttribute("state");
}
// Telemetry for state change.
@@ -278,6 +278,8 @@ skip-if = os == "mac" || e10s # bug 967013; e10s: bug 1094761 - test hits the ne
[browser_ctrlTab.js]
[browser_datareporting_notification.js]
skip-if = !datareporting
[browser_datachoices_notification.js]
skip-if = !datareporting
[browser_devedition.js]
[browser_devices_get_user_media.js]
skip-if = buildapp == 'mulet' || (os == "linux" && debug) || e10s # linux: bug 976544; e10s: bug 1071623
@@ -0,0 +1,213 @@
/* 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/. */
"use strict";
// Pass an empty scope object to the import to prevent "leaked window property"
// errors in tests.
let Preferences = Cu.import("resource://gre/modules/Preferences.jsm", {}).Preferences;
let TelemetryReportingPolicy =
Cu.import("resource://gre/modules/TelemetryReportingPolicy.jsm", {}).TelemetryReportingPolicy;
XPCOMUtils.defineLazyGetter(this, "gDatareportingService",
() => Cc["@mozilla.org/datareporting/service;1"]
.getService(Ci.nsISupports)
.wrappedJSObject);
const PREF_BRANCH = "datareporting.policy.";
const PREF_DRS_ENABLED = "datareporting.healthreport.service.enabled";
const PREF_BYPASS_NOTIFICATION = PREF_BRANCH + "dataSubmissionPolicyBypassNotification";
const PREF_CURRENT_POLICY_VERSION = PREF_BRANCH + "currentPolicyVersion";
const PREF_ACCEPTED_POLICY_VERSION = PREF_BRANCH + "dataSubmissionPolicyAcceptedVersion";
const PREF_ACCEPTED_POLICY_DATE = PREF_BRANCH + "dataSubmissionPolicyNotifiedTime";
const TEST_POLICY_VERSION = 37;
/**
* Wait for a tick.
*/
function promiseNextTick() {
return new Promise(resolve => executeSoon(resolve));
}
/**
* Wait for a notification to be shown in a notification box.
* @param {Object} aNotificationBox The notification box.
* @return {Promise} Resolved when the notification is displayed.
*/
function promiseWaitForAlertActive(aNotificationBox) {
let deferred = PromiseUtils.defer();
aNotificationBox.addEventListener("AlertActive", function onActive() {
aNotificationBox.removeEventListener("AlertActive", onActive, true);
deferred.resolve();
});
return deferred.promise;
}
/**
* Wait for a notification to be closed.
* @param {Object} aNotification The notification.
* @return {Promise} Resolved when the notification is closed.
*/
function promiseWaitForNotificationClose(aNotification) {
let deferred = PromiseUtils.defer();
waitForNotificationClose(aNotification, deferred.resolve);
return deferred.promise;
}
let checkInfobarButton = Task.async(function* (aNotification) {
// Check that the button on the data choices infobar does the right thing.
let buttons = aNotification.getElementsByTagName("button");
Assert.equal(buttons.length, 1, "There is 1 button in the data reporting notification.");
let button = buttons[0];
// Add an observer to ensure the "advanced" pane opened (but don't bother
// closing it - we close the entire window when done.)
let paneLoadedPromise = promiseTopicObserved("advanced-pane-loaded");
// Click on the button.
button.click();
// Wait for the preferences panel to open.
let preferenceWindow = yield paneLoadedPromise;
yield promiseNextTick();
// If the prefs are being displayed in a dialog we need to close it.
// If in a tab (ie, in-content prefs) it closes with the window.
if (!Services.prefs.getBoolPref("browser.preferences.inContent")) {
prefWin.close();
}
});
add_task(function* setup(){
const drsEnabled = Preferences.get(PREF_DRS_ENABLED, true);
const bypassNotification = Preferences.get(PREF_BYPASS_NOTIFICATION, true);
const currentPolicyVersion = Preferences.get(PREF_CURRENT_POLICY_VERSION, 1);
// Register a cleanup function to reset our preferences.
registerCleanupFunction(() => {
Preferences.set(PREF_DRS_ENABLED, drsEnabled);
Preferences.set(PREF_BYPASS_NOTIFICATION, bypassNotification);
Preferences.set(PREF_CURRENT_POLICY_VERSION, currentPolicyVersion);
// Start polling again.
gDatareportingService.policy.startPolling();
return closeAllNotifications();
});
// Disable Healthreport/Data reporting service.
Preferences.set(PREF_DRS_ENABLED, false);
// Don't skip the infobar visualisation.
Preferences.set(PREF_BYPASS_NOTIFICATION, false);
// Set the current policy version.
Preferences.set(PREF_CURRENT_POLICY_VERSION, TEST_POLICY_VERSION);
// Stop the polling to make sure no policy gets displayed by FHR.
gDatareportingService.policy.stopPolling();
});
function clearAcceptedPolicy() {
// Reset the accepted policy.
Preferences.reset(PREF_ACCEPTED_POLICY_VERSION);
Preferences.reset(PREF_ACCEPTED_POLICY_DATE);
}
add_task(function* test_single_window(){
clearAcceptedPolicy();
// Close all the notifications, then try to trigger the data choices infobar.
yield closeAllNotifications();
let notificationBox = document.getElementById("global-notificationbox");
// Make sure that we have a coherent initial state.
Assert.equal(Preferences.get(PREF_ACCEPTED_POLICY_VERSION, 0), 0,
"No version should be set on init.");
Assert.equal(Preferences.get(PREF_ACCEPTED_POLICY_DATE, 0), 0,
"No date should be set on init.");
Assert.ok(!TelemetryReportingPolicy.testIsUserNotified(),
"User not notified about datareporting policy.");
let alertShownPromise = promiseWaitForAlertActive(notificationBox);
// This should be false and trigger the Infobar.
Assert.ok(!TelemetryReportingPolicy.canUpload(),
"User should not be allowed to upload and the infobar should be triggered.");
// Wait for the infobar to be displayed.
yield alertShownPromise;
Assert.equal(notificationBox.allNotifications.length, 1, "Notification Displayed.");
Assert.ok(TelemetryReportingPolicy.canUpload(), "User should be allowed to upload now.");
yield promiseNextTick();
let promiseClosed = promiseWaitForNotificationClose(notificationBox.currentNotification);
yield checkInfobarButton(notificationBox.currentNotification);
yield promiseClosed;
Assert.equal(notificationBox.allNotifications.length, 0, "No notifications remain.");
// Check that we are still clear to upload and that the policy data is saved.
Assert.ok(TelemetryReportingPolicy.canUpload());
Assert.equal(TelemetryReportingPolicy.testIsUserNotified(), true,
"User notified about datareporting policy.");
Assert.equal(Preferences.get(PREF_ACCEPTED_POLICY_VERSION, 0), TEST_POLICY_VERSION,
"Version pref set.");
Assert.greater(parseInt(Preferences.get(PREF_ACCEPTED_POLICY_DATE, null), 10), -1,
"Date pref set.");
});
add_task(function* test_multiple_windows(){
clearAcceptedPolicy();
// Close all the notifications, then try to trigger the data choices infobar.
yield closeAllNotifications();
// Ensure we see the notification on all windows and that action on one window
// results in dismiss on every window.
let otherWindow = yield BrowserTestUtils.openNewBrowserWindow();
// Get the notification box for both windows.
let notificationBoxes = [
document.getElementById("global-notificationbox"),
otherWindow.document.getElementById("global-notificationbox")
];
Assert.ok(notificationBoxes[1], "2nd window has a global notification box.");
// Make sure that we have a coherent initial state.
Assert.equal(Preferences.get(PREF_ACCEPTED_POLICY_VERSION, 0), 0, "No version should be set on init.");
Assert.equal(Preferences.get(PREF_ACCEPTED_POLICY_DATE, 0), 0, "No date should be set on init.");
Assert.ok(!TelemetryReportingPolicy.testIsUserNotified(), "User not notified about datareporting policy.");
let showAlertPromises = [
promiseWaitForAlertActive(notificationBoxes[0]),
promiseWaitForAlertActive(notificationBoxes[1])
];
// This should be false and trigger the Infobar.
Assert.ok(!TelemetryReportingPolicy.canUpload(),
"User should not be allowed to upload and the infobar should be triggered.");
yield Promise.all(showAlertPromises);
// Both notification were displayed. Close one and check that both gets closed.
let closeAlertPromises = [
promiseWaitForNotificationClose(notificationBoxes[0].currentNotification),
promiseWaitForNotificationClose(notificationBoxes[1].currentNotification)
];
notificationBoxes[0].currentNotification.close();
yield Promise.all(closeAlertPromises);
// Close the second window we opened.
yield BrowserTestUtils.closeWindow(otherWindow);
// Check that we are clear to upload and that the policy data us saved.
Assert.ok(TelemetryReportingPolicy.canUpload(),"User should be allowed to upload now.");
Assert.equal(TelemetryReportingPolicy.testIsUserNotified(), true,
"User notified about datareporting policy.");
Assert.equal(Preferences.get(PREF_ACCEPTED_POLICY_VERSION, 0), TEST_POLICY_VERSION,
"Version pref set.");
Assert.greater(parseInt(Preferences.get(PREF_ACCEPTED_POLICY_DATE, null), 10), -1,
"Date pref set.");
});
@@ -47,30 +47,6 @@ function sendNotifyRequest(name) {
return [policy, deferred.promise];
}
/**
* Wait for a <notification> to be closed then call the specified callback.
*/
function waitForNotificationClose(notification, cb) {
let parent = notification.parentNode;
let observer = new MutationObserver(function onMutatations(mutations) {
for (let mutation of mutations) {
for (let i = 0; i < mutation.removedNodes.length; i++) {
let node = mutation.removedNodes.item(i);
if (node != notification) {
continue;
}
observer.disconnect();
cb();
}
}
});
observer.observe(parent, {childList: true});
}
let dumpAppender, rootLogger;
function test() {
@@ -46,6 +46,7 @@ function testBenignPage() {
ok(!TrackingProtection.container.hidden, "The container is visible");
ok(!TrackingProtection.content.hasAttribute("state"), "content: no state");
ok(!TrackingProtection.icon.hasAttribute("state"), "icon: no state");
ok(!TrackingProtection.icon.hasAttribute("tooltiptext"), "icon: no tooltip");
ok(hidden("#tracking-protection-icon"), "icon is hidden");
ok(hidden("#tracking-action-block"), "blockButton is hidden");
@@ -64,6 +65,8 @@ function testTrackingPage(window) {
'content: state="blocked-tracking-content"');
is(TrackingProtection.icon.getAttribute("state"), "blocked-tracking-content",
'icon: state="blocked-tracking-content"');
is(TrackingProtection.icon.getAttribute("tooltiptext"),
gNavigatorBundle.getString("trackingProtection.icon.activeTooltip"), "correct tooltip");
ok(!hidden("#tracking-protection-icon"), "icon is visible");
ok(hidden("#tracking-action-block"), "blockButton is hidden");
@@ -90,6 +93,8 @@ function testTrackingPageUnblocked() {
'content: state="loaded-tracking-content"');
is(TrackingProtection.icon.getAttribute("state"), "loaded-tracking-content",
'icon: state="loaded-tracking-content"');
is(TrackingProtection.icon.getAttribute("tooltiptext"),
gNavigatorBundle.getString("trackingProtection.icon.disabledTooltip"), "correct tooltip");
ok(!hidden("#tracking-protection-icon"), "icon is visible");
ok(!hidden("#tracking-action-block"), "blockButton is visible");
+21
View File
@@ -9,6 +9,27 @@ XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
"resource://testing-common/PlacesTestUtils.jsm");
/**
* Wait for a <notification> to be closed then call the specified callback.
*/
function waitForNotificationClose(notification, cb) {
let parent = notification.parentNode;
let observer = new MutationObserver(function onMutatations(mutations) {
for (let mutation of mutations) {
for (let i = 0; i < mutation.removedNodes.length; i++) {
let node = mutation.removedNodes.item(i);
if (node != notification) {
continue;
}
observer.disconnect();
cb();
}
}
});
observer.observe(parent, {childList: true});
}
function closeAllNotifications () {
let notificationBox = document.getElementById("global-notificationbox");
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

@@ -0,0 +1,13 @@
<?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/. -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid" width="32" height="32" viewBox="0 0 32 32">
<style>
.cls-1 {
fill: #0c99d5;
fill-rule: evenodd;
}
</style>
<path d="M26.797,6.125 C26.719,6.050 26.674,6.013 26.674,6.013 C26.715,6.045 26.756,6.082 26.797,6.125 M28.924,21.127 C28.947,20.948 28.949,20.780 28.929,20.626 C28.501,21.359 27.844,22.025 27.228,22.905 C27.980,22.421 28.624,21.866 28.924,21.127 ZM30.097,13.924 C30.082,13.747 30.062,13.570 30.036,13.394 C29.974,12.946 29.875,12.504 29.728,12.076 C29.735,12.102 29.741,12.129 29.747,12.155 C29.737,12.124 29.731,12.107 29.731,12.107 C29.731,12.107 29.614,12.472 29.435,13.070 C29.423,14.290 29.290,15.417 29.094,16.268 C29.419,15.962 29.657,15.599 29.820,15.196 C29.748,15.461 29.649,15.713 29.520,15.947 C29.361,16.217 29.182,16.436 29.009,16.610 C28.821,16.797 28.641,16.932 28.500,17.024 C28.543,16.905 28.585,16.773 28.625,16.631 C28.626,16.629 28.626,16.628 28.627,16.626 C28.637,16.590 28.647,16.552 28.657,16.513 C28.761,16.176 28.854,15.828 28.934,15.474 C29.049,14.961 29.137,14.433 29.192,13.898 C29.300,12.857 29.284,11.787 29.104,10.744 C29.015,10.227 28.886,9.717 28.712,9.220 C28.480,8.559 28.197,8.001 27.916,7.544 C27.895,7.508 27.874,7.472 27.853,7.436 C27.760,7.280 27.665,7.132 27.570,6.994 C27.258,6.543 26.939,6.200 26.674,6.013 C26.715,6.045 26.756,6.082 26.797,6.125 C26.719,6.050 26.674,6.013 26.674,6.013 C26.694,6.035 26.712,6.058 26.732,6.081 C26.682,6.033 26.653,6.008 26.653,6.008 C26.653,6.008 26.682,6.170 26.733,6.456 C25.969,5.218 24.807,4.635 24.807,4.635 C24.807,4.635 24.902,4.945 25.050,5.391 C25.741,5.949 26.345,6.571 26.869,7.227 C26.871,7.238 26.873,7.250 26.875,7.261 C26.905,7.435 26.938,7.624 26.973,7.826 C26.880,7.700 26.782,7.575 26.683,7.451 C25.589,5.958 24.211,4.706 22.611,3.779 C22.625,3.783 22.600,3.776 22.613,3.780 C20.672,2.647 18.429,2.000 16.039,2.000 C12.495,2.000 9.273,3.423 6.880,5.744 C6.814,5.809 7.271,6.270 7.404,6.311 C8.081,6.106 8.838,6.051 9.423,6.120 C9.705,5.897 9.663,5.963 9.961,5.769 L9.964,5.772 C11.767,4.606 13.854,3.982 16.035,3.982 C18.042,3.982 19.969,4.510 21.669,5.503 C22.118,5.635 22.683,5.830 23.182,6.091 C22.663,5.187 22.132,4.560 21.761,4.182 C23.311,5.364 24.150,6.425 24.701,7.396 C24.746,7.475 24.789,7.553 24.830,7.631 C24.928,7.816 25.017,7.998 25.099,8.177 C24.570,7.618 23.753,7.042 23.039,6.772 C22.981,6.750 22.924,6.730 22.868,6.712 C22.708,6.662 22.555,6.628 22.414,6.617 C23.550,7.488 25.407,9.978 25.432,13.744 C25.432,13.765 25.432,13.786 25.432,13.807 C25.432,14.010 25.428,14.216 25.417,14.427 C25.207,13.971 24.877,13.340 24.562,12.869 C24.483,12.751 24.405,12.644 24.330,12.551 C24.265,12.471 24.202,12.400 24.143,12.346 C24.479,15.517 24.324,16.750 24.116,17.651 C24.096,17.734 24.077,17.815 24.057,17.894 C24.015,18.058 23.973,18.216 23.934,18.378 C23.920,18.257 23.899,18.145 23.874,18.040 C23.816,17.791 23.735,17.585 23.666,17.424 C23.643,17.372 23.621,17.322 23.603,17.280 C23.603,17.280 23.581,17.854 23.325,18.780 C23.199,19.234 23.018,19.771 22.754,20.367 C22.294,21.408 21.823,21.903 21.501,22.062 C21.397,22.113 21.309,22.129 21.242,22.117 C21.167,22.112 21.126,22.079 21.127,22.076 C21.135,22.001 21.143,21.926 21.146,21.854 C21.150,21.754 21.145,21.662 21.119,21.593 C21.119,21.593 20.862,21.684 20.697,21.924 C20.630,22.020 20.544,22.115 20.431,22.203 C20.411,22.219 20.614,21.936 20.599,21.949 C20.499,22.033 20.392,22.130 20.285,22.245 C20.170,22.368 20.059,22.494 19.954,22.609 C19.699,22.887 19.483,23.095 19.352,23.001 C19.437,22.975 19.513,22.906 19.572,22.818 C19.635,22.726 19.680,22.613 19.699,22.500 C19.544,22.612 19.152,22.914 18.272,23.049 C18.109,23.074 17.707,23.146 17.127,23.121 C16.424,23.090 15.460,22.916 14.345,22.341 C14.578,22.313 14.903,22.241 15.196,22.312 C15.275,22.331 15.352,22.360 15.424,22.405 C15.392,22.369 15.355,22.338 15.315,22.310 C14.933,22.037 14.212,22.084 13.681,21.911 C13.170,21.744 12.503,21.005 12.119,20.631 C12.263,20.667 12.407,20.696 12.551,20.721 C12.652,20.738 12.752,20.753 12.852,20.765 C13.008,20.784 13.164,20.798 13.319,20.805 C14.486,20.856 15.595,20.569 16.313,20.063 C17.285,19.377 17.861,18.876 18.378,18.994 C18.428,19.006 18.476,19.010 18.522,19.010 C18.543,19.010 18.563,19.009 18.583,19.007 C18.867,18.975 19.053,18.730 19.002,18.441 C18.983,18.332 18.931,18.217 18.836,18.104 C18.561,17.778 18.016,17.375 17.274,17.265 C16.935,17.215 16.556,17.226 16.142,17.333 C15.385,17.528 14.711,18.047 13.824,18.051 C13.526,18.053 13.204,17.996 12.846,17.850 C12.759,17.815 12.671,17.774 12.580,17.728 C12.489,17.681 12.877,17.783 12.781,17.725 C12.508,17.621 12.011,17.386 11.888,17.297 C11.868,17.282 12.094,17.339 12.070,17.324 C10.721,16.501 10.809,15.842 10.809,15.435 C10.809,15.270 10.858,15.077 10.953,14.899 C11.046,14.723 11.183,14.563 11.362,14.461 C11.475,14.502 11.562,14.541 11.616,14.567 C11.655,14.586 11.677,14.598 11.677,14.598 C11.677,14.598 11.664,14.576 11.644,14.546 C11.613,14.499 11.565,14.428 11.530,14.386 C11.544,14.381 11.557,14.377 11.571,14.373 C11.665,14.406 11.829,14.468 11.985,14.532 C12.092,14.576 12.195,14.621 12.268,14.659 C12.514,14.786 12.596,14.916 12.596,14.916 C12.596,14.916 1Line truncated
</svg>

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

+1 -2
View File
@@ -14,7 +14,6 @@ browser.jar:
content/branding/icon16.png (../default16.png)
content/branding/icon32.png (../default32.png)
content/branding/icon128.png (../mozicon128.png)
content/branding/identity-icons-brand.png (identity-icons-brand.png)
content/branding/[email protected] ([email protected])
content/branding/identity-icons-brand.svg (identity-icons-brand.svg)
content/branding/silhouette-40.svg (silhouette-40.svg)
content/branding/aboutDialog.css (aboutDialog.css)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

@@ -0,0 +1,13 @@
<?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/. -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid" width="32" height="32" viewBox="0 0 32 32">
<style>
.cls-1 {
fill: #144787;
fill-rule: evenodd;
}
</style>
<path d="M15.953,30.000 C8.221,30.000 1.953,23.732 1.953,16.000 C1.953,8.268 8.221,2.000 15.953,2.000 C23.685,2.000 29.953,8.268 29.953,16.000 C29.953,23.732 23.685,30.000 15.953,30.000 ZM16.000,4.000 C9.373,4.000 4.000,9.373 4.000,16.000 C4.000,22.627 9.373,28.000 16.000,28.000 C22.627,28.000 28.000,22.627 28.000,16.000 C28.000,9.373 22.627,4.000 16.000,4.000 ZM27.085,16.311 C27.142,16.652 27.085,17.189 26.942,17.483 C26.885,17.958 26.784,18.470 26.561,18.931 C26.407,19.254 26.189,19.798 25.772,19.846 C25.646,19.858 25.319,20.214 25.283,20.155 C25.208,20.028 25.155,19.869 24.999,19.809 C24.873,19.751 24.990,19.698 24.895,19.643 C24.828,19.607 24.816,19.527 24.803,19.452 C24.756,19.459 24.710,19.469 24.668,19.492 C24.580,19.543 24.528,19.636 24.445,19.693 C24.391,19.671 24.300,19.631 24.307,19.561 C24.235,19.627 24.158,19.762 24.088,19.660 C24.030,19.576 24.071,19.459 24.068,19.367 C24.064,19.275 23.978,19.139 23.883,19.254 C23.816,19.334 23.769,19.345 23.665,19.365 C23.570,19.385 23.496,19.449 23.395,19.450 C23.156,19.456 23.176,19.563 23.117,19.744 C23.063,19.902 22.845,19.920 22.750,20.050 C22.700,20.117 22.549,20.431 22.421,20.318 C22.319,20.227 22.581,19.988 22.581,19.868 C22.581,19.767 22.498,19.709 22.475,19.618 C22.457,19.552 22.479,19.498 22.403,19.463 C22.448,19.376 22.500,19.239 22.455,19.142 C22.398,19.015 22.189,19.130 22.139,19.206 C22.088,19.277 21.964,19.523 21.848,19.374 C21.819,19.341 21.840,19.299 21.785,19.301 C21.747,19.301 21.720,19.325 21.702,19.354 C21.621,19.328 21.652,19.254 21.682,19.199 C21.770,19.040 21.781,18.864 21.900,18.718 C22.026,18.561 22.220,18.468 22.333,18.301 C22.372,18.242 22.441,18.131 22.385,18.064 C22.364,18.038 22.326,18.027 22.313,17.995 C22.297,17.956 22.315,17.913 22.310,17.874 C22.268,17.891 22.222,17.909 22.175,17.894 C22.169,17.851 22.175,17.805 22.164,17.761 C22.108,17.783 22.049,17.851 21.982,17.836 C21.919,17.823 21.927,17.867 21.857,17.865 C21.916,17.772 21.952,17.667 22.015,17.575 C22.051,17.521 22.101,17.473 22.130,17.413 C22.198,17.271 22.058,17.158 22.081,17.020 C22.106,16.863 22.281,16.825 22.417,16.839 C22.554,16.854 22.707,16.980 22.845,16.930 C22.975,16.887 23.014,16.706 22.977,16.590 C22.933,16.460 22.768,16.424 22.779,16.265 C22.784,16.172 22.831,16.089 22.813,15.996 C22.799,15.921 22.761,15.854 22.743,15.779 C22.700,15.598 22.867,15.549 22.923,15.405 C22.951,15.329 22.964,15.138 23.092,15.223 C23.205,15.300 23.158,15.476 23.266,15.564 C23.392,15.670 23.563,15.600 23.690,15.535 C23.796,15.480 23.958,15.425 24.012,15.314 C24.088,15.163 23.947,14.988 24.138,14.892 C24.217,14.853 24.415,14.744 24.505,14.779 C24.587,14.810 24.616,14.902 24.675,14.961 C24.699,14.882 24.731,14.810 24.781,14.748 C24.889,14.613 25.040,14.518 25.035,14.330 C25.082,14.104 25.010,14.119 24.970,13.940 C24.961,13.858 24.888,13.292 25.017,13.315 C25.310,13.366 25.065,12.676 25.022,12.563 C25.008,12.523 24.942,12.470 24.895,12.448 C24.767,12.330 24.692,12.528 24.611,12.454 C24.512,12.332 24.530,12.133 24.515,11.982 C24.490,11.818 24.397,11.698 24.393,11.534 C24.391,11.455 23.924,10.932 24.021,10.856 C24.079,10.823 24.816,10.879 24.776,10.823 C24.654,10.644 24.704,10.469 24.461,10.371 C24.307,10.307 24.204,10.138 24.055,10.065 C23.983,10.030 23.679,9.806 23.937,9.790 C24.106,9.779 23.902,9.526 23.827,9.502 C23.735,9.473 23.742,9.752 23.654,9.509 C23.635,9.469 23.273,9.012 23.264,9.056 C23.252,9.127 23.343,9.225 23.333,9.307 C23.306,9.533 22.982,9.108 22.993,9.125 C22.933,9.059 22.694,8.882 22.666,8.802 C22.671,8.819 22.774,8.629 22.775,8.629 C22.833,8.553 22.774,8.467 22.707,8.398 C22.624,8.314 22.486,8.305 22.473,8.177 C22.471,8.157 22.374,7.979 22.459,7.982 C22.529,7.988 22.754,8.172 22.836,8.210 C23.061,8.314 22.996,8.383 23.128,8.505 C23.313,8.638 23.606,8.799 23.768,8.997 C23.793,9.043 24.122,9.380 24.134,9.252 C24.138,9.209 24.019,8.872 23.971,8.855 C23.971,8.855 23.755,8.580 23.750,8.556 C23.751,8.565 23.408,8.154 23.493,8.168 C23.624,8.192 24.093,8.542 24.064,8.677 C24.044,8.766 24.221,8.830 24.248,8.912 C24.255,8.935 24.567,9.221 24.611,9.241 C24.658,9.263 24.819,9.415 24.855,9.460 C24.920,9.506 24.972,9.462 24.994,9.578 C25.003,9.631 25.087,9.819 25.114,9.855 C25.193,9.961 25.247,10.125 25.294,10.249 C25.360,10.431 25.319,10.633 25.323,10.821 C25.342,10.874 25.233,10.938 25.240,11.005 C25.253,11.111 25.254,11.235 25.269,11.329 C25.283,11.426 25.466,11.679 25.436,11.759 C25.366,11.907 25.416,11.891 25.486,12.027 C25.533,12.120 25.436,12.159 25.479,12.277 C25.296,12.295 25.477,12.379 25.360,12.421 C25.254,12.435 25.222,12.414 25.132,12.483 C25.100,12.506 25.506,13.100 25.580,12.526 C25.600,12.372 25.765,12.220 25.921,12.157 C26.006,12.120 26.087,12.281 26.110,12.120 C26.115,12.075 26.029,11.929 26.071,11.909 C26.155,11.878 26.299,12.539 26.365,12.588 C26.529,12.703 26.642,12.893 26.664,13.093 C26.687,13.325 27.108,13.685 27.021,13.898 C26.960,14.050 26.984,14.494 27.000,14.662 C27.027,14.841 27.085,14.984 27.086,15.176 C27.086,15.280 27.016,15.531 27.063,15.619 C27Line truncated
</svg>

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

+1 -2
View File
@@ -14,7 +14,6 @@ browser.jar:
content/branding/icon16.png (../default16.png)
content/branding/icon32.png (../default32.png)
content/branding/icon128.png (../mozicon128.png)
content/branding/identity-icons-brand.png (identity-icons-brand.png)
content/branding/[email protected] ([email protected])
content/branding/identity-icons-brand.svg (identity-icons-brand.svg)
content/branding/silhouette-40.svg (silhouette-40.svg)
content/branding/aboutDialog.css (aboutDialog.css)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

@@ -0,0 +1,13 @@
<?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/. -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid" width="32" height="32" viewBox="0 0 32 32">
<style>
.cls-1 {
fill: #ff9500;
fill-rule: evenodd;
}
</style>
<path d="M26.797,6.125 C26.719,6.050 26.674,6.013 26.674,6.013 C26.715,6.045 26.756,6.082 26.797,6.125 M28.924,21.127 C28.947,20.948 28.949,20.780 28.929,20.626 C28.501,21.359 27.844,22.025 27.228,22.905 C27.980,22.421 28.624,21.866 28.924,21.127 ZM30.097,13.924 C30.082,13.747 30.062,13.570 30.036,13.394 C29.974,12.946 29.875,12.504 29.728,12.076 C29.735,12.102 29.741,12.129 29.747,12.155 C29.737,12.124 29.731,12.107 29.731,12.107 C29.731,12.107 29.614,12.472 29.435,13.070 C29.423,14.290 29.290,15.417 29.094,16.268 C29.419,15.962 29.657,15.599 29.820,15.196 C29.748,15.461 29.649,15.713 29.520,15.947 C29.361,16.217 29.182,16.436 29.009,16.610 C28.821,16.797 28.641,16.932 28.500,17.024 C28.543,16.905 28.585,16.773 28.625,16.631 C28.626,16.629 28.626,16.628 28.627,16.626 C28.637,16.590 28.647,16.552 28.657,16.513 C28.761,16.176 28.854,15.828 28.934,15.474 C29.049,14.961 29.137,14.433 29.192,13.898 C29.300,12.857 29.284,11.787 29.104,10.744 C29.015,10.227 28.886,9.717 28.712,9.220 C28.480,8.559 28.197,8.001 27.916,7.544 C27.895,7.508 27.874,7.472 27.853,7.436 C27.760,7.280 27.665,7.132 27.570,6.994 C27.258,6.543 26.939,6.200 26.674,6.013 C26.715,6.045 26.756,6.082 26.797,6.125 C26.719,6.050 26.674,6.013 26.674,6.013 C26.694,6.035 26.712,6.058 26.732,6.081 C26.682,6.033 26.653,6.008 26.653,6.008 C26.653,6.008 26.682,6.170 26.733,6.456 C25.969,5.218 24.807,4.635 24.807,4.635 C24.807,4.635 24.902,4.945 25.050,5.391 C25.741,5.949 26.345,6.571 26.869,7.227 C26.871,7.238 26.873,7.250 26.875,7.261 C26.905,7.435 26.938,7.624 26.973,7.826 C26.880,7.700 26.782,7.575 26.683,7.451 C25.589,5.958 24.211,4.706 22.611,3.779 C22.625,3.783 22.600,3.776 22.613,3.780 C20.672,2.647 18.429,2.000 16.039,2.000 C12.495,2.000 9.273,3.423 6.880,5.744 C6.814,5.809 7.271,6.270 7.404,6.311 C8.081,6.106 8.838,6.051 9.423,6.120 C9.705,5.897 9.663,5.963 9.961,5.769 L9.964,5.772 C11.767,4.606 13.854,3.982 16.035,3.982 C18.042,3.982 19.969,4.510 21.669,5.503 C22.118,5.635 22.683,5.830 23.182,6.091 C22.663,5.187 22.132,4.560 21.761,4.182 C23.311,5.364 24.150,6.425 24.701,7.396 C24.746,7.475 24.789,7.553 24.830,7.631 C24.928,7.816 25.017,7.998 25.099,8.177 C24.570,7.618 23.753,7.042 23.039,6.772 C22.981,6.750 22.924,6.730 22.868,6.712 C22.708,6.662 22.555,6.628 22.414,6.617 C23.550,7.488 25.407,9.978 25.432,13.744 C25.432,13.765 25.432,13.786 25.432,13.807 C25.432,14.010 25.428,14.216 25.417,14.427 C25.207,13.971 24.877,13.340 24.562,12.869 C24.483,12.751 24.405,12.644 24.330,12.551 C24.265,12.471 24.202,12.400 24.143,12.346 C24.479,15.517 24.324,16.750 24.116,17.651 C24.096,17.734 24.077,17.815 24.057,17.894 C24.015,18.058 23.973,18.216 23.934,18.378 C23.920,18.257 23.899,18.145 23.874,18.040 C23.816,17.791 23.735,17.585 23.666,17.424 C23.643,17.372 23.621,17.322 23.603,17.280 C23.603,17.280 23.581,17.854 23.325,18.780 C23.199,19.234 23.018,19.771 22.754,20.367 C22.294,21.408 21.823,21.903 21.501,22.062 C21.397,22.113 21.309,22.129 21.242,22.117 C21.167,22.112 21.126,22.079 21.127,22.076 C21.135,22.001 21.143,21.926 21.146,21.854 C21.150,21.754 21.145,21.662 21.119,21.593 C21.119,21.593 20.862,21.684 20.697,21.924 C20.630,22.020 20.544,22.115 20.431,22.203 C20.411,22.219 20.614,21.936 20.599,21.949 C20.499,22.033 20.392,22.130 20.285,22.245 C20.170,22.368 20.059,22.494 19.954,22.609 C19.699,22.887 19.483,23.095 19.352,23.001 C19.437,22.975 19.513,22.906 19.572,22.818 C19.635,22.726 19.680,22.613 19.699,22.500 C19.544,22.612 19.152,22.914 18.272,23.049 C18.109,23.074 17.707,23.146 17.127,23.121 C16.424,23.090 15.460,22.916 14.345,22.341 C14.578,22.313 14.903,22.241 15.196,22.312 C15.275,22.331 15.352,22.360 15.424,22.405 C15.392,22.369 15.355,22.338 15.315,22.310 C14.933,22.037 14.212,22.084 13.681,21.911 C13.170,21.744 12.503,21.005 12.119,20.631 C12.263,20.667 12.407,20.696 12.551,20.721 C12.652,20.738 12.752,20.753 12.852,20.765 C13.008,20.784 13.164,20.798 13.319,20.805 C14.486,20.856 15.595,20.569 16.313,20.063 C17.285,19.377 17.861,18.876 18.378,18.994 C18.428,19.006 18.476,19.010 18.522,19.010 C18.543,19.010 18.563,19.009 18.583,19.007 C18.867,18.975 19.053,18.730 19.002,18.441 C18.983,18.332 18.931,18.217 18.836,18.104 C18.561,17.778 18.016,17.375 17.274,17.265 C16.935,17.215 16.556,17.226 16.142,17.333 C15.385,17.528 14.711,18.047 13.824,18.051 C13.526,18.053 13.204,17.996 12.846,17.850 C12.759,17.815 12.671,17.774 12.580,17.728 C12.489,17.681 12.877,17.783 12.781,17.725 C12.508,17.621 12.011,17.386 11.888,17.297 C11.868,17.282 12.094,17.339 12.070,17.324 C10.721,16.501 10.809,15.842 10.809,15.435 C10.809,15.270 10.858,15.077 10.953,14.899 C11.046,14.723 11.183,14.563 11.362,14.461 C11.475,14.502 11.562,14.541 11.616,14.567 C11.655,14.586 11.677,14.598 11.677,14.598 C11.677,14.598 11.664,14.576 11.644,14.546 C11.613,14.499 11.565,14.428 11.530,14.386 C11.544,14.381 11.557,14.377 11.571,14.373 C11.665,14.406 11.829,14.468 11.985,14.532 C12.092,14.576 12.195,14.621 12.268,14.659 C12.514,14.786 12.596,14.916 12.596,14.916 C12.596,14.916 1Line truncated
</svg>

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

+1 -2
View File
@@ -13,7 +13,6 @@ browser.jar:
content/branding/icon16.png (../default16.png)
content/branding/icon32.png (../default32.png)
content/branding/icon128.png (../mozicon128.png)
content/branding/identity-icons-brand.png (identity-icons-brand.png)
content/branding/[email protected] ([email protected])
content/branding/identity-icons-brand.svg (identity-icons-brand.svg)
content/branding/silhouette-40.svg (silhouette-40.svg)
content/branding/aboutDialog.css (aboutDialog.css)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

@@ -0,0 +1,13 @@
<?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/. -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid" width="32" height="32" viewBox="0 0 32 32">
<style>
.cls-1 {
fill: #144787;
fill-rule: evenodd;
}
</style>
<path d="M15.953,30.000 C8.221,30.000 1.953,23.732 1.953,16.000 C1.953,8.268 8.221,2.000 15.953,2.000 C23.685,2.000 29.953,8.268 29.953,16.000 C29.953,23.732 23.685,30.000 15.953,30.000 ZM16.000,4.000 C9.373,4.000 4.000,9.373 4.000,16.000 C4.000,22.627 9.373,28.000 16.000,28.000 C22.627,28.000 28.000,22.627 28.000,16.000 C28.000,9.373 22.627,4.000 16.000,4.000 ZM27.085,16.311 C27.142,16.652 27.085,17.189 26.942,17.483 C26.885,17.958 26.784,18.470 26.561,18.931 C26.407,19.254 26.189,19.798 25.772,19.846 C25.646,19.858 25.319,20.214 25.283,20.155 C25.208,20.028 25.155,19.869 24.999,19.809 C24.873,19.751 24.990,19.698 24.895,19.643 C24.828,19.607 24.816,19.527 24.803,19.452 C24.756,19.459 24.710,19.469 24.668,19.492 C24.580,19.543 24.528,19.636 24.445,19.693 C24.391,19.671 24.300,19.631 24.307,19.561 C24.235,19.627 24.158,19.762 24.088,19.660 C24.030,19.576 24.071,19.459 24.068,19.367 C24.064,19.275 23.978,19.139 23.883,19.254 C23.816,19.334 23.769,19.345 23.665,19.365 C23.570,19.385 23.496,19.449 23.395,19.450 C23.156,19.456 23.176,19.563 23.117,19.744 C23.063,19.902 22.845,19.920 22.750,20.050 C22.700,20.117 22.549,20.431 22.421,20.318 C22.319,20.227 22.581,19.988 22.581,19.868 C22.581,19.767 22.498,19.709 22.475,19.618 C22.457,19.552 22.479,19.498 22.403,19.463 C22.448,19.376 22.500,19.239 22.455,19.142 C22.398,19.015 22.189,19.130 22.139,19.206 C22.088,19.277 21.964,19.523 21.848,19.374 C21.819,19.341 21.840,19.299 21.785,19.301 C21.747,19.301 21.720,19.325 21.702,19.354 C21.621,19.328 21.652,19.254 21.682,19.199 C21.770,19.040 21.781,18.864 21.900,18.718 C22.026,18.561 22.220,18.468 22.333,18.301 C22.372,18.242 22.441,18.131 22.385,18.064 C22.364,18.038 22.326,18.027 22.313,17.995 C22.297,17.956 22.315,17.913 22.310,17.874 C22.268,17.891 22.222,17.909 22.175,17.894 C22.169,17.851 22.175,17.805 22.164,17.761 C22.108,17.783 22.049,17.851 21.982,17.836 C21.919,17.823 21.927,17.867 21.857,17.865 C21.916,17.772 21.952,17.667 22.015,17.575 C22.051,17.521 22.101,17.473 22.130,17.413 C22.198,17.271 22.058,17.158 22.081,17.020 C22.106,16.863 22.281,16.825 22.417,16.839 C22.554,16.854 22.707,16.980 22.845,16.930 C22.975,16.887 23.014,16.706 22.977,16.590 C22.933,16.460 22.768,16.424 22.779,16.265 C22.784,16.172 22.831,16.089 22.813,15.996 C22.799,15.921 22.761,15.854 22.743,15.779 C22.700,15.598 22.867,15.549 22.923,15.405 C22.951,15.329 22.964,15.138 23.092,15.223 C23.205,15.300 23.158,15.476 23.266,15.564 C23.392,15.670 23.563,15.600 23.690,15.535 C23.796,15.480 23.958,15.425 24.012,15.314 C24.088,15.163 23.947,14.988 24.138,14.892 C24.217,14.853 24.415,14.744 24.505,14.779 C24.587,14.810 24.616,14.902 24.675,14.961 C24.699,14.882 24.731,14.810 24.781,14.748 C24.889,14.613 25.040,14.518 25.035,14.330 C25.082,14.104 25.010,14.119 24.970,13.940 C24.961,13.858 24.888,13.292 25.017,13.315 C25.310,13.366 25.065,12.676 25.022,12.563 C25.008,12.523 24.942,12.470 24.895,12.448 C24.767,12.330 24.692,12.528 24.611,12.454 C24.512,12.332 24.530,12.133 24.515,11.982 C24.490,11.818 24.397,11.698 24.393,11.534 C24.391,11.455 23.924,10.932 24.021,10.856 C24.079,10.823 24.816,10.879 24.776,10.823 C24.654,10.644 24.704,10.469 24.461,10.371 C24.307,10.307 24.204,10.138 24.055,10.065 C23.983,10.030 23.679,9.806 23.937,9.790 C24.106,9.779 23.902,9.526 23.827,9.502 C23.735,9.473 23.742,9.752 23.654,9.509 C23.635,9.469 23.273,9.012 23.264,9.056 C23.252,9.127 23.343,9.225 23.333,9.307 C23.306,9.533 22.982,9.108 22.993,9.125 C22.933,9.059 22.694,8.882 22.666,8.802 C22.671,8.819 22.774,8.629 22.775,8.629 C22.833,8.553 22.774,8.467 22.707,8.398 C22.624,8.314 22.486,8.305 22.473,8.177 C22.471,8.157 22.374,7.979 22.459,7.982 C22.529,7.988 22.754,8.172 22.836,8.210 C23.061,8.314 22.996,8.383 23.128,8.505 C23.313,8.638 23.606,8.799 23.768,8.997 C23.793,9.043 24.122,9.380 24.134,9.252 C24.138,9.209 24.019,8.872 23.971,8.855 C23.971,8.855 23.755,8.580 23.750,8.556 C23.751,8.565 23.408,8.154 23.493,8.168 C23.624,8.192 24.093,8.542 24.064,8.677 C24.044,8.766 24.221,8.830 24.248,8.912 C24.255,8.935 24.567,9.221 24.611,9.241 C24.658,9.263 24.819,9.415 24.855,9.460 C24.920,9.506 24.972,9.462 24.994,9.578 C25.003,9.631 25.087,9.819 25.114,9.855 C25.193,9.961 25.247,10.125 25.294,10.249 C25.360,10.431 25.319,10.633 25.323,10.821 C25.342,10.874 25.233,10.938 25.240,11.005 C25.253,11.111 25.254,11.235 25.269,11.329 C25.283,11.426 25.466,11.679 25.436,11.759 C25.366,11.907 25.416,11.891 25.486,12.027 C25.533,12.120 25.436,12.159 25.479,12.277 C25.296,12.295 25.477,12.379 25.360,12.421 C25.254,12.435 25.222,12.414 25.132,12.483 C25.100,12.506 25.506,13.100 25.580,12.526 C25.600,12.372 25.765,12.220 25.921,12.157 C26.006,12.120 26.087,12.281 26.110,12.120 C26.115,12.075 26.029,11.929 26.071,11.909 C26.155,11.878 26.299,12.539 26.365,12.588 C26.529,12.703 26.642,12.893 26.664,13.093 C26.687,13.325 27.108,13.685 27.021,13.898 C26.960,14.050 26.984,14.494 27.000,14.662 C27.027,14.841 27.085,14.984 27.086,15.176 C27.086,15.280 27.016,15.531 27.063,15.619 C27Line truncated
</svg>

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

+1 -2
View File
@@ -14,7 +14,6 @@ browser.jar:
content/branding/icon16.png (../default16.png)
content/branding/icon32.png (../default32.png)
content/branding/icon128.png (../mozicon128.png)
content/branding/identity-icons-brand.png (identity-icons-brand.png)
content/branding/[email protected] ([email protected])
content/branding/identity-icons-brand.svg (identity-icons-brand.svg)
content/branding/silhouette-40.svg (silhouette-40.svg)
content/branding/aboutDialog.css (aboutDialog.css)
@@ -638,6 +638,7 @@ loop.roomViews = (function(mozL10n) {
return true;
case ROOM_STATES.READY:
case ROOM_STATES.GATHER:
case ROOM_STATES.INIT:
case ROOM_STATES.JOINING:
case ROOM_STATES.SESSION_CONNECTED:
@@ -638,6 +638,7 @@ loop.roomViews = (function(mozL10n) {
return true;
case ROOM_STATES.READY:
case ROOM_STATES.GATHER:
case ROOM_STATES.INIT:
case ROOM_STATES.JOINING:
case ROOM_STATES.SESSION_CONNECTED:
@@ -372,6 +372,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
return true;
case ROOM_STATES.READY:
case ROOM_STATES.GATHER:
case ROOM_STATES.INIT:
case ROOM_STATES.JOINING:
case ROOM_STATES.SESSION_CONNECTED:
@@ -372,6 +372,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
return true;
case ROOM_STATES.READY:
case ROOM_STATES.GATHER:
case ROOM_STATES.INIT:
case ROOM_STATES.JOINING:
case ROOM_STATES.SESSION_CONNECTED:
@@ -343,6 +343,9 @@ trackingProtection.intro.description=When the shield is visible, that means Fire
trackingProtection.intro.step1of3=1 of 3
trackingProtection.intro.nextButton.label=Next
trackingProtection.icon.activeTooltip=Tracking attempts blocked
trackingProtection.icon.disabledTooltip=Tracking content detected
# Edit Bookmark UI
editBookmarkPanel.pageBookmarkedTitle=Page Bookmarked
editBookmarkPanel.pageBookmarkedDescription=%S will always remember this page for you.
+2 -2
View File
@@ -34,7 +34,7 @@
--toolbarbutton-combined-boxshadow: 0 0 0 1px hsla(0,0%,100%,.2);
--toolbarbutton-combined-backgroundimage: linear-gradient(hsla(210,54%,20%,.2) 0, hsla(210,54%,20%,.2) 18px);
--verified-identity-box-backgroundcolor: #fff;
--identity-box-verified-background-color: #fff;
}
#menubar-items {
@@ -986,7 +986,7 @@ toolbarbutton[constrain-size="true"][cui-areatype="toolbar"] > .toolbarbutton-ba
}
#identity-box.verifiedIdentity:not(:-moz-lwtheme):not(:hover):not([open=true]) {
background-color: var(--verified-identity-box-backgroundcolor);
background-color: var(--identity-box-verified-background-color);
}
#identity-box:-moz-focusring {
@@ -174,16 +174,6 @@ panelmultiview[nosubviews=true] > .panel-viewcontainer > .panel-viewstack > .pan
flex-direction: column;
}
#app-extension-point-end > #PanelUI-menu-button {
padding: 2px 5px;
}
#app-extension-point-end > #PanelUI-menu-button .toolbarbutton-text {
display: none;
}
#app-extension-point-end > #PanelUI-menu-button .toolbarbutton-icon {
margin: 0;
}
#PanelUI-popup > arrowscrollbox > autorepeatbutton {
display: none;
}
+1 -1
View File
@@ -63,7 +63,7 @@
:root[devtoolstheme="dark"] #identity-box {
--identity-box-border-color: #5F6670;
--identity-box-chrome-color: #46afe3;
--verified-identity-box-background-color: transparent;
--identity-box-verified-background-color: transparent;
--identity-box-selected-background-color: rgba(231,230,230,.2);
}
@@ -18,7 +18,7 @@
%endif
%endif
border-inline-end: 1px solid;
border-inline-end: 1px solid var(--identity-box-border-color);
border-image: linear-gradient(transparent 15%,
var(--identity-box-border-color) 15%,
var(--identity-box-border-color) 85%,
@@ -33,6 +33,7 @@
#identity-box:hover,
#identity-box[open=true] {
background-color: var(--identity-box-selected-background-color);
border-image-source: none;
}
#urlbar[pageproxystate="valid"] > #identity-box.verifiedIdentity {
@@ -119,8 +120,7 @@
}
.chromeUI > #page-proxy-favicon[pageproxystate="valid"] {
list-style-image: url(chrome://branding/content/identity-icons-brand.png);
-moz-image-region: rect(0, 16px, 16px, 0);
list-style-image: url(chrome://branding/content/identity-icons-brand.svg);
}
.verifiedDomain > #page-proxy-favicon[pageproxystate="valid"],
@@ -146,13 +146,6 @@
opacity: 0.3;
}
@media (min-resolution: 1.1dppx) {
.chromeUI > #page-proxy-favicon[pageproxystate="valid"] {
list-style-image: url(chrome://branding/content/[email protected]);
-moz-image-region: rect(0, 32px, 32px, 0);
}
}
#urlbar[actiontype="searchengine"] > #identity-box > #page-proxy-favicon {
-moz-image-region: inherit;
list-style-image: url(chrome://global/skin/icons/autocomplete-search.svg#search-icon);
+4 -2
View File
@@ -38,7 +38,7 @@
--toolbarbutton-combined-boxshadow: none;
--toolbarbutton-combined-backgroundimage: linear-gradient(hsla(210,54%,20%,.2) 0, hsla(210,54%,20%,.2) 16px);
--verified-identity-box-backgroundcolor: #FFF;
--identity-box-verified-background-color: #fff;
--urlbar-dropmarker-url: url("chrome://browser/skin/urlbar-history-dropmarker.png");
--urlbar-dropmarker-region: rect(0px, 11px, 14px, 0px);
@@ -1261,6 +1261,8 @@ toolbarbutton[constrain-size="true"][cui-areatype="toolbar"] > .toolbarbutton-ba
.searchbar-textbox {
font-size: 1.15em;
min-height: 28px;
transition-property: border-color, box-shadow;
transition-duration: .1s;
}
:root {
@@ -1435,7 +1437,7 @@ html|*.urlbar-input:-moz-lwtheme::-moz-placeholder,
}
#identity-box.verifiedIdentity:not(:-moz-lwtheme):not(:hover):not([open=true]) {
background-color: var(--verified-identity-box-backgroundcolor);
background-color: var(--identity-box-verified-background-color);
}
#identity-box:-moz-focusring {
@@ -953,10 +953,12 @@ Convert(BluetoothPropertyType aIn, uint8_t& aOut)
nsresult
Convert(const BluetoothRemoteName& aIn, nsAString& aOut)
{
const char* name = reinterpret_cast<const char*>(aIn.mName);
// We construct an nsCString here because the string
// returned from the PDU is not 0-terminated.
aOut = NS_ConvertUTF8toUTF16(
nsCString(reinterpret_cast<const char*>(aIn.mName), sizeof(aIn.mName)));
nsCString(name, strnlen(name, sizeof(aIn.mName))));
return NS_OK;
}
+2 -1
View File
@@ -19,7 +19,8 @@ function isNetworkReady() {
SpecialPowers.Ci.nsINetworkInterfaceListService.LIST_NOT_INCLUDE_MMS_INTERFACES |
SpecialPowers.Ci.nsINetworkInterfaceListService.LIST_NOT_INCLUDE_SUPL_INTERFACES |
SpecialPowers.Ci.nsINetworkInterfaceListService.LIST_NOT_INCLUDE_IMS_INTERFACES |
SpecialPowers.Ci.nsINetworkInterfaceListService.LIST_NOT_INCLUDE_DUN_INTERFACES);
SpecialPowers.Ci.nsINetworkInterfaceListService.LIST_NOT_INCLUDE_DUN_INTERFACES |
SpecialPowers.Ci.nsINetworkInterfaceListService.LIST_NOT_INCLUDE_FOTA_INTERFACES);
var num = itfList.getNumberOfInterface();
for (var i = 0; i < num; i++) {
var ips = {};
+24 -14
View File
@@ -276,28 +276,38 @@ MobileMessageCallback::NotifyGetSegmentInfoForTextFailed(int32_t aError)
}
NS_IMETHODIMP
MobileMessageCallback::NotifyGetSmscAddress(const nsAString& aSmscAddress)
MobileMessageCallback::NotifyGetSmscAddress(const nsAString& aSmscAddress,
uint32_t aTypeOfNumber,
uint32_t aNumberPlanIdentification)
{
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.Init(mDOMRequest->GetOwner()))) {
return NotifyError(nsIMobileMessageCallback::INTERNAL_ERROR);
}
JSContext* cx = jsapi.cx();
JSString* smsc = JS_NewUCStringCopyN(cx, aSmscAddress.BeginReading(),
aSmscAddress.Length());
TypeOfAddress toa;
if (!smsc) {
return NotifyError(nsIMobileMessageCallback::INTERNAL_ERROR);
}
// Check the value is valid and set TON accordingly.
bool isTonValid = aTypeOfNumber < uint32_t(TypeOfNumber::EndGuard_);
toa.mTypeOfNumber = (isTonValid) ?
static_cast<TypeOfNumber>(aTypeOfNumber) : TypeOfNumber::Unknown;
JS::Rooted<JS::Value> val(cx, JS::StringValue(smsc));
return NotifySuccess(val);
// Check the value is valid and set NPI accordingly.
bool isNpiValid =
aNumberPlanIdentification < uint32_t(NumberPlanIdentification::EndGuard_);
toa.mNumberPlanIdentification = (isNpiValid) ?
static_cast<NumberPlanIdentification>(aNumberPlanIdentification) :
NumberPlanIdentification::Unknown;
SmscAddress smsc;
smsc.mTypeOfAddress = toa;
smsc.mAddress.Construct(nsString(aSmscAddress));
mPromise->MaybeResolve(smsc);
return NS_OK;
}
NS_IMETHODIMP
MobileMessageCallback::NotifyGetSmscAddressFailed(int32_t aError)
{
return NotifyError(aError);
const nsAString& errorStr = ConvertErrorCodeToErrorString(aError);
mPromise->MaybeRejectBrokenly(errorStr);
return NS_OK;
}
NS_IMETHODIMP
+19 -7
View File
@@ -725,7 +725,7 @@ MobileMessageManager::Observe(nsISupports* aSubject, const char* aTopic,
return NS_OK;
}
already_AddRefed<DOMRequest>
already_AddRefed<Promise>
MobileMessageManager::GetSmscAddress(const Optional<uint32_t>& aServiceId,
ErrorResult& aRv)
{
@@ -754,15 +754,27 @@ MobileMessageManager::GetSmscAddress(const Optional<uint32_t>& aServiceId,
return nullptr;
}
nsRefPtr<DOMRequest> request = new DOMRequest(window);
nsCOMPtr<nsIMobileMessageCallback> msgCallback = new MobileMessageCallback(request);
rv = smsService->GetSmscAddress(serviceId, msgCallback);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(window);
if (!global) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
return request.forget();
nsRefPtr<Promise> promise = Promise::Create(global, aRv);
if (aRv.Failed()) {
return nullptr;
}
nsCOMPtr<nsIMobileMessageCallback> msgCallback =
new MobileMessageCallback(promise);
rv = smsService->GetSmscAddress(serviceId, msgCallback);
if (NS_FAILED(rv)) {
promise->MaybeReject(rv);
return promise.forget();
}
return promise.forget();
}
already_AddRefed<Promise>
+1 -1
View File
@@ -114,7 +114,7 @@ public:
RetrieveMMS(nsIDOMMozMmsMessage* aMessage,
ErrorResult& aRv);
already_AddRefed<DOMRequest>
already_AddRefed<Promise>
GetSmscAddress(const Optional<uint32_t>& aServiceId,
ErrorResult& aRv);
+3 -1
View File
@@ -1031,7 +1031,9 @@ SmsService.prototype = {
null,
(aResponse) => {
if (!aResponse.errorMsg) {
aRequest.notifyGetSmscAddress(aResponse.smscAddress);
aRequest.notifyGetSmscAddress(aResponse.smscAddress,
aResponse.typeOfNumber,
aResponse.numberPlanIdentification);
} else {
aRequest.notifyGetSmscAddressFailed(
Ci.nsIMobileMessageCallback.NOT_FOUND_ERROR);
@@ -4,7 +4,7 @@
#include "nsISupports.idl"
[scriptable, uuid(b1367554-51c6-4153-b20a-effec50ca827)]
[scriptable, uuid(609692b0-1fc7-404a-91c4-eb2ec4d16c20)]
interface nsIMobileMessageCallback : nsISupports
{
/**
@@ -52,7 +52,9 @@ interface nsIMobileMessageCallback : nsISupports
/**
* SMSC Address get/set result
*/
void notifyGetSmscAddress(in DOMString aSmscAddress);
void notifyGetSmscAddress(in DOMString aSmscAddress,
in unsigned long aTypeOfNumber,
in unsigned long aNumberPlanIdentification);
void notifyGetSmscAddressFailed(in long error);
void notifySetSmscAddress();
void notifySetSmscAddressFailed(in long error);
@@ -53,7 +53,10 @@ interface nsISmsService : nsISupports
/**
* Constant definitions of SM-RP number plan identification as defined in
* |Table 10.5.118: Called party BCD number| of 3GPP TS 24.008.
* |Table 10.5.118: Called party BCD number| of 3GPP TS 24.008. These values
* do not represent the actual protocol values defined in the 3GPP standard,
* but rather the corresponding enum values of NumberPlanIdentification in
* MozMobileMessageManager.
*/
const unsigned short NUMBER_PLAN_IDENTIFICATION_UNKNOWN = 0;
const unsigned short NUMBER_PLAN_IDENTIFICATION_ISDN = 1;
+2
View File
@@ -87,6 +87,8 @@ struct ReplyGetSegmentInfoForTextFail
struct ReplyGetSmscAddress
{
nsString smscAddress;
uint32_t typeOfNumber;
uint32_t numberPlanIdentification;
};
struct ReplyGetSmscAddressFail
+3 -1
View File
@@ -259,7 +259,9 @@ SmsRequestChild::Recv__delete__(const MessageReply& aReply)
aReply.get_ReplyGetSegmentInfoForTextFail().error());
break;
case MessageReply::TReplyGetSmscAddress:
mReplyRequest->NotifyGetSmscAddress(aReply.get_ReplyGetSmscAddress().smscAddress());
mReplyRequest->NotifyGetSmscAddress(aReply.get_ReplyGetSmscAddress().smscAddress(),
aReply.get_ReplyGetSmscAddress().typeOfNumber(),
aReply.get_ReplyGetSmscAddress().numberPlanIdentification());
break;
case MessageReply::TReplyGetSmscAddressFail:
mReplyRequest->NotifyGetSmscAddressFailed(aReply.get_ReplyGetSmscAddressFail().error());
+6 -2
View File
@@ -761,9 +761,13 @@ SmsRequestParent::NotifyGetSegmentInfoForTextFailed(int32_t aError)
}
NS_IMETHODIMP
SmsRequestParent::NotifyGetSmscAddress(const nsAString& aSmscAddress)
SmsRequestParent::NotifyGetSmscAddress(const nsAString& aSmscAddress,
uint32_t aTypeOfNumber,
uint32_t aNumberPlanIdentification)
{
return SendReply(ReplyGetSmscAddress(nsString(aSmscAddress)));
return SendReply(ReplyGetSmscAddress(nsString(aSmscAddress),
aTypeOfNumber,
aNumberPlanIdentification));
}
NS_IMETHODIMP
@@ -14,59 +14,53 @@ const SMSC_DEF_TEXT = '"+123456789",145';
const SMSC_TON_UNKNOWN = '0407485455'
const SMSC_TON_UNKNOWN_TEXT = '"0407485455",129';
function getSmscAddress() {
return new Promise((resolve, reject) => {
let req = manager.getSmscAddress();
if (!req) {
reject("manager.getSmscAddress() returns null.");
}
function verifySmscAddress(smsc, expectedAddr, expectedTon, expectedNpi) {
is(smsc.address, expectedAddr);
is(smsc.typeOfAddress.typeOfNumber, expectedTon);
is(smsc.typeOfAddress.numberPlanIdentification, expectedNpi);
}
req.onsuccess = function() {
resolve(this.result);
};
startTestCommon(function testCaseMain() {
return Promise.resolve()
req.onerror = function() {
reject(this.error);
};
});
};
// Verify setting AT&T SMSC address.
.then(() => manager.setSmscAddress({ address:SMSC_ATT }))
.then(() => manager.getSmscAddress())
.then((result) =>
verifySmscAddress(result, SMSC_ATT, "international", "isdn"))
startTestBase(function testCaseMain() {
return ensureMobileMessage()
// Verify setting O2 SMSC address.
.then(() => manager.setSmscAddress({ address:SMSC_O2 }))
.then(() => manager.getSmscAddress())
.then((result) =>
verifySmscAddress(result, SMSC_O2, "international", "isdn"))
// Verify setting AT&T SMSC address.
.then(() => manager.setSmscAddress({ address:SMSC_ATT }))
.then(() => getSmscAddress())
.then((result) => is(result, SMSC_ATT_TEXT))
// Verify setting AT&T SMSC address with extra illegal characters.
.then(() => manager.setSmscAddress({ address:SMSC_ATT_TYPO }))
.then(() => manager.getSmscAddress())
.then((result) =>
verifySmscAddress(result, SMSC_ATT, "international", "isdn"))
// Verify setting O2 SMSC address.
.then(() => manager.setSmscAddress({ address:SMSC_O2 }))
.then(() => getSmscAddress())
.then((result) => is(result, SMSC_O2_TEXT))
// Verify setting a SMSC address with TON=unknown.
.then(() => manager.setSmscAddress({ address:SMSC_TON_UNKNOWN }))
.then(() => manager.getSmscAddress())
.then((result) =>
verifySmscAddress(result, SMSC_TON_UNKNOWN, "unknown", "isdn"))
// Verify setting AT&T SMSC address with extra illegal characters.
.then(() => manager.setSmscAddress({ address:SMSC_ATT_TYPO }))
.then(() => getSmscAddress())
.then((result) => is(result, SMSC_ATT_TEXT))
// Verify setting invalid SMSC address.
.then(() => manager.setSmscAddress({}))
.then(() => Promise.reject("Expect for an error."),
(err) => log("Got expected error: " + err))
.then(() => manager.setSmscAddress({ address:"" }))
.then(() => Promise.reject("Expect for an error."),
(err) => log("Got expected error: " + err))
.then(() => manager.setSmscAddress({ address:"???" }))
.then(() => Promise.reject("Expect for an error."),
(err) => log("Got expected error: " + err))
// Verify setting a SMSC address with TON=unknown.
.then(() => manager.setSmscAddress({ address:SMSC_TON_UNKNOWN }))
.then(() => getSmscAddress())
.then((result) => is(result, SMSC_TON_UNKNOWN_TEXT))
// Verify setting invalid SMSC address.
.then(() => manager.setSmscAddress({}))
.then(() => Promise.reject("Expect for an error."),
(err) => log("Got expected error: " + err))
.then(() => manager.setSmscAddress({ address:"" }))
.then(() => Promise.reject("Expect for an error."),
(err) => log("Got expected error: " + err))
.then(() => manager.setSmscAddress({ address:"???" }))
.then(() => Promise.reject("Expect for an error."),
(err) => log("Got expected error: " + err))
// Restore to default emulator SMSC address.
.then(() => manager.setSmscAddress({ address:SMSC_DEF }))
.then(() => getSmscAddress())
.then((result) => is(result, SMSC_DEF_TEXT));
// Restore to default emulator SMSC address.
.then(() => manager.setSmscAddress({ address:SMSC_DEF }))
.then(() => manager.getSmscAddress())
.then((result) =>
verifySmscAddress(result, SMSC_DEF, "international", "isdn"));
});
@@ -2,77 +2,21 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 60000;
SpecialPowers.addPermission("sms", true, document);
MARIONETTE_HEAD_JS = 'head.js';
// Expected SMSC addresses of emulator
const SMSC = "\"+123456789\",145";
const SMSC = "+123456789";
const TON = "international";
const NPI = "isdn";
let manager = window.navigator.mozMobileMessage;
function verifySmscAddress(smsc, expectedAddr, expectedTon, expectedNpi) {
is(smsc.address, expectedAddr);
is(smsc.typeOfAddress.typeOfNumber, expectedTon);
is(smsc.typeOfAddress.numberPlanIdentification, expectedNpi);
}
let tasks = {
// List of test fuctions. Each of them should call |tasks.next()| when
// completed or |tasks.finish()| to jump to the last one.
_tasks: [],
_nextTaskIndex: 0,
push: function(func) {
this._tasks.push(func);
},
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
task();
} catch (ex) {
ok(false, "test task[" + index + "] throws: " + ex);
// Run last task as clean up if possible.
if (index != this._tasks.length - 1) {
this.finish();
}
}
},
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function() {
this.next();
}
};
tasks.push(function init() {
log("Initialize test object.");
ok(manager instanceof MozMobileMessageManager,
"manager is instance of " + manager.constructor);
tasks.next();
startTestCommon(function testCaseMain() {
return Promise.resolve()
.then(() => manager.getSmscAddress())
.then((result) => verifySmscAddress(result, SMSC, TON, NPI));
});
tasks.push(function readSmscAddress() {
log("read SMSC address");
let req = manager.getSmscAddress();
ok(req, "DOMRequest object for getting smsc address");
req.onsuccess = function(e) {
is(e.target.result, SMSC, "SMSC address");
tasks.next();
};
req.onerror = function(error) {
ok(false, "readSmscAddress(): Received 'onerror'");
tasks.finish();
};
});
// WARNING: All tasks should be pushed before this!!!
tasks.push(function cleanUp() {
manager.onreceived = null;
SpecialPowers.removePermission("sms", document);
finish();
});
// Start the test
tasks.run();
+5 -1
View File
@@ -68,6 +68,7 @@ const NETWORK_TYPE_MOBILE_MMS = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS;
const NETWORK_TYPE_MOBILE_SUPL = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL;
const NETWORK_TYPE_MOBILE_IMS = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_IMS;
const NETWORK_TYPE_MOBILE_DUN = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN;
const NETWORK_TYPE_MOBILE_FOTA = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_FOTA;
const NETWORK_STATE_UNKNOWN = Ci.nsINetworkInterface.NETWORK_STATE_UNKNOWN;
const NETWORK_STATE_CONNECTING = Ci.nsINetworkInterface.NETWORK_STATE_CONNECTING;
@@ -444,6 +445,8 @@ DataCallHandler.prototype = {
return NETWORK_TYPE_MOBILE_IMS;
case "dun":
return NETWORK_TYPE_MOBILE_DUN;
case "fota":
return NETWORK_TYPE_MOBILE_FOTA;
default:
return NETWORK_TYPE_UNKNOWN;
}
@@ -688,7 +691,8 @@ DataCallHandler.prototype = {
aNetworkType === NETWORK_TYPE_MOBILE_MMS ||
aNetworkType === NETWORK_TYPE_MOBILE_SUPL ||
aNetworkType === NETWORK_TYPE_MOBILE_IMS ||
aNetworkType === NETWORK_TYPE_MOBILE_DUN) {
aNetworkType === NETWORK_TYPE_MOBILE_DUN ||
aNetworkType === NETWORK_TYPE_MOBILE_FOTA) {
return true;
}
@@ -41,7 +41,10 @@ NetworkInterfaceListService.prototype = {
LIST_NOT_INCLUDE_IMS_INTERFACES) != 0,
excludeDun: (aConditions &
Ci.nsINetworkInterfaceListService.
LIST_NOT_INCLUDE_DUN_INTERFACES) != 0
LIST_NOT_INCLUDE_DUN_INTERFACES) != 0,
excludeFota: (aConditions &
Ci.nsINetworkInterfaceListService.
LIST_NOT_INCLUDE_FOTA_INTERFACES) != 0
}
)[0]);
}
+5 -2
View File
@@ -228,13 +228,15 @@ NetworkManager.prototype = {
let excludeSupl = aMsg.json.excludeSupl;
let excludeIms = aMsg.json.excludeIms;
let excludeDun = aMsg.json.excludeDun;
let excludeFota = aMsg.json.excludeFota;
let interfaces = [];
for each (let i in this.networkInterfaces) {
if ((i.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS && excludeMms) ||
(i.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL && excludeSupl) ||
(i.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_IMS && excludeIms) ||
(i.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN && excludeDun)) {
(i.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN && excludeDun) ||
(i.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_FOTA && excludeFota)) {
continue;
}
@@ -614,7 +616,8 @@ NetworkManager.prototype = {
return (type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL ||
type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_IMS ||
type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN);
type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN ||
type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_FOTA);
},
isNetworkTypeMobile: function(type) {
-5
View File
@@ -60,13 +60,8 @@ const kPrefRilDebuggingEnabled = "ril.debugging.enabled";
const RADIO_POWER_OFF_TIMEOUT = 30000;
const HW_DEFAULT_CLIENT_ID = 0;
const NETWORK_TYPE_UNKNOWN = Ci.nsINetworkInterface.NETWORK_TYPE_UNKNOWN;
const NETWORK_TYPE_WIFI = Ci.nsINetworkInterface.NETWORK_TYPE_WIFI;
const NETWORK_TYPE_MOBILE = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE;
const NETWORK_TYPE_MOBILE_MMS = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS;
const NETWORK_TYPE_MOBILE_SUPL = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL;
const NETWORK_TYPE_MOBILE_IMS = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_IMS;
const NETWORK_TYPE_MOBILE_DUN = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN;
// TODO: Bug 815526, deprecate RILContentHelper.
const RIL_IPC_ICCMANAGER_MSG_NAMES = [
+1 -1
View File
@@ -5,7 +5,7 @@
#include "nsISupports.idl"
#include "nsINetworkManager.idl"
[scriptable, uuid(e48d290b-ea3b-4987-9333-2e01f64c92ba)]
[scriptable, uuid(b8ce8528-fce8-4b5e-9d0a-c3247296ccaf)]
interface nsIRilNetworkInterface : nsINetworkInterface
{
readonly attribute unsigned long serviceId;
@@ -20,13 +20,14 @@ interface nsINetworkInterfaceList : nsISupports
nsINetworkInterface getInterface(in long interfaceIndex);
};
[scriptable, uuid(ee0e7cd7-1baa-44fd-86cb-f70acb549163)]
[scriptable, uuid(21d7fc8b-28c4-4a4f-a15e-1f9defbc2cec)]
interface nsINetworkInterfaceListService : nsISupports
{
const long LIST_NOT_INCLUDE_MMS_INTERFACES = (1 << 0);
const long LIST_NOT_INCLUDE_SUPL_INTERFACES = (1 << 1);
const long LIST_NOT_INCLUDE_IMS_INTERFACES = (1 << 2);
const long LIST_NOT_INCLUDE_DUN_INTERFACES = (1 << 3);
const long LIST_NOT_INCLUDE_FOTA_INTERFACES = (1 << 4);
/**
* Obtain a list of network interfaces that satisfy the specified condition.
+2 -1
View File
@@ -7,7 +7,7 @@
/**
* Information about networks that is exposed to network manager API consumers.
*/
[scriptable, uuid(cb62ae03-6bda-43ff-9560-916d60203d33)]
[scriptable, uuid(12da2bfd-0801-40d9-9c2e-768868526065)]
interface nsINetworkInterface : nsISupports
{
const long NETWORK_STATE_UNKNOWN = -1;
@@ -32,6 +32,7 @@ interface nsINetworkInterface : nsISupports
const long NETWORK_TYPE_WIFI_P2P = 4;
const long NETWORK_TYPE_MOBILE_IMS = 5;
const long NETWORK_TYPE_MOBILE_DUN = 6;
const long NETWORK_TYPE_MOBILE_FOTA = 7;
/**
* Network type. One of the NETWORK_TYPE_* constants.
+2 -1
View File
@@ -1411,7 +1411,8 @@ this.CALLED_PARTY_BCD_NPI_PRIVATE = 9;
/**
* Array of number plan identification values which can be used to map an
* enumeration to the corresponding value.
* enumeration to the corresponding value. The indices should be consistent
* with nsISmsService::NUMBER_PLAN_IDENTIFICATION_* constants.
*/
this.CALLED_PARTY_BCD_NPI = [
CALLED_PARTY_BCD_NPI_UNKNOWN,
+84 -22
View File
@@ -170,7 +170,6 @@ RilObject.prototype = {
this.IMEISV = null;
this.ESN = null;
this.MEID = null;
this.SMSC = null;
/**
* ICC information that is not exposed to Gaia.
@@ -1621,17 +1620,7 @@ RilObject.prototype = {
* Get the Short Message Service Center address.
*/
getSmscAddress: function(options) {
if (!this.SMSC) {
this.context.Buf.simpleRequest(REQUEST_GET_SMSC_ADDRESS, options);
return;
}
if (!options || options.rilMessageType !== "getSmscAddress") {
return;
}
options.smscAddress = this.SMSC;
this.sendChromeMessage(options);
this.context.Buf.simpleRequest(REQUEST_GET_SMSC_ADDRESS, options);
},
/**
@@ -1643,8 +1632,8 @@ RilObject.prototype = {
* Type of number in integer, as defined in
* |Table 10.5.118: Called party BCD number| of 3GPP TS 24.008.
* @param numberPlanIdentification
* Number plan identification in integer, as defined in
* |Table 10.5.118: Called party BCD number| of 3GPP TS 24.008.
* The index of number plan identification value in
* CALLED_PARTY_BCD_NPI array.
*/
setSmscAddress: function(options) {
let ton = options.typeOfNumber;
@@ -1673,7 +1662,6 @@ RilObject.prototype = {
}
// Init parcel.
this.SMSC = null;
let Buf = this.context.Buf;
Buf.newParcel(REQUEST_SET_SMSC_ADDRESS, options);
@@ -4824,13 +4812,91 @@ RilObject.prototype[REQUEST_EXIT_EMERGENCY_CALLBACK_MODE] = function REQUEST_EXI
this.sendChromeMessage(options);
};
RilObject.prototype[REQUEST_GET_SMSC_ADDRESS] = function REQUEST_GET_SMSC_ADDRESS(length, options) {
this.SMSC = options.errorMsg ? null : this.context.Buf.readString();
if (!options.rilMessageType || options.rilMessageType !== "getSmscAddress") {
return;
}
options.smscAddress = this.SMSC;
if (options.errorMsg) {
this.sendChromeMessage(options);
return;
}
let tosca = TOA_UNKNOWN;
let smsc = "";
let Buf = this.context.Buf;
if (RILQUIRKS_SMSC_ADDRESS_FORMAT === "pdu") {
let pduHelper = this.context.GsmPDUHelper;
let strlen = Buf.readInt32();
let length = pduHelper.readHexOctet();
// As defined in |8.2.5.2 Destination address element| of 3GPP TS 24.011,
// the value of length field can not exceed 11. Since the content might be
// filled with 12 'F' when SMSC is cleared, we don't parse the TOA and
// address fields if reported length exceeds 11 here. Instead, keep the
// default value (TOA_UNKNOWN with an empty address) in this case.
const MAX_LENGTH = 11
if (length <= MAX_LENGTH) {
tosca = pduHelper.readHexOctet();
// Read and covert the decimal values back to special BCD digits defined in
// |Called party BCD number| of 3GPP TS 24.008 (refer the following table).
//
// +=========+=======+=====+
// | value | digit | hex |
// +========================
// | 1 0 1 0 | * | 0xA |
// | 1 0 1 1 | # | 0xB |
// | 1 1 0 0 | a | 0xC |
// | 1 1 0 1 | b | 0xD |
// | 1 1 1 0 | c | 0xE |
// +=========+=======+=====+
smsc = pduHelper.readSwappedNibbleBcdString(length - 1, true)
.replace(/a/ig, "*")
.replace(/b/ig, "#")
.replace(/c/ig, "a")
.replace(/d/ig, "b")
.replace(/e/ig, "c");
Buf.readStringDelimiter(strlen);
}
} else /* RILQUIRKS_SMSC_ADDRESS_FORMAT === "text" */ {
let text = Buf.readString();
let segments = text.split(",", 2);
// Parse TOA only if it presents since some devices might omit the TOA
// segment in the reported SMSC address. If TOA does not present, keep the
// default value TOA_UNKNOWN.
if (segments.length === 2) {
tosca = this.parseInt(segments[1], TOA_UNKNOWN, 10);
}
smsc = segments[0].replace(/\"/g, "");
}
// Convert the NPI value to the corresponding index of CALLED_PARTY_BCD_NPI
// array. If the value does not present in the array, use
// CALLED_PARTY_BCD_NPI_ISDN.
let npi = CALLED_PARTY_BCD_NPI.indexOf(tosca & 0xf);
if (npi === -1) {
npi = CALLED_PARTY_BCD_NPI.indexOf(CALLED_PARTY_BCD_NPI_ISDN);
}
// Extract TON.
let ton = (tosca & 0x70) >> 4;
// Ensure + sign if TON is international, and vice versa.
const TON_INTERNATIONAL = (TOA_INTERNATIONAL & 0x70) >> 4;
if (ton === TON_INTERNATIONAL && smsc.charAt(0) !== "+") {
smsc = "+" + smsc;
} else if (smsc.charAt(0) === "+" && ton !== TON_INTERNATIONAL) {
if (DEBUG) {
this.context.debug("SMSC address number begins with '+' while the TON is not international. Change TON to international.");
}
ton = TON_INTERNATIONAL;
}
options.smscAddress = smsc;
options.typeOfNumber = ton;
options.numberPlanIdentification = npi;
this.sendChromeMessage(options);
};
RilObject.prototype[REQUEST_SET_SMSC_ADDRESS] = function REQUEST_SET_SMSC_ADDRESS(length, options) {
@@ -4838,10 +4904,6 @@ RilObject.prototype[REQUEST_SET_SMSC_ADDRESS] = function REQUEST_SET_SMSC_ADDRES
return;
}
if (options.rilRequestError) {
optioins.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
}
this.sendChromeMessage(options);
};
RilObject.prototype[REQUEST_REPORT_SMS_MEMORY_STATUS] = function REQUEST_REPORT_SMS_MEMORY_STATUS(length, options) {
+3 -1
View File
@@ -20,13 +20,15 @@ const NETWORK_TYPE_MOBILE_MMS = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS;
const NETWORK_TYPE_MOBILE_SUPL = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL;
const NETWORK_TYPE_MOBILE_IMS = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_IMS;
const NETWORK_TYPE_MOBILE_DUN = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN;
const NETWORK_TYPE_MOBILE_FOTA = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_FOTA;
const networkTypes = [
NETWORK_TYPE_MOBILE,
NETWORK_TYPE_MOBILE_MMS,
NETWORK_TYPE_MOBILE_SUPL,
NETWORK_TYPE_MOBILE_IMS,
NETWORK_TYPE_MOBILE_DUN
NETWORK_TYPE_MOBILE_DUN,
NETWORK_TYPE_MOBILE_FOTA
];
let Promise = Cu.import("resource://gre/modules/Promise.jsm").Promise;
@@ -9,7 +9,7 @@ function setEmulatorAPN() {
[{"carrier":"T-Mobile US",
"apn":"epc.tmobile.com",
"mmsc":"http://mms.msg.eng.t-mobile.com/mms/wapenc",
"types":["default","supl","mms","ims","dun"]}]
"types":["default","supl","mms","ims","dun", "fota"]}]
];
return setSettings(SETTINGS_KEY_DATA_APN_SETTINGS, apn);
@@ -57,6 +57,7 @@ function testNonDefaultDataConnection() {
.then(() => doTestNonDefaultDataConnection(NETWORK_TYPE_MOBILE_SUPL))
.then(() => doTestNonDefaultDataConnection(NETWORK_TYPE_MOBILE_IMS))
.then(() => doTestNonDefaultDataConnection(NETWORK_TYPE_MOBILE_DUN))
.then(() => doTestNonDefaultDataConnection(NETWORK_TYPE_MOBILE_FOTA))
// Restore APN settings
.then(() => setSettings(SETTINGS_KEY_DATA_APN_SETTINGS, currentApn));
}
@@ -24,7 +24,10 @@ function setEmulatorAPN() {
"types":["ims"] },
{ "carrier":"T-Mobile US",
"apn":"epc5.tmobile.com",
"types":["dun"] }]];
"types":["dun"] },
{ "carrier":"T-Mobile US",
"apn":"epc6.tmobile.com",
"types":["fota"] }]];
return setSettings(SETTINGS_KEY_DATA_APN_SETTINGS, apn);
}
@@ -6,20 +6,26 @@ subscriptLoader.loadSubScript("resource://gre/modules/ril_consts.js", this);
const SMSC_ATT = '+13123149810';
const SMSC_ATT_TYPO = '+++1312@@@314$$$9,8,1,0';
const SMSC_ATT_TEXT = '"+13123149810",145';
const SMSC_ATT_TEXT_INCORRECT_TOA = '"+13123149810",129';
const SMSC_ATT_PDU = '07913121139418F0';
const SMSC_O2 = '+447802000332';
const SMSC_O2_TEXT = '"+447802000332",145';
const SMSC_O2_PDU = '0791448720003023';
const SMSC_EMPTY = '';
const SMSC_TON_UNKNOWN = '0407485455'
const SMSC_TON_UNKNOWN_TEXT = '"0407485455",129';
const SMSC_TON_UNKNOWN_TEXT_NO_TOA = '"0407485455"';
const SMSC_TON_UNKNOWN_TEXT_INVALID_TOA = '"0407485455",abc';
const SMSC_TON_UNKNOWN_PDU = '06814070844555';
const SMSC_EMPTY_PDU = 'FFFFFFFFFFFFFFFFFFFFFFFF';
const SMSC_EMPTY_TEXT = '';
function run_test() {
run_next_test();
}
function setSmsc(context, smsc, ton, npi, expected) {
context.Buf.sendParcel = function() {
context.Buf.postRILMessage = function() {
equal(this.readString(), expected);
};
@@ -30,6 +36,17 @@ function setSmsc(context, smsc, ton, npi, expected) {
});
}
function getSmsc(worker, context, raw, smsc, ton, npi) {
worker.postMessage = function(message) {
equal(message.smscAddress, smsc);
equal(message.typeOfNumber, ton);
equal(message.numberPlanIdentification, npi);
}
context.Buf.writeString(raw);
context.RIL[REQUEST_GET_SMSC_ADDRESS](0, { rilMessageType: "getSmscAddress"});
}
add_test(function test_setSmscAddress() {
let worker = newUint8Worker();
let context = worker.ContextPool._contexts[0];
@@ -69,3 +86,27 @@ add_test(function test_setSmscAddress() {
run_next_test();
});
add_test(function test_getSmscAddress() {
let worker = newUint8Worker();
let context = worker.ContextPool._contexts[0];
// Test text mode.
worker.RILQUIRKS_SMSC_ADDRESS_FORMAT = "text";
getSmsc(worker, context, SMSC_ATT_TEXT, SMSC_ATT, 1, 1);
getSmsc(worker, context, SMSC_ATT_TEXT_INCORRECT_TOA, SMSC_ATT, 1, 1);
getSmsc(worker, context, SMSC_O2_TEXT, SMSC_O2, 1, 1);
getSmsc(worker, context, SMSC_TON_UNKNOWN_TEXT, SMSC_TON_UNKNOWN, 0, 1);
getSmsc(worker, context, SMSC_TON_UNKNOWN_TEXT_NO_TOA, SMSC_TON_UNKNOWN, 0, 1);
getSmsc(worker, context, SMSC_TON_UNKNOWN_TEXT_INVALID_TOA, SMSC_TON_UNKNOWN,
0, 1);
getSmsc(worker, context, SMSC_EMPTY_TEXT, SMSC_EMPTY, 0, 1);
// Test pdu mode.
worker.RILQUIRKS_SMSC_ADDRESS_FORMAT = "pdu";
getSmsc(worker, context, SMSC_ATT_PDU, SMSC_ATT, 1, 1);
getSmsc(worker, context, SMSC_O2_PDU, SMSC_O2, 1, 1);
getSmsc(worker, context, SMSC_TON_UNKNOWN_PDU, SMSC_TON_UNKNOWN, 0, 1);
getSmsc(worker, context, SMSC_EMPTY_PDU, SMSC_EMPTY, 0, 1);
run_next_test();
});
+1 -1
View File
@@ -194,7 +194,7 @@ interface MozMobileMessageManager : EventTarget
DOMRequest retrieveMMS(MozMmsMessage message);
[Throws]
DOMRequest getSmscAddress(optional unsigned long serviceId);
Promise<SmscAddress> getSmscAddress(optional unsigned long serviceId);
/**
* Set the SMSC address.
+2 -1
View File
@@ -44,7 +44,8 @@ GetInterfaces(std::vector<NetworkInterface>* aInterfaces)
nsINetworkInterfaceListService::LIST_NOT_INCLUDE_SUPL_INTERFACES |
nsINetworkInterfaceListService::LIST_NOT_INCLUDE_MMS_INTERFACES |
nsINetworkInterfaceListService::LIST_NOT_INCLUDE_IMS_INTERFACES |
nsINetworkInterfaceListService::LIST_NOT_INCLUDE_DUN_INTERFACES;
nsINetworkInterfaceListService::LIST_NOT_INCLUDE_DUN_INTERFACES |
nsINetworkInterfaceListService::LIST_NOT_INCLUDE_FOTA_INTERFACES;
nsCOMPtr<nsINetworkInterfaceList> networkList;
NS_ENSURE_SUCCESS(listService->GetDataInterfaceList(flags,
getter_AddRefs(networkList)),
@@ -653,10 +653,6 @@ just addresses the organization to follow, e.g. "This site is run by " -->
<!-- Voice search in the awesome bar -->
<!ENTITY voicesearch_prompt "Speak now">
<!ENTITY voicesearch_failed_title "&brandShortName; Voice Search">
<!ENTITY voicesearch_failed_message "There is a problem with voice search right now. Please try later.">
<!ENTITY voicesearch_failed_message_recoverable "Sorry! We could not recognize your words. Please try again.">
<!ENTITY voicesearch_failed_retry "Try again">
<!-- Localization note (remote_tabs_last_synced): the variable is replaced by a
"relative time span string" produced by Android. This string describes the
@@ -689,8 +689,8 @@ OnSharedPreferenceChangeListener
pref.setSummary(getString(R.string.pref_category_customize_alt_summary));
}
if (getResources().getString(R.string.pref_category_input_options).equals(key)) {
if (!AppConstants.NIGHTLY_BUILD || (!InputOptionsUtils.supportsVoiceRecognizer(getApplicationContext(), getResources().getString(R.string.voicesearch_prompt)) &&
!InputOptionsUtils.supportsQrCodeReader(getApplicationContext()))) {
if (!InputOptionsUtils.supportsVoiceRecognizer(getApplicationContext(), getResources().getString(R.string.voicesearch_prompt)) &&
!InputOptionsUtils.supportsQrCodeReader(getApplicationContext())) {
preferences.removePreference(pref);
i--;
continue;
@@ -824,7 +824,7 @@ OnSharedPreferenceChangeListener
continue;
}
} else if (PREFS_VOICE_INPUT_ENABLED.equals(key)) {
if (!AppConstants.NIGHTLY_BUILD || !InputOptionsUtils.supportsVoiceRecognizer(getApplicationContext(), getResources().getString(R.string.voicesearch_prompt))) {
if (!InputOptionsUtils.supportsVoiceRecognizer(getApplicationContext(), getResources().getString(R.string.voicesearch_prompt))) {
// Remove UI for voice input on non nightly builds.
preferences.removePreference(pref);
i--;
-4
View File
@@ -540,10 +540,6 @@
<!-- Voice search from the Awesome Bar -->
<string name="voicesearch_prompt">&voicesearch_prompt;</string>
<string name="voicesearch_failed_title">&voicesearch_failed_title;</string>
<string name="voicesearch_failed_message">&voicesearch_failed_message;</string>
<string name="voicesearch_failed_message_recoverable">&voicesearch_failed_message_recoverable;</string>
<string name="voicesearch_failed_retry">&voicesearch_failed_retry;</string>
<!-- Miscellaneous -->
<string name="ellipsis">&ellipsis;</string>
@@ -218,10 +218,6 @@ public class ToolbarEditLayout extends ThemedLinearLayout {
}
private boolean voiceIsEnabled(Context context, String prompt) {
// Voice input is enabled for nightly only
if(!AppConstants.NIGHTLY_BUILD) {
return false;
}
final boolean voiceIsSupported = InputOptionsUtils.supportsVoiceRecognizer(context, prompt);
if (!voiceIsSupported) {
return false;
@@ -237,22 +233,6 @@ public class ToolbarEditLayout extends ThemedLinearLayout {
ActivityHandlerHelper.startIntentForActivity(activity, intent, new ActivityResultHandler() {
@Override
public void onActivityResult(int resultCode, Intent data) {
switch (resultCode) {
case RecognizerIntent.RESULT_CLIENT_ERROR:
case RecognizerIntent.RESULT_NETWORK_ERROR:
case RecognizerIntent.RESULT_SERVER_ERROR:
// We have an temporarily unrecoverable error.
handleVoiceSearchError(false);
break;
case RecognizerIntent.RESULT_AUDIO_ERROR:
case RecognizerIntent.RESULT_NO_MATCH:
// Maybe the user can say it differently?
handleVoiceSearchError(true);
break;
case Activity.RESULT_CANCELED:
break;
}
if (resultCode != Activity.RESULT_OK) {
return;
}
@@ -272,33 +252,6 @@ public class ToolbarEditLayout extends ThemedLinearLayout {
});
}
private void handleVoiceSearchError(boolean offerRetry) {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext())
.setTitle(R.string.voicesearch_failed_title)
.setIcon(R.drawable.icon).setNeutralButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
if (offerRetry) {
builder.setMessage(R.string.voicesearch_failed_message_recoverable)
.setNegativeButton(R.string.voicesearch_failed_retry, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
launchVoiceRecognizer();
}
});
} else {
builder.setMessage(R.string.voicesearch_failed_message);
}
AlertDialog dialog = builder.create();
dialog.show();
}
private boolean qrCodeIsEnabled(Context context) {
// QR code is enabled for nightly only
if(!AppConstants.NIGHTLY_BUILD) {
@@ -229,7 +229,7 @@ public class testSettingsMenuItems extends PixelTest {
}
// Voice input
if (AppConstants.NIGHTLY_BUILD && InputOptionsUtils.supportsVoiceRecognizer(this.getActivity().getApplicationContext(), this.getActivity().getResources().getString(R.string.voicesearch_prompt))) {
if (InputOptionsUtils.supportsVoiceRecognizer(this.getActivity().getApplicationContext(), this.getActivity().getResources().getString(R.string.voicesearch_prompt))) {
String[] voiceInputUi = { mStringHelper.VOICE_INPUT_TITLE_LABEL, mStringHelper.VOICE_INPUT_SUMMARY_LABEL };
settingsMap.get(PATH_DISPLAY).add(voiceInputUi);
}
@@ -87,6 +87,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "TelemetrySession",
"resource://gre/modules/TelemetrySession.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetrySend",
"resource://gre/modules/TelemetrySend.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryReportingPolicy",
"resource://gre/modules/TelemetryReportingPolicy.jsm");
/**
* Setup Telemetry logging. This function also gets called when loggin related
@@ -651,6 +653,9 @@ let Impl = {
this._sessionRecorder.onStartup();
}
// This will trigger displaying the datachoices infobar.
TelemetryReportingPolicy.setup();
if (!this.enableTelemetryRecording()) {
this._log.config("setupChromeProcess - Telemetry recording is disabled, skipping Chrome process setup.");
return Promise.resolve();
@@ -726,6 +731,9 @@ let Impl = {
// Now do an orderly shutdown.
try {
// Stop the datachoices infobar display.
TelemetryReportingPolicy.shutdown();
// Stop any ping sending.
yield TelemetrySend.shutdown();
@@ -0,0 +1,419 @@
/* 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/. */
"use strict";
this.EXPORTED_SYMBOLS = [
"TelemetryReportingPolicy"
];
const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
Cu.import("resource://gre/modules/Log.jsm", this);
Cu.import("resource://gre/modules/Preferences.jsm", this);
Cu.import("resource://gre/modules/Services.jsm", this);
Cu.import("resource://gre/modules/Timer.jsm", this);
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
Cu.import("resource://services-common/observers.js", this);
XPCOMUtils.defineLazyModuleGetter(this, "TelemetrySend",
"resource://gre/modules/TelemetrySend.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "UpdateChannel",
"resource://gre/modules/UpdateChannel.jsm");
const LOGGER_NAME = "Toolkit.Telemetry";
const LOGGER_PREFIX = "TelemetryReportingPolicy::";
// Oldest year to allow in date preferences. The FHR infobar was implemented in
// 2012 and no dates older than that should be encountered.
const OLDEST_ALLOWED_ACCEPTANCE_YEAR = 2012;
const PREF_BRANCH = "datareporting.policy.";
// Indicates whether this is the first run or not. This is used to decide when to display
// the policy.
const PREF_FIRST_RUN = "toolkit.telemetry.reportingpolicy.firstRun";
// Allows to skip the datachoices infobar. This should only be used in tests.
const PREF_BYPASS_NOTIFICATION = PREF_BRANCH + "dataSubmissionPolicyBypassNotification";
// The submission kill switch: if this preference is disable, no submission will ever take place.
const PREF_DATA_SUBMISSION_ENABLED = PREF_BRANCH + "dataSubmissionEnabled";
// This preference holds the current policy version, which overrides
// DEFAULT_DATAREPORTING_POLICY_VERSION
const PREF_CURRENT_POLICY_VERSION = PREF_BRANCH + "currentPolicyVersion";
// This indicates the minimum required policy version. If the accepted policy version
// is lower than this, the notification bar must be showed again.
const PREF_MINIMUM_POLICY_VERSION = PREF_BRANCH + "minimumPolicyVersion";
// The version of the accepted policy.
const PREF_ACCEPTED_POLICY_VERSION = PREF_BRANCH + "dataSubmissionPolicyAcceptedVersion";
// The date user accepted the policy.
const PREF_ACCEPTED_POLICY_DATE = PREF_BRANCH + "dataSubmissionPolicyNotifiedTime";
// The following preferences are deprecated and will be purged during the preferences
// migration process.
const DEPRECATED_FHR_PREFS = [
PREF_BRANCH + "dataSubmissionPolicyAccepted",
PREF_BRANCH + "dataSubmissionPolicyBypassAcceptance",
PREF_BRANCH + "dataSubmissionPolicyResponseType",
PREF_BRANCH + "dataSubmissionPolicyResponseTime"
];
// How much time until we display the data choices notification bar, on the first run.
const NOTIFICATION_DELAY_FIRST_RUN_MSEC = 60 * 1000; // 60s
// Same as above, for the next runs.
const NOTIFICATION_DELAY_NEXT_RUNS_MSEC = 10 * 1000; // 10s
/**
* This is a policy object used to override behavior within this module.
* Tests override properties on this object to allow for control of behavior
* that would otherwise be very hard to cover.
*/
let Policy = {
now: () => new Date(),
setShowInfobarTimeout: (callback, delayMs) => setTimeout(callback, delayMs),
clearShowInfobarTimeout: (id) => clearTimeout(id),
};
/**
* Represents a request to display data policy.
*
* Receivers of these instances are expected to call one or more of the on*
* functions when events occur.
*
* When one of these requests is received, the first thing a callee should do
* is present notification to the user of the data policy. When the notice
* is displayed to the user, the callee should call `onUserNotifyComplete`.
*
* If for whatever reason the callee could not display a notice,
* it should call `onUserNotifyFailed`.
*
* @param {Object} aLog The log object used to log the error in case of failures.
*/
function NotifyPolicyRequest(aLog) {
this._log = aLog;
}
NotifyPolicyRequest.prototype = Object.freeze({
/**
* Called when the user is notified of the policy.
*/
onUserNotifyComplete: function () {
return TelemetryReportingPolicyImpl._infobarShownCallback();
},
/**
* Called when there was an error notifying the user about the policy.
*
* @param error
* (Error) Explains what went wrong.
*/
onUserNotifyFailed: function (error) {
this._log.error("onUserNotifyFailed - " + error);
},
});
this.TelemetryReportingPolicy = {
// The current policy version number. If the version number stored in the prefs
// is smaller than this, data upload will be disabled until the user is re-notified
// about the policy changes.
DEFAULT_DATAREPORTING_POLICY_VERSION: 1,
/**
* Setup the policy.
*/
setup: function() {
return TelemetryReportingPolicyImpl.setup();
},
/**
* Shutdown and clear the policy.
*/
shutdown: function() {
return TelemetryReportingPolicyImpl.shutdown();
},
/**
* Check if we are allowed to upload data. In order to submit data both these conditions
* should be true:
* - The data submission preference should be true.
* - The datachoices infobar should have been displayed.
*
* @return {Boolean} True if we are allowed to upload data, false otherwise.
*/
canUpload: function() {
return TelemetryReportingPolicyImpl.canUpload();
},
/**
* Test only method, restarts the policy.
*/
reset: function() {
return TelemetryReportingPolicyImpl.reset();
},
/**
* Test only method, used to check if user is notified of the policy in tests.
*/
testIsUserNotified: function() {
return TelemetryReportingPolicyImpl.isUserNotifiedOfCurrentPolicy;
},
/**
* Test only method, used to simulate the infobar being shown in xpcshell tests.
*/
testInfobarShown: function() {
return TelemetryReportingPolicyImpl._infobarShownCallback();
},
};
let TelemetryReportingPolicyImpl = {
_logger: null,
// Keep track of the notification status if user wasn't notified already.
_notificationInProgress: false,
// The timer used to show the datachoices notification at startup.
_startupNotificationTimerId: null,
get _log() {
if (!this._logger) {
this._logger = Log.repository.getLoggerWithMessagePrefix(LOGGER_NAME, LOGGER_PREFIX);
}
return this._logger;
},
/**
* Get the date the policy was notified.
* @return {Object} A date object or null on errors.
*/
get dataSubmissionPolicyNotifiedDate() {
let prefString = Preferences.get(PREF_ACCEPTED_POLICY_DATE, 0);
let valueInteger = parseInt(prefString, 10);
// If nothing or an invalid value is saved in the prefs, bail out.
if (Number.isNaN(valueInteger) || valueInteger == 0) {
this._log.error("get dataSubmissionPolicyNotifiedDate - Invalid date stored.");
return null;
}
// Make sure the notification date is newer then the oldest allowed date.
let date = new Date(valueInteger);
if (date.getFullYear() < OLDEST_ALLOWED_ACCEPTANCE_YEAR) {
this._log.error("get dataSubmissionPolicyNotifiedDate - The stored date is too old.");
return null;
}
return date;
},
/**
* Set the date the policy was notified.
* @param {Object} aDate A valid date object.
*/
set dataSubmissionPolicyNotifiedDate(aDate) {
this._log.trace("set dataSubmissionPolicyNotifiedDate - aDate: " + aDate);
if (!aDate || aDate.getFullYear() < OLDEST_ALLOWED_ACCEPTANCE_YEAR) {
this._log.error("set dataSubmissionPolicyNotifiedDate - Invalid notification date.");
return;
}
Preferences.set(PREF_ACCEPTED_POLICY_DATE, aDate.getTime().toString());
},
/**
* Whether submission of data is allowed.
*
* This is the master switch for remote server communication. If it is
* false, we never request upload or deletion.
*/
get dataSubmissionEnabled() {
// Default is true because we are opt-out.
return Preferences.get(PREF_DATA_SUBMISSION_ENABLED, true);
},
get currentPolicyVersion() {
return Preferences.get(PREF_CURRENT_POLICY_VERSION,
TelemetryReportingPolicy.DEFAULT_DATAREPORTING_POLICY_VERSION);
},
/**
* The minimum policy version which for dataSubmissionPolicyAccepted to
* to be valid.
*/
get minimumPolicyVersion() {
const minPolicyVersion = Preferences.get(PREF_MINIMUM_POLICY_VERSION, 1);
// First check if the current channel has a specific minimum policy version. If not,
// use the general minimum policy version.
let channel = "";
try {
channel = UpdateChannel.get(false);
} catch(e) {
this._log.error("minimumPolicyVersion - Unable to retrieve the current channel.");
return minPolicyVersion;
}
const channelPref = PREF_MINIMUM_POLICY_VERSION + ".channel-" + channel;
return Preferences.get(channelPref, minPolicyVersion);
},
get dataSubmissionPolicyAcceptedVersion() {
return Preferences.get(PREF_ACCEPTED_POLICY_VERSION, 0);
},
set dataSubmissionPolicyAcceptedVersion(value) {
Preferences.set(PREF_ACCEPTED_POLICY_VERSION, value);
},
/**
* Checks to see if the user has been notified about data submission
* @return {Bool} True if user has been notified and the notification is still valid,
* false otherwise.
*/
get isUserNotifiedOfCurrentPolicy() {
// If we don't have a sane notification date, the user was not notified yet.
if (!this.dataSubmissionPolicyNotifiedDate ||
this.dataSubmissionPolicyNotifiedDate.getTime() <= 0) {
return false;
}
// The accepted policy version should not be less than the minimum policy version.
if (this.dataSubmissionPolicyAcceptedVersion < this.minimumPolicyVersion) {
return false;
}
// Otherwise the user was already notified.
return true;
},
/**
* Test only method, restarts the policy.
*/
reset: function() {
this.shutdown();
return this.setup();
},
/**
* Setup the policy.
*/
setup: function() {
this._log.trace("setup");
// Migrate the data choices infobar, if needed.
this._migratePreferences();
// Add the event observers.
Services.obs.addObserver(this, "sessionstore-windows-restored", false);
},
/**
* Clean up the reporting policy.
*/
shutdown: function() {
this._log.trace("shutdown");
this._detachObservers();
Policy.clearShowInfobarTimeout(this._startupNotificationTimerId);
},
/**
* Detach the observers that were attached during setup.
*/
_detachObservers: function() {
Services.obs.removeObserver(this, "sessionstore-windows-restored");
},
/**
* Check if we are allowed to upload data. In order to submit data both these conditions
* should be true:
* - The data submission preference should be true.
* - The datachoices infobar should have been displayed.
*
* @return {Boolean} True if we are allowed to upload data, false otherwise.
*/
canUpload: function() {
// If data submission is disabled, there's no point in showing the infobar. Just
// forbid to upload.
if (!this.dataSubmissionEnabled) {
return false;
}
// Make sure the user is notified of the current policy. If he isn't, don't try
// to upload anything.
if (!this._ensureUserNotified()) {
return false;
}
// Submission is enabled and user is notified: upload is allowed.
return true;
},
/**
* Migrate the data policy preferences, if needed.
*/
_migratePreferences: function() {
// Current prefs are mostly the same than the old ones, except for some deprecated ones.
for (let pref of DEPRECATED_FHR_PREFS) {
Preferences.reset(pref);
}
},
/**
* Make sure the user is notified about the policy before allowing upload.
* @return {Boolean} True if the user was notified, false otherwise.
*/
_ensureUserNotified: function() {
const BYPASS_NOTIFICATION = Preferences.get(PREF_BYPASS_NOTIFICATION, false);
if (this.isUserNotifiedOfCurrentPolicy || BYPASS_NOTIFICATION) {
return true;
}
this._log.trace("ensureUserNotified - User not notified, notifying now.");
if (this._notificationInProgress) {
this._log.trace("ensureUserNotified - User not notified, notification in progress.");
return false;
}
this._notificationInProgress = true;
let request = new NotifyPolicyRequest(this._log);
Observers.notify("datareporting:notify-data-policy:request", request);
return false;
},
/**
* Called when the user is notified with the infobar.
*/
_infobarShownCallback: function() {
this._log.trace("_infobarShownCallback");
this._recordNotificationData();
TelemetrySend.notifyCanUpload();
},
/**
* Record date and the version of the accepted policy.
*/
_recordNotificationData: function() {
this._log.trace("_recordNotificationData");
this.dataSubmissionPolicyNotifiedDate = Policy.now();
this.dataSubmissionPolicyAcceptedVersion = this.currentPolicyVersion;
// The user was notified and the notification data saved: the notification
// is no longer in progress.
this._notificationInProgress = false;
},
observe: function(aSubject, aTopic, aData) {
if (aTopic != "sessionstore-windows-restored") {
return;
}
const isFirstRun = Preferences.get(PREF_FIRST_RUN, true);
const delay =
isFirstRun ? NOTIFICATION_DELAY_FIRST_RUN_MSEC: NOTIFICATION_DELAY_NEXT_RUNS_MSEC;
this._startupNotificationTimerId = Policy.setShowInfobarTimeout(
// Calling |canUpload| eventually shows the infobar, if needed.
() => this.canUpload(), delay);
// We performed at least a run, flip the firstRun preference.
Preferences.set(PREF_FIRST_RUN, false);
},
};
+40 -8
View File
@@ -30,6 +30,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "AsyncShutdown",
"resource://gre/modules/AsyncShutdown.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStorage",
"resource://gre/modules/TelemetryStorage.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryReportingPolicy",
"resource://gre/modules/TelemetryReportingPolicy.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "Telemetry",
"@mozilla.org/base/telemetry;1",
"nsITelemetry");
@@ -198,6 +200,13 @@ this.TelemetrySend = {
return TelemetrySendImpl.overduePingsCount;
},
/**
* Notify that we can start submitting data to the servers.
*/
notifyCanUpload: function() {
return TelemetrySendImpl.notifyCanUpload();
},
/**
* Only used in tests. Used to reset the module data to emulate a restart.
*/
@@ -382,8 +391,8 @@ let SendScheduler = {
let pending = TelemetryStorage.getPendingPingList();
let current = TelemetrySendImpl.getUnpersistedPings();
this._log.trace("_doSendTask - pending: " + pending.length + ", current: " + current.length);
pending = pending.filter(p => TelemetrySendImpl.canSend(p));
current = current.filter(p => TelemetrySendImpl.canSend(p));
pending = pending.filter(p => TelemetrySendImpl.sendingEnabled(p));
current = current.filter(p => TelemetrySendImpl.sendingEnabled(p));
this._log.trace("_doSendTask - can send - pending: " + pending.length + ", current: " + current.length);
// Bail out if there is nothing to send.
@@ -632,6 +641,15 @@ let TelemetrySendImpl = {
return SendScheduler.reset();
},
/**
* Notify that we can start submitting data to the servers.
*/
notifyCanUpload: function() {
// Let the scheduler trigger sending pings if possible.
SendScheduler.triggerSendingPings(true);
return this.promisePendingPingActivity();
},
observe: function(subject, topic, data) {
switch(topic) {
case TOPIC_IDLE_DAILY:
@@ -643,15 +661,15 @@ let TelemetrySendImpl = {
submitPing: function(ping) {
this._log.trace("submitPing - ping id: " + ping.id);
if (!this.canSend(ping)) {
if (!this.sendingEnabled(ping)) {
this._log.trace("submitPing - Telemetry is not allowed to send pings.");
return Promise.resolve();
}
if (!this._sendingEnabled) {
if (!this.canSendNow) {
// Sending is disabled or throttled, add this to the persisted pending pings.
this._log.trace("submitPing - can't send ping now, persisting to disk - " +
"sendingEnabled: " + this._sendingEnabled);
"canSendNow: " + this.canSendNow);
return TelemetryStorage.savePendingPing(ping);
}
@@ -806,7 +824,7 @@ let TelemetrySendImpl = {
},
_doPing: function(ping, id, isPersisted) {
if (!this.canSend(ping)) {
if (!this.sendingEnabled(ping)) {
// We can't send the pings to the server, so don't try to.
this._log.trace("_doPing - Can't send ping " + ping.id);
return Promise.resolve();
@@ -910,7 +928,21 @@ let TelemetrySendImpl = {
},
/**
* Check if pings can be sent to the server. If FHR is not allowed to upload,
* Check if sending is temporarily disabled.
* @return {Boolean} True if we can send pings to the server right now, false if
* sending is temporarily disabled.
*/
get canSendNow() {
// If the reporting policy was not accepted yet, don't send pings.
if (!TelemetryReportingPolicy.canUpload()) {
return false;
}
return this._sendingEnabled;
},
/**
* Check if sending is disabled. If FHR is not allowed to upload,
* pings are not sent to the server (Telemetry is a sub-feature of FHR). If trying
* to send a deletion ping, don't block it.
* If unified telemetry is off, don't send pings if Telemetry is disabled.
@@ -918,7 +950,7 @@ let TelemetrySendImpl = {
* @param {Object} [ping=null] A ping to be checked.
* @return {Boolean} True if pings can be send to the servers, false otherwise.
*/
canSend: function(ping = null) {
sendingEnabled: function(ping = null) {
// We only send pings from official builds, but allow overriding this for tests.
if (!Telemetry.isOfficialTelemetry && !this._testMode) {
return false;
@@ -1614,40 +1614,42 @@ let Impl = {
/**
* Save both the "saved-session" and the "shutdown" pings to disk.
*/
saveShutdownPings: Task.async(function*() {
saveShutdownPings: function() {
this._log.trace("saveShutdownPings");
if (IS_UNIFIED_TELEMETRY) {
try {
let shutdownPayload = this.getSessionPayload(REASON_SHUTDOWN, false);
// We don't wait for "shutdown" pings to be written to disk before gathering the
// "saved-session" payload. Instead we append the promises to this list and wait
// on both to be saved after kicking off their collection.
let p = [];
let options = {
addClientId: true,
addEnvironment: true,
overwrite: true,
};
yield TelemetryController.addPendingPing(getPingType(shutdownPayload), shutdownPayload, options);
} catch (ex) {
this._log.error("saveShutdownPings - failed to submit shutdown ping", ex);
}
if (IS_UNIFIED_TELEMETRY) {
let shutdownPayload = this.getSessionPayload(REASON_SHUTDOWN, false);
let options = {
addClientId: true,
addEnvironment: true,
overwrite: true,
};
p.push(TelemetryController.addPendingPing(getPingType(shutdownPayload), shutdownPayload, options)
.catch(e => this._log.error("saveShutdownPings - failed to submit shutdown ping", e)));
}
// As a temporary measure, we want to submit saved-session too if extended Telemetry is enabled
// to keep existing performance analysis working.
if (Telemetry.canRecordExtended) {
try {
let payload = this.getSessionPayload(REASON_SAVED_SESSION, false);
let payload = this.getSessionPayload(REASON_SAVED_SESSION, false);
let options = {
addClientId: true,
addEnvironment: true,
};
yield TelemetryController.addPendingPing(getPingType(payload), payload, options);
} catch (ex) {
this._log.error("saveShutdownPings - failed to submit saved-session ping", ex);
}
let options = {
addClientId: true,
addEnvironment: true,
};
p.push(TelemetryController.addPendingPing(getPingType(payload), payload, options)
.catch (e => this._log.error("saveShutdownPings - failed to submit saved-session ping", e)));
}
}),
// Wait on pings to be saved.
return Promise.all(p);
},
testSavePendingPing: function testSaveHistograms() {
@@ -44,3 +44,38 @@ Sending only happens on official builds with ``MOZ_TELEMETRY_REPORTING`` defined
``toolkit.telemetry.log.dump``
Sets whether to dump Telemetry log messages to ``stdout`` too.
Data-choices notification
-------------------------
``toolkit.telemetry.reportingpolicy.firstRun``
This preference is not present until the first run. After, its value is set to false. This is used to show the infobar with a more aggressive timeout if it wasn't shown yet.
``datareporting.policy.dataSubmissionEnabled``
This is the data submission master kill switch. If disabled, no policy is shown or upload takes place, ever.
``datareporting.policy.dataSubmissionPolicyNotifiedTime``
Records the date user was shown the policy. This preference is also used on Android.
``datareporting.policy.dataSubmissionPolicyAcceptedVersion``
Records the version of the policy notified to the user. This preference is also used on Android.
``datareporting.policy.dataSubmissionPolicyBypassNotification``
Used in tests, it allows to skip the notification check.
``datareporting.policy.currentPolicyVersion``
Stores the current policy version, overrides the default value defined in TelemetryReportingPolicy.jsm.
``datareporting.policy.minimumPolicyVersion``
The minimum policy version that is accepted for the current policy. This can be set per channel.
``datareporting.policy.minimumPolicyVersion.channel-NAME``
This is the only channel-specific version that we currently use for the minimum policy version.
+1
View File
@@ -32,6 +32,7 @@ EXTRA_COMPONENTS += [
EXTRA_JS_MODULES += [
'TelemetryArchive.jsm',
'TelemetryLog.jsm',
'TelemetryReportingPolicy.jsm',
'TelemetrySend.jsm',
'TelemetryStopwatch.jsm',
'TelemetryStorage.jsm',
@@ -238,6 +238,7 @@ function fakeNow(...args) {
Cu.import("resource://gre/modules/TelemetryController.jsm"),
Cu.import("resource://gre/modules/TelemetryStorage.jsm"),
Cu.import("resource://gre/modules/TelemetrySend.jsm"),
Cu.import("resource://gre/modules/TelemetryReportingPolicy.jsm"),
];
for (let m of modules) {
@@ -285,6 +286,8 @@ if (runningInParent) {
Services.prefs.setCharPref("toolkit.telemetry.log.level", "Trace");
// Telemetry archiving should be on.
Services.prefs.setBoolPref("toolkit.telemetry.archive.enabled", true);
// Telemetry xpcshell tests cannot show the infobar.
Services.prefs.setBoolPref("datareporting.policy.dataSubmissionPolicyBypassNotification", true);
fakePingSendTimer((callback, timeout) => {
Services.tm.mainThread.dispatch(() => callback(), Ci.nsIThread.DISPATCH_NORMAL);
@@ -0,0 +1,255 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Test that TelemetryController sends close to shutdown don't lead
// to AsyncShutdown timeouts.
"use strict";
Cu.import("resource://gre/modules/Preferences.jsm", this);
Cu.import("resource://gre/modules/Services.jsm", this);
Cu.import("resource://gre/modules/TelemetryController.jsm", this);
Cu.import("resource://gre/modules/TelemetrySend.jsm", this);
Cu.import("resource://gre/modules/TelemetryReportingPolicy.jsm", this);
Cu.import("resource://gre/modules/TelemetryUtils.jsm", this);
Cu.import("resource://gre/modules/Timer.jsm", this);
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
const PREF_BRANCH = "toolkit.telemetry.";
const PREF_ENABLED = PREF_BRANCH + "enabled";
const PREF_SERVER = PREF_BRANCH + "server";
const PREF_DRS_ENABLED = "datareporting.healthreport.service.enabled";
const TEST_CHANNEL = "TestChannelABC";
const PREF_POLICY_BRANCH = "datareporting.policy.";
const PREF_BYPASS_NOTIFICATION = PREF_POLICY_BRANCH + "dataSubmissionPolicyBypassNotification";
const PREF_DATA_SUBMISSION_ENABLED = PREF_POLICY_BRANCH + "dataSubmissionEnabled";
const PREF_CURRENT_POLICY_VERSION = PREF_POLICY_BRANCH + "currentPolicyVersion";
const PREF_MINIMUM_POLICY_VERSION = PREF_POLICY_BRANCH + "minimumPolicyVersion";
const PREF_MINIMUM_CHANNEL_POLICY_VERSION = PREF_MINIMUM_POLICY_VERSION + ".channel-" + TEST_CHANNEL;
const PREF_ACCEPTED_POLICY_VERSION = PREF_POLICY_BRANCH + "dataSubmissionPolicyAcceptedVersion";
const PREF_ACCEPTED_POLICY_DATE = PREF_POLICY_BRANCH + "dataSubmissionPolicyNotifiedTime";
function fakeShowPolicyTimeout(set, clear) {
let reportingPolicy = Cu.import("resource://gre/modules/TelemetryReportingPolicy.jsm");
reportingPolicy.Policy.setShowInfobarTimeout = set;
reportingPolicy.Policy.clearShowInfobarTimeout = clear;
}
function fakeResetAcceptedPolicy() {
Preferences.reset(PREF_ACCEPTED_POLICY_DATE);
Preferences.reset(PREF_ACCEPTED_POLICY_VERSION);
}
function run_test() {
// Addon manager needs a profile directory
do_get_profile(true);
loadAddonManager("[email protected]", "XPCShell", "1", "1.9.2");
Services.prefs.setBoolPref(PREF_ENABLED, true);
// We need to disable FHR in order to use the policy from telemetry.
Services.prefs.setBoolPref(PREF_DRS_ENABLED, false);
// Don't bypass the notifications in this test, we'll fake it.
Services.prefs.setBoolPref(PREF_BYPASS_NOTIFICATION, false);
TelemetryReportingPolicy.setup();
run_next_test();
}
add_task(function* test_firstRun() {
const PREF_FIRST_RUN = "toolkit.telemetry.reportingpolicy.firstRun";
const FIRST_RUN_TIMEOUT_MSEC = 60 * 1000; // 60s
const OTHER_RUNS_TIMEOUT_MSEC = 10 * 1000; // 10s
Preferences.reset(PREF_FIRST_RUN);
let startupTimeout = 0;
fakeShowPolicyTimeout((callback, timeout) => startupTimeout = timeout, () => {});
TelemetryReportingPolicy.reset();
Services.obs.notifyObservers(null, "sessionstore-windows-restored", null);
Assert.equal(startupTimeout, FIRST_RUN_TIMEOUT_MSEC,
"The infobar display timeout should be 60s on the first run.");
// Run again, and check that we actually wait only 10 seconds.
TelemetryReportingPolicy.reset();
Services.obs.notifyObservers(null, "sessionstore-windows-restored", null);
Assert.equal(startupTimeout, OTHER_RUNS_TIMEOUT_MSEC,
"The infobar display timeout should be 10s on other runs.");
});
add_task(function* test_prefs() {
TelemetryReportingPolicy.reset();
let now = fakeNow(2009, 11, 18);
// If the date is not valid (earlier than 2012), we don't regard the policy as accepted.
TelemetryReportingPolicy.testInfobarShown();
Assert.ok(!TelemetryReportingPolicy.testIsUserNotified());
Assert.equal(Preferences.get(PREF_ACCEPTED_POLICY_DATE, null), 0,
"Invalid dates should not make the policy accepted.");
// Check that the notification date and version are correctly saved to the prefs.
now = fakeNow(2012, 11, 18);
TelemetryReportingPolicy.testInfobarShown();
Assert.equal(Preferences.get(PREF_ACCEPTED_POLICY_DATE, null), now.getTime(),
"A valid date must correctly be saved.");
// Now that user is notified, check if we are allowed to upload.
Assert.ok(TelemetryReportingPolicy.canUpload(),
"We must be able to upload after the policy is accepted.");
// Disable submission and check that we're no longer allowed to upload.
Preferences.set(PREF_DATA_SUBMISSION_ENABLED, false);
Assert.ok(!TelemetryReportingPolicy.canUpload(),
"We must not be able to upload if data submission is disabled.");
// Turn the submission back on.
Preferences.set(PREF_DATA_SUBMISSION_ENABLED, true);
Assert.ok(TelemetryReportingPolicy.canUpload(),
"We must be able to upload if data submission is enabled and the policy was accepted.");
// Set a new minimum policy version and check that user is no longer notified.
let newMinimum = Preferences.get(PREF_CURRENT_POLICY_VERSION, 1) + 1;
Preferences.set(PREF_MINIMUM_POLICY_VERSION, newMinimum);
Assert.ok(!TelemetryReportingPolicy.testIsUserNotified(),
"A greater minimum policy version must invalidate the policy and disable upload.");
// Eventually accept the policy and make sure user is notified.
Preferences.set(PREF_CURRENT_POLICY_VERSION, newMinimum);
TelemetryReportingPolicy.testInfobarShown();
Assert.ok(TelemetryReportingPolicy.testIsUserNotified(),
"Accepting the policy again should show the user as notified.");
Assert.ok(TelemetryReportingPolicy.canUpload(),
"Accepting the policy again should let us upload data.");
// Set a new, per channel, minimum policy version. Start by setting a test current channel.
let defaultPrefs = new Preferences({ defaultBranch: true });
defaultPrefs.set("app.update.channel", TEST_CHANNEL);
// Increase and set the new minimum version, then check that we're not notified anymore.
newMinimum++;
Preferences.set(PREF_MINIMUM_CHANNEL_POLICY_VERSION, newMinimum);
Assert.ok(!TelemetryReportingPolicy.testIsUserNotified(),
"Increasing the minimum policy version should invalidate the policy.");
// Eventually accept the policy and make sure user is notified.
Preferences.set(PREF_CURRENT_POLICY_VERSION, newMinimum);
TelemetryReportingPolicy.testInfobarShown();
Assert.ok(TelemetryReportingPolicy.testIsUserNotified(),
"Accepting the policy again should show the user as notified.");
Assert.ok(TelemetryReportingPolicy.canUpload(),
"Accepting the policy again should let us upload data.");
});
add_task(function* test_migratePrefs() {
const DEPRECATED_FHR_PREFS = {
"datareporting.policy.dataSubmissionPolicyAccepted": true,
"datareporting.policy.dataSubmissionPolicyBypassAcceptance": true,
"datareporting.policy.dataSubmissionPolicyResponseType": "foxyeah",
"datareporting.policy.dataSubmissionPolicyResponseTime": Date.now().toString(),
};
// Make sure the preferences are set before setting up the policy.
for (let name in DEPRECATED_FHR_PREFS) {
Preferences.set(name, DEPRECATED_FHR_PREFS[name]);
}
// Set up the policy.
TelemetryReportingPolicy.reset();
// They should have been removed by now.
for (let name in DEPRECATED_FHR_PREFS) {
Assert.ok(!Preferences.has(name), name + " should have been removed.");
}
});
add_task(function* test_userNotifiedOfCurrentPolicy() {
fakeResetAcceptedPolicy();
TelemetryReportingPolicy.reset();
// User should be reported as not notified by default.
Assert.ok(!TelemetryReportingPolicy.testIsUserNotified(),
"The initial state should be unnotified.");
// Forcing a policy version should not automatically make the user notified.
Preferences.set(PREF_ACCEPTED_POLICY_VERSION,
TelemetryReportingPolicy.DEFAULT_DATAREPORTING_POLICY_VERSION);
Assert.ok(!TelemetryReportingPolicy.testIsUserNotified(),
"The default state of the date should have a time of 0 and it should therefore fail");
// Showing the notification bar should make the user notified.
let now = fakeNow(2012, 11, 11);
TelemetryReportingPolicy.testInfobarShown();
Assert.ok(TelemetryReportingPolicy.testIsUserNotified(),
"Using the proper API causes user notification to report as true.");
// It is assumed that later versions of the policy will incorporate previous
// ones, therefore this should also return true.
let newVersion =
Preferences.get(PREF_CURRENT_POLICY_VERSION, 1) + 1;
Preferences.set(PREF_ACCEPTED_POLICY_VERSION, newVersion);
Assert.ok(TelemetryReportingPolicy.testIsUserNotified(),
"A future version of the policy should pass.");
newVersion =
Preferences.get(PREF_CURRENT_POLICY_VERSION, 1) - 1;
Preferences.set(PREF_ACCEPTED_POLICY_VERSION, newVersion);
Assert.ok(!TelemetryReportingPolicy.testIsUserNotified(),
"A previous version of the policy should fail.");
});
add_task(function* test_canSend() {
const TEST_PING_TYPE = "test-ping";
PingServer.start();
Preferences.set(PREF_SERVER, "http://localhost:" + PingServer.port);
yield TelemetryController.reset();
TelemetryReportingPolicy.reset();
// User should be reported as not notified by default.
Assert.ok(!TelemetryReportingPolicy.testIsUserNotified(),
"The initial state should be unnotified.");
// Assert if we receive any ping before the policy is accepted.
PingServer.registerPingHandler(() => Assert.ok(false, "Should not have received any pings now"));
yield TelemetryController.submitExternalPing(TEST_PING_TYPE, {});
// Reset the ping handler.
PingServer.resetPingHandler();
// Fake the infobar: this should also trigger the ping send task.
TelemetryReportingPolicy.testInfobarShown();
let ping = yield PingServer.promiseNextPings(1);
Assert.equal(ping.length, 1, "We should have received one ping.");
Assert.equal(ping[0].type, TEST_PING_TYPE,
"We should have received the previous ping.");
// Submit another ping, to make sure it gets sent.
yield TelemetryController.submitExternalPing(TEST_PING_TYPE, {});
// Get the ping and check its type.
ping = yield PingServer.promiseNextPings(1);
Assert.equal(ping.length, 1, "We should have received one ping.");
Assert.equal(ping[0].type, TEST_PING_TYPE, "We should have received the new ping.");
// Fake a restart with a pending ping.
yield TelemetryController.addPendingPing(TEST_PING_TYPE, {});
yield TelemetryController.reset();
// We should be immediately sending the ping out.
ping = yield PingServer.promiseNextPings(1);
Assert.equal(ping.length, 1, "We should have received one ping.");
Assert.equal(ping[0].type, TEST_PING_TYPE, "We should have received the pending ping.");
// Submit another ping, to make sure it gets sent.
yield TelemetryController.submitExternalPing(TEST_PING_TYPE, {});
// Get the ping and check its type.
ping = yield PingServer.promiseNextPings(1);
Assert.equal(ping.length, 1, "We should have received one ping.");
Assert.equal(ping[0].type, TEST_PING_TYPE, "We should have received the new ping.");
yield PingServer.stop();
});
@@ -53,3 +53,4 @@ run-sequentially = Bug 1046307, test can fail intermittently when CPU load is hi
[test_TelemetrySend.js]
[test_ChildHistograms.js]
skip-if = os == "android"
[test_TelemetryReportingPolicy.js]