mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 15:55:36 +00:00
Bug 1653199 - Add web-share permission policy r=ckerschb
Restrict navigator.share() to web-share permission policy Differential Revision: https://phabricator.services.mozilla.com/D83903
This commit is contained in:
parent
a315a1a0f0
commit
c40f16142f
@ -1373,6 +1373,14 @@ Promise* Navigator::Share(const ShareData& aData, ErrorResult& aRv) {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!FeaturePolicyUtils::IsFeatureAllowed(mWindow->GetExtantDoc(),
|
||||||
|
u"web-share"_ns)) {
|
||||||
|
aRv.ThrowNotAllowedError(
|
||||||
|
"Document's Permission Policy does not allow calling "
|
||||||
|
"share() from this context.");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if (mSharePromise) {
|
if (mSharePromise) {
|
||||||
NS_WARNING("Only one share picker at a time per navigator instance");
|
NS_WARNING("Only one share picker at a time per navigator instance");
|
||||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||||
|
@ -33,6 +33,7 @@ static FeatureMap sSupportedFeatures[] = {
|
|||||||
{"microphone", FeaturePolicyUtils::FeaturePolicyValue::eSelf},
|
{"microphone", FeaturePolicyUtils::FeaturePolicyValue::eSelf},
|
||||||
{"display-capture", FeaturePolicyUtils::FeaturePolicyValue::eSelf},
|
{"display-capture", FeaturePolicyUtils::FeaturePolicyValue::eSelf},
|
||||||
{"fullscreen", FeaturePolicyUtils::FeaturePolicyValue::eSelf},
|
{"fullscreen", FeaturePolicyUtils::FeaturePolicyValue::eSelf},
|
||||||
|
{"web-share", FeaturePolicyUtils::FeaturePolicyValue::eSelf},
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -22,6 +22,7 @@ let supportedFeatures = [
|
|||||||
"document-domain",
|
"document-domain",
|
||||||
"speaker",
|
"speaker",
|
||||||
"vr",
|
"vr",
|
||||||
|
"web-share",
|
||||||
];
|
];
|
||||||
|
|
||||||
function checkFeatures(features) {
|
function checkFeatures(features) {
|
||||||
|
Loading…
Reference in New Issue
Block a user