зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1361000 - Log a deprecation warning to the web console upon use of EME in an insecure context. r=bz
Preliminary telemetry indicated 15% of users of EME are in an insecure context. We'd better log a warning to the web console to inform authors that their sites will stop working, rather than just breaking them! MozReview-Commit-ID: CZasdbcC1jS --HG-- extra : rebase_source : 685a36be1601215aff4e962fd206d1332abbff79
This commit is contained in:
Родитель
cbcda12051
Коммит
20ae51f46a
|
@ -69,6 +69,7 @@
|
|||
#include "nsStreamUtils.h"
|
||||
#include "WidgetUtils.h"
|
||||
#include "nsIPresentationService.h"
|
||||
#include "nsIScriptError.h"
|
||||
|
||||
#include "mozilla/dom/MediaDevices.h"
|
||||
#include "MediaManager.h"
|
||||
|
@ -2024,6 +2025,22 @@ Navigator::RequestMediaKeySystemAccess(const nsAString& aKeySystem,
|
|||
Telemetry::Accumulate(Telemetry::MEDIA_EME_SECURE_CONTEXT,
|
||||
mWindow->IsSecureContext());
|
||||
|
||||
if (!mWindow->IsSecureContext()) {
|
||||
nsIDocument* doc = mWindow->GetExtantDoc();
|
||||
nsString uri;
|
||||
if (doc) {
|
||||
doc->GetDocumentURI(uri);
|
||||
}
|
||||
const char16_t* params[] = { uri.get() };
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
NS_LITERAL_CSTRING("Media"),
|
||||
doc,
|
||||
nsContentUtils::eDOM_PROPERTIES,
|
||||
"MediaEMEInsecureContextDeprecatedWarning",
|
||||
params,
|
||||
ArrayLength(params));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(mWindow);
|
||||
RefPtr<DetailedPromise> promise =
|
||||
DetailedPromise::Create(go, aRv,
|
||||
|
|
|
@ -145,6 +145,8 @@ MediaRecorderMultiTracksNotSupported=MediaRecorder does not support recording mu
|
|||
MediaStreamAddTrackDifferentAudioChannel=MediaStreamTrack %S could not be added since it belongs to a different AudioChannel.
|
||||
# LOCALIZATION NOTE: Do not translate "MediaStream", "stop()" and "MediaStreamTrack"
|
||||
MediaStreamStopDeprecatedWarning=MediaStream.stop() is deprecated and will soon be removed. Use MediaStreamTrack.stop() instead.
|
||||
# LOCALIZATION NOTE: %S is the URL of the web page which is not served on HTTPS and thus is not encrypted and considered insecure.
|
||||
MediaEMEInsecureContextDeprecatedWarning=Using Encrypted Media Extensions at %S on an insecure (i.e. non-HTTPS) context is deprecated and will soon be removed. You should consider switching to a secure origin such as HTTPS.
|
||||
# LOCALIZATION NOTE: Do not translate "DOMException", "code" and "name"
|
||||
DOMExceptionCodeWarning=Use of DOMException’s code attribute is deprecated. Use name instead.
|
||||
# LOCALIZATION NOTE: Do not translate "__exposedProps__"
|
||||
|
|
Загрузка…
Ссылка в новой задаче