Bug 1351089 - Remove unused PresentationDeviceInfoManager.jsm r=schien,smaug

MozReview-Commit-ID: FoMZNIFtgFM

--HG--
extra : rebase_source : 0fef4325bdea8c346f526a4fb6459a6dfe31fc5b
This commit is contained in:
Dan Banner 2017-07-03 19:51:01 +01:00
parent 1f1de877ae
commit d8518d604e
16 changed files with 0 additions and 443 deletions

View File

@ -166,8 +166,6 @@ var whitelist = [
{file: "resource://gre/modules/ISO8601DateUtils.jsm"},
// Bug 1337345
{file: "resource://gre/modules/Manifest.jsm"},
// Bug 1351089
{file: "resource://gre/modules/PresentationDeviceInfoManager.jsm"},
// Bug 1351097
{file: "resource://gre/modules/accessibility/AccessFu.jsm"},
// Bug 1351637

View File

@ -546,8 +546,6 @@
@RESPATH@/components/nsAsyncShutdown.manifest
@RESPATH@/components/nsAsyncShutdown.js
@RESPATH@/components/PresentationDeviceInfoManager.manifest
@RESPATH@/components/PresentationDeviceInfoManager.js
@RESPATH@/components/BuiltinProviders.manifest
@RESPATH@/components/PresentationControlService.js
@RESPATH@/components/PresentationDataChannelSessionTransport.js

View File

@ -1,119 +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 {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
function log(aMsg) {
//dump("-*- PresentationDeviceInfoManager.js : " + aMsg + "\n");
}
const PRESENTATIONDEVICEINFOMANAGER_CID = Components.ID("{1bd66bef-f643-4be3-b690-0c656353eafd}");
const PRESENTATIONDEVICEINFOMANAGER_CONTRACTID = "@mozilla.org/presentation-device/deviceInfo;1";
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
"@mozilla.org/childprocessmessagemanager;1",
"nsIMessageSender");
function PresentationDeviceInfoManager() {}
PresentationDeviceInfoManager.prototype = {
__proto__: DOMRequestIpcHelper.prototype,
classID: PRESENTATIONDEVICEINFOMANAGER_CID,
contractID: PRESENTATIONDEVICEINFOMANAGER_CONTRACTID,
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference,
Ci.nsIObserver,
Ci.nsIDOMGlobalPropertyInitializer]),
receiveMessage: function(aMsg) {
if (!aMsg || !aMsg.data) {
return;
}
let data = aMsg.data;
log("receive aMsg: " + aMsg.name);
switch (aMsg.name) {
case "PresentationDeviceInfoManager:OnDeviceChange": {
let detail = {
detail: {
type: data.type,
deviceInfo: data.deviceInfo,
}
};
let event = new this._window.CustomEvent("devicechange", Cu.cloneInto(detail, this._window));
this.__DOM_IMPL__.dispatchEvent(event);
break;
}
case "PresentationDeviceInfoManager:GetAll:Result:Ok": {
let resolver = this.takePromiseResolver(data.requestId);
if (!resolver) {
return;
}
resolver.resolve(Cu.cloneInto(data.devices, this._window));
break;
}
case "PresentationDeviceInfoManager:GetAll:Result:Error": {
let resolver = this.takePromiseResolver(data.requestId);
if (!resolver) {
return;
}
resolver.reject(data.error);
break;
}
}
},
init: function(aWin) {
log("init");
this.initDOMRequestHelper(aWin, [
{name: "PresentationDeviceInfoManager:OnDeviceChange", weakRef: true},
{name: "PresentationDeviceInfoManager:GetAll:Result:Ok", weakRef: true},
{name: "PresentationDeviceInfoManager:GetAll:Result:Error", weakRef: true},
]);
},
uninit: function() {
log("uninit");
let self = this;
this.forEachPromiseResolver(function(aKey) {
self.takePromiseResolver(aKey).reject("PresentationDeviceInfoManager got destroyed");
});
},
get ondevicechange() {
return this.__DOM_IMPL__.getEventHandler("ondevicechange");
},
set ondevicechange(aHandler) {
this.__DOM_IMPL__.setEventHandler("ondevicechange", aHandler);
},
getAll: function() {
log("getAll");
let self = this;
return this.createPromiseWithId(function(aResolverId) {
cpmm.sendAsyncMessage("PresentationDeviceInfoManager:GetAll", {
requestId: aResolverId,
});
});
},
forceDiscovery: function() {
cpmm.sendAsyncMessage("PresentationDeviceInfoManager:ForceDiscovery");
},
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PresentationDeviceInfoManager]);

View File

@ -1,98 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* 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;
this.EXPORTED_SYMBOLS = ["PresentationDeviceInfoService"];
function log(aMsg) {
//dump("PresentationDeviceInfoManager.jsm: " + aMsg + "\n");
}
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "presentationDeviceManager",
"@mozilla.org/presentation-device/manager;1",
"nsIPresentationDeviceManager");
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
"@mozilla.org/parentprocessmessagemanager;1",
"nsIMessageBroadcaster");
this.PresentationDeviceInfoService = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIMessageListener,
Ci.nsIObserver]),
init: function() {
log("init");
ppmm.addMessageListener("PresentationDeviceInfoManager:GetAll", this);
ppmm.addMessageListener("PresentationDeviceInfoManager:ForceDiscovery", this);
Services.obs.addObserver(this, "presentation-device-change");
},
getAll: function(aData, aMm) {
log("getAll");
let deviceArray = presentationDeviceManager.getAvailableDevices().QueryInterface(Ci.nsIArray);
if (!deviceArray) {
aData.error = "DataError";
aMm.sendAsyncMessage("PresentationDeviceInfoManager:GetAll:Result:Error", aData);
return;
}
aData.devices = [];
for (let i = 0; i < deviceArray.length; i++) {
let device = deviceArray.queryElementAt(i, Ci.nsIPresentationDevice);
aData.devices.push({
id: device.id,
name: device.name,
type: device.type,
});
}
aMm.sendAsyncMessage("PresentationDeviceInfoManager:GetAll:Result:Ok", aData);
},
forceDiscovery: function() {
log("forceDiscovery");
presentationDeviceManager.forceDiscovery();
},
observe: function(aSubject, aTopic, aData) {
log("observe: " + aTopic);
let device = aSubject.QueryInterface(Ci.nsIPresentationDevice);
let data = {
type: aData,
deviceInfo: {
id: device.id,
name: device.name,
type: device.type,
},
};
ppmm.broadcastAsyncMessage("PresentationDeviceInfoManager:OnDeviceChange", data);
},
receiveMessage: function(aMessage) {
let msg = aMessage.data || {};
let mm = aMessage.target;
log("receiveMessage: " + aMessage.name);
switch (aMessage.name) {
case "PresentationDeviceInfoManager:GetAll": {
this.getAll(msg, mm);
break;
}
case "PresentationDeviceInfoManager:ForceDiscovery": {
this.forceDiscovery();
break;
}
}
},
};
this.PresentationDeviceInfoService.init();

View File

@ -1,3 +0,0 @@
# PresentationDeviceInfoManager.js
component {1bd66bef-f643-4be3-b690-0c656353eafd} PresentationDeviceInfoManager.js
contract @mozilla.org/presentation-device/deviceInfo;1 {1bd66bef-f643-4be3-b690-0c656353eafd}

View File

@ -63,8 +63,6 @@ UNIFIED_SOURCES += [
EXTRA_COMPONENTS += [
'PresentationDataChannelSessionTransport.js',
'PresentationDataChannelSessionTransport.manifest',
'PresentationDeviceInfoManager.js',
'PresentationDeviceInfoManager.manifest',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
@ -73,10 +71,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
'PresentationNetworkHelper.manifest',
]
EXTRA_JS_MODULES += [
'PresentationDeviceInfoManager.jsm',
]
IPDL_SOURCES += [
'ipc/PPresentation.ipdl',
'ipc/PPresentationBuilder.ipdl',

View File

@ -5,8 +5,6 @@
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import('resource://gre/modules/PresentationDeviceInfoManager.jsm');
const { XPCOMUtils } = Cu.import('resource://gre/modules/XPCOMUtils.jsm');
const manager = Cc['@mozilla.org/presentation-device/manager;1']

View File

@ -5,7 +5,6 @@ support-files =
[test_presentation_datachannel_sessiontransport.html]
skip-if = os == 'android'
[test_presentation_device_info.html]
[test_presentation_sender_startWithDevice.html]
skip-if = toolkit == 'android' # Bug 1129785
[test_presentation_tcp_sender.html]

View File

@ -39,7 +39,6 @@ skip-if = (e10s || toolkit == 'android') # Bug 1129785
skip-if = (e10s || toolkit == 'android') # Bug 1129785
[test_presentation_1ua_connection_wentaway_oop.html]
skip-if = (e10s || toolkit == 'android') # Bug 1129785
[test_presentation_device_info_permission.html]
[test_presentation_tcp_sender_disconnect.html]
skip-if = toolkit == 'android' # Bug 1129785
[test_presentation_tcp_sender_establish_connection_error.html]

View File

@ -1,141 +0,0 @@
<!DOCTYPE HTML>
<html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<head>
<meta charset="utf-8">
<title>Test for B2G Presentation Device Info API</title>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1080474">Test for B2G Presentation Device Info API</a>
<script type="application/javascript">
'use strict';
SimpleTest.waitForExplicitFinish();
var testDevice = {
id: 'id',
name: 'name',
type: 'type',
};
var gUrl = SimpleTest.getTestFileURL('PresentationDeviceInfoChromeScript.js');
var gScript = SpecialPowers.loadChromeScript(gUrl);
function testSetup() {
return new Promise(function(resolve, reject) {
gScript.addMessageListener('setup-complete', function() {
resolve();
});
gScript.sendAsyncMessage('setup');
});
}
function testForceDiscovery() {
info('test force discovery');
return new Promise(function(resolve, reject) {
gScript.addMessageListener('force-discovery', function() {
ok(true, 'nsIPresentationDeviceProvider.forceDiscovery is invoked');
resolve();
});
navigator.mozPresentationDeviceInfo.forceDiscovery();
});
}
function testDeviceAdd() {
info('test device add');
return new Promise(function(resolve, reject) {
navigator.mozPresentationDeviceInfo.addEventListener('devicechange', function(e) {
let detail = e.detail;
is(detail.type, 'add', 'expected update type');
is(detail.deviceInfo.id, testDevice.id, 'expected device id');
is(detail.deviceInfo.name, testDevice.name, 'expected device name');
is(detail.deviceInfo.type, testDevice.type, 'expected device type');
navigator.mozPresentationDeviceInfo.getAll()
.then(function(devices) {
is(devices.length, 1, 'expected 1 available device');
is(devices[0].id, testDevice.id, 'expected device id');
is(devices[0].name, testDevice.name, 'expected device name');
is(devices[0].type, testDevice.type, 'expected device type');
resolve();
});
}, {once: true});
gScript.sendAsyncMessage('trigger-device-add', testDevice);
});
}
function testDeviceUpdate() {
info('test device update');
return new Promise(function(resolve, reject) {
testDevice.name = 'name-update';
navigator.mozPresentationDeviceInfo.addEventListener('devicechange', function(e) {
let detail = e.detail;
is(detail.type, 'update', 'expected update type');
is(detail.deviceInfo.id, testDevice.id, 'expected device id');
is(detail.deviceInfo.name, testDevice.name, 'expected device name');
is(detail.deviceInfo.type, testDevice.type, 'expected device type');
navigator.mozPresentationDeviceInfo.getAll()
.then(function(devices) {
is(devices.length, 1, 'expected 1 available device');
is(devices[0].id, testDevice.id, 'expected device id');
is(devices[0].name, testDevice.name, 'expected device name');
is(devices[0].type, testDevice.type, 'expected device type');
resolve();
});
}, {once: true});
gScript.sendAsyncMessage('trigger-device-update', testDevice);
});
}
function testDeviceRemove() {
info('test device remove');
return new Promise(function(resolve, reject) {
navigator.mozPresentationDeviceInfo.addEventListener('devicechange', function(e) {
let detail = e.detail;
is(detail.type, 'remove', 'expected update type');
is(detail.deviceInfo.id, testDevice.id, 'expected device id');
is(detail.deviceInfo.name, testDevice.name, 'expected device name');
is(detail.deviceInfo.type, testDevice.type, 'expected device type');
navigator.mozPresentationDeviceInfo.getAll()
.then(function(devices) {
is(devices.length, 0, 'expected 0 available device');
resolve();
});
}, {once: true});
gScript.sendAsyncMessage('trigger-device-remove');
});
}
function runTests() {
testSetup()
.then(testForceDiscovery)
.then(testDeviceAdd)
.then(testDeviceUpdate)
.then(testDeviceRemove)
.then(function() {
info('test finished, teardown');
gScript.sendAsyncMessage('teardown', '');
gScript.destroy();
SimpleTest.finish();
});
}
window.addEventListener('load', function() {
SpecialPowers.pushPrefEnv({
'set': [
['dom.presentation.enabled', true],
]
}, runTests);
});
</script>
</pre>
</body>
</html>

View File

@ -1,35 +0,0 @@
<!DOCTYPE HTML>
<html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<head>
<meta charset="utf-8">
<title>Test for B2G Presentation Device Info API Permission</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1080474">Test for B2G Presentation Device Info API Permission</a>
<script type="application/javascript">
'use strict';
SimpleTest.waitForExplicitFinish();
function runTests() {
is(navigator.mozPresentationDeviceInfo, undefined, 'navigator.mozPresentationDeviceInfo is undefined');
SimpleTest.finish();
}
window.addEventListener('load', function() {
SpecialPowers.pushPrefEnv({
'set': [
['dom.presentation.enabled', true],
]
}, runTests);
});
</script>
</pre>
</body>
</html>

View File

@ -755,9 +755,6 @@ var interfaceNamesInGlobalScope =
"PopupBlockedEvent",
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "PopupBoxObject", xbl: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "PresentationDeviceInfoManager",
disabled: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "Presentation", desktop: false, release: false },
// IMPORTANT: Do not change this list without review from a DOM peer!

View File

@ -1,26 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*/
dictionary PresentationDeviceInfo {
DOMString id;
DOMString name;
DOMString type;
};
[NavigatorProperty="mozPresentationDeviceInfo",
JSImplementation="@mozilla.org/presentation-device/deviceInfo;1",
Pref="dom.presentation.enabled",
ChromeOnly]
interface PresentationDeviceInfoManager : EventTarget {
// notify if any device updated.
attribute EventHandler ondevicechange;
// retrieve all available device infos
Promise<sequence<PresentationDeviceInfo>> getAll();
// Force all registered device provider to update device information.
void forceDiscovery();
};

View File

@ -751,7 +751,6 @@ WEBIDL_FILES = [
'PresentationAvailability.webidl',
'PresentationConnection.webidl',
'PresentationConnectionList.webidl',
'PresentationDeviceInfoManager.webidl',
'PresentationReceiver.webidl',
'PresentationRequest.webidl',
'ProcessingInstruction.webidl',

View File

@ -395,8 +395,6 @@
@BINPATH@/components/DownloadLegacy.js
#ifndef MOZ_GECKOVIEW_JAR
@BINPATH@/components/PresentationDeviceInfoManager.manifest
@BINPATH@/components/PresentationDeviceInfoManager.js
@BINPATH@/components/BuiltinProviders.manifest
@BINPATH@/components/PresentationControlService.js
@BINPATH@/components/PresentationNetworkHelper.js

View File

@ -167,7 +167,6 @@
"policies.js": ["ErrorHandler", "SyncScheduler"],
"prefs.js": ["PrefsEngine", "PrefRec"],
"prefs.jsm": ["Preference"],
"PresentationDeviceInfoManager.jsm": ["PresentationDeviceInfoService"],
"ProfileStorage.jsm": ["profileStorage"],
"PromiseWorker.jsm": ["BasePromiseWorker"],
"PushCrypto.jsm": ["PushCrypto", "concatArray"],