Commit e315ae63 authored by Clément David's avatar Clément David
Browse files

Bug 1419495 - Remove SelfSupport service r=dexter r=smaug

parent fddbc981
......@@ -50,7 +50,6 @@ DIRS += [
'search',
'sessionstore',
'shell',
'selfsupport',
'syncedtabs',
'uitour',
'translation',
......
/* 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";
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
const PREF_FHR_UPLOAD_ENABLED = "datareporting.healthreport.uploadEnabled";
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryArchive",
"resource://gre/modules/TelemetryArchive.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryEnvironment",
"resource://gre/modules/TelemetryEnvironment.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryController",
"resource://gre/modules/TelemetryController.jsm");
function MozSelfSupportInterface() {
}
MozSelfSupportInterface.prototype = {
classDescription: "MozSelfSupport",
classID: Components.ID("{d30aae8b-f352-4de3-b936-bb9d875df0bb}"),
contractID: "@mozilla.org/mozselfsupport;1",
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer]),
_window: null,
init(window) {
this._window = window;
},
get healthReportDataSubmissionEnabled() {
return Services.prefs.getBoolPref(PREF_FHR_UPLOAD_ENABLED, false);
},
set healthReportDataSubmissionEnabled(enabled) {
Services.prefs.setBoolPref(PREF_FHR_UPLOAD_ENABLED, enabled);
},
resetPref(name) {
Services.prefs.clearUserPref(name);
},
resetSearchEngines() {
Services.search.restoreDefaultEngines();
Services.search.resetToOriginalDefaultEngine();
},
getTelemetryPingList() {
return this._wrapPromise(TelemetryArchive.promiseArchivedPingList());
},
getTelemetryPing(pingId) {
return this._wrapPromise(TelemetryArchive.promiseArchivedPingById(pingId));
},
getCurrentTelemetryEnvironment() {
const current = TelemetryEnvironment.currentEnvironment;
return new this._window.Promise(resolve => resolve(current));
},
getCurrentTelemetrySubsessionPing() {
const current = TelemetryController.getCurrentPingData(true);
return new this._window.Promise(resolve => resolve(current));
},
_wrapPromise(promise) {
return new this._window.Promise(
(resolve, reject) => promise.then(resolve, reject));
},
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([MozSelfSupportInterface]);
component {d30aae8b-f352-4de3-b936-bb9d875df0bb} SelfSupportService.js
contract @mozilla.org/mozselfsupport;1 {d30aae8b-f352-4de3-b936-bb9d875df0bb}
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
with Files("**"):
BUG_COMPONENT = ("Toolkit", "Telemetry")
EXTRA_COMPONENTS += [
'SelfSupportService.js',
'SelfSupportService.manifest',
]
BROWSER_CHROME_MANIFESTS += [
'test/browser.ini',
]
"use strict";
module.exports = {
"extends": [
"plugin:mozilla/browser-test"
]
};
function prefHas(pref) {
return Services.prefs.getPrefType(pref) != Ci.nsIPrefBranch.PREF_INVALID;
}
function prefIsSet(pref) {
return Services.prefs.prefHasUserValue(pref);
}
function test_resetPref() {
const prefNewName = "browser.newpref.fake";
Assert.ok(!prefHas(prefNewName), "pref should not exist");
const prefExistingName = "extensions.hotfix.id";
Assert.ok(prefHas(prefExistingName), "pref should exist");
Assert.ok(!prefIsSet(prefExistingName), "pref should not be user-set");
let prefExistingOriginalValue = Services.prefs.getStringPref(prefExistingName);
registerCleanupFunction(function() {
Services.prefs.setStringPref(prefExistingName, prefExistingOriginalValue);
Services.prefs.deleteBranch(prefNewName);
});
// 1. do nothing on an inexistent pref
MozSelfSupport.resetPref(prefNewName);
Assert.ok(!prefHas(prefNewName), "pref should still not exist");
// 2. creation of a new pref
Services.prefs.setIntPref(prefNewName, 10);
Assert.ok(prefHas(prefNewName), "pref should exist");
Assert.equal(Services.prefs.getIntPref(prefNewName), 10, "pref value should be 10");
MozSelfSupport.resetPref(prefNewName);
Assert.ok(!prefHas(prefNewName), "pref should not exist any more");
// 3. do nothing on an unchanged existing pref
MozSelfSupport.resetPref(prefExistingName);
Assert.ok(prefHas(prefExistingName), "pref should still exist");
Assert.equal(Services.prefs.getStringPref(prefExistingName), prefExistingOriginalValue, "pref value should be the same as original");
// 4. change the value of an existing pref
Services.prefs.setStringPref(prefExistingName, "anyone@mozilla.org");
Assert.ok(prefHas(prefExistingName), "pref should exist");
Assert.equal(Services.prefs.getStringPref(prefExistingName), "anyone@mozilla.org", "pref value should have changed");
MozSelfSupport.resetPref(prefExistingName);
Assert.ok(prefHas(prefExistingName), "pref should still exist");
Assert.equal(Services.prefs.getStringPref(prefExistingName), prefExistingOriginalValue, "pref value should be the same as original");
// 5. delete an existing pref
// deleteBranch is implemented in such a way that
// clearUserPref can't undo its action
// see discussion in bug 1075160
}
function test_resetSearchEngines() {
const defaultEngineOriginal = Services.search.defaultEngine;
const visibleEnginesOriginal = Services.search.getVisibleEngines();
// 1. do nothing on unchanged search configuration
MozSelfSupport.resetSearchEngines();
Assert.equal(Services.search.defaultEngine, defaultEngineOriginal, "default engine should be reset");
Assert.deepEqual(Services.search.getVisibleEngines(), visibleEnginesOriginal,
"default visible engines set should be reset");
// 2. change the default search engine
const defaultEngineNew = visibleEnginesOriginal[3];
Assert.notEqual(defaultEngineOriginal, defaultEngineNew, "new default engine should be different from original");
Services.search.defaultEngine = defaultEngineNew;
Assert.equal(Services.search.defaultEngine, defaultEngineNew, "default engine should be set to new");
MozSelfSupport.resetSearchEngines();
Assert.equal(Services.search.defaultEngine, defaultEngineOriginal, "default engine should be reset");
Assert.deepEqual(Services.search.getVisibleEngines(), visibleEnginesOriginal,
"default visible engines set should be reset");
// 3. remove an engine
const engineRemoved = visibleEnginesOriginal[2];
Services.search.removeEngine(engineRemoved);
Assert.ok(Services.search.getVisibleEngines().indexOf(engineRemoved) == -1,
"removed engine should not be visible any more");
MozSelfSupport.resetSearchEngines();
Assert.equal(Services.search.defaultEngine, defaultEngineOriginal, "default engine should be reset");
Assert.deepEqual(Services.search.getVisibleEngines(), visibleEnginesOriginal,
"default visible engines set should be reset");
// 4. add an angine
// we don't remove user-added engines as they are only used if selected
}
function test() {
test_resetPref();
test_resetSearchEngines();
}
......@@ -490,10 +490,6 @@
@RESPATH@/components/nsINIProcessor.js
@RESPATH@/components/nsPrompter.manifest
@RESPATH@/components/nsPrompter.js
#ifdef MOZ_SERVICES_HEALTHREPORT
@RESPATH@/browser/components/SelfSupportService.manifest
@RESPATH@/browser/components/SelfSupportService.js
#endif
@RESPATH@/components/SyncComponents.manifest
@RESPATH@/components/Weave.js
@RESPATH@/components/FxAccountsComponents.manifest
......
......@@ -235,7 +235,6 @@
#include "mozilla/dom/FunctionBinding.h"
#include "mozilla/dom/HashChangeEvent.h"
#include "mozilla/dom/IntlUtils.h"
#include "mozilla/dom/MozSelfSupportBinding.h"
#include "mozilla/dom/PopStateEvent.h"
#include "mozilla/dom/PopupBlockedEvent.h"
#include "mozilla/dom/PrimitiveConversions.h"
......@@ -1211,8 +1210,6 @@ nsGlobalWindowInner::CleanUp()
mExternal = nullptr;
mMozSelfSupport = nullptr;
mPerformance = nullptr;
#ifdef MOZ_WEBSPEECH
......@@ -1508,7 +1505,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindowInner)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAudioWorklet)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPaintWorklet)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mExternal)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMozSelfSupport)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mIntlUtils)
tmp->TraverseHostObjectURIs(cb);
......@@ -1586,7 +1582,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindowInner)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mAudioWorklet)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPaintWorklet)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mExternal)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mMozSelfSupport)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mIntlUtils)
tmp->UnlinkHostObjectURIs();
......@@ -2589,21 +2584,6 @@ nsGlobalWindowInner::GetContent(JSContext* aCx,
(aCx, aRetval, aCallerType, aError), aError, );
}
MozSelfSupport*
nsGlobalWindowInner::GetMozSelfSupport(ErrorResult& aError)
{
if (mMozSelfSupport) {
return mMozSelfSupport;
}
// We're called from JS and want to use out existing JSContext (and,
// importantly, its compartment!) here.
AutoJSContext cx;
GlobalObject global(cx, FastGetGlobalJSObject());
mMozSelfSupport = MozSelfSupport::Constructor(global, cx, aError);
return mMozSelfSupport;
}
BarProp*
nsGlobalWindowInner::GetMenubar(ErrorResult& aError)
{
......
......@@ -112,7 +112,6 @@ class IncrementalRunnable;
class IntlUtils;
class Location;
class MediaQueryList;
class MozSelfSupport;
class Navigator;
class OwningExternalOrWindowProxy;
class Promise;
......@@ -889,8 +888,6 @@ public:
bool ShouldResistFingerprinting();
mozilla::dom::MozSelfSupport* GetMozSelfSupport(mozilla::ErrorResult& aError);
already_AddRefed<nsPIDOMWindowOuter>
OpenDialog(JSContext* aCx,
const nsAString& aUrl,
......@@ -1326,8 +1323,6 @@ protected:
// it wouldn't see the ~External function's declaration.
nsCOMPtr<nsISupports> mExternal;
RefPtr<mozilla::dom::MozSelfSupport> mMozSelfSupport;
RefPtr<mozilla::dom::Storage> mLocalStorage;
RefPtr<mozilla::dom::Storage> mSessionStorage;
......
......@@ -235,7 +235,6 @@
#include "mozilla/dom/FunctionBinding.h"
#include "mozilla/dom/HashChangeEvent.h"
#include "mozilla/dom/IntlUtils.h"
#include "mozilla/dom/MozSelfSupportBinding.h"
#include "mozilla/dom/PopStateEvent.h"
#include "mozilla/dom/PopupBlockedEvent.h"
#include "mozilla/dom/PrimitiveConversions.h"
......
......@@ -110,7 +110,6 @@ class IncrementalRunnable;
class IntlUtils;
class Location;
class MediaQueryList;
class MozSelfSupport;
class Navigator;
class OwningExternalOrWindowProxy;
class Promise;
......
/* 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/. */
/**
* The MozSelfSupport interface allows external Mozilla support sites such as
* FHR and SUMO to access data and control settings that are not otherwise
* exposed to external content.
*
* At the moment, this is a ChromeOnly interface, but the plan is to allow
* specific Mozilla domains to access it directly.
*/
[ChromeOnly,
JSImplementation="@mozilla.org/mozselfsupport;1",
Constructor()]
interface MozSelfSupport
{
/**
* Controls whether uploading FHR data is allowed.
*/
attribute boolean healthReportDataSubmissionEnabled;
/**
* Retrieve a list of the archived Telemetry pings.
* This contains objects with ping info, which are of the form:
* {
* type: <string>, // The pings type, e.g. "main", "environment-change", ...
* timestampCreated: <number>, // The time the ping was created (ms since unix epoch).
* id: <string>, // The pings UUID.
* }
*
* @return Promise<sequence<Object>>
* Resolved with the ping infos when the archived ping list has been built.
*/
Promise<sequence<object>> getTelemetryPingList();
/**
* Retrieve an archived Telemetry ping by it's id.
* This will load the ping data async from the archive, possibly hitting the disk.
*
* @return Promise<Object>
* Resolved with the ping data, see the Telemetry "main" ping documentation for the format.
*/
Promise<object> getTelemetryPing(DOMString pingID);
/**
* Get the current Telemetry environment - see the Telemetry documentation for details on the format.
*
* @return Promise<Object>
* Resolved with an object containing the Telemetry environment data.
*/
Promise<object> getCurrentTelemetryEnvironment();
/**
* Get a Telemetry "main" ping containing the current session measurements.
*
* @return Promise<Object>
* Resolved with the ping data, see the Telemetry "main" ping documentation for the format.
*/
Promise<object> getCurrentTelemetrySubsessionPing();
/**
* Resets a named pref:
* - if there is a default value, then change the value back to default,
* - if there's no default value, then delete the pref,
* - no-op otherwise.
*
* @param DOMString
* The name of the pref to reset.
*/
void resetPref(DOMString name);
/**
* Resets original search engines, and resets the default one.
*/
void resetSearchEngines();
};
......@@ -303,14 +303,6 @@ partial interface Window {
*/
[Throws] readonly attribute unsigned long long mozPaintCount;
/**
* This property exists because static attributes don't yet work for
* JS-implemented WebIDL (see bugs 1058606 and 863952). With this hack, we
* can use `MozSelfSupport.something(...)`, which will continue to work
* after we ditch this property and switch to static attributes. See
*/
[ChromeOnly, Throws] readonly attribute MozSelfSupport MozSelfSupport;
attribute EventHandler ondevicemotion;
attribute EventHandler ondeviceorientation;
attribute EventHandler onabsolutedeviceorientation;
......
......@@ -211,9 +211,6 @@ with Files("Media*Track*"):
with Files("Mouse*"):
BUG_COMPONENT = ("Core", "DOM: Events")
with Files("MozSelfSupport.webidl"):
BUG_COMPONENT = ("Firefox Health Report", "Client: Desktop")
with Files("MozTimeManager.webidl"):
BUG_COMPONENT = ("Core", "DOM: Device Interfaces")
......@@ -689,7 +686,6 @@ WEBIDL_FILES = [
'MimeTypeArray.webidl',
'MouseEvent.webidl',
'MouseScrollEvent.webidl',
'MozSelfSupport.webidl',
'MozStorageAsyncStatementParams.webidl',
'MozStorageStatementParams.webidl',
'MozStorageStatementRow.webidl',
......
......@@ -815,7 +815,6 @@
"browser/modules/test/browser_ContentSearch.js": 6354,
"browser/modules/test/browser_NetworkPrioritizer.js": 7917,
"browser/modules/test/browser_PermissionUI.js": 5119,
"browser/modules/test/browser_SelfSupportBackend.js": 5739,
"browser/modules/test/browser_UnsubmittedCrashHandler.js": 2991,
"browser/modules/test/browser_UsageTelemetry.js": 12884,
"browser/modules/test/browser_UsageTelemetry_content.js": 3978,
......
......@@ -742,7 +742,6 @@
"browser/modules/test/browser_ContentSearch.js": 5221,
"browser/modules/test/browser_NetworkPrioritizer.js": 4005,
"browser/modules/test/browser_PermissionUI.js": 4020,
"browser/modules/test/browser_SelfSupportBackend.js": 5724,
"browser/modules/test/browser_UnsubmittedCrashHandler.js": 2842,
"browser/modules/test/browser_UsageTelemetry.js": 9979,
"browser/modules/test/browser_UsageTelemetry_content.js": 3073,
......@@ -1020,4 +1019,4 @@
"toolkit/mozapps/update/tests/browser/browser_updatesPartialPatchWithBadPartialSize.js": 1852,
"uriloader/exthandler/tests/mochitest/browser_web_protocol_handlers.js": 2437
}
}
\ No newline at end of file
}
......@@ -11,7 +11,7 @@ send it until the maximum ping age is exceeded (14 days).
.. note::
The :doc:`main pings <../data/main-ping>` are kept locally even after successful submission to enable the HealthReport and SelfSupport features. They will be deleted after their retention period of 180 days.
The :doc:`main pings <../data/main-ping>` are kept locally even after successful submission to enable the HealthReport feature. They will be deleted after their retention period of 180 days.
Submission logic
================
......
......@@ -34,7 +34,6 @@ module.exports = {
"MatchPatternSet": false,
"MenuBoxObject": false,
// Specific to Firefox (Chrome code only).
"MozSelfSupport": false,
"SharedArrayBuffer": false,
"SimpleGestureEvent": false,
// Note: StopIteration will likely be removed as part of removing legacy
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment