Bug 1411739 Use window::IsSecureContext to determine if screensharing is allowed instead of checking for https r=jib

MozReview-Commit-ID: HCKY1bNcpy4

--HG--
extra : rebase_source : 43ae071aef39bcf6af945fcd850721837505aed3
This commit is contained in:
Tom Ritter 2017-10-26 11:09:29 -05:00
Родитель 89cd3c967e
Коммит f9e8727c01
1 изменённых файлов: 1 добавлений и 12 удалений

Просмотреть файл

@ -152,17 +152,6 @@ static Atomic<bool> sInShutdown;
typedef media::Pledge<bool, dom::MediaStreamError*> PledgeVoid; typedef media::Pledge<bool, dom::MediaStreamError*> PledgeVoid;
static bool
HostIsHttps(nsIURI &docURI)
{
bool isHttps;
nsresult rv = docURI.SchemeIs("https", &isHttps);
if (NS_WARN_IF(NS_FAILED(rv))) {
return false;
}
return isHttps;
}
class SourceListener : public MediaStreamListener { class SourceListener : public MediaStreamListener {
public: public:
SourceListener(); SourceListener();
@ -2346,7 +2335,7 @@ MediaManager::GetUserMedia(nsPIDOMWindowInner* aWindow,
"media.getusermedia.browser.enabled" : "media.getusermedia.browser.enabled" :
"media.getusermedia.screensharing.enabled"), "media.getusermedia.screensharing.enabled"),
false) || false) ||
(!privileged && !HostIsHttps(*docURI))) { (!privileged && !aWindow->IsSecureContext())) {
RefPtr<MediaStreamError> error = RefPtr<MediaStreamError> error =
new MediaStreamError(aWindow, new MediaStreamError(aWindow,
NS_LITERAL_STRING("NotAllowedError")); NS_LITERAL_STRING("NotAllowedError"));