mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1254287 - Remove the EngineeringMode API r=evelyn,sicking
This commit is contained in:
parent
d6b419d1e9
commit
5cdc96be90
@ -216,7 +216,6 @@
|
||||
@RESPATH@/components/dom_xpath.xpt
|
||||
@RESPATH@/components/dom_xul.xpt
|
||||
@RESPATH@/components/dom_time.xpt
|
||||
@RESPATH@/components/dom_engineeringmode.xpt
|
||||
@RESPATH@/components/dom_presentation.xpt
|
||||
@RESPATH@/components/downloads.xpt
|
||||
@RESPATH@/components/editor.xpt
|
||||
@ -664,10 +663,6 @@
|
||||
@RESPATH@/components/inputmethod.xpt
|
||||
#endif
|
||||
|
||||
@RESPATH@/components/EngineeringMode.manifest
|
||||
@RESPATH@/components/EngineeringModeAPI.js
|
||||
@RESPATH@/components/EngineeringModeService.js
|
||||
|
||||
@RESPATH@/components/SystemUpdate.manifest
|
||||
@RESPATH@/components/SystemUpdateManager.js
|
||||
|
||||
|
Binary file not shown.
@ -257,14 +257,6 @@ var Activities = {
|
||||
startActivity: function activities_startActivity(aMsg) {
|
||||
debug("StartActivity: " + JSON.stringify(aMsg));
|
||||
|
||||
// The caller app will be killed by |assertAppHasStatus| if it doesn't
|
||||
// fit our permission requirement.
|
||||
let callerApp = this.callers[aMsg.id].mm;
|
||||
if (aMsg.options.name === 'internal-system-engineering-mode' &&
|
||||
!callerApp.assertAppHasStatus(Ci.nsIPrincipal.APP_STATUS_CERTIFIED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let self = this;
|
||||
let successCb = function successCb(aResults) {
|
||||
debug(JSON.stringify(aResults));
|
||||
@ -384,13 +376,6 @@ var Activities = {
|
||||
};
|
||||
|
||||
let matchFunc = function matchFunc(aResult) {
|
||||
let calleeApp = DOMApplicationRegistry.getAppByManifestURL(aResult.manifest);
|
||||
// Only allow certified apps to handle this special activity
|
||||
if (aMsg.options.name === 'internal-system-engineering-mode' &&
|
||||
calleeApp.appStatus !== Ci.nsIPrincipal.APP_STATUS_CERTIFIED) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the activity is in the developer mode activity list, only let the
|
||||
// system app be a provider.
|
||||
let isSystemApp = false;
|
||||
|
@ -62,14 +62,6 @@ ActivityProxy.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
// Only let certified app to initiate this activitiy.
|
||||
if (aOptions.name === 'internal-system-engineering-mode' &&
|
||||
principal.appStatus != Ci.nsIPrincipal.APP_STATUS_CERTIFIED) {
|
||||
Services.DOMRequest.fireErrorAsync(this.activity, "SecurityError");
|
||||
Services.obs.notifyObservers(null, "Activity:Error", null);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check the activities that are restricted to be used in dev mode.
|
||||
let devMode = false;
|
||||
let isDevModeActivity = false;
|
||||
|
@ -452,11 +452,6 @@ this.PermissionsTable = { geolocation: {
|
||||
access: ["read", "write"],
|
||||
additional: ["settings-api"]
|
||||
},
|
||||
"engineering-mode": {
|
||||
app: DENY_ACTION,
|
||||
privileged: DENY_ACTION,
|
||||
certified: ALLOW_ACTION
|
||||
},
|
||||
"tv": {
|
||||
app: DENY_ACTION,
|
||||
privileged: DENY_ACTION,
|
||||
|
@ -1,6 +0,0 @@
|
||||
component {27e55b94-fc43-42b3-b0f0-28bebdd804f1} EngineeringModeAPI.js
|
||||
contract @mozilla.org/dom/engineering-mode-api;1 {27e55b94-fc43-42b3-b0f0-28bebdd804f1}
|
||||
|
||||
component {1345a96a-7b8d-4017-a776-07d918f14d84} EngineeringModeService.js
|
||||
contract @mozilla.org/engineering-mode-service;1 {1345a96a-7b8d-4017-a776-07d918f14d84}
|
||||
category profile-after-change EngineeringModeService @mozilla.org/engineering-mode-service;1
|
@ -1,129 +0,0 @@
|
||||
/* 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 DEBUG = false;
|
||||
function debug(s) {
|
||||
if (DEBUG) dump("-*- EngineeringModeAPI: " + s + "\n");
|
||||
}
|
||||
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsIMessageSender");
|
||||
|
||||
function EngineeringModeAPI() {
|
||||
}
|
||||
|
||||
EngineeringModeAPI.prototype = {
|
||||
__proto__: DOMRequestIpcHelper.prototype,
|
||||
|
||||
classDescription: "Engineering Mode API",
|
||||
classID: Components.ID("{27e55b94-fc43-42b3-b0f0-28bebdd804f1}"),
|
||||
contractID: "@mozilla.org/dom/engineering-mode-api;1",
|
||||
|
||||
// For DOMRequestHelper: must have nsISupportsWeakReference and nsIObserver.
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer,
|
||||
Ci.nsISupportsWeakReference,
|
||||
Ci.nsIObserver]),
|
||||
|
||||
init: function(aWindow) {
|
||||
this.initDOMRequestHelper(aWindow, ["EngineeringMode:OnMessage",
|
||||
"EngineeringMode:SetValue:Result:OK",
|
||||
"EngineeringMode:SetValue:Result:KO",
|
||||
"EngineeringMode:GetValue:Result:OK",
|
||||
"EngineeringMode:GetValue:Result:KO"]);
|
||||
cpmm.sendAsyncMessage("EngineeringMode:Register", null);
|
||||
},
|
||||
|
||||
uninit: function() {
|
||||
cpmm.sendAsyncMessage("EngineeringMode:Unregister", null);
|
||||
},
|
||||
|
||||
// This returns a Promise<DOMString>
|
||||
getValue: function getValue(aName) {
|
||||
debug("getValue " + aName);
|
||||
let promiseInit = function(aResolverId) {
|
||||
debug("promise init called for getValue " + aName + " has resolverId " + aResolverId);
|
||||
cpmm.sendAsyncMessage("EngineeringMode:GetValue", {
|
||||
requestId: aResolverId,
|
||||
name: aName
|
||||
});
|
||||
}.bind(this);
|
||||
|
||||
return this.createPromiseWithId(promiseInit);
|
||||
},
|
||||
|
||||
// This returns a Promise<void>
|
||||
setValue: function setValue(aName, aValue) {
|
||||
debug("setValue " + aName + ' as ' + aValue );
|
||||
let promiseInit = function(aResolverId) {
|
||||
debug("promise init called for getValue " + aName + " has resolverId " + aResolverId);
|
||||
cpmm.sendAsyncMessage("EngineeringMode:SetValue", {
|
||||
requestId: aResolverId,
|
||||
name: aName,
|
||||
value: aValue
|
||||
});
|
||||
}.bind(this);
|
||||
|
||||
return this.createPromiseWithId(promiseInit);
|
||||
},
|
||||
|
||||
set onmessage(aHandler) {
|
||||
this.__DOM_IMPL__.setEventHandler("onmessage", aHandler);
|
||||
},
|
||||
|
||||
get onmessage() {
|
||||
return this.__DOM_IMPL__.getEventHandler("onmessage");
|
||||
},
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
debug("receiveMessage: name: " + aMessage.name);
|
||||
let resolver = null;
|
||||
let data = aMessage.data;
|
||||
|
||||
switch (aMessage.name) {
|
||||
case "EngineeringMode:OnMessage":
|
||||
let detail = Cu.cloneInto(data, this._window);
|
||||
let event = new this._window.CustomEvent("message", {"detail": detail});
|
||||
this.__DOM_IMPL__.dispatchEvent(event);
|
||||
break;
|
||||
case "EngineeringMode:GetValue:Result:OK":
|
||||
case "EngineeringMode:GetValue:Result:KO":
|
||||
resolver = this.takePromiseResolver(data.requestId);
|
||||
if (!resolver) {
|
||||
return;
|
||||
}
|
||||
if (aMessage.name === "EngineeringMode:GetValue:Result:OK") {
|
||||
resolver.resolve(data.value);
|
||||
} else {
|
||||
resolver.reject(data.reason);
|
||||
}
|
||||
break;
|
||||
case "EngineeringMode:SetValue:Result:OK":
|
||||
case "EngineeringMode:SetValue:Result:KO":
|
||||
resolver = this.takePromiseResolver(data.requestId);
|
||||
if (!resolver) {
|
||||
return;
|
||||
}
|
||||
if (aMessage.name === "EngineeringMode:SetValue:Result:OK") {
|
||||
resolver.resolve();
|
||||
} else {
|
||||
resolver.reject(data.reason);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([EngineeringModeAPI]);
|
@ -1,163 +0,0 @@
|
||||
/* 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 DEBUG = false;
|
||||
function debug(s) {
|
||||
if (DEBUG) dump("-*- EngineeringModeService: " + s + "\n");
|
||||
}
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageBroadcaster");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "EngineeringMode",
|
||||
"@mozilla.org/b2g/engineering-mode-impl;1",
|
||||
"nsIEngineeringMode");
|
||||
|
||||
function EngineeringModeService() {
|
||||
}
|
||||
|
||||
EngineeringModeService.prototype = {
|
||||
classID: Components.ID("{1345a96a-7b8d-4017-a776-07d918f14d84}"),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
|
||||
Ci.nsIEngineeringModeMessageHandler]),
|
||||
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
debug("-- init");
|
||||
|
||||
switch(aTopic) {
|
||||
case "profile-after-change":
|
||||
Services.obs.addObserver(this, "xpcom-shutdown", false);
|
||||
ppmm.addMessageListener("EngineeringMode:Register", this);
|
||||
ppmm.addMessageListener("EngineeringMode:Unregister", this);
|
||||
ppmm.addMessageListener("EngineeringMode:SetValue", this);
|
||||
ppmm.addMessageListener("EngineeringMode:GetValue", this);
|
||||
this._clients = [];
|
||||
break;
|
||||
case "xpcom-shutdown":
|
||||
Services.obs.removeObserver(this, "xpcom-shutdown");
|
||||
ppmm.removeMessageListener("EngineeringMode:Register", this);
|
||||
ppmm.removeMessageListener("EngineeringMode:Unregister", this);
|
||||
ppmm.removeMessageListener("EngineeringMode:SetValue", this);
|
||||
ppmm.removeMessageListener("EngineeringMode:GetValue", this);
|
||||
if (this._hasEngineeringModeImpl()) {
|
||||
EngineeringMode.setMessageHandler(function(){});
|
||||
}
|
||||
this._clients = null;
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
debug("receiveMessage: name: " + aMessage.name);
|
||||
|
||||
if (!aMessage.target.assertPermission("engineering-mode")) {
|
||||
debug(aMessage.name + " from a content process with no 'engineering-mode' privileges.");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (aMessage.name) {
|
||||
case "EngineeringMode:Register":
|
||||
// Lazy bind message handler until we have first client.
|
||||
if (this._hasEngineeringModeImpl() && this._clients.length === 0) {
|
||||
EngineeringMode.setMessageHandler(this.onMessage.bind(this));
|
||||
}
|
||||
|
||||
this._clients.push(aMessage.target);
|
||||
break;
|
||||
|
||||
case "EngineeringMode:Unregister":
|
||||
let index = this._clients.indexOf(aMessage.target);
|
||||
if (index > -1) {
|
||||
this._clients.splice(index, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case "EngineeringMode:SetValue":
|
||||
this.setValue(aMessage.target, aMessage.data);
|
||||
break;
|
||||
|
||||
case "EngineeringMode:GetValue":
|
||||
this.getValue(aMessage.target, aMessage.data);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
setValue: function(aTarget, aData) {
|
||||
if (!this._hasEngineeringModeImpl()) {
|
||||
aTarget.sendAsyncMessage("EngineeringMode:SetValue:Result:KO", {
|
||||
requestId: aData.requestId,
|
||||
reason: "No engineering mode implementation"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
EngineeringMode.setValue(aData.name, aData.value, {
|
||||
onsuccess: function() {
|
||||
aTarget.sendAsyncMessage("EngineeringMode:SetValue:Result:OK", {
|
||||
requestId: aData.requestId
|
||||
});
|
||||
},
|
||||
onerror: function(aError) {
|
||||
aTarget.sendAsyncMessage("EngineeringMode:SetValue:Result:KO", {
|
||||
requestId: aData.requestId,
|
||||
reason: "Error: code " + aError
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getValue: function(aTarget, aData) {
|
||||
if (!this._hasEngineeringModeImpl()) {
|
||||
aTarget.sendAsyncMessage("EngineeringMode:GetValue:Result:KO", {
|
||||
requestId: aData.requestId,
|
||||
reason: "No engineering mode implementation"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
EngineeringMode.getValue(aData.name, {
|
||||
onsuccess: function(aValue) {
|
||||
aTarget.sendAsyncMessage("EngineeringMode:GetValue:Result:OK", {
|
||||
requestId: aData.requestId,
|
||||
value: aValue
|
||||
});
|
||||
},
|
||||
onerror: function(aError) {
|
||||
aTarget.sendAsyncMessage("EngineeringMode:GetValue:Result:KO", {
|
||||
requestId: aData.requestId,
|
||||
reason: "Error: code " + aError
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onMessage: function(aMessage) {
|
||||
this._clients.forEach(function(aClient) {
|
||||
aClient.sendAsyncMessage("EngineeringMode:OnMessage", {
|
||||
data: aMessage
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
_hasEngineeringModeImpl: function() {
|
||||
if (typeof Cc["@mozilla.org/b2g/engineering-mode-impl;1"] === "undefined") {
|
||||
debug("Can not get engineering mode implementation.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([EngineeringModeService]);
|
@ -1,19 +0,0 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; 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/.
|
||||
|
||||
if CONFIG['MOZ_B2G']:
|
||||
EXTRA_COMPONENTS += [
|
||||
'EngineeringMode.manifest',
|
||||
'EngineeringModeAPI.js',
|
||||
'EngineeringModeService.js',
|
||||
]
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIEngineeringMode.idl',
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'dom_engineeringmode'
|
||||
|
@ -1,29 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, function, uuid(82e7c515-d174-4e84-9091-e7e89617a6d9)]
|
||||
interface nsIEngineeringModeMessageHandler : nsISupports
|
||||
{
|
||||
void handleMessage(in DOMString message);
|
||||
};
|
||||
|
||||
[scriptable, uuid(fdae21b9-bd8c-4d01-bc6a-6c3a7b5efb27)]
|
||||
interface nsIEngineeringModeCallback : nsISupports
|
||||
{
|
||||
void onsuccess([optional] in DOMString value);
|
||||
void onerror(in int32_t error);
|
||||
};
|
||||
|
||||
// Implemented by contract id @mozilla.org/b2g/engineering-mode-impl;1
|
||||
[scriptable, uuid(7251c99b-225f-4e39-8336-a7e2a087aa21)]
|
||||
interface nsIEngineeringMode : nsISupports
|
||||
{
|
||||
void getValue(in DOMString name, in nsIEngineeringModeCallback callback);
|
||||
void setValue(in DOMString name, in DOMString value,
|
||||
in nsIEngineeringModeCallback callback);
|
||||
void setMessageHandler(in nsIEngineeringModeMessageHandler handler);
|
||||
};
|
||||
|
@ -151,8 +151,7 @@ if CONFIG['MOZ_B2G']:
|
||||
DIRS += [
|
||||
'downloads',
|
||||
'identity',
|
||||
'mobileid',
|
||||
'engineeringmode'
|
||||
'mobileid'
|
||||
]
|
||||
|
||||
DIRS += ['presentation']
|
||||
|
@ -1,13 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
[JSImplementation="@mozilla.org/dom/engineering-mode-api;1",
|
||||
NavigatorProperty="engineeringMode",
|
||||
AvailableIn=CertifiedApps,
|
||||
CheckAnyPermissions="engineering-mode"]
|
||||
interface EngineeringMode : EventTarget {
|
||||
Promise<DOMString> getValue(DOMString name);
|
||||
Promise<void> setValue(DOMString name, DOMString value);
|
||||
attribute EventHandler onmessage;
|
||||
};
|
@ -145,7 +145,6 @@ WEBIDL_FILES = [
|
||||
'DummyBinding.webidl',
|
||||
'DynamicsCompressorNode.webidl',
|
||||
'Element.webidl',
|
||||
'EngineeringMode.webidl',
|
||||
'Event.webidl',
|
||||
'EventHandler.webidl',
|
||||
'EventListener.webidl',
|
||||
|
@ -881,7 +881,7 @@ pref("devtools.debugger.prompt-connection", true);
|
||||
// Block tools from seeing / interacting with certified apps
|
||||
pref("devtools.debugger.forbid-certified-apps", true);
|
||||
// List of permissions that a sideloaded app can't ask for
|
||||
pref("devtools.apps.forbidden-permissions", "embed-apps,engineering-mode,embed-widgets");
|
||||
pref("devtools.apps.forbidden-permissions", "embed-apps,embed-widgets");
|
||||
|
||||
// DevTools default color unit
|
||||
pref("devtools.defaultColorUnit", "authored");
|
||||
|
Loading…
Reference in New Issue
Block a user