Bug 1228526 - Part 2, show devices supported request URL in selection prompt dialog. r=chunmin

MozReview-Commit-ID: FYR2ruFsyGy

--HG--
extra : rebase_source : f0ffe43b6c0f24df6ed55750c7113e758a66710c
This commit is contained in:
Shih-Chiang Chien 2016-08-23 17:57:33 +08:00
parent a2a2c152ab
commit 1a2dc51208

View File

@ -46,12 +46,17 @@ PresentationDevicePrompt.prototype = {
return this.bundle.GetStringFromName(aName);
},
_loadDevices: function() {
_loadDevices: function(requestURL) {
debug("_loadDevices");
let presentationUrls = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
let url = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
url.data = requestURL;
presentationUrls.appendElement(url, false);
let deviceManager = Cc["@mozilla.org/presentation-device/manager;1"]
.getService(Ci.nsIPresentationDeviceManager);
let devices = deviceManager.getAvailableDevices().QueryInterface(Ci.nsIArray);
let devices = deviceManager.getAvailableDevices(presentationUrls).QueryInterface(Ci.nsIArray);
// Re-load the available devices
this._devices = [];
@ -113,7 +118,7 @@ PresentationDevicePrompt.prototype = {
debug("promptDeviceSelection");
// Load available presentation devices into this._devices
this._loadDevices();
this._loadDevices(aRequest.requestURL);
if (!this._devices.length) { // Cancel request if no available device
aRequest.cancel(Cr.NS_ERROR_DOM_NOT_FOUND_ERR);